Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+112 -112
View File
@@ -24,76 +24,76 @@ extern BOOLEAN GetCDromDriveLetter( STR8 pString );
BOOLEAN PerformTimeLimitedCheck();
// WANNE: Given a string, replaces all instances of "oldpiece" with "newpiece"
/*
/*
*
* Modified this routine to eliminate recursion and to avoid infinite
* expansion of string when newpiece contains oldpiece. --Byron
*/
//STR8 Replace(STR8 string, STR8 oldpiece, STR8 newpiece)
//{
// int str_index, newstr_index, oldpiece_index, end,
* expansion of string when newpiece contains oldpiece. --Byron
*/
//STR8 Replace(STR8 string, STR8 oldpiece, STR8 newpiece)
//{
// int str_index, newstr_index, oldpiece_index, end,
//
// new_len, old_len, cpy_len;
// STR8 c;
// static char newstring[MAXLINE];
// new_len, old_len, cpy_len;
// STR8 c;
// static char newstring[MAXLINE];
//
// if ((c = strstr(string, oldpiece)) == NULL)
// if ((c = strstr(string, oldpiece)) == NULL)
//
// return string;
// return string;
//
// new_len = strlen(newpiece);
// old_len = strlen(oldpiece);
// end = strlen(string) - old_len;
// oldpiece_index = c - string;
// new_len = strlen(newpiece);
// old_len = strlen(oldpiece);
// end = strlen(string) - old_len;
// oldpiece_index = c - string;
//
//
// newstr_index = 0;
// str_index = 0;
// while(str_index <= end && c != NULL)
// {
// newstr_index = 0;
// str_index = 0;
// while(str_index <= end && c != NULL)
// {
//
// //Copy characters from the left of matched pattern occurence
// cpy_len = oldpiece_index-str_index;
// strncpy(newstring+newstr_index, string+str_index, cpy_len);
// newstr_index += cpy_len;
// str_index += cpy_len;
// //Copy characters from the left of matched pattern occurence
// cpy_len = oldpiece_index-str_index;
// strncpy(newstring+newstr_index, string+str_index, cpy_len);
// newstr_index += cpy_len;
// str_index += cpy_len;
//
// //Copy replacement characters instead of matched pattern
// strcpy(newstring+newstr_index, newpiece);
// newstr_index += new_len;
// str_index += old_len;
// //Copy replacement characters instead of matched pattern
// strcpy(newstring+newstr_index, newpiece);
// newstr_index += new_len;
// str_index += old_len;
//
// //Check for another pattern match
// if((c = strstr(string+str_index, oldpiece)) != NULL)
// oldpiece_index = c - string;
// //Check for another pattern match
// if((c = strstr(string+str_index, oldpiece)) != NULL)
// oldpiece_index = c - string;
//
//
// }
// // Copy remaining characters from the right of last matched pattern
// strcpy(newstring+newstr_index, string+str_index);
// }
// // Copy remaining characters from the right of last matched pattern
// strcpy(newstring+newstr_index, string+str_index);
//
// return newstring;
//}
// return newstring;
//}
// WANNE: Replaces german specific characters
// WANNE: Replaces german specific characters
//STR8 ReplaceGermanSpecialCharacters(STR8 text)
//{
// // ä
// text = Replace(text, "ä", "ä");
// // Ä
// text = Replace(text, "Ä", "Ä");
// // ö
// text = Replace(text, "ö", "ö");
// // Ö
// text = Replace(text, "Ö", "Ö");
// // ü
// text = Replace(text, "ü", "ü");
// // Ü
// text = Replace(text, "Ü", "Ü");
// // ß
// text = Replace(text, "ß", "ß");
// // ä
// text = Replace(text, "ä", "ä");
// // Ä
// text = Replace(text, "Ä", "Ä");
// // ö
// text = Replace(text, "ö", "ö");
// // Ö
// text = Replace(text, "Ö", "Ö");
// // ü
// text = Replace(text, "ü", "ü");
// // Ü
// text = Replace(text, "Ü", "Ü");
// // ß
// text = Replace(text, "ß", "ß");
//
// return text;
// return text;
//}
@@ -111,7 +111,7 @@ CHAR8 Drive[128], Dir[128], Name[128], Ext[128];
else
{
_splitpath(pFilename, Drive, Dir, Name, Ext);
strcat(Name, "_8");
strcpy(pDestination, Drive);
@@ -125,9 +125,9 @@ CHAR8 Drive[128], Dir[128], Name[128], Ext[128];
BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColFile )
{
HWFILE hFileHandle;
BYTE bColHeader[ 8 ];
UINT32 cnt;
HWFILE hFileHandle;
BYTE bColHeader[ 8 ];
UINT32 cnt;
//See if files exists, if not, return error
if ( !FileExists( ColFile ) )
@@ -138,7 +138,7 @@ BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColF
}
// Open and read in the file
if ( ( hFileHandle = FileOpen( ColFile, FILE_ACCESS_READ, FALSE)) == 0)
if ( ( hFileHandle = FileOpen( ColFile, FILE_ACCESS_READ, FALSE)) == 0)
{
// Return FALSE w/ debug
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Cannot open COL file");
@@ -146,14 +146,14 @@ BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColF
}
// Skip header
FileRead( hFileHandle, bColHeader, sizeof( bColHeader ) , NULL);
FileRead( hFileHandle, bColHeader, sizeof( bColHeader ) , NULL);
// Read in a palette entry at a time
for ( cnt = 0; cnt < 256; cnt++ )
{
FileRead( hFileHandle, &pPalette[ cnt ].peRed, sizeof( UINT8 ) , NULL);
FileRead( hFileHandle, &pPalette[ cnt ].peGreen, sizeof( UINT8 ) , NULL);
FileRead( hFileHandle, &pPalette[ cnt ].peBlue, sizeof( UINT8 ) , NULL);
FileRead( hFileHandle, &pPalette[ cnt ].peRed, sizeof( UINT8 ) , NULL);
FileRead( hFileHandle, &pPalette[ cnt ].peGreen, sizeof( UINT8 ) , NULL);
FileRead( hFileHandle, &pPalette[ cnt ].peBlue, sizeof( UINT8 ) , NULL);
}
// Close file
@@ -167,7 +167,7 @@ BOOLEAN DisplayPaletteRep( PaletteRepID aPalRep, UINT8 ubXPos, UINT8 ubYPos, UIN
UINT16 us16BPPColor;
UINT32 cnt1;
UINT8 ubSize, ubType;
INT16 sTLX, sTLY, sBRX, sBRY;
INT16 sTLX, sTLY, sBRX, sBRY;
UINT8 ubPaletteRep;
// Create 16BPP Palette
@@ -197,7 +197,7 @@ BOOLEAN DisplayPaletteRep( PaletteRepID aPalRep, UINT8 ubXPos, UINT8 ubYPos, UIN
}
BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont )
BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont )
{
UINT32 Cur, uiLet, uiNewLet, uiHyphenLet;
STR16 curletter;
@@ -205,7 +205,7 @@ BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont )
BOOLEAN fLineSplit = FALSE;
HVOBJECT hFont;
// CHECK FOR WRAP
// CHECK FOR WRAP
Cur=0;
uiLet = 0;
curletter = pStr;
@@ -229,12 +229,12 @@ BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont )
{
if ( (*curletter) == 32 )
{
// Split Line!
fLineSplit = TRUE;
// Split Line!
fLineSplit = TRUE;
pStr[ uiNewLet ] = (INT16)'\0';
pStr[ uiNewLet ] = (INT16)'\0';
wcscpy( pStr2, &(pStr[ uiNewLet + 1 ]) );
wcscpy( pStr2, &(pStr[ uiNewLet + 1 ]) );
}
if ( fLineSplit )
@@ -242,14 +242,14 @@ BOOLEAN WrapString( STR16 pStr, STR16 pStr2, UINT16 usWidth, INT32 uiFont )
uiNewLet--;
curletter--;
}
if( !fLineSplit)
{
//We completed the check for a space, but failed, so use the hyphen method.
swprintf( pStr2, L"-%s", &(pStr[uiHyphenLet]) );
pStr[uiHyphenLet] = (INT16)'/0';
fLineSplit = TRUE; //hyphen method
fLineSplit = TRUE; //hyphen method
break;
}
}
@@ -298,7 +298,7 @@ BOOLEAN IfWin95(void)
void HandleLimitedNumExecutions( )
{
// Get system directory
HWFILE hFileHandle;
HWFILE hFileHandle;
CHAR8 ubSysDir[ 512 ];
INT8 bNumRuns;
@@ -328,7 +328,7 @@ void HandleLimitedNumExecutions( )
SET_ERROR( "Error 1054: Cannot execute - contact Sir-Tech Software." );
return;
}
}
else
{
@@ -355,9 +355,9 @@ void HandleLimitedNumExecutions( )
SGPFILENAME gCheckFilenames[] =
{
"DATA\\INTRO.SLF",
"DATA\\LOADSCREENS.SLF",
"DATA\\MAPS.SLF",
"DATA\\INTRO.SLF",
"DATA\\LOADSCREENS.SLF",
"DATA\\MAPS.SLF",
"DATA\\NPC_SPEECH.SLF",
"DATA\\SPEECH.SLF",
};
@@ -365,14 +365,14 @@ SGPFILENAME gCheckFilenames[] =
UINT32 gCheckFileMinSizes[] =
{
68000000,
36000000,
87000000,
187000000,
236000000
68000000,
36000000,
87000000,
187000000,
236000000
};
#if defined( JA2TESTVERSION ) || defined( _DEBUG )
#if defined( JA2TESTVERSION ) || defined( _DEBUG )
#define NOCDCHECK
#endif
@@ -400,46 +400,46 @@ BOOLEAN HandleJA2CDCheck( )
BOOLEAN fFailed = FALSE;
CHAR8 zCdLocation[ SGPFILENAME_LEN ];
CHAR8 zCdFile[ SGPFILENAME_LEN ];
INT32 cnt;
INT32 cnt;
HWFILE hFile;
// Check for a file on CD....
if( GetCDromDriveLetter( zCdLocation ) )
{
for ( cnt = 0; cnt < 5; cnt++ )
{
// OK, build filename
sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ cnt ] );
for ( cnt = 0; cnt < 5; cnt++ )
{
// OK, build filename
sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ cnt ] );
hFile = FileOpen( zCdFile, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
// Check if it exists...
if ( !hFile )
{
fFailed = TRUE;
// Check if it exists...
if ( !hFile )
{
fFailed = TRUE;
FileClose( hFile );
break;
}
break;
}
// Check min size
// Check min size
//#ifndef GERMAN
// if ( FileGetSize( hFile ) < gCheckFileMinSizes[ cnt ] )
// {
// fFailed = TRUE;
// if ( FileGetSize( hFile ) < gCheckFileMinSizes[ cnt ] )
// {
// fFailed = TRUE;
// FileClose( hFile );
// break;
// }
// break;
// }
//#endif
FileClose( hFile );
}
}
else
{
fFailed = TRUE;
}
}
else
{
fFailed = TRUE;
}
if ( fFailed )
{
CHAR8 zErrorMessage[256];
@@ -452,8 +452,8 @@ BOOLEAN HandleJA2CDCheck( )
}
}
return( TRUE );
return( TRUE );
#endif
}
@@ -482,7 +482,7 @@ BOOLEAN HandleJA2CDCheckTwo( )
fFailed = FALSE;
}
}
if ( fFailed )
{
CHAR8 zErrorMessage[256];
@@ -519,7 +519,7 @@ BOOLEAN PerformTimeLimitedCheck()
if( sSystemTime.wYear > 1999 || sSystemTime.wMonth > 7 )
{
//spit out an error message
MessageBox( NULL, "This time limited version of Jagged Alliance 2 has expired.", "Ja2 Error!", MB_OK );
MessageBox( NULL, "This time limited version of Jagged Alliance 2 has expired.", "Ja2 Error!", MB_OK );
return( FALSE );
}
@@ -531,11 +531,11 @@ BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation )
{
BOOLEAN fFailed = FALSE;
CHAR8 zCdFile[ SGPFILENAME_LEN ];
INT32 cnt;
INT32 cnt;
HWFILE hFile;
for ( cnt = 0; cnt < 4; cnt++ )
{
for ( cnt = 0; cnt < 4; cnt++ )
{
// OK, build filename
sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ cnt ] );
@@ -546,7 +546,7 @@ BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation )
{
fFailed = TRUE;
FileClose( hFile );
break;
break;
}
FileClose( hFile );
}