From 6df124efd719db3f13b9fcfad6a5908c4697e029 Mon Sep 17 00:00:00 2001 From: Lesh Date: Wed, 6 Sep 2006 19:10:08 +0000 Subject: [PATCH] - code cleanup mostly from Brent Johnson (Nonomori), a very few from me git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@508 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Editor/LoadScreen.cpp | 2 +- Laptop/CharProfile.cpp | 2 +- Laptop/IMP Begin Screen.cpp | 8 +- MainMenuScreen.cpp | 2 +- SaveLoadGame.cpp | 2 +- Standard Gaming Platform/Button System.cpp | 2 +- Standard Gaming Platform/DEBUG.cpp | 2 +- Standard Gaming Platform/sgp.cpp | 2 +- Standard Gaming Platform/soundman.cpp | 2 +- Standard Gaming Platform/video.cpp | 2 +- Strategic/Assignments.cpp | 2 +- Strategic/Auto Resolve.cpp | 2 +- Strategic/Campaign Types.h | 190 +++++++++--------- .../Map Screen Interface Map Inventory.h | 2 +- Strategic/Map Screen Interface Map.cpp | 8 +- Strategic/MilitiaSquads.cpp | 16 +- Strategic/Queen Command.cpp | 13 +- Strategic/Reinforcement.cpp | 14 +- Strategic/mapscreen.cpp | 2 +- Tactical/Items.cpp | 4 +- Tactical/LOS.cpp | 2 +- Tactical/Map Information.cpp | 5 +- Tactical/Soldier Control.cpp | 2 +- TacticalAI/AIMain.cpp | 2 +- TacticalAI/Attacks.cpp | 18 +- TileEngine/Explosion Control.cpp | 10 +- TileEngine/SmokeEffects.cpp | 14 +- TileEngine/Tile Animation.cpp | 4 +- TileEngine/Tile Cache.cpp | 4 +- TileEngine/Tile Surface.cpp | 2 +- TileEngine/lighting.cpp | 2 +- TileEngine/physics.cpp | 2 +- TileEngine/worlddef.cpp | 1 + aniviewscreen.cpp | 2 +- 34 files changed, 174 insertions(+), 175 deletions(-) diff --git a/Editor/LoadScreen.cpp b/Editor/LoadScreen.cpp index c1c43db0..5fc24076 100644 --- a/Editor/LoadScreen.cpp +++ b/Editor/LoadScreen.cpp @@ -638,7 +638,7 @@ FDLG_LIST *AddToFDlgList(FDLG_LIST *pList, GETFILESTRUCT *pInfo) } // Add and sort alphabetically without regard to case -- function limited to 10 chars comparison - if ( stricmp(pList->FileInfo.zFileName, pInfo->zFileName ) > 0 ) + if ( _stricmp(pList->FileInfo.zFileName, pInfo->zFileName ) > 0 ) { // pInfo is smaller than pList (i.e. Insert before) pNode = (FDLG_LIST *)MemAlloc( sizeof(FDLG_LIST) ); diff --git a/Laptop/CharProfile.cpp b/Laptop/CharProfile.cpp index 442a21e6..b4ff8167 100644 --- a/Laptop/CharProfile.cpp +++ b/Laptop/CharProfile.cpp @@ -90,7 +90,7 @@ INT32 giIMPButtonImage[1]; // visted subpages BOOLEAN fVisitedIMPSubPages[ IMP_NUM_PAGES ]; extern INT32 iCurrentPortrait; -extern iCurrentVoices; +extern INT32 iCurrentVoices; extern INT32 giMaxPersonalityQuizQuestion; extern BOOLEAN fStartOverFlag; diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 4aff5b2f..a2f1879f 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -586,7 +586,7 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) uiFullNameCharacterPosition = 0; } // make sure we haven't moved too far - if( ( uiFullNameCursorPosition + StringPixLength( ( CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) + if( ( uiFullNameCursorPosition + StringPixLength( ( CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)FULL_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X) { // do nothing for now, when pop up is in place, display break; @@ -622,7 +622,7 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) } // make sure we haven't moved too far - if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) + if( ( uiNickNameCursorPosition + StringPixLength( (CHAR16 *)&(uiKey ), FONT14ARIAL ) ) > (UINT32)NICK_NAME_REGION_WIDTH + 196 + LAPTOP_SCREEN_UL_X ) { // do nothing for now, when pop up is in place, display break; @@ -1244,8 +1244,6 @@ void Print8CharacterOnlyString( void ) BOOLEAN CheckCharacterInputForEgg( void ) { - MERC_HIRE_STRUCT HireMercStruct; - #ifndef JA2BETAVERSION return( FALSE ); #else @@ -1456,6 +1454,8 @@ BOOLEAN CheckCharacterInputForEgg( void ) iPortraitNumber = 2; //DEF: temp + MERC_HIRE_STRUCT HireMercStruct; + HireMercStruct.sSectorX = gsMercArriveSectorX; HireMercStruct.sSectorY = gsMercArriveSectorY; HireMercStruct.bSectorZ = 0; diff --git a/MainMenuScreen.cpp b/MainMenuScreen.cpp index 6f01bd26..1e1c3b8f 100644 --- a/MainMenuScreen.cpp +++ b/MainMenuScreen.cpp @@ -521,7 +521,7 @@ void SetMainMenuExitScreen( UINT32 uiNewScreen ) void CreateDestroyBackGroundMouseMask( BOOLEAN fCreate ) { - static fRegionCreated = FALSE; + static BOOLEAN fRegionCreated = FALSE; if( fCreate ) { diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 130399e5..71c5cf30 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -121,7 +121,7 @@ extern void TrashAllSoldiers( ); extern void ResetJA2ClockGlobalTimers( void ); extern void BeginLoadScreen( void ); -extern EndLoadScreen(); +extern void EndLoadScreen(); //Global variable used #ifdef JA2BETAVERSION diff --git a/Standard Gaming Platform/Button System.cpp b/Standard Gaming Platform/Button System.cpp index deec790f..30d6cb75 100644 --- a/Standard Gaming Platform/Button System.cpp +++ b/Standard Gaming Platform/Button System.cpp @@ -4092,7 +4092,7 @@ void DrawDialogBox( INT32 iDlgBox ) //------------------------------------------------------------------------------------------------------ -template INT32 CreateCheckBoxButton(INT16, INT16, char *, INT16, GUI_CALLBACK); +// template INT32 CreateCheckBoxButton(INT16, INT16, char *, INT16, GUI_CALLBACK); template INT32 CreateCheckBoxButton(INT16, INT16, char const *, INT16, GUI_CALLBACK); template INT32 CreateCheckBoxButton( INT16 x, INT16 y, string3 filename, INT16 Priority, GUI_CALLBACK ClickCallback ) diff --git a/Standard Gaming Platform/DEBUG.cpp b/Standard Gaming Platform/DEBUG.cpp index 3a3b1a50..2c9982ea 100644 --- a/Standard Gaming Platform/DEBUG.cpp +++ b/Standard Gaming Platform/DEBUG.cpp @@ -494,7 +494,7 @@ template void _FailMessage(char const *, unsigned in template void _FailMessage(int, unsigned int, char const *); template void _FailMessage(int, unsigned int, char *); template void _FailMessage(char *, unsigned int, char *); -template void _FailMessage(unsigned char *, unsigned int, char *); +// template void _FailMessage(unsigned char *, unsigned int, char *); template void _FailMessage(unsigned char *, unsigned int, char const *); template void _FailMessage( type1 pString, UINT32 uiLineNum, type2 pSourceFile ) diff --git a/Standard Gaming Platform/sgp.cpp b/Standard Gaming Platform/sgp.cpp index 23a6abb6..7e146f85 100644 --- a/Standard Gaming Platform/sgp.cpp +++ b/Standard Gaming Platform/sgp.cpp @@ -118,7 +118,7 @@ UINT8 gbPixelDepth = PIXEL_DEPTH; INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam) { - static fRestore = FALSE; + static BOOLEAN fRestore = FALSE; if(gfIgnoreMessages) return(DefWindowProc(hWindow, Message, wParam, lParam)); diff --git a/Standard Gaming Platform/soundman.cpp b/Standard Gaming Platform/soundman.cpp index abea0c4b..961679a3 100644 --- a/Standard Gaming Platform/soundman.cpp +++ b/Standard Gaming Platform/soundman.cpp @@ -1207,7 +1207,7 @@ BOOLEAN fRemoved; FileClose(hFile); strcpy(pSampleList[uiSample].pName, pFilename); - strupr(pSampleList[uiSample].pName); + _strupr(pSampleList[uiSample].pName); pSampleList[uiSample].uiSize=uiSize; pSampleList[uiSample].uiFlags|=SAMPLE_ALLOCATED; return(uiSample); diff --git a/Standard Gaming Platform/video.cpp b/Standard Gaming Platform/video.cpp index bf285003..f06c83be 100644 --- a/Standard Gaming Platform/video.cpp +++ b/Standard Gaming Platform/video.cpp @@ -2963,7 +2963,7 @@ HRESULT ReturnCode; return(TRUE); } -template void FatalError(char *, ...); +// template void FatalError(char *, ...); template void FatalError(char const *, ...); template void FatalError( string1 pError, ...) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 24a96766..8787d04e 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -10309,7 +10309,7 @@ void SetTimeOfAssignmentChangeForMerc( SOLDIERTYPE *pSoldier ) // have we spent enough time on assignment for it to count? BOOLEAN EnoughTimeOnAssignment( SOLDIERTYPE *pSoldier ) { - if( GetWorldTotalMin() - pSoldier->uiLastAssignmentChangeMin >= gGameExternalOptions.ubMinutesForAssignmentToCount ) + if( GetWorldTotalMin() - pSoldier->uiLastAssignmentChangeMin >= (UINT32)gGameExternalOptions.ubMinutesForAssignmentToCount ) { return( TRUE ); } diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index b6047a2e..ab03269e 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -67,7 +67,7 @@ // default = 7 (%) #define EXP_BONUS 7 -#define MAX_AR_TEAM_SIZE 256 +#define MAX_AR_TEAM_SIZE 255 // Must fit in 8 bits #define REINFORCMENT_ATTACK_DELAY_PER_SOLDIER_IN_SECTOR 1000 diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index 02bda764..21ee52ff 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -4,9 +4,9 @@ #include "types.h" //Macro to convert sector coordinates (1-16,1-16) to 0-255 -#define SECTOR(x,y) ((y-1)*16+x-1) -#define SECTORX(SectorID) ((SectorID % 16) + 1) -#define SECTORY(SectorID) ((SectorID / 16) + 1) +#define SECTOR(x,y) ((y-1)*16+x-1) +#define SECTORX(SectorID) ((SectorID % 16) + 1) +#define SECTORY(SectorID) ((SectorID / 16) + 1) //Sector enumerations // @@ -53,36 +53,34 @@ enum //strategic values for each sector //Various flag definitions -#define SF_USE_MAP_SETTINGS 0x00000001 -#define SF_ENEMY_AMBUSH_LOCATION 0x00000002 +#define SF_USE_MAP_SETTINGS 0x00000001 +#define SF_ENEMY_AMBUSH_LOCATION 0x00000002 //Special case flag used when players encounter enemies in a sector, then retreat. The number of enemies //will display on mapscreen until time is compressed. When time is compressed, the flag is cleared, and //a question mark is displayed to reflect that the player no longer knows. -#define SF_PLAYER_KNOWS_ENEMIES_ARE_HERE 0x00000004 +#define SF_PLAYER_KNOWS_ENEMIES_ARE_HERE 0x00000004 -#define SF_SAM_SITE 0x00000008 -#define SF_MINING_SITE 0x00000010 -#define SF_ALREADY_VISITED 0x00000020 -#define SF_USE_ALTERNATE_MAP 0x00000040 -#define SF_PENDING_ALTERNATE_MAP 0x00000080 -#define SF_ALREADY_LOADED 0x00000100 -#define SF_HAS_ENTERED_TACTICAL 0x00000200 -#define SF_SKYRIDER_NOTICED_ENEMIES_HERE 0x00000400 -#define SF_HAVE_USED_GUIDE_QUOTE 0x00000800 +#define SF_SAM_SITE 0x00000008 +#define SF_MINING_SITE 0x00000010 +#define SF_ALREADY_VISITED 0x00000020 +#define SF_USE_ALTERNATE_MAP 0x00000040 +#define SF_PENDING_ALTERNATE_MAP 0x00000080 +#define SF_ALREADY_LOADED 0x00000100 +#define SF_HAS_ENTERED_TACTICAL 0x00000200 +#define SF_SKYRIDER_NOTICED_ENEMIES_HERE 0x00000400 +#define SF_HAVE_USED_GUIDE_QUOTE 0x00000800 - -#define SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS 0x00100000 //Temp File starts with sm_ -#define SF_LIGHTING_EFFECTS_TEMP_FILE_EXISTS 0x00200000 //Temp File starts with l_ - -#define SF_REVEALED_STATUS_TEMP_FILE_EXISTS 0x01000000 //Temp File starts with v_ -#define SF_DOOR_STATUS_TEMP_FILE_EXISTS 0x02000000 //Temp File starts with ds_ +#define SF_SMOKE_EFFECTS_TEMP_FILE_EXISTS 0x00100000 //Temp File starts with sm_ +#define SF_LIGHTING_EFFECTS_TEMP_FILE_EXISTS 0x00200000 //Temp File starts with l_ +#define SF_REVEALED_STATUS_TEMP_FILE_EXISTS 0x01000000 //Temp File starts with v_ +#define SF_DOOR_STATUS_TEMP_FILE_EXISTS 0x02000000 //Temp File starts with ds_ #define SF_ENEMY_PRESERVED_TEMP_FILE_EXISTS 0x04000000 //Temp File starts with e_ -#define SF_CIV_PRESERVED_TEMP_FILE_EXISTS 0x08000000 //Temp File starts with c_ -#define SF_ITEM_TEMP_FILE_EXISTS 0x10000000 //Temp File starts with i_ -#define SF_ROTTING_CORPSE_TEMP_FILE_EXISTS 0x20000000 //Temp File starts with r_ -#define SF_MAP_MODIFICATIONS_TEMP_FILE_EXISTS 0x40000000 //Temp File starts with m_ -#define SF_DOOR_TABLE_TEMP_FILES_EXISTS 0x80000000 //Temp File starts with d_ +#define SF_CIV_PRESERVED_TEMP_FILE_EXISTS 0x08000000 //Temp File starts with c_ +#define SF_ITEM_TEMP_FILE_EXISTS 0x10000000 //Temp File starts with i_ +#define SF_ROTTING_CORPSE_TEMP_FILE_EXISTS 0x20000000 //Temp File starts with r_ +#define SF_MAP_MODIFICATIONS_TEMP_FILE_EXISTS 0x40000000 //Temp File starts with m_ +#define SF_DOOR_TABLE_TEMP_FILES_EXISTS 0x80000000 //Temp File starts with d_ // town militia experience categories @@ -95,11 +93,11 @@ enum }; // facilities flags -#define SFCF_HOSPITAL 0x00000001 -#define SFCF_INDUSTRY 0x00000002 -#define SFCF_PRISON 0x00000004 -#define SFCF_MILITARY 0x00000008 -#define SFCF_AIRPORT 0x00000010 +#define SFCF_HOSPITAL 0x00000001 +#define SFCF_INDUSTRY 0x00000002 +#define SFCF_PRISON 0x00000004 +#define SFCF_MILITARY 0x00000008 +#define SFCF_AIRPORT 0x00000010 #define SFCF_GUN_RANGE 0x00000020 // coordinates of shooting range sector @@ -109,28 +107,29 @@ enum //Vehicle types -#define FOOT 0x01 //anywhere -#define CAR 0x02 //roads -#define TRUCK 0x04 //roads, plains, sparse +#define FOOT 0x01 //anywhere +#define CAR 0x02 //roads +#define TRUCK 0x04 //roads, plains, sparse #define TRACKED 0x08 //roads, plains, sand, sparse -#define AIR 0x10 //can traverse all terrains at 100% +#define AIR 0x10 //can traverse all terrains at 100% //Traversability ratings enum { - TOWN, //instant - ROAD, //everything travels at 100% + TOWN, //instant + ROAD, //everything travels at 100% PLAINS, //foot 90%, truck 75%, tracked 100% - SAND, //foot 70%, tracked 60% + SAND, //foot 70%, tracked 60% SPARSE, //foot 70%, truck 50%, tracked 60% DENSE, //foot 50% SWAMP, //foot 20% WATER, //foot 15% HILLS, //foot 50%, truck 50%, tracked 50% - GROUNDBARRIER,//only air (super dense forest, ocean, etc.) + GROUNDBARRIER, //only air (super dense forest, ocean, etc.) NS_RIVER, //river from north to south EW_RIVER, //river from east to west EDGEOFWORLD, //nobody can traverse. + //NEW (not used for border values -- traversal calculations) TROPICS, FARMLAND, @@ -144,11 +143,12 @@ enum COASTAL_ROAD, SAND_ROAD, SWAMP_ROAD, + //only used for text purposes and not assigned to areas (SAM sites are hard coded throughout the code) - SPARSE_SAM_SITE, //D15 near Drassen - SAND_SAM_SITE, //I8 near Tixa - TROPICS_SAM_SITE, //D2 near Chitzena - MEDUNA_SAM_SITE, //N4 in Meduna + SPARSE_SAM_SITE, //D15 near Drassen + SAND_SAM_SITE, //I8 near Tixa + TROPICS_SAM_SITE, //D2 near Chitzena + MEDUNA_SAM_SITE, //N4 in Meduna CAMBRIA_HOSPITAL_SITE, DRASSEN_AIRPORT_SITE, MEDUNA_AIRPORT_SITE, @@ -166,71 +166,71 @@ enum }; extern UINT8 gszTerrain[NUM_TRAVTERRAIN_TYPES][15]; -#define TRAVELRATING_NONE 0 -#define TRAVELRATING_LOW 25 +#define TRAVELRATING_NONE 0 +#define TRAVELRATING_LOW 25 #define TRAVELRATING_NORMAL 50 -#define TRAVELRATING_HIGH 75 +#define TRAVELRATING_HIGH 75 #define TRAVELRATING_EXTREME 100 //Used by ubGarrisonID when a sector doesn't point to a garrison. Used by strategic AI only. -#define NO_GARRISON 255 +#define NO_GARRISON 255 typedef struct SECTORINFO { //information pertaining to this sector - UINT32 uiFlags; //various special conditions - UINT8 ubInvestigativeState; //When the sector is attacked by the player, the state increases by 1 permanently. - //This value determines how quickly it is investigated by the enemy. - UINT8 ubGarrisonID; //IF the sector has an ID for this (non 255), then the queen values this sector and it - //indexes the garrison group. - INT8 ubPendingReinforcements; //when the enemy owns this sector, this value will keep track of HIGH priority reinforcements -- not regular. + UINT32 uiFlags; //various special conditions + UINT8 ubInvestigativeState; //When the sector is attacked by the player, the state increases by 1 permanently. + //This value determines how quickly it is investigated by the enemy. + UINT8 ubGarrisonID; //IF the sector has an ID for this (non 255), then the queen values this sector and it + //indexes the garrison group. + INT8 ubPendingReinforcements; //when the enemy owns this sector, this value will keep track of HIGH priority reinforcements -- not regular. BOOLEAN fMilitiaTrainingPaid; - UINT8 ubMilitiaTrainingPercentDone; - UINT8 ubMilitiaTrainingHundredths; + UINT8 ubMilitiaTrainingPercentDone; + UINT8 ubMilitiaTrainingHundredths; //enemy military presence BOOLEAN fPlayer[ 4 ]; //whether the player THINKS the sector is unde his control or not. array is for sublevels //enemy only info - UINT8 ubNumTroops; //the actual number of troops here. - UINT8 ubNumElites; //the actual number of elites here. - UINT8 ubNumAdmins; //the actual number of admins here. - UINT8 ubNumCreatures; //only set when immediately before ground attack made! + UINT8 ubNumTroops; //the actual number of troops here. + UINT8 ubNumElites; //the actual number of elites here. + UINT8 ubNumAdmins; //the actual number of admins here. + UINT8 ubNumCreatures; //only set when immediately before ground attack made! UINT8 ubTroopsInBattle, ubElitesInBattle, ubAdminsInBattle, ubCreaturesInBattle; - INT8 bLastKnownEnemies; // -1 means never been there, no idea, otherwise it's what we'd observed most recently - // while this is being maintained (partially, surely buggy), nothing uses it anymore. ARM + INT8 bLastKnownEnemies; // -1 means never been there, no idea, otherwise it's what we'd observed most recently + // while this is being maintained (partially, surely buggy), nothing uses it anymore. ARM UINT32 ubDayOfLastCreatureAttack; - UINT32 uiFacilitiesFlags; // the flags for various facilities + UINT32 uiFacilitiesFlags; // the flags for various facilities - UINT8 ubTraversability[5];//determines the traversability ratings to adjacent sectors. - //The last index represents the traversability if travelling - //throught the sector without entering it. - INT8 bNameId; - INT8 bUSUSED; - INT8 bBloodCats; - INT8 bBloodCatPlacements; - INT8 UNUSEDbSAMCondition; + UINT8 ubTraversability[5]; //determines the traversability ratings to adjacent sectors. + //The last index represents the traversability if travelling + //throught the sector without entering it. + INT8 bNameId; + INT8 bUSUSED; + INT8 bBloodCats; + INT8 bBloodCatPlacements; + INT8 UNUSEDbSAMCondition; - UINT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, - //the more people go near it. A travel rating of 0 means there are never people - //around. This value is used for determining how often items would "vanish" from - //a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM) - UINT8 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE - UINT16 usUNUSEDMilitiaLevels; // unused (ARM) + UINT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, + //the more people go near it. A travel rating of 0 means there are never people + //around. This value is used for determining how often items would "vanish" from + //a sector (nice theory, except it isn't being used that way. Stealing is only in towns. ARM) + UINT8 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE + UINT16 usUNUSEDMilitiaLevels; // unused (ARM) UINT8 ubUNUSEDNumberOfJoeBlowCivilians; // unused (ARM) UINT32 uiTimeCurrentSectorWasLastLoaded; //Specifies the last time the player was in the sector - UINT8 ubUNUSEDNumberOfEnemiesThoughtToBeHere; // using bLastKnownEnemies instead - UINT32 uiTimeLastPlayerLiberated; //in game seconds (used to prevent the queen from attacking for awhile) + UINT8 ubUNUSEDNumberOfEnemiesThoughtToBeHere; // using bLastKnownEnemies instead + UINT32 uiTimeLastPlayerLiberated; //in game seconds (used to prevent the queen from attacking for awhile) BOOLEAN fSurfaceWasEverPlayerControlled; - UINT8 bFiller1; - UINT8 bFiller2; - UINT8 bFiller3; + UINT8 bFiller1; + UINT8 bFiller2; + UINT8 bFiller3; UINT32 uiNumberOfWorldItemsInTempFileThatCanBeSeenByPlayer; - INT8 bPadding[ 41 ]; + INT8 bPadding[ 41 ]; }SECTORINFO; @@ -243,22 +243,22 @@ typedef struct SECTORINFO typedef struct UNDERGROUND_SECTORINFO { - UINT32 uiFlags; - UINT8 ubSectorX, ubSectorY, ubSectorZ; - UINT8 ubNumElites, ubNumTroops, ubNumAdmins, ubNumCreatures; - UINT8 fVisited; - INT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, - //the more people go near it. A travel rating of 0 means there are never people - //around. This value is used for determining how often items would "vanish" from - //a sector. + UINT32 uiFlags; + UINT8 ubSectorX, ubSectorY, ubSectorZ; + UINT8 ubNumElites, ubNumTroops, ubNumAdmins, ubNumCreatures; + UINT8 fVisited; + INT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, + //the more people go near it. A travel rating of 0 means there are never people + //around. This value is used for determining how often items would "vanish" from + //a sector. UINT32 uiTimeCurrentSectorWasLastLoaded; //Specifies the last time the player was in the sector - struct UNDERGROUND_SECTORINFO *next; - UINT8 ubAdjacentSectors; //mask containing which sectors are adjacent - UINT8 ubCreatureHabitat; //determines how creatures live in this sector (see creature spreading.c) - UINT8 ubElitesInBattle, ubTroopsInBattle, ubAdminsInBattle, ubCreaturesInBattle; + struct UNDERGROUND_SECTORINFO *next; + UINT8 ubAdjacentSectors; //mask containing which sectors are adjacent + UINT8 ubCreatureHabitat; //determines how creatures live in this sector (see creature spreading.c) + UINT8 ubElitesInBattle, ubTroopsInBattle, ubAdminsInBattle, ubCreaturesInBattle; UINT32 uiNumberOfWorldItemsInTempFileThatCanBeSeenByPlayer; - INT8 bPadding[36]; + INT8 bPadding[36]; //no padding left! }UNDERGROUND_SECTORINFO; diff --git a/Strategic/Map Screen Interface Map Inventory.h b/Strategic/Map Screen Interface Map Inventory.h index 6bdd3c30..6d44eb36 100644 --- a/Strategic/Map Screen Interface Map Inventory.h +++ b/Strategic/Map Screen Interface Map Inventory.h @@ -54,7 +54,7 @@ extern WORLDITEM *pInventoryPoolList; extern INT32 iCurrentInventoryPoolPage; extern BOOLEAN fMapInventoryItemCompatable[ ]; // WANNE 2 -extern MAP_INVENTORY_POOL_SLOT_COUNT; +extern INT32 MAP_INVENTORY_POOL_SLOT_COUNT; BOOLEAN IsMapScreenWorldItemInvisibleInMapInventory( WORLDITEM *pWorldItem ); BOOLEAN IsMapScreenWorldItemVisibleInMapInventory( WORLDITEM *pWorldItem ); diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 92077b2b..0bbc64c8 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -4515,10 +4515,10 @@ void DisplayPositionOfHelicopter( void ) // WANNE 2 - AssertMsg( ( x >= 0 ) && ( x < SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid x = %d. At %d,%d. Next %d,%d. Min/Max X = %d/%d", + AssertMsg( ( x >= 0 ) && ( x < (UINT32)SCREEN_WIDTH ), String( "DisplayPositionOfHelicopter: Invalid x = %d. At %d,%d. Next %d,%d. Min/Max X = %d/%d", x, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, minX, maxX ) ); - AssertMsg( ( y >= 0 ) && ( y < SCREEN_HEIGHT ), String( "DisplayPositionOfHelicopter: Invalid y = %d. At %d,%d. Next %d,%d. Min/Max Y = %d/%d", + AssertMsg( ( y >= 0 ) && ( y < (UINT32)SCREEN_HEIGHT ), String( "DisplayPositionOfHelicopter: Invalid y = %d. At %d,%d. Next %d,%d. Min/Max Y = %d/%d", y, pGroup->ubSectorX, pGroup->ubSectorY, pGroup->ubNextX, pGroup->ubNextY, minY, maxY ) ); @@ -4584,8 +4584,8 @@ void DisplayDestinationOfHelicopter( void ) y = MAP_VIEW_START_Y + ( MAP_GRID_Y * sMapY ) + 3; // WANNE 2 - AssertMsg( ( x >= 0 ) && ( x < SCREEN_WIDTH ), String( "DisplayDestinationOfHelicopter: Invalid x = %d. Dest %d,%d", x, sMapX, sMapY ) ); - AssertMsg( ( y >= 0 ) && ( y < SCREEN_HEIGHT ), String( "DisplayDestinationOfHelicopter: Invalid y = %d. Dest %d,%d", y, sMapX, sMapY ) ); + AssertMsg( ( x >= 0 ) && ( x < (UINT32)SCREEN_WIDTH ), String( "DisplayDestinationOfHelicopter: Invalid x = %d. Dest %d,%d", x, sMapX, sMapY ) ); + AssertMsg( ( y >= 0 ) && ( y < (UINT32)SCREEN_HEIGHT ), String( "DisplayDestinationOfHelicopter: Invalid y = %d. Dest %d,%d", y, sMapX, sMapY ) ); // clip blits to mapscreen region ClipBlitsToMapViewRegion( ); diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 41c47f51..783cdeda 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -248,7 +248,7 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) // is it in a right direction? if( ddAngle >= ddMinAngle && ddAngle <= ddMaxAngle ) { - DOUBLE ddDistance = sqrt( pow( sLMY - sMapY, 2 ) + pow( sLMX - sMapX, 2 ) ); + DOUBLE ddDistance = sqrt( pow( (double)(sLMY - sMapY), 2 ) + pow( (double)(sLMX - sMapX), 2 ) ); ddRes += (DOUBLE)uiSumOfEnemyTroops / pow( ddDistance, 2 ); @@ -289,17 +289,17 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) } if( CountAllMilitiaInSector( sDMapX, sDMapY ) && - CountAllMilitiaInSector( sDMapX, sDMapY ) + CountAllMilitiaInSector( sMapX, sMapY ) <= gGameExternalOptions.guiMaxMilitiaSquadSize ) + (UINT32)( CountAllMilitiaInSector( sDMapX, sDMapY ) + CountAllMilitiaInSector( sMapX, sMapY ) ) <= gGameExternalOptions.guiMaxMilitiaSquadSize ) iRes += DIR_WITH_UNFULL_SQUAD_RATING_BONUS; if( NumEnemiesInSector( sDMapX, sDMapY ) ) { // if( GetTownIdForSector( sMapX, sMapY ) == BLANK_SECTOR ) - iDiff = iRes * ( (FLOAT)CountAllMilitiaInFiveSectors( sDMapX, sDMapY ) / (FLOAT)NumEnemiesInFiveSectors( sDMapX, sDMapY ) ); + iDiff = (INT32)( (FLOAT)iRes * ( (FLOAT)CountAllMilitiaInFiveSectors( sDMapX, sDMapY ) / (FLOAT)NumEnemiesInFiveSectors( sDMapX, sDMapY ) ) ); // else // iDiff = iRes * ( (FLOAT)CountAllMilitiaInFiveSectors( sMapX, sMapY ) / DIV_OF_ORIGINAL_MILITIA / (FLOAT)NumEnemiesInFiveSectors( sDMapX, sDMapY ) ); - if( iDiff > (FLOAT)DIR_MIN_DIF * iRes ) + if( iDiff > (INT32)( (FLOAT)DIR_MIN_DIF * (FLOAT)iRes ) ) iRes = iDiff; else iRes = 0; @@ -307,7 +307,7 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) // There's player's mercs! Go there - if( PlayerMercsInSector_MSE( sDMapX, sDMapY, FALSE ) ) + if( PlayerMercsInSector_MSE( (UINT8)sDMapX, (UINT8)sDMapY, FALSE ) ) iRes += 15000;// should be enough // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"M %ld, E%ld,%ld %ld, Diff %ld", CountAllMilitiaInSector( sMapX, sMapY ), sDMapX, sDMapY, NumEnemiesInSector( sDMapX, sDMapY ), ((INT32)CountAllMilitiaInSector( sMapX, sMapY )) - ((INT32)NumEnemiesInSector( sDMapX, sDMapY )) ); @@ -512,7 +512,7 @@ void UpdateMilitiaSquads(INT16 sMapX, INT16 sMapY ) } // moving squad, if it is not a SAM site else if(!IsThisSectorASAMSector( sMapX, sMapY, 0 )) - if( !PlayerMercsInSector_MSE( sMapX, sMapY, FALSE ) ) // and there's no player's mercs in the sector + if( !PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, FALSE ) ) // and there's no player's mercs in the sector { if( GetWorldHour() % 2 )return; @@ -621,7 +621,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) gpAttackDirs[ x + 1 ][0] += pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA] - uiNumGreen; gpAttackDirs[ x + 1 ][1] += pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA] - uiNumReg; gpAttackDirs[ x + 1 ][2] += pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA] - uiNumElite; - gpAttackDirs[ x + 1 ][3] = pMoveDir[ x ][2]; + gpAttackDirs[ x + 1 ][3] = (UINT8)pMoveDir[ x ][2]; uiNumGreen = pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; uiNumReg = pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; @@ -679,7 +679,7 @@ void MilitiaFollowPlayer( INT16 sMapX, INT16 sMapY, INT16 sDMapX, INT16 sDMapY ) { if( GetTownIdForSector( sMapX, sMapY ) != BLANK_SECTOR || IsThisSectorASAMSector( sMapX, sMapY, 0 ) || - PlayerMercsInSector_MSE( sMapX, sMapY, TRUE ) )return; + PlayerMercsInSector_MSE( (UINT8)sMapX, (UINT8)sMapY, TRUE ) )return; if( GetTownIdForSector( sDMapX, sDMapY ) != BLANK_SECTOR || IsThisSectorASAMSector( sDMapX, sDMapY, 0 ) )return; diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 383add2c..ca64d176 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -275,7 +275,6 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites ) { GROUP *pGroup; - SECTORINFO *pSector; Assert( sSectorX >= 1 && sSectorX <= 16 ); Assert( sSectorY >= 1 && sSectorY <= 16 ); @@ -958,7 +957,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); #ifdef JA2BETAVERSION if( guiCurrentScreen == GAME_SCREEN ) { - if( ubTotalEnemies <= iMaxEnemyGroupSize && pSector->ubNumCreatures != pSector->ubCreaturesInBattle || + if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumCreatures != pSector->ubCreaturesInBattle || !pSector->ubNumCreatures || !pSector->ubCreaturesInBattle || pSector->ubNumCreatures > 50 || pSector->ubCreaturesInBattle > 50 ) { @@ -999,7 +998,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); { case SOLDIER_CLASS_ADMINISTRATOR: #ifdef JA2BETAVERSION - if( ubTotalEnemies <= iMaxEnemyGroupSize && pSector->ubNumAdmins != pSector->ubAdminsInBattle || + if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumAdmins != pSector->ubAdminsInBattle || !pSector->ubNumAdmins || !pSector->ubAdminsInBattle || pSector->ubNumAdmins > 100 || pSector->ubAdminsInBattle > iMaxEnemyGroupSize ) { @@ -1017,7 +1016,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); break; case SOLDIER_CLASS_ARMY: #ifdef JA2BETAVERSION - if( ubTotalEnemies <= iMaxEnemyGroupSize && pSector->ubNumTroops != pSector->ubTroopsInBattle || + if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumTroops != pSector->ubTroopsInBattle || !pSector->ubNumTroops || !pSector->ubTroopsInBattle || pSector->ubNumTroops > 100 || pSector->ubTroopsInBattle > iMaxEnemyGroupSize ) { @@ -1035,7 +1034,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); break; case SOLDIER_CLASS_ELITE: #ifdef JA2BETAVERSION - if( ubTotalEnemies <= iMaxEnemyGroupSize && pSector->ubNumElites != pSector->ubElitesInBattle || + if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumElites != pSector->ubElitesInBattle || !pSector->ubNumElites || !pSector->ubElitesInBattle || pSector->ubNumElites > 100 || pSector->ubElitesInBattle > iMaxEnemyGroupSize ) { @@ -1053,7 +1052,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); break; case SOLDIER_CLASS_CREATURE: #ifdef JA2BETAVERSION - if( ubTotalEnemies <= iMaxEnemyGroupSize && pSector->ubNumCreatures != pSector->ubCreaturesInBattle || + if( ubTotalEnemies <= (UINT32)iMaxEnemyGroupSize && pSector->ubNumCreatures != pSector->ubCreaturesInBattle || !pSector->ubNumCreatures || !pSector->ubCreaturesInBattle || pSector->ubNumCreatures > 50 || pSector->ubCreaturesInBattle > 50 ) { @@ -1123,7 +1122,7 @@ void AddPossiblePendingEnemiesToBattle() SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; static UINT8 ubPredefinedInsertionCode = 255; - if( ( !PlayerMercsInSector( gWorldSectorX, gWorldSectorY, 0 ) && !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) ) + if( ( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) && !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) ) || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return; diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index 89632a50..8e7691e6 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -122,7 +122,7 @@ UINT8 GetAdjacentSectors( UINT8 pSectors[4], INT16 sSectorX, INT16 sSectorY ) ( GetTownIdForSector( sSectorX, sSectorY ) != BLANK_SECTOR ? TRUE : FALSE ), TRUE, IS_ONLY_IN_CITIES ); for( ubIndex = 0; ubIndex < ubDirNumber; ubIndex++ ) - pSectors[ ubCounter++ ] = pusMoveDir[ ubIndex ][ 0 ]; + pSectors[ ubCounter++ ] = (UINT8)pusMoveDir[ ubIndex ][ 0 ]; return ubCounter; } @@ -266,10 +266,10 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY ) pGroup->ubPrevX = pGroup->ubSectorX; pGroup->ubPrevY = pGroup->ubSectorY; - pGroup->ubSectorX = pGroup->ubNextX = sMapX; - pGroup->ubSectorY = pGroup->ubNextY = sMapY; + pGroup->ubSectorX = pGroup->ubNextX = (UINT8)sMapX; + pGroup->ubSectorY = pGroup->ubNextY = (UINT8)sMapY; - return pusMoveDir[ ubIndex ][ 2 ]; + return (UINT8)pusMoveDir[ ubIndex ][ 2 ]; } if( NumEnemiesInFiveSectors( sMapX, sMapY ) - NumEnemiesInSector( sMapX, sMapY ) == 0 ) @@ -297,7 +297,7 @@ UINT8 DoReinforcementAsPendingEnemy( INT16 sMapX, INT16 sMapY ) (pSector->ubNumAdmins)--; } - return pusMoveDir[ ubIndex ][ 2 ]; + return (UINT8)pusMoveDir[ ubIndex ][ 2 ]; } } } @@ -361,7 +361,7 @@ UINT8 DoReinforcementAsPendingMilitia( INT16 sMapX, INT16 sMapY, UINT8 *pubRank *pubRank = GREEN_MILITIA; } - return pusMoveDir[ ubIndex ][ 2 ]; + return (UINT8)pusMoveDir[ ubIndex ][ 2 ]; } } @@ -377,7 +377,7 @@ void AddPossiblePendingMilitiaToBattle() static UINT8 ubPredefinedInsertionCode = 255; static UINT8 ubPredefinedRank = 255; - if( !PlayerMercsInSector( gWorldSectorX, gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) + if( !PlayerMercsInSector( (UINT8)gWorldSectorX, (UINT8)gWorldSectorY, 0 ) || !CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ) || !NumEnemiesInSector( gWorldSectorX, gWorldSectorY ) ) return; //gGameExternalOptions.guiMaxMilitiaSquadSize - CountAllMilitiaInSector( gWorldSectorX, gWorldSectorY ); ubSlots = NumFreeMilitiaSlots(); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index c48503d5..962f2ede 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9862,7 +9862,7 @@ void MapInvDoneButtonfastHelpCall( ) void UpdateStatusOfMapSortButtons( void ) { INT32 iCounter = 0; - static fShownLastTime = FALSE; + static BOOLEAN fShownLastTime = FALSE; if( ( gfPreBattleInterfaceActive ) || fShowInventoryFlag ) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 9ff4c484..2927e8c3 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -2222,7 +2222,7 @@ UINT8 CalculateObjectWeight( OBJECTTYPE *pObject ) { //Pulmu: //Temporary calculation for minWeight - UINT32 uiMinWeight = (Item[ pObject->usGunAmmoItem].ubWeight / 5.0) + 0.5; + UINT32 uiMinWeight = (UINT32)((Item[ pObject->usGunAmmoItem].ubWeight / 5.0) + 0.5); if( uiMinWeight < 1 || uiMinWeight > Item[ pObject->usGunAmmoItem].ubWeight) { uiMinWeight = 1; @@ -2248,7 +2248,7 @@ UINT8 CalculateObjectWeight( OBJECTTYPE *pObject ) { usWeight = 0; //Temporary calculation for minWeight. 0.2*ubWeight rounded correctly - UINT32 uiMinWeight = (Item[pObject->usItem].ubWeight / 5.0) + 0.5; + UINT32 uiMinWeight = (UINT32)((Item[pObject->usItem].ubWeight / 5.0) + 0.5); if( uiMinWeight < 1 || uiMinWeight > Item[pObject->usItem].ubWeight) { uiMinWeight = 1; diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index f73d6ea0..cb07a2af 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -144,7 +144,7 @@ static UINT8 gubTreeSightReduction[ANIM_STAND + 1] = #define MAX_CHANCE_OF_HITTING_STRUCTURE 90 -static guiStructureHitChance[ MAX_DIST_FOR_LESS_THAN_MAX_CHANCE_TO_HIT_STRUCTURE + 1] = +static UINT32 guiStructureHitChance[ MAX_DIST_FOR_LESS_THAN_MAX_CHANCE_TO_HIT_STRUCTURE + 1] = { 0, // 0 tiles 0, diff --git a/Tactical/Map Information.cpp b/Tactical/Map Information.cpp index a57777d0..a98c7072 100644 --- a/Tactical/Map Information.cpp +++ b/Tactical/Map Information.cpp @@ -25,9 +25,9 @@ //Don't mess with this value, unless you want to force update all maps in the game! // Lesh: fix the sad situation with the different major map versions //#ifdef RUSSIAN - #define MAJOR_MAP_VERSION 6.00 + //#define MAJOR_MAP_VERSION 6.00 //#else -// #define MAJOR_MAP_VERSION 5.00 + #define MAJOR_MAP_VERSION 5.00 //#endif FLOAT gdMajorMapVersion = MAJOR_MAP_VERSION; @@ -37,7 +37,6 @@ BOOLEAN gfWorldLoaded; MAPCREATE_STRUCT gMapInformation; //Current minor map version updater. -// Lesh: increased. was 25 #define MINOR_MAP_VERSION 25 UINT8 gubMinorMapVersion = MINOR_MAP_VERSION; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index ea392794..689de74b 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -11443,7 +11443,7 @@ void DebugValidateSoldierData( ) SOLDIERTYPE *pSoldier; CHAR16 sString[ 1024 ]; BOOLEAN fProblemDetected = FALSE; - static uiFrameCount = 0; + static UINT32 uiFrameCount = 0; // this function is too slow to run every frame, so do the check only every 50 frames diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index a7a5cf0a..5c629aa3 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -474,7 +474,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) if (gfTurnBasedAI) { - if ( ( GetJA2Clock() - gTacticalStatus.uiTimeSinceMercAIStart ) > ( gGameExternalOptions.gubDeadLockDelay * 1000 ) && !gfUIInDeadlock ) + if ( ( GetJA2Clock() - gTacticalStatus.uiTimeSinceMercAIStart ) > ( (UINT32)gGameExternalOptions.gubDeadLockDelay * 1000 ) && !gfUIInDeadlock ) { // ATE: Display message that deadlock occured... LiveMessage( "Breaking Deadlock" ); diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 24c55329..4ece97a7 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -507,7 +507,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { return; // no shells, can't fire the MORTAR } - ubSafetyMargin = Explosive[ Item[ pSoldier->inv[bPayloadPocket].usItem ].ubClassIndex ].ubRadius; + ubSafetyMargin = (UINT8)Explosive[ Item[ pSoldier->inv[bPayloadPocket].usItem ].ubClassIndex ].ubRadius; } // if he's got a GL in his hand, make sure he has some type of GRENADE avail. else if (Item[usInHand].grenadelauncher ) @@ -519,7 +519,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { return; // no grenades, can't fire the GLAUNCHER } - ubSafetyMargin = Explosive[ Item[ pSoldier->inv[ bPayloadPocket ].usItem ].ubClassIndex ].ubRadius; + ubSafetyMargin = (UINT8)Explosive[ Item[ pSoldier->inv[ bPayloadPocket ].usItem ].ubClassIndex ].ubRadius; usGrenade = pSoldier->inv[ bPayloadPocket ].usItem; } else if ( Item[usInHand].rocketlauncher ) @@ -528,7 +528,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // put in hand if ( Item[usInHand].singleshotrocketlauncher ) // as C1 - ubSafetyMargin = Explosive[ Item[ C1 ].ubClassIndex ].ubRadius; + ubSafetyMargin = (UINT8)Explosive[ Item[ C1 ].ubClassIndex ].ubRadius; else { bPayloadPocket = FindLaunchable ( pSoldier, usInHand ); @@ -536,7 +536,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { return; // no ammo, can't fire } - ubSafetyMargin = Explosive[ Item[ pSoldier->inv[bPayloadPocket].usItem ].ubClassIndex ].ubRadius; + ubSafetyMargin = (UINT8)Explosive[ Item[ pSoldier->inv[bPayloadPocket].usItem ].ubClassIndex ].ubRadius; } } else if (Item[usInHand].cannon ) @@ -547,7 +547,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { return; // no ammo, can't fire } - ubSafetyMargin = Explosive[ Item[ pSoldier->inv[bPayloadPocket].usItem ].ubClassIndex ].ubRadius; + ubSafetyMargin = (UINT8)Explosive[ Item[ pSoldier->inv[bPayloadPocket].usItem ].ubClassIndex ].ubRadius; //bPayloadPocket = FindObj( pSoldier, TANK_SHELL ); @@ -563,7 +563,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // else it's a plain old grenade, now in his hand DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a grenade"); bPayloadPocket = HANDPOS; - ubSafetyMargin = Explosive[ Item[ pSoldier->inv[ bPayloadPocket ].usItem ].ubClassIndex ].ubRadius; + ubSafetyMargin = (UINT8)Explosive[ Item[ pSoldier->inv[ bPayloadPocket ].usItem ].ubClassIndex ].ubRadius; usGrenade = pSoldier->inv[ bPayloadPocket ].usItem; if ( Item[usGrenade].flare ) @@ -1675,13 +1675,13 @@ INT32 EstimateShotDamage(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ub { // explosive damage is 100-200% that of the rated, so multiply by 3/2s here case CREATURE_QUEEN_SPIT: //TODO: Madd - remove the hardcoding here - iDamage += ( 3 * Explosive[ Item[ LARGE_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, Explosive[ Item[ LARGE_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; + iDamage += ( 3 * Explosive[ Item[ LARGE_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ LARGE_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; break; case CREATURE_OLD_MALE_SPIT: - iDamage += ( 3 * Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; + iDamage += ( 3 * Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; break; default: - iDamage += ( 3 * Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; + iDamage += ( 3 * Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubDamage * NumMercsCloseTo( pOpponent->sGridNo, (UINT8)Explosive[ Item[ VERY_SMALL_CREATURE_GAS ].ubClassIndex ].ubRadius ) ) / 2; break; } } diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 5e33f5a2..98aed463 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -263,12 +263,12 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT16 // No explosive but an attacker with HE ammo. if ( !( Item[ usItem ].usItemClass & IC_EXPLOSV ) && ubOwner != NOBODY) { - ExpParams.ubTypeID = Explosive[AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ubGunAmmoType].highExplosive].ubAnimationID; + ExpParams.ubTypeID = (INT8)Explosive[AmmoTypes[MercPtrs[ubOwner]->inv[MercPtrs[ubOwner]->ubAttackingHand ].ubGunAmmoType].highExplosive].ubAnimationID; // return; } else // just normal explosives should get here { - ExpParams.ubTypeID = Explosive[ Item[ usItem ].ubClassIndex ].ubAnimationID; + ExpParams.ubTypeID = (INT8)Explosive[ Item[ usItem ].ubClassIndex ].ubAnimationID; } // Callahan end @@ -1100,7 +1100,7 @@ BOOLEAN ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNe // Get tile type GetTileType( pNode->usIndex, &uiTileType ); // Check if we are a fountain! - if ( stricmp( gTilesets[ giCurrentTilesetID ].TileSurfaceFilenames[ uiTileType ], "fount1.sti" ) == 0 ) + if ( _stricmp( gTilesets[ giCurrentTilesetID ].TileSurfaceFilenames[ uiTileType ], "fount1.sti" ) == 0 ) { // Yes we are! // Remove water.... @@ -2458,7 +2458,7 @@ void SpreadEffect( INT16 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, if ( fSubsequent != BLOOD_SPREAD_EFFECT ) { - MakeNoise( NOBODY, sGridNo, bLevel, gpWorldLevelData[sGridNo].ubTerrainID, Explosive[ Item [ usItem ].ubClassIndex ].ubVolume, NOISE_EXPLOSION ); + MakeNoise( NOBODY, sGridNo, bLevel, gpWorldLevelData[sGridNo].ubTerrainID, (UINT8)Explosive[ Item [ usItem ].ubClassIndex ].ubVolume, NOISE_EXPLOSION ); } } @@ -3017,7 +3017,7 @@ void HandleExplosionQueue( void ) } else if ( pObj->usBombItem == TRIP_FLARE ) { - NewLightEffect( sGridNo, Explosive[pObj->usItem].ubDuration, Explosive[pObj->usItem].ubStartRadius ); + NewLightEffect( sGridNo, (UINT8)Explosive[pObj->usItem].ubDuration, (UINT8)Explosive[pObj->usItem].ubStartRadius ); RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, ubLevel ); } else diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 7ec8267a..d284441d 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -26,8 +26,8 @@ #include "SaveLoadGame.h" -INT8 FromWorldFlagsToSmokeType( UINT8 ubWorldFlags ); -UINT8 FromSmokeTypeToWorldFlags( INT8 bType ); +INT8 FromWorldFlagsToSmokeType( UINT16 ubWorldFlags ); +UINT16 FromSmokeTypeToWorldFlags( INT8 bType ); @@ -80,7 +80,7 @@ void RecountSmokeEffects( void ) // Returns NO_SMOKE_EFFECT if none there... INT8 GetSmokeEffectOnTile( INT16 sGridNo, INT8 bLevel ) { - UINT8 ubExtFlags; + UINT16 ubExtFlags; ubExtFlags = gpWorldLevelData[ sGridNo ].ubExtFlags[ bLevel ]; @@ -95,7 +95,7 @@ INT8 GetSmokeEffectOnTile( INT16 sGridNo, INT8 bLevel ) } -INT8 FromWorldFlagsToSmokeType( UINT8 ubWorldFlags ) +INT8 FromWorldFlagsToSmokeType( UINT16 ubWorldFlags ) { if ( ubWorldFlags & MAPELEMENT_EXT_SMOKE ) { @@ -124,7 +124,7 @@ INT8 FromWorldFlagsToSmokeType( UINT8 ubWorldFlags ) } -UINT8 FromSmokeTypeToWorldFlags( INT8 bType ) +UINT16 FromSmokeTypeToWorldFlags( INT8 bType ) { switch( bType ) { @@ -227,8 +227,8 @@ INT32 NewSmokeEffect( INT16 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner ) - pSmoke->ubDuration = Explosive[ Item[ usItem ].ubClassIndex ].ubDuration; - pSmoke->ubRadius = Explosive[ Item[ usItem ].ubClassIndex ].ubStartRadius; + pSmoke->ubDuration = (UINT8)Explosive[ Item[ usItem ].ubClassIndex ].ubDuration; + pSmoke->ubRadius = (UINT8)Explosive[ Item[ usItem ].ubClassIndex ].ubStartRadius; pSmoke->bAge = 0; pSmoke->fAllocated = TRUE; pSmoke->bType = bSmokeEffectType; diff --git a/TileEngine/Tile Animation.cpp b/TileEngine/Tile Animation.cpp index f7677b3c..6e04f44d 100644 --- a/TileEngine/Tile Animation.cpp +++ b/TileEngine/Tile Animation.cpp @@ -557,7 +557,7 @@ void UpdateAniTiles( ) // CHECK IF WE SHOULD BE DISPLAYING TRANSLUCENTLY! if ( pNode->sCurrentFrame == pNode->ubKeyFrame2 ) { - UINT8 ubExpType; + UINT16 ubExpType; switch( pNode->uiKeyFrame2Code ) { @@ -576,7 +576,7 @@ void UpdateAniTiles( ) } else { - SpreadEffect( pNode->sGridNo, Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubRadius, (UINT16)pNode->uiUserData, (UINT8)pNode->ubUserData2, FALSE, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, -1 ); + SpreadEffect( pNode->sGridNo, (UINT8)Explosive[ Item[ (UINT16)pNode->uiUserData ].ubClassIndex ].ubRadius, (UINT16)pNode->uiUserData, (UINT8)pNode->ubUserData2, FALSE, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, -1 ); } // Forfait any other animations this frame.... return; diff --git a/TileEngine/Tile Cache.cpp b/TileEngine/Tile Cache.cpp index ed62a69a..e7af8a7b 100644 --- a/TileEngine/Tile Cache.cpp +++ b/TileEngine/Tile Cache.cpp @@ -85,7 +85,7 @@ BOOLEAN InitTileCache( ) SET_ERROR( "Cannot load tilecache JSD: %s", gpTileCacheStructInfo[ cnt ].Filename ); } #endif - if ( stricmp( gpTileCacheStructInfo[ cnt ].zRootName, "l_dead1" ) == 0 ) + if ( _stricmp( gpTileCacheStructInfo[ cnt ].zRootName, "l_dead1" ) == 0 ) { giDefaultStructIndex = cnt; } @@ -370,7 +370,7 @@ void GetRootName( INT8 * pDestStr, INT8 * pSrcStr ) } // Now remove extension... - cEndOfName = strchr( (const char *)pDestStr, '.' ); + cEndOfName = strchr( (char *)pDestStr, '.' ); if (cEndOfName != NULL) { *cEndOfName = '\0'; diff --git a/TileEngine/Tile Surface.cpp b/TileEngine/Tile Surface.cpp index 11b4902c..66e718ca 100644 --- a/TileEngine/Tile Surface.cpp +++ b/TileEngine/Tile Surface.cpp @@ -188,7 +188,7 @@ void SetRaisedObjectFlag( char *cFilename, TILE_IMAGERY *pTileSurf ) GetRootName( (INT8 *)cRootFile, (INT8 *)cFilename ); while( ubRaisedObjectFiles[ cnt ][ 0 ] != '1' ) { - if ( stricmp( ubRaisedObjectFiles[ cnt ], cRootFile ) == 0 ) + if ( _stricmp( ubRaisedObjectFiles[ cnt ], cRootFile ) == 0 ) { pTileSurf->bRaisedObjectType = TRUE; } diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index c437a660..00500aaa 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -3098,7 +3098,7 @@ INT32 iCount; for(iCount=0; iCount < MAX_LIGHT_TEMPLATES; iCount++) { - if((pLightNames[iCount]!=NULL) && !(stricmp(pFilename, pLightNames[iCount]))) + if((pLightNames[iCount]!=NULL) && !(_stricmp(pFilename, pLightNames[iCount]))) return(iCount); } diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 1e704e2f..af537a6a 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -2521,7 +2521,7 @@ DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2337")); { // Add a light effect... - NewLightEffect( pObject->sGridNo, Explosive[Item[pObject->Obj.usItem].ubClassIndex].ubDuration , Explosive[Item[pObject->Obj.usItem].ubClassIndex].ubStartRadius ); + NewLightEffect( pObject->sGridNo, (UINT8)Explosive[Item[pObject->Obj.usItem].ubClassIndex].ubDuration , (UINT8)Explosive[Item[pObject->Obj.usItem].ubClassIndex].ubStartRadius ); } } else if ( Item[ pObject->Obj.usItem ].usItemClass & IC_GRENADE ) diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index a4880a68..1f03ddcd 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -2987,6 +2987,7 @@ BOOLEAN LoadWorld( UINT8 * puiFilename ) { UINT32 uiNums[37]; LOADDATA( uiNums, pBuffer, 37 * sizeof( INT32 ) ); + dMajorMapVersion = 5.00; } SetRelativeStartAndEndPercentage( 0, 58, 59, L"Loading room information..." ); diff --git a/aniviewscreen.cpp b/aniviewscreen.cpp index 9a95d31b..50887f95 100644 --- a/aniviewscreen.cpp +++ b/aniviewscreen.cpp @@ -333,7 +333,7 @@ UINT16 GetAnimStateFromName( INT8 *zName ) // FInd the next animation with start height the same... for ( cnt = 0; cnt < NUMANIMATIONSTATES; cnt++ ) { - if ( stricmp( gAnimControl[ cnt ].zAnimStr, zName ) == 0 ) + if ( _stricmp( gAnimControl[ cnt ].zAnimStr, zName ) == 0 ) { return( (UINT16) cnt ); }