Initial commit of Command & Conquer Generals and Command & Conquer Generals Zero Hour source code.
This commit is contained in:
parent
2e338c00cb
commit
3d0ee53a05
6072 changed files with 2283311 additions and 0 deletions
224
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/mathutil.cpp
Normal file
224
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/mathutil.cpp
Normal file
|
@ -0,0 +1,224 @@
|
|||
/*
|
||||
** Command & Conquer Generals Zero Hour(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//
|
||||
// Filename: mathutil.cpp
|
||||
// Project: wwutil
|
||||
// Author: Tom Spencer-Smith
|
||||
// Date: June 1998
|
||||
// Description:
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "mathutil.h" // I WANNA BE FIRST!
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include "wwmath.h"
|
||||
#include "miscutil.h"
|
||||
#include "wwdebug.h"
|
||||
|
||||
const double cMathUtil::PI_1 = 3.1415927;
|
||||
const double cMathUtil::PI_2 = 1.5707963;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Returns a unit vector
|
||||
//
|
||||
void cMathUtil::Angle_To_Vector(double angle, double & dx, double & dy)
|
||||
{
|
||||
WWASSERT(angle > -WWMATH_EPSILON && angle < 360.0 + WWMATH_EPSILON);
|
||||
|
||||
double angleRadians;
|
||||
|
||||
if (angle >= 0 && angle < 90) {
|
||||
angleRadians = angle * PI_1 / 180.0;
|
||||
dx = WWMath::Sin(angleRadians);
|
||||
dy = WWMath::Cos(angleRadians);
|
||||
} else if (angle >= 90 && angle < 180) {
|
||||
angleRadians = (angle - 90) * PI_1 / 180.0;
|
||||
dx = WWMath::Cos(angleRadians);
|
||||
dy = -WWMath::Sin(angleRadians);
|
||||
} else if (angle >= 180 && angle < 270) {
|
||||
angleRadians = (angle - 180) * PI_1 / 180.0;
|
||||
dx = -WWMath::Sin(angleRadians);
|
||||
dy = -WWMath::Cos(angleRadians);
|
||||
} else {
|
||||
angleRadians = (angle - 270) * PI_1 / 180.0;
|
||||
dx = -WWMath::Cos(angleRadians);
|
||||
dy = WWMath::Sin(angleRadians);
|
||||
}
|
||||
|
||||
double len;
|
||||
len = ::sqrt(dx * dx + dy * dy);
|
||||
WWASSERT(::fabs(len - 1) < 0.0005);
|
||||
|
||||
//
|
||||
// Correction for Irish nature of windows y coords
|
||||
//
|
||||
dy *= -1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void cMathUtil::Vector_To_Angle(double dx, double dy, double & angle)
|
||||
{
|
||||
double theta;
|
||||
|
||||
if (dx == 0 && dy == 0) {
|
||||
theta = 0;
|
||||
}
|
||||
|
||||
if (dx == 0) {
|
||||
if (dy <= 0) {
|
||||
theta = 0;
|
||||
} else {
|
||||
theta = PI_1;
|
||||
}
|
||||
} else {
|
||||
theta = WWMath::Atan(-dy / dx);
|
||||
if (dx < 0) {
|
||||
theta += PI_1;
|
||||
}
|
||||
theta += 3 * PI_2;
|
||||
if (theta >= 2 * PI_1) {
|
||||
theta -= 2 * PI_1;
|
||||
}
|
||||
theta = 2 * PI_1 - theta;
|
||||
if (theta == 2 * PI_1) {
|
||||
theta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
angle = theta * 180.0 / PI_1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
double cMathUtil::Simple_Distance(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
double dx = x2 - x1;
|
||||
double dy = y2 - y1;
|
||||
return(::sqrt(dx * dx + dy * dy));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int cMathUtil::Round(double arg)
|
||||
{
|
||||
//return (int)(arg + 0.5);
|
||||
|
||||
if (arg > MISCUTIL_EPSILON) {
|
||||
return (int) (arg + 0.5f);
|
||||
} else if (arg < -MISCUTIL_EPSILON) {
|
||||
return (int) (arg - 0.5f);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void cMathUtil::Rotate_Vector(double & vx, double & vy, double angle)
|
||||
{
|
||||
double angle_radians = angle * PI_1 / 180.0;
|
||||
|
||||
double vx1 = vx;
|
||||
double vy1 = vy;
|
||||
|
||||
vx = vx1 * ::WWMath::Cos(angle_radians) - vy1 * ::WWMath::Sin(angle_radians);
|
||||
vy = vx1 * ::WWMath::Sin(angle_radians) + vy1 * ::WWMath::Cos(angle_radians);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
double cMathUtil::Get_Uniform_Pdf_Double(double lower, double upper)
|
||||
{
|
||||
WWASSERT(upper - lower > -MISCUTIL_EPSILON);
|
||||
|
||||
double x = lower + ::rand() / (double) RAND_MAX * (upper - lower);
|
||||
|
||||
WWASSERT(x - lower > -MISCUTIL_EPSILON && upper - x > -MISCUTIL_EPSILON);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
double cMathUtil::Get_Normalized_Uniform_Pdf_Double()
|
||||
{
|
||||
return Get_Uniform_Pdf_Double(0, 1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int cMathUtil::Get_Uniform_Pdf_Int(int lower, int upper)
|
||||
{
|
||||
WWASSERT(lower <= upper);
|
||||
int x = lower + ::rand() % (upper - lower + 1);
|
||||
|
||||
WWASSERT(x >= lower && upper >= x);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
double cMathUtil::Get_Hat_Pdf_Double(double lower, double upper)
|
||||
{
|
||||
WWASSERT(upper - lower > -MISCUTIL_EPSILON);
|
||||
|
||||
double x;
|
||||
|
||||
if (::fabs(upper - lower) < MISCUTIL_EPSILON) {
|
||||
x = lower;
|
||||
} else {
|
||||
|
||||
double dx = (upper - lower) / 2.0f;
|
||||
double dy = 1 / dx;
|
||||
double m = dy / dx;
|
||||
double c = -m * lower;
|
||||
|
||||
x = Get_Uniform_Pdf_Double(lower, lower + dx);
|
||||
double y = Get_Uniform_Pdf_Double(0, dy);
|
||||
|
||||
if (y > m * x + c) {
|
||||
x += dx;
|
||||
}
|
||||
}
|
||||
|
||||
WWASSERT(x - lower > -MISCUTIL_EPSILON && upper - x > -MISCUTIL_EPSILON);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
double cMathUtil::Get_Normalized_Hat_Pdf_Double()
|
||||
{
|
||||
return Get_Hat_Pdf_Double(0, 1);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int cMathUtil::Get_Hat_Pdf_Int(int lower, int upper)
|
||||
{
|
||||
return Round(Get_Hat_Pdf_Double(lower, upper));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
58
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/mathutil.h
Normal file
58
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/mathutil.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
** Command & Conquer Generals Zero Hour(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//
|
||||
// Filename: mathutil.h
|
||||
// Project: wwutil
|
||||
// Author: Tom Spencer-Smith
|
||||
// Date: June 1998
|
||||
// Description: static
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#if defined(_MSV_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef MATHUTIL_H
|
||||
#define MATHUTIL_H
|
||||
|
||||
class cMathUtil
|
||||
{
|
||||
public:
|
||||
static void Angle_To_Vector(double angle, double & dx, double & dy);
|
||||
static void Vector_To_Angle(double dx, double dy, double & angle);
|
||||
static double Simple_Distance(double x1, double y1, double x2, double y2);
|
||||
static int Round(double arg);
|
||||
static void Rotate_Vector(double & vx, double & vy, double angle);
|
||||
|
||||
//
|
||||
// Random numbers generated according to simple
|
||||
// Probability Density Functions
|
||||
//
|
||||
static double Get_Uniform_Pdf_Double(double lower, double upper);
|
||||
static double Get_Normalized_Uniform_Pdf_Double();
|
||||
static int Get_Uniform_Pdf_Int(int lower, int upper);
|
||||
static double Get_Hat_Pdf_Double(double lower, double upper);
|
||||
static double Get_Normalized_Hat_Pdf_Double();
|
||||
static int Get_Hat_Pdf_Int(int lower, int upper);
|
||||
|
||||
static const double PI_1;
|
||||
static const double PI_2;
|
||||
};
|
||||
|
||||
#endif // MATHUTIL_H
|
326
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/miscutil.cpp
Normal file
326
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/miscutil.cpp
Normal file
|
@ -0,0 +1,326 @@
|
|||
/*
|
||||
** Command & Conquer Generals Zero Hour(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//
|
||||
// Filename: miscutil.cpp
|
||||
// Project: wwutil
|
||||
// Author: Tom Spencer-Smith
|
||||
// Date: June 1998
|
||||
// Description:
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "miscutil.h" // I WANNA BE FIRST!
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "rawfile.h"
|
||||
#include "wwdebug.h"
|
||||
#include "win.h"
|
||||
#include "mmsys.h"
|
||||
#include "ffactory.h"
|
||||
|
||||
//
|
||||
// cMiscUtil statics
|
||||
//
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
LPCSTR cMiscUtil::Get_Text_Time(void)
|
||||
{
|
||||
//
|
||||
// Returns a pointer to an internal statically allocated buffer...
|
||||
// Subsequent time operations will destroy the contents of that buffer.
|
||||
// Note: BoundsChecker reports 2 memory leaks in ctime here.
|
||||
//
|
||||
|
||||
long time_now = ::time(NULL);
|
||||
char * time_str = ::ctime(&time_now);
|
||||
time_str[::strlen(time_str) - 1] = 0; // remove \n
|
||||
return time_str;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void cMiscUtil::Seconds_To_Hms(float seconds, int & h, int & m, int & s)
|
||||
{
|
||||
WWASSERT(seconds >= 0);
|
||||
|
||||
h = (int) (seconds / 3600);
|
||||
seconds -= h * 3600;
|
||||
m = (int) (seconds / 60);
|
||||
seconds -= m * 60;
|
||||
s = (int) seconds;
|
||||
|
||||
WWASSERT(h >= 0);
|
||||
WWASSERT(m >= 0 && m < 60);
|
||||
WWASSERT(s >= 0 && s < 60);
|
||||
|
||||
//WWASSERT(fabs((h * 3600 + m * 60 + s) / 60) - mins < WWMATH_EPSILON);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::Is_String_Same(LPCSTR str1, LPCSTR str2)
|
||||
{
|
||||
WWASSERT(str1 != NULL);
|
||||
WWASSERT(str2 != NULL);
|
||||
|
||||
return(::stricmp(str1, str2) == 0);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::Is_String_Different(LPCSTR str1, LPCSTR str2)
|
||||
{
|
||||
WWASSERT(str1 != NULL);
|
||||
WWASSERT(str2 != NULL);
|
||||
|
||||
return(::stricmp(str1, str2) != 0);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::File_Exists(LPCSTR filename)
|
||||
{
|
||||
#if 0
|
||||
WWASSERT(filename != NULL);
|
||||
|
||||
WIN32_FIND_DATA find_info;
|
||||
HANDLE file_handle = ::FindFirstFile(filename, &find_info);
|
||||
|
||||
if (file_handle != INVALID_HANDLE_VALUE) {
|
||||
::FindClose(file_handle);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
FileClass * file = _TheFileFactory->Get_File( filename );
|
||||
if ( file && file->Is_Available() ) {
|
||||
return true;
|
||||
}
|
||||
_TheFileFactory->Return_File( file );
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::File_Is_Read_Only(LPCSTR filename)
|
||||
{
|
||||
WWASSERT(filename != NULL);
|
||||
|
||||
DWORD attributes = ::GetFileAttributes(filename);
|
||||
return ((attributes != 0xFFFFFFFF) && (attributes & FILE_ATTRIBUTE_READONLY));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::Is_Alphabetic(char c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::Is_Numeric(char c)
|
||||
{
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::Is_Alphanumeric(char c)
|
||||
{
|
||||
return Is_Alphabetic(c) || Is_Numeric(c);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool cMiscUtil::Is_Whitespace(char c)
|
||||
{
|
||||
return c == ' ' || c == '\t';
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void cMiscUtil::Trim_Trailing_Whitespace(char * text)
|
||||
{
|
||||
WWASSERT(text != NULL);
|
||||
|
||||
int length = ::strlen(text);
|
||||
while (length > 0 && Is_Whitespace(text[length - 1])) {
|
||||
text[--length] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void cMiscUtil::Get_File_Id_String(LPCSTR filename, StringClass & str)
|
||||
{
|
||||
WWASSERT(filename != NULL);
|
||||
|
||||
// WWDEBUG_SAY(("cMiscUtil::Get_File_Id_String for %s\n", filename));
|
||||
|
||||
//
|
||||
// Get size
|
||||
//
|
||||
RawFileClass file(filename);
|
||||
int filesize = file.Size();
|
||||
//WWASSERT(filesize > 0);
|
||||
if (filesize <= 0)
|
||||
{
|
||||
WWDEBUG_SAY(("Error: cMiscUtil::Get_File_Id_String for %s: filesize = %d\n",
|
||||
filename, filesize));
|
||||
//W3D_DIE;
|
||||
}
|
||||
file.Close();
|
||||
|
||||
//
|
||||
// Note... this timedatestamp is not present for all file types...
|
||||
//
|
||||
IMAGE_FILE_HEADER header = {0};
|
||||
extern bool Get_Image_File_Header(LPCSTR filename, IMAGE_FILE_HEADER *file_header);
|
||||
/*
|
||||
bool success;
|
||||
success = Get_Image_File_Header(filename, &header);
|
||||
WWASSERT(success);
|
||||
*/
|
||||
Get_Image_File_Header(filename, &header);
|
||||
int time_date_stamp = header.TimeDateStamp;
|
||||
|
||||
char working_filename[500];
|
||||
strcpy(working_filename, filename);
|
||||
::strupr(working_filename);
|
||||
|
||||
//
|
||||
// Strip path off filename
|
||||
//
|
||||
char * p_start = &working_filename[strlen(working_filename)];
|
||||
int num_chars = 1;
|
||||
while (p_start > working_filename && *(p_start - 1) != '\\') {
|
||||
p_start--;
|
||||
num_chars++;
|
||||
}
|
||||
::memmove(working_filename, p_start, num_chars);
|
||||
|
||||
//
|
||||
// Put all this data into a string
|
||||
//
|
||||
str.Format("%s %d %d", working_filename, filesize, time_date_stamp);
|
||||
|
||||
//WWDEBUG_SAY(("File id string: %s\n", str));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void cMiscUtil::Remove_File(LPCSTR filename)
|
||||
{
|
||||
WWASSERT(filename != NULL);
|
||||
|
||||
::DeleteFile(filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
#define SIZE_OF_NT_SIGNATURE sizeof(DWORD)
|
||||
#define PEFHDROFFSET(a) ((LPVOID)((BYTE *)a + \
|
||||
((PIMAGE_DOS_HEADER)a)->e_lfanew + SIZE_OF_NT_SIGNATURE))
|
||||
*/
|
||||
|
||||
/*
|
||||
int cMiscUtil::Get_Exe_Key(void)
|
||||
{
|
||||
//
|
||||
// Get exe name
|
||||
//
|
||||
char filename[500];
|
||||
int succeeded;
|
||||
succeeded = ::GetModuleFileName(NULL, filename, sizeof(filename));
|
||||
::strupr(filename);
|
||||
WWASSERT(succeeded);
|
||||
|
||||
//
|
||||
// Get size
|
||||
//
|
||||
RawFileClass file(filename);
|
||||
int filesize = file.Size();
|
||||
WWASSERT(filesize > 0);
|
||||
file.Close();
|
||||
|
||||
//
|
||||
// Strip path off filename
|
||||
//
|
||||
char * p_start = &filename[strlen(filename)];
|
||||
int num_chars = 1;
|
||||
while (*(p_start - 1) != '\\') {
|
||||
p_start--;
|
||||
num_chars++;
|
||||
}
|
||||
::memmove(filename, p_start, num_chars);
|
||||
|
||||
//
|
||||
// Pull a time/date stamp out of the exe header
|
||||
//
|
||||
PIMAGE_FILE_HEADER p_header = (PIMAGE_FILE_HEADER) PEFHDROFFSET(ProgramInstance);
|
||||
WWASSERT(p_header != NULL);
|
||||
int time_date_stamp = p_header->TimeDateStamp;
|
||||
|
||||
//
|
||||
// Put all this data into a string
|
||||
//
|
||||
char id_string[500];
|
||||
::sprintf(id_string, "%s %d %d", filename, filesize, time_date_stamp);
|
||||
WWDEBUG_SAY(("File id string: %s\n", id_string));
|
||||
|
||||
//
|
||||
// return the crc of that string as the key
|
||||
//
|
||||
return CRCEngine()(id_string, strlen(id_string));
|
||||
}
|
||||
*/
|
||||
|
||||
//#include <stdio.h>
|
||||
//#include "verchk.h"
|
||||
|
||||
/*
|
||||
//-----------------------------------------------------------------------------
|
||||
int cMiscUtil::Get_Exe_Key(void)
|
||||
{
|
||||
//
|
||||
// Get exe name
|
||||
//
|
||||
char filename[500];
|
||||
int succeeded;
|
||||
succeeded = ::GetModuleFileName(NULL, filename, sizeof(filename));
|
||||
::strupr(filename);
|
||||
WWASSERT(succeeded);
|
||||
|
||||
StringClass string;
|
||||
Get_File_Id_String(filename, string);
|
||||
|
||||
//
|
||||
// return the crc of that string as the key
|
||||
//
|
||||
return CRCEngine()(string, strlen(string));
|
||||
}
|
||||
*/
|
||||
|
||||
//#include "crc.h"
|
70
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/miscutil.h
Normal file
70
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/miscutil.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
** Command & Conquer Generals Zero Hour(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//
|
||||
// Filename: miscutil.h
|
||||
// Project: wwutil
|
||||
// Author: Tom Spencer-Smith
|
||||
// Date: June 1998
|
||||
// Description:
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
#if defined(_MSV_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef MISCUTIL_H
|
||||
#define MISCUTIL_H
|
||||
|
||||
#ifndef ALWAYS_H
|
||||
#include "always.h"
|
||||
#endif
|
||||
|
||||
#include "bittype.h"
|
||||
#include "wwstring.h"
|
||||
|
||||
const float MISCUTIL_EPSILON = 0.0001f;
|
||||
|
||||
class cMiscUtil
|
||||
{
|
||||
public:
|
||||
static LPCSTR Get_Text_Time(void);
|
||||
static void Seconds_To_Hms(float seconds, int & h, int & m, int & s);
|
||||
static bool Is_String_Same(LPCSTR str1, LPCSTR str2);
|
||||
static bool Is_String_Different(LPCSTR str1, LPCSTR str2);
|
||||
static void Get_File_Id_String(LPCSTR filename, StringClass & str);
|
||||
static bool File_Exists(LPCSTR filename);
|
||||
static bool File_Is_Read_Only(LPCSTR filename);
|
||||
static bool Is_Alphabetic(char c);
|
||||
static bool Is_Numeric(char c);
|
||||
static bool Is_Alphanumeric(char c);
|
||||
static bool Is_Whitespace(char c);
|
||||
static void Trim_Trailing_Whitespace(char * text);
|
||||
static void Remove_File(LPCSTR filename);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // MISCUTIL_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//static int Get_Exe_Key(void);
|
179
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/wwutil.dsp
Normal file
179
GeneralsMD/Code/Libraries/Source/WWVegas/Wwutil/wwutil.dsp
Normal file
|
@ -0,0 +1,179 @@
|
|||
# Microsoft Developer Studio Project File - Name="wwutil" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=wwutil - Win32 DebugW3D
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "wwutil.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "wwutil.mak" CFG="wwutil - Win32 DebugW3D"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "wwutil - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "wwutil - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "wwutil - Win32 Profile" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "wwutil - Win32 Internal" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "wwutil - Win32 DebugW3D" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""$/Commando/Code/wwutil", ACDBAAAA"
|
||||
# PROP Scc_LocalPath "."
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "wwutil - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /G6 /MD /W3 /WX /Gi /GX /O2 /Ob2 /I "..\wwlib" /I "..\wwdebug" /I "..\wwmath" /D "_MBCS" /D "_LIB" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "NDEBUG" /D "WIN32" /D "IG_DEBUG_STACKTRACE" /YX /FD /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\Lib\WWUtil.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "wwutil - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /G6 /MDd /W3 /WX /Gi /GX /Zi /O2 /Ob2 /I "..\wwlib" /I "..\wwdebug" /I "..\wwmath" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\Lib\WWUtilDebug.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "wwutil - Win32 Profile"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Profile"
|
||||
# PROP BASE Intermediate_Dir "Profile"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Profile"
|
||||
# PROP Intermediate_Dir "Profile"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /WX /GX /Zi /O2 /Op /Ob2 /I "..\wwlib" /I "..\wwdebug" /I "..\wwmath" /D "NDEBUG" /D "WWDEBUG" /D "_MBCS" /D "_LIB" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "_PROFILE" /YX /FD /Gh /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\Lib\WWUtilProfile.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "wwutil - Win32 Internal"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Internal"
|
||||
# PROP BASE Intermediate_Dir "Internal"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Internal"
|
||||
# PROP Intermediate_Dir "Internal"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W4 /WX /Gi /GX /O2 /Ob2 /I "..\wwlib" /I "..\wwdebug" /I "..\wwmath" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /c
|
||||
# ADD CPP /nologo /G6 /MD /W3 /WX /Gi /GX /Zi /O2 /I "..\wwlib" /I "..\wwdebug" /I "..\wwmath" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /D "_INTERNAL" /YX /FD /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\..\..\Lib\WWUtil.lib"
|
||||
# ADD LIB32 /nologo /out:"..\..\..\Lib\WWUtilInternal.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "wwutil - Win32 DebugW3D"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "DebugW3D"
|
||||
# PROP BASE Intermediate_Dir "DebugW3D"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "DebugW3D"
|
||||
# PROP Intermediate_Dir "DebugW3D"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /WX /Gm /Gi /GX /ZI /Od /I "..\wwlib" /I "..\wwdebug" /I "..\wwmath" /D "_DEBUG" /D "WWDEBUG" /D "_MBCS" /D "_LIB" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /G6 /MDd /W3 /WX /Gm /Gi /GX /ZI /Od /I "..\wwlib" /I "..\wwdebug" /I "..\wwmath" /D "_DEBUG" /D "WWDEBUG" /D "_MBCS" /D "_LIB" /D "WIN32" /D "_WINDOWS" /D "WIN32_LEAN_AND_MEAN" /YX /FD /GZ /c
|
||||
# SUBTRACT CPP /Fr
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\..\..\Lib\WWUtilDebug.lib"
|
||||
# ADD LIB32 /nologo /out:"..\..\..\Lib\WWUtilDebugW3D.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "wwutil - Win32 Release"
|
||||
# Name "wwutil - Win32 Debug"
|
||||
# Name "wwutil - Win32 Profile"
|
||||
# Name "wwutil - Win32 Internal"
|
||||
# Name "wwutil - Win32 DebugW3D"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mathutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mathutil.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\miscutil.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\miscutil.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
Reference in a new issue