mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- Fixed a few Visual Studio compiler warnings
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3129 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1914,12 +1914,13 @@ void RefreshScreen(void *DummyVariable)
|
||||
#endif
|
||||
CHAR8 FileName[64];
|
||||
INT32 iIndex;
|
||||
STRING512 DataDir;
|
||||
STRING512 ExecDir;
|
||||
UINT16 *p16BPPData;
|
||||
|
||||
// Snap: save current directory
|
||||
#ifndef USE_VFS
|
||||
STRING512 DataDir;
|
||||
STRING512 ExecDir;
|
||||
|
||||
GetFileManCurrentDirectory( DataDir );
|
||||
GetExecutableDirectory( ExecDir );
|
||||
SetFileManCurrentDirectory( ExecDir );
|
||||
|
||||
@@ -564,11 +564,11 @@ BOOLEAN PrepareEnemyForSectorBattle()
|
||||
// OJW - 20090403 - override max ai in co-op
|
||||
if (is_networked && is_server && OVERRIDE_MAX_AI == 1)
|
||||
{
|
||||
float totalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites;
|
||||
ubTotalAdmins = ((float)pSector->ubNumAdmins / totalEnemies) * mapMaximumNumberOfEnemies;
|
||||
ubTotalTroops = ((float)pSector->ubNumTroops / totalEnemies) * mapMaximumNumberOfEnemies;
|
||||
ubTotalElites = ((float)pSector->ubNumElites / totalEnemies) * mapMaximumNumberOfEnemies;
|
||||
totalEnemies = ubTotalAdmins + ubTotalTroops + ubTotalElites;
|
||||
float totalEnemies = (float)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites);
|
||||
ubTotalAdmins = (unsigned int)(((float)pSector->ubNumAdmins / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
ubTotalTroops = (unsigned int)(((float)pSector->ubNumTroops / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
ubTotalElites = (unsigned int)(((float)pSector->ubNumElites / totalEnemies) * mapMaximumNumberOfEnemies);
|
||||
totalEnemies = (float)(ubTotalAdmins + ubTotalTroops + ubTotalElites);
|
||||
|
||||
// take care of any rounding losses
|
||||
while (totalEnemies < mapMaximumNumberOfEnemies)
|
||||
|
||||
@@ -1358,7 +1358,6 @@ void EndLoadScreen( )
|
||||
//Report the time it took to load the map. This is temporary until we are satisfied with the time
|
||||
//it takes to load the map.
|
||||
CHAR16 str[60];
|
||||
FILE *fp;
|
||||
UINT32 uiSeconds;
|
||||
UINT32 uiHundreths;
|
||||
UINT32 uiUnaccounted;
|
||||
@@ -1381,6 +1380,8 @@ void EndLoadScreen( )
|
||||
}
|
||||
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str );
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
if( fStartNewFile )
|
||||
{ //start new file
|
||||
fp = fopen( "TimeResults.txt", "w" );
|
||||
|
||||
@@ -68,7 +68,7 @@ ammotypeStartElementHandle(void *userData, const XML_Char *name, const XML_Char
|
||||
strcmp(name, "standardIssue") == 0 ||
|
||||
strcmp(name, "numberOfBullets") == 0 ||
|
||||
//zilpin: pellet spread patterns externalized in XML
|
||||
stricmp(name, "spreadPattern") == 0 ||
|
||||
strcmp(name, "spreadPattern") == 0 ||
|
||||
strcmp(name, "highExplosive") == 0 ||
|
||||
strcmp(name, "explosionSize") == 0 ||
|
||||
strcmp(name, "antiTank") == 0 ||
|
||||
@@ -226,7 +226,7 @@ ammotypeEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curAmmoType.numberOfBullets = (UINT8) atol(pData->szCharData);
|
||||
}
|
||||
//zilpin: pellet spread patterns externalized in XML
|
||||
else if(stricmp(name, "spreadPattern") == 0)
|
||||
else if(strcmp(name, "spreadPattern") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curAmmoType.spreadPattern = FindSpreadPatternIndex( pData->szCharData );
|
||||
|
||||
@@ -69,12 +69,11 @@ typedef spreadpatternParseData;
|
||||
static void XMLCALL
|
||||
spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
int i;
|
||||
spreadpatternParseData * pData = (spreadpatternParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||
{
|
||||
if(stricmp(name, "SPREADPATTERNLIST") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
if(strcmp(name, "SPREADPATTERNLIST") == 0 && pData->curElement == ELEMENT_NONE)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
@@ -86,7 +85,7 @@ spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(stricmp(name, "SPREADPATTERN") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
else if(strcmp(name, "SPREADPATTERN") == 0 && pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
|
||||
@@ -111,7 +110,7 @@ spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_
|
||||
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if(stricmp(name, "p") == 0 )//&& pData->curElement == ELEMENT_LIST)
|
||||
else if(strcmp(name, "p") == 0 )//&& pData->curElement == ELEMENT_LIST)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
gpSpreadPattern[giSpreadPatternCount-1].iCount++;
|
||||
@@ -128,12 +127,12 @@ spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_
|
||||
pData->maxReadDepth++; //we are not skipping this element
|
||||
}
|
||||
else if( //pData->curElement == ELEMENT &&
|
||||
( stricmp(name, "x") == 0
|
||||
|| stricmp(name, "y") == 0
|
||||
|| stricmp(name, "xspread") == 0
|
||||
|| stricmp(name, "yspread") == 0
|
||||
|| stricmp(name, "Name") == 0
|
||||
|| stricmp(name, "method") == 0
|
||||
( strcmp(name, "x") == 0
|
||||
|| strcmp(name, "y") == 0
|
||||
|| strcmp(name, "xspread") == 0
|
||||
|| strcmp(name, "yspread") == 0
|
||||
|| strcmp(name, "Name") == 0
|
||||
|| strcmp(name, "method") == 0
|
||||
))
|
||||
|
||||
{
|
||||
@@ -167,21 +166,20 @@ static void XMLCALL
|
||||
spreadpatternEndElementHandle(void *userData, const XML_Char *name)
|
||||
{
|
||||
DOUBLE d;
|
||||
int i;
|
||||
|
||||
|
||||
spreadpatternParseData * pData = (spreadpatternParseData *)userData;
|
||||
|
||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||
{
|
||||
if(stricmp(name, "SPREADPATTERNLIST") == 0)
|
||||
if(strcmp(name, "SPREADPATTERNLIST") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_NONE;
|
||||
}
|
||||
else if(stricmp(name, "SPREADPATTERN") == 0)
|
||||
else if(strcmp(name, "SPREADPATTERN") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
}
|
||||
else if(stricmp(name, "p") == 0)
|
||||
else if(strcmp(name, "p") == 0)
|
||||
{
|
||||
//I would prefer the format to be:
|
||||
// <SPREADPATTERN><p x="0.1" y="0.1"/><p x="0.2" y="0.2"/></SPREADPATTERN>
|
||||
@@ -190,31 +188,31 @@ spreadpatternEndElementHandle(void *userData, const XML_Char *name)
|
||||
//because the XML editor will probably have problems with using attributes instead of tags.
|
||||
pData->curElement = ELEMENT_LIST;
|
||||
}
|
||||
else if(stricmp(name, "x") == 0)
|
||||
else if(strcmp(name, "x") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
d = atof(pData->szCharData);
|
||||
gpSpreadPattern[giSpreadPatternCount-1].x[ gpSpreadPattern[giSpreadPatternCount-1].iCount-1 ] = d;
|
||||
}
|
||||
else if(stricmp(name, "y") == 0)
|
||||
else if(strcmp(name, "y") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
d = atof(pData->szCharData);
|
||||
gpSpreadPattern[giSpreadPatternCount-1].y[ gpSpreadPattern[giSpreadPatternCount-1].iCount-1 ] = d;
|
||||
}
|
||||
else if(stricmp(name, "xspread") == 0)
|
||||
else if(strcmp(name, "xspread") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
d = fabs( atof(pData->szCharData) );
|
||||
gpSpreadPattern[giSpreadPatternCount-1].xspread = d;
|
||||
}
|
||||
else if(stricmp(name, "yspread") == 0)
|
||||
else if(strcmp(name, "yspread") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
d = fabs( atof(pData->szCharData) );
|
||||
gpSpreadPattern[giSpreadPatternCount-1].yspread = d;
|
||||
}
|
||||
else if(stricmp(name, "Name") == 0)
|
||||
else if(strcmp(name, "Name") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
//Trim whitespace.
|
||||
@@ -224,15 +222,15 @@ spreadpatternEndElementHandle(void *userData, const XML_Char *name)
|
||||
memset(gpSpreadPattern[giSpreadPatternCount-1].Name,0,SPREADPATTERN_NAME_SIZE);
|
||||
strncpy(gpSpreadPattern[giSpreadPatternCount-1].Name,pData->szCharData,SPREADPATTERN_NAME_SIZE-1);
|
||||
}
|
||||
else if(stricmp(name, "method") == 0)
|
||||
else if(strcmp(name, "method") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
//Trim whitespace.
|
||||
while( pData->szCharData[0] == ' ' ) memmove( pData->szCharData , &pData->szCharData[1] , strlen(&pData->szCharData[1]) );
|
||||
while( strlen(pData->szCharData)>0 && pData->szCharData[ strlen(pData->szCharData)-1 ] == ' ' ) pData->szCharData[ strlen(pData->szCharData)-1 ]=0;
|
||||
//Find it.
|
||||
for(i=0;i<SPREADPATTERNMETHOD_COUNT;++i){
|
||||
if(stricmp(pData->szCharData, gSpreadPatternMethodNames[i] ) == 0){
|
||||
for(unsigned int i=0;i<SPREADPATTERNMETHOD_COUNT;++i){
|
||||
if(strcmp(pData->szCharData, gSpreadPatternMethodNames[i] ) == 0){
|
||||
gpSpreadPattern[giSpreadPatternCount-1].method = i;
|
||||
break;
|
||||
}
|
||||
@@ -326,11 +324,9 @@ BOOLEAN WriteSpreadPatterns()
|
||||
|
||||
|
||||
{
|
||||
UINT32 i,j;
|
||||
|
||||
FilePrintf(hFile,"<SPREADPATTERNLIST>\r\n");
|
||||
FilePrintf(hFile,"<!-- giSpreadPatternCount = %d -->\r\n", giSpreadPatternCount );
|
||||
for(i = 0 ; i < giSpreadPatternCount; i++)
|
||||
for(INT32 i = 0 ; i < giSpreadPatternCount; i++)
|
||||
{
|
||||
FilePrintf(hFile,"\t<SPREADPATTERN>\r\n");
|
||||
FilePrintf(hFile,"\t<!-- index = %d -->\r\n",i);
|
||||
@@ -339,7 +335,7 @@ BOOLEAN WriteSpreadPatterns()
|
||||
FilePrintf(hFile,"\t<xspread>%2.4f</xspread>",gpSpreadPattern[i].xspread);
|
||||
FilePrintf(hFile," <yspread>%2.4f</yspread>\r\n",gpSpreadPattern[i].yspread);
|
||||
FilePrintf(hFile,"\t<!-- p iCount = %d -->\r\n",gpSpreadPattern[i].iCount);
|
||||
for(j=0;j<gpSpreadPattern[i].iCount;j++)
|
||||
for(INT32 j=0;j<gpSpreadPattern[i].iCount;j++)
|
||||
{
|
||||
FilePrintf(hFile,"\t\t<p>");
|
||||
FilePrintf(hFile,"<x>%2.4f</x>",gpSpreadPattern[i].x[j]);
|
||||
@@ -364,7 +360,8 @@ BOOLEAN WriteSpreadPatterns()
|
||||
//If the name is not found, or the index was out of range, then return 0.
|
||||
int FindSpreadPatternIndex( const STR strName )
|
||||
{
|
||||
int i=0,n=0;
|
||||
UINT32 ui = 0;
|
||||
INT32 i,n=0;
|
||||
char str[SPREADPATTERN_NAME_SIZE]={};
|
||||
|
||||
//Copy search name sans leading and trailing space.
|
||||
@@ -374,14 +371,16 @@ int FindSpreadPatternIndex( const STR strName )
|
||||
while( strlen(str)>0 && str[ strlen(str)-1 ] == ' ' ) str[ strlen(str)-1 ]=0;
|
||||
|
||||
//Named pattern or raw index?
|
||||
for(i=0;i<strlen(str);i++) if( !isdigit(str[i]) ) break;
|
||||
for(ui=0;ui<strlen(str);ui++)
|
||||
if( !isdigit(str[ui]) )
|
||||
break;
|
||||
|
||||
if(i<strlen(str))
|
||||
if(ui<strlen(str))
|
||||
{
|
||||
//Holds named SpreadPattern. Search.
|
||||
for(i=0;i<giSpreadPatternCount;i++)
|
||||
{
|
||||
if( !stricmp(str, gpSpreadPattern[i].Name) )
|
||||
if( !strcmp(str, gpSpreadPattern[i].Name) )
|
||||
{
|
||||
//Match! Assign and return.
|
||||
n=i;
|
||||
|
||||
@@ -521,7 +521,6 @@ extern BOOLEAN gfLoadShadeTablesFromTextFile;
|
||||
|
||||
void BuildTileShadeTables( )
|
||||
{
|
||||
HWFILE hfile;
|
||||
// BF
|
||||
//STRING512 DataDir;
|
||||
//STRING512 ShadeTableDir;
|
||||
|
||||
@@ -193,7 +193,7 @@ SMKFLIC *pSmack;
|
||||
SMKFLIC *SmkOpenFlic(CHAR8 *cFilename)
|
||||
{
|
||||
SMKFLIC *pSmack;
|
||||
HANDLE hFile;
|
||||
|
||||
|
||||
// Get an available flic slot from the list
|
||||
if(!(pSmack=SmkGetFreeFlic()))
|
||||
@@ -210,6 +210,8 @@ SMKFLIC *SmkOpenFlic(CHAR8 *cFilename)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
HANDLE hFile;
|
||||
|
||||
//Get the real file handle for the file man handle for the smacker file
|
||||
hFile = GetRealFileHandleFromFileManFileHandle( pSmack->hFileHandle );
|
||||
#else
|
||||
|
||||
@@ -105,7 +105,7 @@ void ConvertRGBDistribution555To565( UINT16 * p16BPPData, UINT32 uiNumberOfPixel
|
||||
void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 sHeight, STR cOutputName, UINT32 fFlags, UINT32 uiAppDataSize )
|
||||
{
|
||||
|
||||
FILE * pOutput;
|
||||
|
||||
|
||||
UINT32 uiOriginalSize;
|
||||
UINT8 * pOutputBuffer = NULL;
|
||||
@@ -167,6 +167,8 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
|
||||
// save file
|
||||
//
|
||||
#ifndef USE_VFS
|
||||
FILE * pOutput;
|
||||
|
||||
pOutput = fopen( cOutputName, "wb" );
|
||||
if (pOutput == NULL )
|
||||
{
|
||||
|
||||
+3
-3
@@ -214,8 +214,8 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
|
||||
strcmp(name, "SciFi") == 0 ||
|
||||
strcmp(name, "NewInv") == 0 ||
|
||||
//zilpin: pellet spread patterns externalized in XML
|
||||
stricmp(name, "spreadPattern") == 0 ||
|
||||
strcmp(name, "fFlags") == 0 ))
|
||||
strcmp(name, "spreadPattern") == 0 ||
|
||||
strcmp(name, "fFlags") == 0 ))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) );
|
||||
@@ -1028,7 +1028,7 @@ itemEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curItem.bestlaserrange = (INT16) atol(pData->szCharData);
|
||||
}
|
||||
//zilpin: pellet spread patterns externalized in XML
|
||||
else if(stricmp(name, "spreadPattern") == 0)
|
||||
else if(strcmp(name, "spreadPattern") == 0)
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curItem.spreadPattern = FindSpreadPatternIndex( pData->szCharData );
|
||||
|
||||
Reference in New Issue
Block a user