From 1f0a8f46e81cd27e2259b00a2758d61672ed61dc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 10 Oct 2022 10:08:44 +0300 Subject: [PATCH 001/571] Import changes from the local SVN working copy --- Editor/EditorMercs.cpp | 6 +- GameVersion.h | 3 +- Laptop/BobbyRGuns.cpp | 6 +- Laptop/LaptopSave.h | 2 +- Laptop/insurance Contract.cpp | 20 +- Laptop/insurance Contract.h | 2 +- Multiplayer/client.cpp | 85 +++--- Multiplayer/connect.h | 30 +- Multiplayer/fresh_header.h | 4 +- SaveLoadGame.cpp | 275 ++++-------------- SaveLoadGame.h | 5 +- Strategic/AI Viewer.cpp | 2 +- Strategic/Assignments.cpp | 19 +- Strategic/Auto Resolve.cpp | 8 +- Strategic/Game Event Hook.cpp | 4 +- Strategic/LuaInitNPCs.cpp | 126 ++++---- Strategic/LuaInitNPCs.h | 9 +- Strategic/Map Screen Helicopter.cpp | 2 +- .../Map Screen Interface Map Inventory.cpp | 2 +- Strategic/Map Screen Interface Map.cpp | 10 +- Strategic/Map Screen Interface Map.h | 10 +- Strategic/Map Screen Interface.cpp | 134 +++++---- Strategic/Map Screen Interface.h | 4 +- Strategic/Merc Contract.cpp | 18 +- Strategic/Merc Contract.h | 4 +- Strategic/PreBattle Interface.cpp | 2 +- Strategic/Queen Command.cpp | 4 +- Strategic/Quest Debug System.cpp | 11 +- Strategic/Quests.cpp | 20 +- Strategic/Quests.h | 4 +- Strategic/Scheduling.cpp | 2 +- Strategic/Scheduling.h | 2 +- Strategic/Strategic Event Handler.cpp | 2 +- Strategic/Strategic Merc Handler.cpp | 27 +- Strategic/Strategic Merc Handler.h | 4 +- Strategic/Strategic Mines.cpp | 2 +- Strategic/Strategic Movement.cpp | 2 +- Strategic/Strategic Movement.h | 2 +- Strategic/Strategic Town Loyalty.cpp | 12 +- Strategic/Strategic_VS2019.vcxproj | 20 +- Strategic/Strategic_VS2019.vcxproj.user | 4 + Strategic/mapscreen.cpp | 72 ++--- Strategic/mapscreen.h | 6 +- Strategic/strategicmap.cpp | 6 +- Tactical/Air Raid.cpp | 12 +- Tactical/Animation Data.cpp | 6 +- Tactical/Animation Data.h | 4 +- Tactical/Arms Dealer Init.cpp | 2 +- Tactical/Arms Dealer Init.h | 2 +- Tactical/Auto Bandage.cpp | 6 +- Tactical/Boxing.cpp | 10 +- Tactical/Boxing.h | 2 +- Tactical/Bullets.h | 6 +- Tactical/Campaign.cpp | 2 +- Tactical/Civ Quotes.cpp | 3 +- Tactical/Dialogue Control.cpp | 50 ++-- Tactical/DynamicDialogue.cpp | 5 +- Tactical/DynamicDialogue.h | 2 +- Tactical/End Game.cpp | 6 +- Tactical/Faces.cpp | 18 +- Tactical/Food.cpp | 14 +- Tactical/Handle Doors.cpp | 4 +- Tactical/Handle Items.cpp | 50 ++-- Tactical/Handle Items.h | 8 +- Tactical/Handle UI Plan.cpp | 6 +- Tactical/Handle UI.cpp | 49 ++-- Tactical/Handle UI.h | 16 +- Tactical/Interface Control.cpp | 2 +- Tactical/Interface Dialogue.cpp | 22 +- Tactical/Interface Items.cpp | 22 +- Tactical/Interface Items.h | 3 +- Tactical/Interface Panels.cpp | 78 ++--- Tactical/Interface Panels.h | 20 +- Tactical/Interface Utils.cpp | 2 +- Tactical/Interface.cpp | 34 +-- Tactical/Interface.h | 10 +- Tactical/Item Types.cpp | 2 +- Tactical/Item Types.h | 4 +- Tactical/Items.cpp | 10 +- Tactical/Items.h | 2 +- Tactical/LOS.cpp | 12 +- Tactical/LOS.h | 4 +- Tactical/Merc Entering.cpp | 8 +- Tactical/Merc Hiring.cpp | 16 +- Tactical/Merc Hiring.h | 4 +- Tactical/Militia Control.cpp | 19 +- Tactical/Morale.cpp | 9 +- Tactical/Overhead Types.h | 25 +- Tactical/Overhead.cpp | 247 ++++++++-------- Tactical/Overhead.h | 45 ++- Tactical/PATHAI.cpp | 2 +- Tactical/Real Time Input.cpp | 8 +- Tactical/Rotting Corpses.cpp | 8 +- Tactical/ShopKeeper Interface.cpp | 18 +- Tactical/ShopKeeper Interface.h | 2 +- Tactical/SkillMenu.cpp | 4 +- Tactical/Soldier Add.cpp | 14 +- Tactical/Soldier Add.h | 6 +- Tactical/Soldier Ani.cpp | 37 ++- Tactical/Soldier Control.cpp | 82 +++--- Tactical/Soldier Control.h | 43 ++- Tactical/Soldier Create.cpp | 59 ++-- Tactical/Soldier Create.h | 2 +- Tactical/Soldier Find.cpp | 12 +- Tactical/Soldier Find.h | 2 +- Tactical/Soldier Init List.cpp | 40 +-- Tactical/Soldier Init List.h | 2 +- Tactical/Soldier Profile.cpp | 6 +- Tactical/Soldier Tile.cpp | 6 +- Tactical/Squads.cpp | 4 +- Tactical/Strategic Exit GUI.cpp | 8 +- Tactical/Structure Wrap.cpp | 8 +- Tactical/Structure Wrap.h | 4 +- Tactical/Tactical Save.cpp | 6 +- Tactical/Tactical Turns.cpp | 12 +- Tactical/TeamTurns.cpp | 75 ++--- Tactical/TeamTurns.h | 10 +- Tactical/Turn Based Input.cpp | 173 ++++++----- Tactical/UI Cursors.cpp | 22 +- Tactical/UI Cursors.h | 4 +- Tactical/Vehicles.cpp | 50 ++-- Tactical/Vehicles.h | 6 +- Tactical/Weapons.cpp | 28 +- Tactical/Weapons.h | 8 +- Tactical/World Items.cpp | 2 +- Tactical/World Items.h | 20 +- Tactical/bullets.cpp | 2 +- Tactical/faces.h | 16 +- Tactical/fov.cpp | 2 - Tactical/merc entering.h | 4 +- Tactical/opplist.cpp | 136 ++++----- Tactical/opplist.h | 20 +- TacticalAI/AIInternals.h | 6 +- TacticalAI/AIList.cpp | 32 +- TacticalAI/AIList.h | 10 +- TacticalAI/AIMain.cpp | 12 +- TacticalAI/AIUtils.cpp | 96 +++--- TacticalAI/Attacks.cpp | 20 +- TacticalAI/CreatureDecideAction.cpp | 2 +- TacticalAI/DecideAction.cpp | 24 +- TacticalAI/FindLocations.cpp | 9 +- TacticalAI/Medical.cpp | 39 +-- TacticalAI/NPC.cpp | 27 +- TacticalAI/PanicButtons.cpp | 2 +- TacticalAI/ZombieDecideAction.cpp | 4 +- TacticalAI/ai.h | 56 ++-- TileEngine/Explosion Control.cpp | 83 +++--- TileEngine/Explosion Control.h | 30 +- TileEngine/LightEffects.cpp | 4 +- TileEngine/LightEffects.h | 6 +- TileEngine/SmokeEffects.cpp | 6 +- TileEngine/SmokeEffects.h | 4 +- TileEngine/overhead map.cpp | 4 +- TileEngine/physics.cpp | 2 +- TileEngine/physics.h | 4 +- TileEngine/pits.cpp | 4 +- TileEngine/pits.h | 2 +- TileEngine/structure.cpp | 2 +- TileEngine/structure.h | 2 +- TileEngine/worlddef.h | 4 +- TileEngine/worldman.cpp | 8 +- TileEngine/worldman.h | 2 +- Utils/Event Pump.h | 14 +- Utils/PopUpBox.cpp | 151 +++++++--- Utils/PopUpBox.h | 5 + builddefines.h | 4 +- gamescreen.cpp | 6 +- gamescreen.h | 2 +- lua/lua_VS2019.vcxproj | 20 +- lua/lua_VS2019.vcxproj.user | 4 + 170 files changed, 1798 insertions(+), 1764 deletions(-) create mode 100644 Strategic/Strategic_VS2019.vcxproj.user create mode 100644 lua/lua_VS2019.vcxproj.user diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index 478cd4e9..cef61a4f 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -168,7 +168,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ); void RenderMercInventoryPanel(); void SetDroppableCheckboxesBasedOnMercsInventory(); -extern BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); +extern BOOLEAN InternalAddSoldierToSector( UINT16 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); //array which keeps track of which item is in which slot. This is dependant on the selected merc, so //these temp values must be updated when different mercs are selected, and reset when a merc detailed @@ -565,7 +565,7 @@ void AddMercToWorld( INT32 iMapIndex ) if( IsLocationSittable( iMapIndex, gfRoofPlacement ) ) { - UINT8 ubID; + UINT16 ubID; INT16 sSectorX, sSectorY; SOLDIERINITNODE *pNode; @@ -3789,7 +3789,7 @@ void PasteMercPlacement( INT32 iMapIndex ) if( IsLocationSittable( iMapIndex, gfRoofPlacement ) ) { - UINT8 ubID; + UINT16 ubID; INT16 sSectorX, sSectorY; SOLDIERINITNODE *pNode; diff --git a/GameVersion.h b/GameVersion.h index 05d965f9..2c39f131 100644 --- a/GameVersion.h +++ b/GameVersion.h @@ -22,6 +22,7 @@ extern CHAR16 zRevisionNumber[16]; // Keeps track of the saved game version. Increment the saved game version whenever // you will invalidate the saved game file +#define INCREASED_TEAMSIZES 184 // Asdow: SOLDIERTYPE ubID changed from UINT8 -> UINT16 #define REBELCOMMAND 183 #define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us #define DISABILITYFLAGMASK 181 // Flugente: disabilities get a flagmask @@ -103,7 +104,7 @@ extern CHAR16 zRevisionNumber[16]; #define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes #define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system -#define SAVE_GAME_VERSION REBELCOMMAND +#define SAVE_GAME_VERSION INCREASED_TEAMSIZES //#define RUSSIANGOLD #ifdef __cplusplus diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 823f35ce..8b4edef6 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -3700,11 +3700,11 @@ void OutOfStockMessageBoxCallBack( UINT8 bExitValue ) UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID ) { UINT8 ubItemCount=0; - UINT8 ubMercCount; + UINT16 ubMercCount; UINT8 ubPocketCount; - UINT8 ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT8 ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + UINT16 ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + UINT16 ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; //loop through all the mercs on the team for( ubMercCount = ubFirstID; ubMercCount <= ubLastID; ++ubMercCount ) diff --git a/Laptop/LaptopSave.h b/Laptop/LaptopSave.h index ba269c5d..4f555b96 100644 --- a/Laptop/LaptopSave.h +++ b/Laptop/LaptopSave.h @@ -26,7 +26,7 @@ class SOLDIERTYPE; typedef struct { BOOLEAN fActive; - UINT8 ubSoldierID; + UINT16 ubSoldierID; UINT8 ubMercID; INT32 iPayOutPrice; } LIFE_INSURANCE_PAYOUT; diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index 6c6b5ec0..b40eaacf 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -170,7 +170,7 @@ void InsuranceContractUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering ); INT8 CountInsurableMercs(); void DisableInsuranceContractNextPreviousbuttons(); void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate); -void HandleAcceptButton( UINT8 ubSoldierID, UINT8 ubFormID ); +void HandleAcceptButton( UINT16 ubSoldierID, UINT8 ubFormID ); FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue ); void InsContractNoMercsPopupCallBack( UINT8 bExitValue ); void BuildInsuranceArray(); @@ -752,7 +752,7 @@ void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); - UINT8 ubSoldierID = (UINT8) GetSoldierIDFromMercID( gubMercIDForMercInForm1 ); + INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm1 ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -796,7 +796,7 @@ void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); - UINT8 ubSoldierID = (UINT8) GetSoldierIDFromMercID( gubMercIDForMercInForm2 ); + INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm2 ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -841,7 +841,7 @@ void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason) if (btn->uiFlags & BUTTON_CLICKED_ON) { UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); - UINT8 ubSoldierID = (UINT8) GetSoldierIDFromMercID( gubMercIDForMercInForm3 ); + INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm3 ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -943,10 +943,10 @@ void SelectInsuranceContractRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason INT8 CountInsurableMercs() { - INT16 cnt; - SOLDIERTYPE *pSoldier; - INT16 bLastTeamID; - INT8 bCount=0; + UINT16 cnt; + SOLDIERTYPE *pSoldier; + UINT16 bLastTeamID; + INT8 bCount=0; // Set locator to first merc cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -1071,7 +1071,7 @@ void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate) -void HandleAcceptButton( UINT8 ubSoldierID, UINT8 ubFormID ) +void HandleAcceptButton( UINT16 ubSoldierID, UINT8 ubFormID ) { //passed in either 1,2,3 should be 0,1,2 ubFormID--; @@ -1459,7 +1459,7 @@ void EndInsuranceInvestigation( UINT8 ubPayoutID ) //void InsuranceContractPayLifeInsuranceForDeadMerc( LIFE_INSURANCE_PAYOUT *pPayoutStruct ) -void InsuranceContractPayLifeInsuranceForDeadMerc( UINT8 ubPayoutID ) +void InsuranceContractPayLifeInsuranceForDeadMerc( UINT16 ubPayoutID ) { //if the mercs id number is the same what is in the soldier array if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID == Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].ubID ) diff --git a/Laptop/insurance Contract.h b/Laptop/insurance Contract.h index c7dcf460..1be525a9 100644 --- a/Laptop/insurance Contract.h +++ b/Laptop/insurance Contract.h @@ -18,7 +18,7 @@ void DailyUpdateOfInsuredMercs(); //void InsuranceContractPayLifeInsuranceForDeadMerc( LIFE_INSURANCE_PAYOUT *pPayoutStruct ); BOOLEAN AddLifeInsurancePayout( SOLDIERTYPE *pSoldier ); -void InsuranceContractPayLifeInsuranceForDeadMerc( UINT8 ubPayoutID ); +void InsuranceContractPayLifeInsuranceForDeadMerc( UINT16 ubPayoutID ); void StartInsuranceInvestigation( UINT8 ubPayoutID ); void EndInsuranceInvestigation( UINT8 ubPayoutID ); diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index d09db645..eaf8e54c 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -387,13 +387,13 @@ typedef struct typedef struct { - UINT8 ubProfileID; + UINT16 ubProfileID; } send_dismiss_struct; typedef struct { - UINT8 usSoldierID; + UINT16 usSoldierID; FLOAT dNewXPos; FLOAT dNewYPos; @@ -401,7 +401,7 @@ typedef struct typedef struct { - UINT8 usSoldierID; + UINT16 usSoldierID; INT16 usNewDirection; } gui_dir; @@ -430,12 +430,12 @@ typedef struct typedef struct { - UINT8 ubID; + UINT16 ubID; INT8 bTeam; - UINT8 gubOutOfTurnPersons; - UINT8 gubOutOfTurnOrder[MAXMERCS]; + UINT16 gubOutOfTurnPersons; + UINT16 gubOutOfTurnOrder[MAXMERCS]; BOOLEAN fMarkInterruptOccurred; - UINT8 Interrupted; + UINT16 Interrupted; } INT_STRUCT; typedef struct @@ -475,7 +475,7 @@ typedef struct float dForceY; float dForceZ; UINT32 sTargetGridNo; - UINT8 ubID; + UINT16 ubID; UINT8 ubActionCode; UINT32 uiActionData; UINT16 usItem; @@ -491,7 +491,7 @@ typedef struct float dZ; INT32 sGridNo; bool bWasDud; - UINT8 ubOwnerID; + UINT16 ubOwnerID; INT32 RealObjectID; // the local ID on the initiating client UINT32 uiPreRandomIndex; // send out our current pre-random index } grenade_result; @@ -499,7 +499,7 @@ typedef struct typedef struct { UINT32 sGridNo; - UINT8 ubID; + UINT16 ubID; UINT16 usItem; UINT8 ubItemStatus; UINT32 uiWorldIndex; // the local World Index of this bomb on its creators client @@ -511,7 +511,7 @@ typedef struct typedef struct { - UINT8 ubID; + UINT16 ubID; UINT32 uiWorldItemIndex; UINT8 ubMPTeamIndex; UINT32 uiPreRandomIndex; // send out our current pre-random index @@ -521,7 +521,7 @@ typedef struct { UINT32 uiWorldItemIndex; UINT8 ubMPTeamIndex; - UINT8 ubID; + UINT16 ubID; UINT32 sGridNo; UINT32 uiPreRandomIndex; // send out our current pre-random index } disarm_struct; @@ -531,7 +531,7 @@ typedef struct INT32 sGridNo; UINT8 ubRadius; UINT16 usItem; - UINT8 ubOwner; + UINT16 ubOwner; BOOLEAN fSubsequent; INT8 bLevel; INT32 iSmokeEffectID; @@ -541,13 +541,13 @@ typedef struct typedef struct { UINT8 ubDamageFunc; // 1 - gas damage , 2 - explosive damage - UINT8 ubSoldierID; + UINT16 ubSoldierID; UINT16 usExplosiveClassID; INT16 sSubsequent; BOOL fRecompileMovementCosts; INT16 sWoundAmt; INT16 sBreathAmt; - UINT8 ubAttackerID; + UINT16 ubAttackerID; UINT16 usItem; INT32 sBombGridNo; UINT32 uiDist; @@ -571,7 +571,7 @@ int client_progress[4]; int TEAM; UINT8 netbTeam; -UINT8 ubID_prefix; +UINT16 ubID_prefix; bool is_connected=false; bool is_connecting=false; @@ -990,7 +990,7 @@ void recieveHIT(RPCParameters *rpcParameters) SOLDIERTYPE *pSoldier = MercPtrs[ SWeaponHit->usSoldierID ]; UINT16 usSoldierID; - UINT8 ubAttackerID; + UINT16 ubAttackerID; if((SWeaponHit->usSoldierID >= ubID_prefix) && (SWeaponHit->usSoldierID < (ubID_prefix+6))) // within our netbTeam range... usSoldierID = (SWeaponHit->usSoldierID - ubID_prefix); @@ -1017,7 +1017,7 @@ void recieveHIT(RPCParameters *rpcParameters) } -void send_dismiss(UINT8 ubCurrentSoldierID) +void send_dismiss(UINT16 ubCurrentSoldierID) { send_dismiss_struct sDismissMerc; @@ -1089,8 +1089,7 @@ void recieveHIRE(RPCParameters *rpcParameters) send_hire_struct* sHireMerc = (send_hire_struct*)rpcParameters->input; SOLDIERTYPE *pSoldier; - UINT8 iNewIndex; - UINT8 ubCount=0; + UINT16 iNewIndex; SOLDIERCREATE_STRUCT MercCreateStruct; BOOLEAN fReturn = FALSE; @@ -1283,7 +1282,7 @@ UINT8 numenemyLAN( UINT8 ubSectorX, UINT8 ubSectorY ) return ubNumEnemies; } -void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *pubID ) +void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ) { AI_STRUCT send_inv; send_inv.standard_data = *pCreateStruct; @@ -1298,7 +1297,7 @@ void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *pubID ) void recieveAI (RPCParameters *rpcParameters) { - UINT8 iNewIndex; + UINT16 iNewIndex; SOLDIERTYPE *pSoldier; AI_STRUCT* send_inv = (AI_STRUCT*)rpcParameters->input; @@ -1921,7 +1920,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) INT.ubID = pSoldier->ubID; INT.bTeam = pSoldier->bTeam; - memcpy(INT.gubOutOfTurnOrder, gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS); + memcpy(INT.gubOutOfTurnOrder, gubOutOfTurnOrder, sizeof(UINT16) * MAXMERCS); INT.gubOutOfTurnPersons = gubOutOfTurnPersons; INT.Interrupted=gusSelectedSoldier+ubID_prefix; @@ -1977,7 +1976,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix; } } - memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS); + memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT16) * MAXMERCS); gubOutOfTurnPersons = INT->gubOutOfTurnPersons; if(INT->bTeam==netbTeam)//for us @@ -2025,7 +2024,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) INT->gubOutOfTurnOrder[i]=INT->gubOutOfTurnOrder[i]-ubID_prefix; } } - memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS); + memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT16) * MAXMERCS); gubOutOfTurnPersons = INT->gubOutOfTurnPersons; AddTopMessage( PLAYER_INTERRUPT_MESSAGE, TeamTurnString[ INT->bTeam ] ); @@ -2141,7 +2140,7 @@ void end_interrupt ( BOOLEAN fMarkInterruptOccurred ) INT_STRUCT INT; INT.ubID = pSoldier->ubID; INT.bTeam = pSoldier->bTeam; - memcpy(INT.gubOutOfTurnOrder, gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS); + memcpy(INT.gubOutOfTurnOrder, gubOutOfTurnOrder, sizeof(UINT16) * MAXMERCS); INT.gubOutOfTurnPersons = gubOutOfTurnPersons; INT.fMarkInterruptOccurred=fMarkInterruptOccurred; if(is_server)Sawarded=false; @@ -2182,7 +2181,7 @@ void resume_turn(RPCParameters *rpcParameters) } } - memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT8) * MAXMERCS); + memcpy(gubOutOfTurnOrder,INT->gubOutOfTurnOrder, sizeof(UINT16) * MAXMERCS); gubOutOfTurnPersons = INT->gubOutOfTurnPersons; EndInterrupt( INT->fMarkInterruptOccurred ); } @@ -2928,7 +2927,7 @@ void recieveMAPCHANGE( RPCParameters *rpcParameters ) } // 20091002 - OJW - Explosives -void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID , bool bIsThrownGrenade) +void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade) { ubOwner = MPEncodeSoldierID(ubOwner); // translate our soldier to the "network" version @@ -2993,7 +2992,7 @@ void recieveGRENADE (RPCParameters *rpcParameters) CreateItem( gren->usItem, 99, newObj ); OBJECTTYPE::CopyToOrCreateAt(&pThrower->pTempObject, newObj); // this will create a grenade and launch it - INT32 i = CreatePhysicalObject( pThrower->pTempObject , gren->dLifeSpan , gren->dX , gren->dY , gren->dZ , gren->dForceX , gren->dForceY , gren->dForceZ , pThrower->ubID , gren->ubActionCode , gren->uiActionData, false); + INT32 i = CreatePhysicalObject( pThrower->pTempObject, gren->dLifeSpan, gren->dX, gren->dY, gren->dZ, gren->dForceX, gren->dForceY, gren->dForceZ, pThrower->ubID, gren->ubActionCode, gren->uiActionData, false); // save extra state info so we can check and feed it result later ObjectSlots[ i ].mpRealObjectID = gren->RealObjectID; ObjectSlots[ i ].mpTeam = pThrower->bTeam; @@ -3136,7 +3135,7 @@ void recieveGRENADERESULT (RPCParameters *rpcParameters) } } -void send_plant_explosive (UINT8 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldItemIndex) +void send_plant_explosive (UINT16 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldItemIndex) { explosive_obj exp; @@ -3184,7 +3183,7 @@ void recievePLANTEXPLOSIVE (RPCParameters *rpcParameters) OBJECTTYPE* newObj = new OBJECTTYPE(); CreateItem( exp->usItem, exp->ubItemStatus, newObj ); INT32 iNewItemIndex; - OBJECTTYPE* pObj = AddItemToPoolAndGetIndex( exp->sGridNo, newObj, VISIBLE, exp->ubLevel, exp->usFlags,0, exp->ubID ,&iNewItemIndex); + OBJECTTYPE* pObj = AddItemToPoolAndGetIndex( exp->sGridNo, newObj, VISIBLE, exp->ubLevel, exp->usFlags,0, exp->ubID,&iNewItemIndex); // need to save Item Type metadata agaist the world item (*pObj)[0]->data.misc.ubBombOwner = exp->ubID + 2; // this is a hack the designers put into the game, storing the side as well (which isnt relevant in MP, but still have to do it) (*pObj)[0]->data.misc.usBombItem = exp->usItem; @@ -3237,7 +3236,7 @@ void recievePLANTEXPLOSIVE (RPCParameters *rpcParameters) } } -void send_detonate_explosive (UINT32 uiWorldIndex, UINT8 ubID) +void send_detonate_explosive (UINT32 uiWorldIndex, UINT16 ubID) { ubID = MPEncodeSoldierID(ubID); @@ -3351,7 +3350,7 @@ void recieveDETONATEEXPLOSIVE (RPCParameters *rpcParameters) } } -void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldItem, UINT8 ubID) +void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldItem, UINT16 ubID) { ubID = MPEncodeSoldierID(ubID); @@ -3474,7 +3473,7 @@ void recieveDISARMEXPLOSIVE (RPCParameters *rpcParameters) } } -void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ) +void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ) { spreadeffect_struct sef; @@ -3527,7 +3526,7 @@ void recieveSPREADEFFECT (RPCParameters *rpcParameters) if ( gSmokeEffectData[ uiCount ].fAllocated == TRUE && gSmokeEffectData[ uiCount ].iMPTeamIndex == pSoldier->bTeam && gSmokeEffectData[ uiCount ].iMPSmokeEffectID == sef->iSmokeEffectID) { bFound = true; - SpreadEffect( sef->sGridNo , sef->ubRadius , sef->usItem , sef->ubOwner , sef->fSubsequent , sef->bLevel , uiCount , TRUE); + SpreadEffect( sef->sGridNo, sef->ubRadius, sef->usItem, sef->ubOwner, sef->fSubsequent, sef->bLevel, uiCount, TRUE); break; } } @@ -3544,7 +3543,7 @@ void recieveSPREADEFFECT (RPCParameters *rpcParameters) } else { - SpreadEffect( sef->sGridNo , sef->ubRadius , sef->usItem , sef->ubOwner , sef->fSubsequent , sef->bLevel , sef->iSmokeEffectID , TRUE); + SpreadEffect( sef->sGridNo, sef->ubRadius, sef->usItem, sef->ubOwner, sef->fSubsequent, sef->bLevel, sef->iSmokeEffectID, TRUE); } } } @@ -3559,7 +3558,7 @@ void recieveSPREADEFFECT (RPCParameters *rpcParameters) } } -void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, INT32 iSmokeEffectID) +void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, INT32 iSmokeEffectID) { // i'm reusing this struct, the parameters are essentially the same spreadeffect_struct sef; @@ -3602,7 +3601,7 @@ void recieveNEWSMOKEEFFECT (RPCParameters *rpcParameters) guiPreRandomIndex = sef->uiPreRandomIndex; // start new smoke effect - INT32 iNewSmokeIndex = NewSmokeEffect( sef->sGridNo , sef->usItem , sef->bLevel , sef->ubOwner , TRUE ); + INT32 iNewSmokeIndex = NewSmokeEffect( sef->sGridNo, sef->usItem, sef->bLevel, sef->ubOwner, TRUE ); // attach remote id to local smoke effect gSmokeEffectData[iNewSmokeIndex].iMPTeamIndex = pSoldier->bTeam; @@ -3620,7 +3619,7 @@ void recieveNEWSMOKEEFFECT (RPCParameters *rpcParameters) } } -void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner ) +void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner ) { explosiondamage_struct exp; exp.ubDamageFunc = 1; @@ -3642,7 +3641,7 @@ void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sS client->RPC("sendEXPLOSIONDAMAGE",(const char*)&exp, (int)sizeof(explosiondamage_struct)*8, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0); } -void send_explosivedamage( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ) +void send_explosivedamage( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ) { explosiondamage_struct exp; exp.ubDamageFunc = 2; @@ -3699,7 +3698,7 @@ void recieveEXPLOSIONDAMAGE (RPCParameters *rpcParameters) } else if (exp->ubDamageFunc == 2) { - DamageSoldierFromBlast( exp->ubSoldierID , exp->ubAttackerID , exp->sBombGridNo , exp->sWoundAmt , exp->sBreathAmt , exp->uiDist , exp->usItem , exp->sSubsequent , TRUE); + DamageSoldierFromBlast( exp->ubSoldierID, exp->ubAttackerID, exp->sBombGridNo, exp->sWoundAmt, exp->sBreathAmt, exp->uiDist, exp->usItem, exp->sSubsequent, TRUE); } } } @@ -4206,7 +4205,7 @@ BOOLEAN check_status (void)// any 'enemies' and clients left to fight ?? void UpdateSoldierToNetwork ( SOLDIERTYPE *pSoldier ) { //this send stats to other clients at intervals - UINT8 id = pSoldier->ubID; + UINT16 id = pSoldier->ubID; UINT32 time = GetJA2Clock(); if(id < 20 || (is_server && id <120)) @@ -4519,7 +4518,7 @@ void recieveDISCONNECT(RPCParameters* rpcParameters) // kill the dead clients mercs out of the game UINT8 iNetbTeam = (cl_num)+5; - UINT8 iubID_prefix = gTacticalStatus.Team[ iNetbTeam ].bFirstID;//over here now + UINT16 iubID_prefix = gTacticalStatus.Team[ iNetbTeam ].bFirstID;//over here now // kill any alive soldiers for the disconnected team SOLDIERTYPE *pTeamSoldier; diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index d1d94f10..5984c5fa 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -36,7 +36,7 @@ extern UINT8 cGameType; extern bool allowlaptop; extern UINT8 netbTeam; -extern UINT8 ubID_prefix; +extern UINT16 ubID_prefix; extern FLOAT cDamageMultiplier; //OJW - 20081218 @@ -97,33 +97,33 @@ void send_fire( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ); void send_hit( EV_S_WEAPONHIT *SWeaponHit ); void send_bullet( BULLET * pBullet, UINT16 usHandItem); void send_hire( UINT8 iNewIndex, UINT8 ubCurrentSoldier, INT16 iTotalContractLength, BOOLEAN fCopyProfileItemsOver); -void send_dismiss( UINT8 ubCurrentSoldier); +void send_dismiss( UINT16 ubCurrentSoldierID); void send_gui_pos(SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos); void send_gui_dir(SOLDIERTYPE *pSoldier, UINT16 usNewDirection); void send_EndTurn( UINT8 ubNextTeam ); -void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *pubID ); +void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ); void send_stop (EV_S_STOP_MERC *SStopMerc); void send_interrupt(SOLDIERTYPE *pSoldier); // OJW - 20091002 - explosives -void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID , bool bIsThrownGrenade); +void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade); void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, UINT8 ubOwnerID, INT32 iRealObjectID, bool bIsDud); -void send_plant_explosive (UINT8 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldIndex); -void send_detonate_explosive (UINT32 uiWorldIndex, UINT8 ubID); -void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ); -void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, INT32 iSmokeEffectID); -void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID , INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner ); -void send_explosivedamage( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ); -void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldIndex, UINT8 ubID); +void send_plant_explosive (UINT16 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldIndex); +void send_detonate_explosive (UINT32 uiWorldIndex, UINT16 ubID); +void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ); +void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, INT32 iSmokeEffectID); +void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner ); +void send_explosivedamage( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ); +void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldIndex, UINT16 ubID); void OpenChatMsgBox(void); -INT8 FireBullet( UINT8 ubFirer, BULLET * pBullet, BOOLEAN fFake ); +INT8 FireBullet( UINT16 ubFirer, BULLET * pBullet, BOOLEAN fFake ); void reapplySETTINGS(); @@ -211,7 +211,7 @@ extern BOOLEAN fClientReceivedAllFiles; // sick of confusing myself :) // this one should be called before passing an ID off the client -inline UINT8 MPEncodeSoldierID( UINT8 ubID ) +inline UINT16 MPEncodeSoldierID( UINT16 ubID ) { if ( ubID < 20 ) return ubID + ubID_prefix; // soldier is ours @@ -220,7 +220,7 @@ inline UINT8 MPEncodeSoldierID( UINT8 ubID ) } // this one can be called anywhere, even if the ID was not "encoded" -inline UINT8 MPDecodeSoldierID( UINT8 ubID ) +inline UINT16 MPDecodeSoldierID( UINT16 ubID ) { if ( ubID >= ubID_prefix && ubID < (ubID_prefix + 7) ) return ubID - ubID_prefix; // soldier is ours @@ -233,7 +233,7 @@ inline bool IsOurSoldier (SOLDIERTYPE* pSoldier) return pSoldier->bTeam == netbTeam || pSoldier->bTeam == 0; } -inline bool IsOurSoldier (UINT8 ubID) +inline bool IsOurSoldier (UINT16 ubID) { return (ubID >= ubID_prefix && ubID < (ubID_prefix + 7)) || ubID < 20; } diff --git a/Multiplayer/fresh_header.h b/Multiplayer/fresh_header.h index 58afdf26..46f90ec4 100644 --- a/Multiplayer/fresh_header.h +++ b/Multiplayer/fresh_header.h @@ -62,7 +62,7 @@ void startCombat(UINT8 ubStartingTeam); void intAI (SOLDIERTYPE *pSoldier ); void teamwiped (void); BOOLEAN check_status (void); -extern UINT8 NumEnemyInSector( ); -extern INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); +extern UINT16 NumEnemyInSector( ); +extern UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); void send_heal (SOLDIERTYPE *pSoldier ); void requestAIint(SOLDIERTYPE *pSoldier ); \ No newline at end of file diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 6811ac80..dabf4588 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -322,7 +322,7 @@ typedef struct INT16 sCurInterfacePanel; - UINT8 ubSMCurrentMercID; + UINT16 ubSMCurrentMercID; BOOLEAN fFirstTimeInMapScreen; @@ -559,8 +559,8 @@ BOOLEAN SetMercsInsertionGridNo( ); BOOLEAN LoadOppListInfoFromSavedGame( HWFILE hFile ); BOOLEAN SaveOppListInfoToSavedGame( HWFILE hFile ); -BOOLEAN LoadMercPathToSoldierStruct( HWFILE hFilem, UINT8 ubID ); -BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFilem, UINT8 ubID ); +BOOLEAN LoadMercPathToSoldierStruct( HWFILE hFilem, UINT16 ubID ); +BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFilem, UINT16 ubID ); BOOLEAN LoadGeneralInfo( HWFILE hFile ); BOOLEAN SaveGeneralInfo( HWFILE hFile ); @@ -1082,7 +1082,7 @@ BOOLEAN ITEM_CURSOR_SAVE_INFO::Load(HWFILE hFile) if ( guiCurrentSaveGameVersion >= NIV_SAVEGAME_DATATYPE_CHANGE ) { //3 bytes of info, screw being neat - if ( !FileRead( hFile, this, 3, &uiNumBytesRead ) ) + if ( !FileRead( hFile, this, SIZEOF_ITEM_CURSOR_SAVE_INFO_POD, &uiNumBytesRead ) ) { return FALSE; } @@ -1111,7 +1111,7 @@ BOOLEAN ITEM_CURSOR_SAVE_INFO::Save(HWFILE hFile) { UINT32 uiNumBytesWritten; //3 bytes of info, screw being neat - if ( !FileWrite( hFile, this, 3, &uiNumBytesWritten ) ) + if ( !FileWrite( hFile, this, SIZEOF_ITEM_CURSOR_SAVE_INFO_POD, &uiNumBytesWritten ) ) { return FALSE; } @@ -1859,8 +1859,20 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) //the soldier type info has changed at version 102 //CHRISL: To accomodate future changes to this structure, we'll load each value field by field numBytesRead = 0; - FileRead( hFile, this, (offsetof(SOLDIERTYPE, ubBodyType)+sizeof(ubBodyType)), &uiNumBytesRead ); - numBytesRead += uiNumBytesRead; + if (guiCurrentSaveGameVersion >= INCREASED_TEAMSIZES) + { + numBytesRead = ReadFieldByField(hFile, &this->ubID, sizeof(ubID), sizeof(UINT16), numBytesRead); + } + else + { + numBytesRead = ReadFieldByField(hFile, &this->ubID, sizeof(ubID), sizeof(UINT8), numBytesRead); + // Read and discard bReserved1 so numBytesRead matches the struct size later + UINT8 bReserved1 = 0; + numBytesRead = ReadFieldByField(hFile, &bReserved1, sizeof(bReserved1), sizeof(UINT8), numBytesRead); + } + numBytesRead = ReadFieldByField(hFile, &this->name, sizeof(name), sizeof(CHAR16), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubBodyType, sizeof(ubBodyType), sizeof(UINT8), numBytesRead); + if(guiCurrentSaveGameVersion >= AP100_SAVEGAME_DATATYPE_CHANGE) { //CHRISL: It was changed at version 104 to allow for 16bit action points for the 100AP system numBytesRead = ReadFieldByField(hFile, &this->bActionPoints, sizeof(bActionPoints), sizeof(INT16), numBytesRead); @@ -1888,7 +1900,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->ubWaitActionToDo, sizeof(ubWaitActionToDo), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubInsertionDirection, sizeof(ubInsertionDirection), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bGunType, sizeof(bGunType), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubOppNum, sizeof(ubOppNum), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubOppNum, sizeof(ubOppNum), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bLastRenderVisibleValue, sizeof(bLastRenderVisibleValue), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubAttackingHand, sizeof(ubAttackingHand), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->sWeightCarriedAtTurnStart, sizeof(sWeightCarriedAtTurnStart), sizeof(INT16), numBytesRead); @@ -1932,8 +1944,8 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->usAnimState, sizeof(usAnimState), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->uiAIDelay, sizeof(uiAIDelay), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->sReloadDelay, sizeof(sReloadDelay), sizeof(INT16), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubAttackerID, sizeof(ubAttackerID), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubPreviousAttackerID, sizeof(ubPreviousAttackerID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubAttackerID, sizeof(ubAttackerID), sizeof(UINT16), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubPreviousAttackerID, sizeof(ubPreviousAttackerID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->sInsertionGridNo, sizeof(sInsertionGridNo), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->AnimCache, sizeof(AnimCache), 1, numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bSide, sizeof(bSide), sizeof(UINT8), numBytesRead); @@ -2013,7 +2025,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->pCurrentShade, sizeof(pCurrentShade), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubFadeLevel, sizeof(ubFadeLevel), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubServiceCount, sizeof(ubServiceCount), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubServicePartner, sizeof(ubServicePartner), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubServicePartner, sizeof(ubServicePartner), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->pThrowParams, sizeof(pThrowParams), 4, numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bReverse, sizeof(bReverse), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->pLevelNode, sizeof(pLevelNode), 4, numBytesRead); @@ -2111,7 +2123,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->iTotalLengthOfInsuranceContract, sizeof(iTotalLengthOfInsuranceContract), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubSoldierClass, sizeof(ubSoldierClass), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubAPsLostToSuppression, sizeof(ubAPsLostToSuppression), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubSuppressorID, sizeof(ubSuppressorID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubSuppressorID, sizeof(ubSuppressorID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubDesiredSquadAssignment, sizeof(ubDesiredSquadAssignment), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubNumTraversalsAllowedToMerge, sizeof(ubNumTraversalsAllowedToMerge), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->usPendingAnimation2, sizeof(usPendingAnimation2), sizeof(UINT16), numBytesRead); @@ -2123,7 +2135,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->bBlockedByAnotherMercDirection, sizeof(bBlockedByAnotherMercDirection), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->usAttackingWeapon, sizeof(usAttackingWeapon), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bWeaponMode, sizeof(bWeaponMode), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubTargetID, sizeof(ubTargetID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubTargetID, sizeof(ubTargetID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bAIScheduleProgress, sizeof(bAIScheduleProgress), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->sOffWorldGridNo, sizeof(sOffWorldGridNo), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->pAniTile, sizeof(pAniTile), 1, numBytesRead); @@ -2144,8 +2156,8 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->bOldBattleSnd, sizeof(bOldBattleSnd), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->iBurstSoundID, sizeof(iBurstSoundID), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bSlotItemTakenFrom, sizeof(bSlotItemTakenFrom), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubAutoBandagingMedic, sizeof(ubAutoBandagingMedic), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubRobotRemoteHolderID, sizeof(ubRobotRemoteHolderID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubAutoBandagingMedic, sizeof(ubAutoBandagingMedic), sizeof(UINT16), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubRobotRemoteHolderID, sizeof(ubRobotRemoteHolderID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->uiTimeOfLastContractUpdate, sizeof(uiTimeOfLastContractUpdate), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bTypeOfLastContract, sizeof(bTypeOfLastContract), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bTurnsCollapsed, sizeof(bTurnsCollapsed), sizeof(INT8), numBytesRead); @@ -2164,7 +2176,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->bRegenBoostersUsedToday, sizeof(bRegenBoostersUsedToday), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bNumPelletsHitBy, sizeof(bNumPelletsHitBy), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->sSkillCheckGridNo, sizeof(sSkillCheckGridNo), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubLastEnemyCycledID, sizeof(ubLastEnemyCycledID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubLastEnemyCycledID, sizeof(ubLastEnemyCycledID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubPrevSectorID, sizeof(ubPrevSectorID), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubNumTilesMovesSinceLastForget, sizeof(ubNumTilesMovesSinceLastForget), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bTurningIncrement, sizeof(bTurningIncrement), sizeof(INT8), numBytesRead); @@ -2172,7 +2184,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->usValueGoneUp, sizeof(usValueGoneUp), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubNumLocateCycles, sizeof(ubNumLocateCycles), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubDelayedMovementFlags, sizeof(ubDelayedMovementFlags), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubCTGTTargetID, sizeof(ubCTGTTargetID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubCTGTTargetID, sizeof(ubCTGTTargetID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->uiMercChecksum, sizeof(uiMercChecksum), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bCurrentCivQuote, sizeof(bCurrentCivQuote), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bCurrentCivQuoteDelta, sizeof(bCurrentCivQuoteDelta), sizeof(INT8), numBytesRead); @@ -2203,7 +2215,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->ubLastDamageReason, sizeof(ubLastDamageReason), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->sLastTwoLocations, sizeof(sLastTwoLocations), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->uiTimeSinceLastBleedGrunt, sizeof(uiTimeSinceLastBleedGrunt), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubNextToPreviousAttackerID, sizeof(ubNextToPreviousAttackerID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->ubNextToPreviousAttackerID, sizeof(ubNextToPreviousAttackerID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bDoAutofire, sizeof(bDoAutofire), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->numFlanks, sizeof(numFlanks), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->lastFlankSpot, sizeof(lastFlankSpot), sizeof(INT32), numBytesRead); @@ -2230,9 +2242,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->bScopeMode, sizeof(bScopeMode), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubMilitiaAssists, sizeof(ubMilitiaAssists), sizeof(UINT8), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &this->sNonNPCTraderID, sizeof(sNonNPCTraderID), sizeof(INT8), numBytesRead ); - //numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT8_3, sizeof(bUnusedINT8_3), sizeof(INT8), numBytesRead ); - numBytesRead = ReadFieldByField(hFile, &this->usDragPersonID, sizeof(usDragPersonID), sizeof(UINT8), numBytesRead ); - //numBytesRead = ReadFieldByField(hFile, &this->bUnusedINT16_4, sizeof(bUnusedINT16_4), sizeof(INT16), numBytesRead ); + numBytesRead = ReadFieldByField(hFile, &this->usDragPersonID, sizeof(usDragPersonID), sizeof(UINT16), numBytesRead ); numBytesRead = ReadFieldByField(hFile, &this->sDragCorpseID, sizeof(sDragCorpseID), sizeof(INT16), numBytesRead ); if ( guiCurrentSaveGameVersion < DRAGPERSONS ) @@ -2351,10 +2361,10 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) if ( guiCurrentSaveGameVersion >= DISEASE_SYSTEM ) { - numBytesRead = ReadFieldByField( hFile, &this->sDiseasePoints, sizeof(sDiseasePoints), sizeof(INT32), numBytesRead ); + numBytesRead = ReadFieldByField( hFile, &this->sDiseasePoints, sizeof(sDiseasePoints), sizeof(INT16), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->sDiseaseFlag, sizeof(sDiseaseFlag), sizeof(UINT8), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->ubFiller, sizeof( ubFiller ), sizeof( UINT8 ), numBytesRead ); - numBytesRead = ReadFieldByField( hFile, &this->ubHoursRemainingOnMiniEvent, sizeof( ubHoursRemainingOnMiniEvent), sizeof( UINT8 ), numBytesRead ); + numBytesRead = ReadFieldByField( hFile, &this->ubHoursRemainingOnMiniEvent, sizeof( ubHoursRemainingOnMiniEvent), sizeof( UINT16 ), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->usGLDelayMode, sizeof( usGLDelayMode ), sizeof( UINT8 ), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->usBarrelMode, sizeof( usBarrelMode ), sizeof( UINT8 ), numBytesRead ); numBytesRead = ReadFieldByField( hFile, &this->usBarrelCounter, sizeof( usBarrelCounter ), sizeof( UINT8 ), numBytesRead ); @@ -2486,140 +2496,6 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) buffer++; } - /*if ( guiCurrentSaveGameVersion >= FOOD_CHANGES ) - { - numBytesRead = ReadFieldByField(hFile, &this->bFoodLevel, sizeof(bFoodLevel), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bDrinkLevel, sizeof(bDrinkLevel), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->usStarveDamageHealth, sizeof(usStarveDamageHealth), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->usStarveDamageStrength, sizeof(usStarveDamageStrength), sizeof(UINT8), numBytesRead); - - if ( guiCurrentSaveGameVersion >= MULTITURN_ACTIONS ) - { - numBytesRead = ReadFieldByField(hFile, &this->bOverTurnAPS, sizeof(bOverTurnAPS), sizeof(INT16), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->sMTActionGridNo, sizeof(sMTActionGridNo), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->usMultiTurnAction, sizeof(usMultiTurnAction), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bAIIndex, sizeof(bAIIndex), sizeof(UINT16), numBytesRead); - - if ( guiCurrentSaveGameVersion >= SOLDIER_PROFILES ) - { - numBytesRead = ReadFieldByField(hFile, &this->usSoldierProfile, sizeof(usSoldierProfile), sizeof(UINT16), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->usItemMoveSectorID, sizeof(usItemMoveSectorID), sizeof(UINT8), numBytesRead); - - if ( guiCurrentSaveGameVersion >= SOLDIER_PROFILES ) - { - numBytesRead = ReadFieldByField(hFile, &this->usSkillCounter, sizeof(usSkillCounter), sizeof(UINT16), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->usSkillCooldown, sizeof(usSkillCooldown), sizeof(UINT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->usAISkillUse, sizeof(usAISkillUse), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead); - } - else - { - for(UINT8 i = 0; i < SOLDIER_COUNTER_MAX; ++i) - this->usSkillCounter[i] = 0; - - for(UINT8 i = 0; i < SOLDIER_COOLDOWN_MAX; ++i) - this->usSkillCooldown[i] = 0; - - this->usAISkillUse = 0; - - // as we added new variables, fillersize was reduced, here we account for that. We have to also read the existing fillers that now do not exist anymore - const UINT8 tmp = sizeof(usSkillCounter) + sizeof(usSkillCooldown) + sizeof(usAISkillUse); - UINT8 blarg[tmp]; - numBytesRead = ReadFieldByField(hFile, &blarg, tmp, sizeof(UINT8), numBytesRead); - - numBytesRead = ReadFieldByField(hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead); - } - } - else - { - this->usSoldierProfile = 0; - this->usItemMoveSectorID = 0; - - // as we added new variables, fillersize was reduced, here we account for that. We have to also read the existing fillers that now do not exist anymore - const UINT8 tmp = sizeof(usSoldierProfile) + sizeof(usItemMoveSectorID); - UINT8 blarg[tmp]; - numBytesRead = ReadFieldByField(hFile, &blarg, tmp, sizeof(UINT8), numBytesRead); - - numBytesRead = ReadFieldByField(hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead); - } - } - else - { - this->bOverTurnAPS = 0; - this->sMTActionGridNo = NOWHERE; - this->usMultiTurnAction = 0; - this->bAIIndex = 0; - this->usSoldierProfile = 0; - this->usItemMoveSectorID = 0; - - // as we added new variables, fillersize was reduced, here we account for that. We have to also read the existing fillers that now do not exist anymore - // +1 for padding - const UINT8 tmp = sizeof(bOverTurnAPS) + sizeof(this->sMTActionGridNo) + sizeof(usMultiTurnAction) + sizeof(bAIIndex) + 1 + sizeof(usSoldierProfile) + sizeof(usItemMoveSectorID); - UINT8 blarg[tmp]; - numBytesRead = ReadFieldByField(hFile, &blarg, tmp, sizeof(UINT8), numBytesRead); - - numBytesRead = ReadFieldByField(hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead); - } - } - else - { - //CHRISL: We have to make sure we add a buffer to account for the lack of ubInterruptCounter and that buffer needs to be a full DWORD in size - for(int i = 0; i < sizeof(bFoodLevel); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(bDrinkLevel); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(usStarveDamageHealth); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(usStarveDamageStrength); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(bOverTurnAPS); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(sMTActionGridNo); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(usMultiTurnAction); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(bAIIndex); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(usSoldierProfile); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(usItemMoveSectorID); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - - for(int i = 0; i < sizeof(ubFiller); ++i) - buffer++; - while((buffer%4) > 0) - buffer++; - }*/ - #ifdef JA2UB numBytesRead = ReadFieldByField(hFile, &this->fIgnoreGetupFromCollapseCheck, sizeof(fIgnoreGetupFromCollapseCheck), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->GetupFromJA25StartCounter, sizeof(GetupFromJA25StartCounter), sizeof(TIMECOUNTER), numBytesRead); @@ -2627,38 +2503,9 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->ubPercentDamageInflictedByTeam, sizeof(ubPercentDamageInflictedByTeam), sizeof(UINT8), numBytesRead); #endif numBytesRead += buffer; - if(numBytesRead != SIZEOF_SOLDIERTYPE_POD) + const UINT32 PODsize = SIZEOF_SOLDIERTYPE_POD; + if(numBytesRead != PODsize) return(FALSE); -/* //CHRISL: It was further changed at version 104 to allow for 16bit action points for the 100AP system - //first, load the POD - if ( guiCurrentSaveGameVersion >= AP100_SAVEGAME_DATATYPE_CHANGE ) - { - if ( !FileRead( hFile, this, SIZEOF_SOLDIERTYPE_POD, &uiNumBytesRead ) ) - { - return(FALSE); - } - } - else - { - numBytesRead = 0; - FileRead( hFile, this, (offsetof(SOLDIERTYPE, ubBodyType)+sizeof(ubBodyType)), &uiNumBytesRead ); - numBytesRead += uiNumBytesRead; - numBytesRead = ReadFieldByField(hFile, &this->bActionPoints, 1, 1, numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bInitialActionPoints, 1, 1, numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bOldLife, sizeof(bOldLife), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bVisible, sizeof(bVisible), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bActive, sizeof(bActive), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bTeam, sizeof(bTeam), sizeof(INT8), numBytesRead); - //CHRISL: in the old structure, there are 3 padding bytes at this point in the file. We need to account for - // them before continuing. We also want to include them in our numBytesRead since they cover the changes - // caused by increasing two elements by 1byte each. This includes shifting one byte of padding - FileRead( hFile, padding, 3, &uiNumBytesRead ); - numBytesRead += uiNumBytesRead; - FileRead( hFile, &this->pTempObject, (SIZEOF_SOLDIERTYPE_POD-numBytesRead), &uiNumBytesRead ); - numBytesRead += uiNumBytesRead; - if(numBytesRead != SIZEOF_SOLDIERTYPE_POD) - return(FALSE); - }*/ //load the OO inventory if ( !this->inv.Load(hFile) ) @@ -2696,7 +2543,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->aiData.sNoiseGridno, sizeof(aiData.sNoiseGridno), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.ubNoiseVolume, sizeof(aiData.ubNoiseVolume), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.bLastAttackHit, sizeof(aiData.bLastAttackHit), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->aiData.ubXRayedBy, sizeof(aiData.ubXRayedBy), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->aiData.ubXRayedBy, sizeof(aiData.ubXRayedBy), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.dHeightAdjustment, sizeof(aiData.dHeightAdjustment), sizeof(FLOAT), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.bMorale, sizeof(aiData.bMorale), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.bTeamMoraleMod, sizeof(aiData.bTeamMoraleMod), sizeof(INT8), numBytesRead); @@ -2719,7 +2566,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->aiData.bMoved, sizeof(aiData.bMoved), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.bHunting, sizeof(aiData.bHunting), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.ubLastCall, sizeof(aiData.ubLastCall), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->aiData.ubCaller, sizeof(aiData.ubCaller), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->aiData.ubCaller, sizeof(aiData.ubCaller), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.sCallerGridNo, sizeof(aiData.sCallerGridNo), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.bCallPriority, sizeof(aiData.bCallPriority), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->aiData.bCallActedUpon, sizeof(aiData.bCallActedUpon), sizeof(INT8), numBytesRead); @@ -2951,9 +2798,14 @@ BOOLEAN WORLDITEM::Load(INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorMap LOADDATA(&oldWorldItem, *hBuffer, _OLD_SIZEOF_WORLDITEM_POD); *this = oldWorldItem; } + else if (dMajorMapVersion < 8.0) + { + LOADDATA(this, *hBuffer, _SIZEOF_WORLDITEM_INT8_ID_POD); + } else + { LOADDATA(this, *hBuffer, SIZEOF_WORLDITEM_POD); - + } // Load the OO OBJECTTYPE this->object.Load(hBuffer, dMajorMapVersion, ubMinorMapVersion); } @@ -6675,7 +6527,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) if( gTacticalStatus.ubAttackBusyCount > 1 ) { //Lock the ui - SetUIBusy( (UINT8)gusSelectedSoldier ); + SetUIBusy( gusSelectedSoldier ); } // OJW - 20090403 - Fix Tactical Interface is still locked after quick-load else @@ -6920,7 +6772,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) // player team character fixes SOLDIERTYPE *pTeamSoldier; - for (INT8 bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++) + for (UINT16 bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++) { pTeamSoldier=MercPtrs[bLoop]; @@ -7130,7 +6982,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) { UINT16 cnt; UINT32 uiNumBytesRead=0; - UINT8 ubId; + UINT16 ubId; UINT8 ubOne = 1; UINT8 ubActive = 1; UINT32 uiPercentage; @@ -7868,8 +7720,8 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fPanicFlags, sizeof(gTacticalStatus.fPanicFlags), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sPanicTriggerGridNoUnused, sizeof(gTacticalStatus.sPanicTriggerGridNoUnused), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sHandGrid, sizeof(gTacticalStatus.sHandGrid), sizeof(INT16), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubSpottersCalledForBy, sizeof(gTacticalStatus.ubSpottersCalledForBy), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubTheChosenOne, sizeof(gTacticalStatus.ubTheChosenOne), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubSpottersCalledForBy, sizeof(gTacticalStatus.ubSpottersCalledForBy), sizeof(UINT16), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubTheChosenOne, sizeof(gTacticalStatus.ubTheChosenOne), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiTimeOfLastInput, sizeof(gTacticalStatus.uiTimeOfLastInput), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiTimeSinceDemoOn, sizeof(gTacticalStatus.uiTimeSinceDemoOn), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiCountdownToRestart, sizeof(gTacticalStatus.uiCountdownToRestart), sizeof(UINT32), numBytesRead); @@ -7888,13 +7740,13 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bRealtimeSpeed, sizeof(gTacticalStatus.bRealtimeSpeed), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyIntention, sizeof(gTacticalStatus.ubEnemyIntention), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyIntendedRetreatDirection, sizeof(gTacticalStatus.ubEnemyIntendedRetreatDirection), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID, sizeof(gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID, sizeof(gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID, sizeof(gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID), sizeof(UINT16), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID, sizeof(gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fEnemySightingOnTheirTurn, sizeof(gTacticalStatus.fEnemySightingOnTheirTurn), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fAutoBandageMode, sizeof(gTacticalStatus.fAutoBandageMode), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubAttackBusyCount, sizeof(gTacticalStatus.ubAttackBusyCount), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bNumEnemiesFoughtInBattleUnused, sizeof(gTacticalStatus.bNumEnemiesFoughtInBattleUnused), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEngagedInConvFromActionMercID, sizeof(gTacticalStatus.ubEngagedInConvFromActionMercID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEngagedInConvFromActionMercID, sizeof(gTacticalStatus.ubEngagedInConvFromActionMercID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.usTactialTurnLimitCounter, sizeof(gTacticalStatus.usTactialTurnLimitCounter), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fInTopMessage, sizeof(gTacticalStatus.fInTopMessage), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubTopMessageType, sizeof(gTacticalStatus.ubTopMessageType), sizeof(UINT8), numBytesRead); @@ -7912,7 +7764,7 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fSaidCreatureFlavourQuote, sizeof(gTacticalStatus.fSaidCreatureFlavourQuote), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fHaveSeenCreature, sizeof(gTacticalStatus.fHaveSeenCreature), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fKilledEnemyOnAttack, sizeof(gTacticalStatus.fKilledEnemyOnAttack), sizeof(BOOLEAN), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyKilledOnAttack, sizeof(gTacticalStatus.ubEnemyKilledOnAttack), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyKilledOnAttack, sizeof(gTacticalStatus.ubEnemyKilledOnAttack), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bEnemyKilledOnAttackLevel, sizeof(gTacticalStatus.bEnemyKilledOnAttackLevel), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyKilledOnAttackLocation, sizeof(gTacticalStatus.ubEnemyKilledOnAttackLocation), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fItemsSeenOnAttack, sizeof(gTacticalStatus.fItemsSeenOnAttack), sizeof(BOOLEAN), numBytesRead); @@ -7926,7 +7778,7 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fCantGetThrough, sizeof(gTacticalStatus.fCantGetThrough), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sCantGetThroughGridNo, sizeof(gTacticalStatus.sCantGetThroughGridNo), sizeof(INT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sCantGetThroughSoldierGridNo, sizeof(gTacticalStatus.sCantGetThroughSoldierGridNo), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubCantGetThroughID, sizeof(gTacticalStatus.ubCantGetThroughID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubCantGetThroughID, sizeof(gTacticalStatus.ubCantGetThroughID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fDidGameJustStart, sizeof(gTacticalStatus.fDidGameJustStart), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fStatChangeCheatOn, sizeof(gTacticalStatus.fStatChangeCheatOn), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubLastRequesterTargetID, sizeof(gTacticalStatus.ubLastRequesterTargetID), sizeof(UINT8), numBytesRead); @@ -7940,7 +7792,6 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fHasAGameBeenStarted, sizeof(gTacticalStatus.fHasAGameBeenStarted), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bConsNumTurnsWeHaventSeenButEnemyDoes, sizeof(gTacticalStatus.bConsNumTurnsWeHaventSeenButEnemyDoes), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fSomeoneHit, sizeof(gTacticalStatus.fSomeoneHit), sizeof(BOOLEAN), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubPaddingSmall, sizeof(gTacticalStatus.ubPaddingSmall), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiTimeSinceLastOpplistDecay, sizeof(gTacticalStatus.uiTimeSinceLastOpplistDecay), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bMercArrivingQuoteBeingUsed, sizeof(gTacticalStatus.bMercArrivingQuoteBeingUsed), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyKilledOnAttackKiller, sizeof(gTacticalStatus.ubEnemyKilledOnAttackKiller), sizeof(UINT8), numBytesRead); @@ -7958,7 +7809,7 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiCreatureTenseQuoteLastUpdate, sizeof(gTacticalStatus.uiCreatureTenseQuoteLastUpdate), sizeof(UINT32), numBytesRead); if ( guiCurrentSaveGameVersion >= BUGFIX_NPC_DATA_FOR_BIG_MAPS ) { - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubLastRequesterSurgeryTargetID, sizeof(gTacticalStatus.ubLastRequesterSurgeryTargetID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubLastRequesterSurgeryTargetID, sizeof(gTacticalStatus.ubLastRequesterSurgeryTargetID), sizeof(UINT16), numBytesRead); if ( guiCurrentSaveGameVersion >= IMPROVED_INTERRUPT_SYSTEM ) { numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubInterruptPending, sizeof(gTacticalStatus.ubInterruptPending), sizeof(UINT8), numBytesRead); @@ -8404,7 +8255,7 @@ void CreateSavedGameFileNameFromNumber( UINT8 ubSaveGameID, STR pzNewFileName ) -BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFile, UINT8 ubID ) +BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFile, UINT16 ubID ) { UINT32 uiNumOfNodes=0; PathStPtr pTempPath = Menptr[ ubID ].pMercPath; @@ -8445,7 +8296,7 @@ BOOLEAN SaveMercPathFromSoldierStruct( HWFILE hFile, UINT8 ubID ) -BOOLEAN LoadMercPathToSoldierStruct( HWFILE hFile, UINT8 ubID ) +BOOLEAN LoadMercPathToSoldierStruct( HWFILE hFile, UINT16 ubID ) { UINT32 uiNumOfNodes=0; PathStPtr pTempPath = NULL; @@ -8728,7 +8579,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) if( gpSMCurrentMerc ) sGeneralInfo.ubSMCurrentMercID = gpSMCurrentMerc->ubID; else - sGeneralInfo.ubSMCurrentMercID = 255; + sGeneralInfo.ubSMCurrentMercID = NOBODY; //Save the fact that it is the first time in mapscreen sGeneralInfo.fFirstTimeInMapScreen = fFirstTimeInMapScreen; @@ -8992,7 +8843,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.uiSeedNumber, sizeof(sGeneralInfo.uiSeedNumber), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.uiBaseJA2Clock, sizeof(sGeneralInfo.uiBaseJA2Clock), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sCurInterfacePanel, sizeof(sGeneralInfo.sCurInterfacePanel), sizeof(INT16), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubSMCurrentMercID, sizeof(sGeneralInfo.ubSMCurrentMercID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubSMCurrentMercID, sizeof(sGeneralInfo.ubSMCurrentMercID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fFirstTimeInMapScreen, sizeof(sGeneralInfo.fFirstTimeInMapScreen), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fDisableDueToBattleRoster, sizeof(sGeneralInfo.fDisableDueToBattleRoster), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fDisableMapInterfaceDueToBattle, sizeof(sGeneralInfo.fDisableMapInterfaceDueToBattle), sizeof(BOOLEAN), numBytesRead); @@ -9268,7 +9119,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) // Restore the selected merc - if( sGeneralInfo.ubSMCurrentMercID == 255 ) + if( sGeneralInfo.ubSMCurrentMercID == NOBODY) gpSMCurrentMerc = NULL; else gpSMCurrentMerc = &Menptr[ sGeneralInfo.ubSMCurrentMercID ]; @@ -9729,10 +9580,10 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p } else { - INT16 sSoldierCnt; - SOLDIERTYPE *pSoldier; - INT16 bLastTeamID; - BOOLEAN fFoundAMerc=FALSE; + UINT16 sSoldierCnt; + SOLDIERTYPE *pSoldier; + UINT16 bLastTeamID; + BOOLEAN fFoundAMerc=FALSE; // Set locator to first merc sSoldierCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; diff --git a/SaveLoadGame.h b/SaveLoadGame.h index a1f9664a..b0fb5906 100644 --- a/SaveLoadGame.h +++ b/SaveLoadGame.h @@ -57,7 +57,7 @@ typedef struct INT16 sSectorX; INT16 sSectorY; INT8 bSectorZ; - UINT8 ubNumOfMercsOnPlayersTeam; + UINT16 ubNumOfMercsOnPlayersTeam; INT32 iCurrentBalance; UINT32 uiCurrentScreen; @@ -72,11 +72,10 @@ typedef struct UINT32 uiRandom; - UINT8 ubFiller[500]; // WANNE: Decrease this filler by 1, for each new UINT8 variable! + UINT8 ubFiller[494]; // WANNE: Decrease this filler by 1, for each new UINT8 variable! } SAVED_GAME_HEADER; - extern UINT32 guiScreenToGotoAfterLoadingSavedGame; extern UINT32 guiCurrentSaveGameVersion; diff --git a/Strategic/AI Viewer.cpp b/Strategic/AI Viewer.cpp index 03ca0d07..bfbf2db7 100644 --- a/Strategic/AI Viewer.cpp +++ b/Strategic/AI Viewer.cpp @@ -653,7 +653,7 @@ void RenderMovingGroupsAndMercs() void RenderInfoInSector() { UINT8 ubSectorX, ubSectorY; - UINT8 ubMercs=0, ubActive=0, ubUnconcious=0, ubCollapsed=0; + UINT16 ubMercs=0, ubActive=0, ubUnconcious=0, ubCollapsed=0; INT32 i, xp, yp; if( gfViewEnemies && !gbViewLevel ) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 0e6398d6..da5fb2bb 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -1225,7 +1225,7 @@ BOOLEAN IsAnythingAroundForSoldierToClean( SOLDIERTYPE * pSoldier ) } // now the other merc's stuff - for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) + for(UINT16 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) { // Ignore self, mercs in other sectors, etc. if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) @@ -1289,7 +1289,6 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP { INT8 bPocket; UINT8 ubItemsInPocket, ubObjectInPocketCounter; - INT8 bLoop; OBJECTTYPE * pObj; UINT8 ubPassType; @@ -1340,7 +1339,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP if ( bHighestPass != - 1 ) { // now look for items to repair on other mercs - for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) + for( UINT16 bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) { SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ]; @@ -2052,7 +2051,7 @@ INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier, UINT8 ubMilit AssertNotNIL(pSoldier); - for ( UINT8 bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) + for ( UINT16 bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) { SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ]; if ( pSoldier != pOtherSoldier && pOtherSoldier->bActive && pOtherSoldier->stats.bLife >= OKLIFE && pOtherSoldier->sSectorX == pSoldier->sSectorX && pOtherSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pOtherSoldier->bSectorZ ) @@ -5477,7 +5476,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) // first our own stuff CollectCleanableItems(pSoldier, pSoldier, itemsToClean); // then other mercs' stuff - for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) + for(UINT16 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) { // Ignore self, mercs in other sectors, etc. if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) @@ -5522,7 +5521,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) // silversurfer: Looks strange? It's not. This function now needs the guy that does the repairs and the one that owns the stuff. CollectRepairableItems(pSoldier, pSoldier, itemsToFix); - for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) + for(UINT16 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) { // Ignore self, mercs in other sectors, etc. if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) @@ -9501,7 +9500,7 @@ void HandleHealingByNaturalCauses( SOLDIERTYPE *pSoldier ) if ( gGameOptions.fNewTraitSystem ) { SOLDIERTYPE * pMedic = NULL; - UINT8 cnt; + UINT16 cnt; UINT16 bRegenerationBonus = 0; cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; @@ -13814,7 +13813,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { SOLDIERTYPE * pMedic = NULL; SOLDIERTYPE * pBestMedic = NULL; - UINT8 cnt; + UINT16 cnt; INT8 bSlot; // Find the best doctor @@ -14096,7 +14095,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { SOLDIERTYPE * pMedic = NULL; SOLDIERTYPE * pBestMedic = NULL; - UINT8 cnt; + UINT16 cnt; INT8 bSlot; // Find the best doctor @@ -19505,7 +19504,7 @@ void ResumeOldAssignment( SOLDIERTYPE *pSoldier ) void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ) { UINT8 ubPassType; - INT8 bLoop; + UINT16 bLoop; SOLDIERTYPE * pOtherSoldier; SOLDIERTYPE * pBestOtherSoldier; INT8 bPriority, bBestPriority = -1; diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 2e4da9ed..91349039 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -2853,7 +2853,7 @@ void RetreatButtonCallback( GUI_BUTTON *btn, INT32 reason ) if( gpAR->pRobotCell ) { //if robot is retreating, set the retreat time to be the same as the robot's controller. - UINT8 ubRobotControllerID; + UINT16 ubRobotControllerID; ubRobotControllerID = gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID; @@ -3027,7 +3027,7 @@ void MercCellMouseClickCallback( MOUSE_REGION *reg, INT32 reason ) if( gpAR->pRobotCell ) { //if controller is retreating, make the robot retreat too. - UINT8 ubRobotControllerID; + UINT16 ubRobotControllerID; ubRobotControllerID = gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID; @@ -3751,7 +3751,7 @@ UINT8 GetUnusedMercProfileID() BOOLEAN fUnique = FALSE; while( !fUnique ) { - ubRandom = (UINT8)PreRandom( 40 ); + ubRandom = (UINT8)PreRandom(CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS); for( i = 0; i < 19; i++ ) { fUnique = TRUE; @@ -3769,7 +3769,7 @@ void CreateTempPlayerMerc() { SOLDIERCREATE_STRUCT MercCreateStruct; static INT32 iSoldierCount=0; - UINT8 ubID; + UINT16 ubID; //Init the merc create structure with basic information MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index e951f765..7942c2b5 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -240,7 +240,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) //If a merc gets hired and they dont show up immediately, the merc gets added to the queue and shows up // uiTimeTillMercArrives minutes later case EVENT_DELAYED_HIRING_OF_MERC: - MercArrivesCallback( (UINT8) pEvent->uiParam ); + MercArrivesCallback( (UINT16) pEvent->uiParam ); break; //handles the life insurance contract for a merc from AIM. case EVENT_HANDLE_INSURED_MERCS: @@ -248,7 +248,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) break; //handles when a merc is killed an there is a life insurance payout case EVENT_PAY_LIFE_INSURANCE_FOR_DEAD_MERC: - InsuranceContractPayLifeInsuranceForDeadMerc( (UINT8) pEvent->uiParam ); + InsuranceContractPayLifeInsuranceForDeadMerc( (UINT16) pEvent->uiParam ); break; //gets called every day at midnight. case EVENT_MERC_DAILY_UPDATE: diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index d91243ba..23b1282b 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -908,7 +908,7 @@ UINT16 PROFILLUA_sSectorX; UINT16 PROFILLUA_sSectorY; UINT8 PROFILLUA_bSectorZ; UINT8 PROFILLUA_Level; -UINT8 PROFILLUA_ubID; +UINT16 PROFILLUA_ubID; UINT32 PROFILLUA_sGridNo; UINT8 PROFILLUA_ubDirectiono; UINT8 PROFILLUA_bTeam; @@ -918,7 +918,7 @@ UINT16 PROFILLUA2_sSectorX; UINT16 PROFILLUA2_sSectorY; UINT8 PROFILLUA2_bSectorZ; UINT32 PROFILLUA2_sGridNo; -UINT8 PROFILLUA2_ubID; +UINT16 PROFILLUA2_ubID; LUA_GLOBAL gLuaGlobal[1000]; @@ -2354,7 +2354,7 @@ static int l_WhoIsThere2 (lua_State *L) { UINT32 sGridNo = lua_tointeger(L,1); INT8 bLevel = lua_tointeger(L,2); - UINT8 Val = WhoIsThere2( sGridNo, bLevel ); + UINT16 Val = WhoIsThere2( sGridNo, bLevel ); lua_pushinteger(L, Val); } @@ -2698,8 +2698,9 @@ void LuaHandleSectorLiberation( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, B LuaFunction( _LS.L, "HandleSectorLiberation" ).Param( sSectorX ).Param( sSectorY ).Param( bSectorZ ).Param( fFirstTime ).Call( 4 ); } -void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, - INT32 sGridNo, UINT8 bLevel, UINT8 ubId, +void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, + INT8 bSectorZ, + INT32 sGridNo, UINT8 bLevel, UINT16 ubId, UINT16 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ) { const char* filename = "scripts\\Overhead.lua"; @@ -2918,7 +2919,7 @@ BOOLEAN LuaIDScripts(UINT8 Init, UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 u SOLDIERTYPE * FindSoldierByProfileID_( UINT8 ubProfileID ) { - UINT8 ubLoop, ubLoopLimit; + UINT16 ubLoop, ubLoopLimit; SOLDIERTYPE * pSoldier; ubLoopLimit = MAX_NUM_SOLDIERS; @@ -2935,7 +2936,7 @@ SOLDIERTYPE * FindSoldierByProfileID_( UINT8 ubProfileID ) SOLDIERTYPE * FindSoldierByProfileID2( UINT8 ubProfileID, BOOLEAN fPlayerMercsOnly ) { - UINT8 cnt2, ubLoopLimit; + UINT16 cnt2, ubLoopLimit; SOLDIERTYPE * pSoldier; ubLoopLimit = gTacticalStatus.Team[CIV_TEAM].bLastID; @@ -4730,7 +4731,7 @@ static int l_NumMercsNear(lua_State *L) { UINT8 ubProfileID = lua_tointeger(L,1); UINT8 ubMaxDist = lua_tointeger(L,2); - UINT8 ID2 = NumMercsNear( ubProfileID, ubMaxDist ); + UINT16 ID2 = NumMercsNear( ubProfileID, ubMaxDist ); lua_pushinteger(L, ID2); } @@ -5799,7 +5800,7 @@ static int l_SetOffPanicBombs (lua_State *L) { if ( lua_gettop(L) >= 2 ) { - UINT8 ubID = lua_tointeger(L,1); + UINT16 ubID = lua_tointeger(L,1); INT8 bPanicTrigger = lua_tointeger(L,2); SetOffPanicBombs( ubID, bPanicTrigger ); } @@ -5852,7 +5853,7 @@ static int l_MakeNoise(lua_State *L) if ( lua_gettop(L) >= 6 ) { - UINT8 ubNoiseMaker = lua_tointeger(L,1); + UINT16 ubNoiseMaker = lua_tointeger(L,1); INT32 sGridNo = lua_tointeger(L,2); INT8 bLevel = lua_tointeger(L,3); UINT8 ubTerrType = lua_tointeger(L,4); @@ -5995,7 +5996,7 @@ return 0; static int l_ActionInProgress(lua_State *L) { - UINT8 cnt2; + UINT16 cnt2; SOLDIERTYPE * pSoldier; if (lua_gettop(L) >= 2) @@ -6357,7 +6358,7 @@ static int l_ActivateSwitchInGridNo(lua_State *L) { if (lua_gettop(L) >= 2) { - UINT8 ubID = lua_tointeger(L, 1); + UINT16 ubID = lua_tointeger(L, 1); INT32 sGridNo = lua_tointeger(L, 2); if (!TileIsOutOfBounds(sGridNo) && ubID < TOTAL_SOLDIERS) @@ -7128,7 +7129,7 @@ static int l_ACTION_ITEM_SEX (lua_State *L) if ( ! (gTacticalStatus.uiFlags & INCOMBAT) ) { - UINT8 ubID; + UINT16 ubID; OBJECTTYPE DoorCloser; INT16 sTeleportSpot; INT16 sDoorSpot; @@ -7579,7 +7580,7 @@ static int l_EVENT_InitNewSoldierAnim (lua_State *L) { if ( lua_gettop(L) >= 3 ) { - UINT8 ubTargetNPC = lua_tointeger(L,1); + UINT16 ubTargetNPC = lua_tointeger(L,1); //if (i == 2 ) BodyType = lua_tointeger(L,i); UINT32 ANIM = lua_tointeger(L,2); INT32 cnt = lua_tointeger(L,3); @@ -7636,13 +7637,13 @@ static int l_SetEnterCombatMode (lua_State *L) if ( lua_gettop(L) >= 2 ) { UINT16 group = lua_tointeger(L,1); - UINT8 ubID = lua_tointeger(L,2); + UINT16 ubID = lua_tointeger(L,2); if ( ubID == NOBODY ) return 0; SOLDIERTYPE* pGoon = NULL; - for ( UINT8 ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) + for ( UINT16 ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) { pGoon = MercPtrs[ ubLoop ]; if ( pGoon->ubCivilianGroup == group && pGoon->bActive && pGoon->bInSector && pGoon->stats.bLife >= OKLIFE && pGoon->aiData.bOppList[ ubID ] == SEEN_CURRENTLY ) @@ -7675,7 +7676,7 @@ static int l_MakeMercPtrsHostile (lua_State *L) { if ( lua_gettop(L) >= 1 ) { - UINT8 ubID = lua_tointeger(L,1); + UINT16 ubID = lua_tointeger(L,1); MakeCivHostile(MercPtrs[ ubID ]); } @@ -7734,7 +7735,7 @@ static int l_EVENT_SoldierGotHit (lua_State *L) DeleteTalkingMenu(); if ( pTarget2->stats.bLife >= 0 ) { - pTarget2->EVENT_SoldierGotHit( 1, 100, 10, pTarget2->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); + pTarget2->EVENT_SoldierGotHit( 1, 100, 10, pTarget2->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); } } } @@ -8067,7 +8068,7 @@ static int l_ChangeMercPtrsTeam (lua_State *L) { if ( lua_gettop(L) >= 2 ) { - UINT8 UID = lua_tointeger(L,1); + UINT16 UID = lua_tointeger(L,1); INT8 Side = lua_tointeger(L,2); if ( MercPtrs[UID] && MercPtrs[ UID ]->bInSector && MercPtrs[ UID ]->bActive ) @@ -8878,46 +8879,33 @@ static int l_GetDirection (lua_State *L) static int l_ubID (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT8 ubTargetNPC = 0; - SOLDIERTYPE *pSoldier; - - UINT32 ubID = 0; - - for (i= 1; i<=n; i++ ) + if (lua_gettop(L) >= 1) { - if (i == 1 ) - ubTargetNPC = lua_tointeger(L,i); + UINT8 ubTargetNPC = 0; + SOLDIERTYPE *pSoldier; + + ubTargetNPC = lua_tointeger(L, 1); + pSoldier = FindSoldierByProfileID(ubTargetNPC, FALSE); + if (pSoldier) + lua_pushinteger(L, pSoldier->ubID); + else + lua_pushinteger(L, -1); } - - pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE); - if ( pSoldier ) - ubID = pSoldier->ubID; - else - ubID = -1; - - lua_pushinteger(L, ubID); - return 1; } //------------ static int l_GetFirstID (lua_State *L) { - UINT8 n = lua_gettop(L); - int i; - UINT8 team = 0; - UINT32 id; - - for (i= 1; i<=n; i++ ) + if (lua_gettop(L) >= 1) { - if (i == 1 ) team = lua_tointeger(L,i); + UINT8 team = 0; + UINT32 id; + + team = lua_tointeger(L, 1); + id = gTacticalStatus.Team[team].bFirstID; + + lua_pushinteger(L, id); } - - id = gTacticalStatus.Team[ team ].bFirstID; - - lua_pushinteger(L, id); - return 1; } @@ -9190,7 +9178,7 @@ static int l_WearGasMaskIfAvailable(lua_State *L) { if ( lua_gettop( L ) >= 1 ) { - UINT8 ubID = lua_tointeger( L, 1 ); + UINT16 ubID = lua_tointeger( L, 1 ); if ( MercPtrs[ubID] && MercPtrs[ubID]->bInSector && MercPtrs[ubID]->bActive ) { @@ -9205,7 +9193,7 @@ static int l_SetNewSituationMercPtsr(lua_State *L) { UINT8 n = lua_gettop(L); int i = 0; - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; @@ -9573,7 +9561,7 @@ static int l_SetOffBombsInGridNo (lua_State *L) { UINT8 n = lua_gettop(L); int i = 0; - UINT8 ubID = 0; + UINT16 ubID = 0; INT32 sGridNo = 0; BOOLEAN fAllBombs = FALSE; INT8 bLevel = 0; @@ -9613,7 +9601,7 @@ static int l_AnimMercPtsrSoldierGotHit (lua_State *L) { if ( MercPtrs[ ubID ]->stats.bLife >= 0 ) { - MercPtrs[ ubID ]->EVENT_SoldierGotHit( 1, 100, 10, MercPtrs[ ubID ]->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); + MercPtrs[ ubID ]->EVENT_SoldierGotHit( 1, 100, 10, MercPtrs[ ubID ]->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); } } @@ -9738,7 +9726,8 @@ static int l_FindSoldierByProfileID (lua_State *L) { UINT8 n = lua_gettop(L); int i = 0; - UINT8 ubTargetNPC = 0,ubLoop = 0,ubLoopLimit = 0; + UINT8 ubTargetNPC = 0; + UINT16 ubLoop = 0, ubLoopLimit = 0; SOLDIERTYPE *pSoldier; UINT8 id = -1; @@ -9767,7 +9756,8 @@ static int l_FindSoldierByProfileIDBool (lua_State *L) { UINT8 n = lua_gettop(L); int i = 0; - UINT8 ubTargetNPC = 0,ubLoop = 0,ubLoopLimit = 0; + UINT8 ubTargetNPC = 0; + UINT16 ubLoop = 0, ubLoopLimit = 0; SOLDIERTYPE *pSoldier; UINT8 id = -1; BOOLEAN ProfBool = FALSE; @@ -11445,7 +11435,7 @@ static int l_SetMoneyInSoldierProfile(lua_State *L) static int l_AddToShouldBecomeHostileOrSayQuoteList(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; UINT8 n = lua_gettop(L); int i = 0; @@ -12381,7 +12371,7 @@ return 0; static int l_SetMercPtsrSectorZ(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; INT8 SectorZ; @@ -12413,7 +12403,7 @@ static int l_SetMercPtsrSectorZ(lua_State *L) static int l_SetMercPtsrSectorX(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; INT16 SectorX; @@ -12446,7 +12436,7 @@ static int l_SetMercPtsrSectorX(lua_State *L) static int l_SetMercPtsrSectorY(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; INT16 SectorY; @@ -12479,7 +12469,7 @@ static int l_SetMercPtsrSectorY(lua_State *L) static int l_SetMercPtsrubGroupID(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; INT8 GroupID; @@ -12512,7 +12502,7 @@ static int l_SetMercPtsrubGroupID(lua_State *L) static int l_CheckMercPtsrSectorY(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; INT16 SectorY; @@ -12550,7 +12540,7 @@ static int l_CheckMercPtsrSectorY(lua_State *L) static int l_CheckMercPtsrSectorX(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; INT16 SectorX; @@ -12588,7 +12578,7 @@ static int l_CheckMercPtsrSectorX(lua_State *L) static int l_CheckMercPtsrSectorZ(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; INT16 SectorZ; @@ -12626,7 +12616,7 @@ static int l_CheckMercPtsrSectorZ(lua_State *L) static int l_CheckMercPtsrubGroupID(lua_State *L) { - UINT8 ubID = 0; + UINT16 ubID = 0; BOOLEAN Bool = FALSE; SOLDIERTYPE * pSoldier; UINT8 GroupID; @@ -13269,7 +13259,7 @@ static int l_DoInteractiveActionDefaultResult( lua_State *L ) if ( lua_gettop( L ) >= 3 ) { INT32 sGridNo = lua_tointeger( L, 1 ); - UINT8 ubID = lua_tointeger( L, 2 ); + UINT16 ubID = lua_tointeger( L, 2 ); BOOLEAN success = lua_tointeger( L, 3 ); DoInteractiveActionDefaultResult( sGridNo, ubID, success ); @@ -13282,7 +13272,7 @@ static int l_GiveExp( lua_State *L ) { if ( lua_gettop( L ) >= 3 ) { - UINT8 ubID = lua_tointeger( L, 1 ); + UINT16 ubID = lua_tointeger( L, 1 ); UINT8 ubStat = lua_tointeger( L, 2 ); UINT16 usNumChances = lua_tointeger( L, 3 ); @@ -13375,7 +13365,7 @@ static int l_SoldierSpendMoney( lua_State *L ) { if ( lua_gettop( L ) >= 2 ) { - UINT8 usId = lua_tointeger( L, 1 ); + UINT16 usId = lua_tointeger( L, 1 ); UINT32 amount = lua_tointeger( L, 2 ); lua_pushinteger( L, SpendMoney( MercPtrs[usId], amount ) ); diff --git a/Strategic/LuaInitNPCs.h b/Strategic/LuaInitNPCs.h index cd663ede..043c0fa1 100644 --- a/Strategic/LuaInitNPCs.h +++ b/Strategic/LuaInitNPCs.h @@ -33,7 +33,7 @@ extern UINT16 PROFILLUA_sSectorX; extern UINT16 PROFILLUA_sSectorY; extern UINT8 PROFILLUA_bSectorZ; extern UINT8 PROFILLUA_Level; -extern UINT8 PROFILLUA_ubID; +extern UINT16 PROFILLUA_ubID; extern UINT32 PROFILLUA_sGridNo; extern UINT8 PROFILLUA_ubDirectiono; extern UINT8 PROFILLUA_bTeam; @@ -42,7 +42,7 @@ extern UINT8 PROFILLUA2_ubProfile; extern UINT16 PROFILLUA2_sSectorX; extern UINT16 PROFILLUA2_sSectorY; extern UINT8 PROFILLUA2_bSectorZ; -extern UINT8 PROFILLUA2_ubID; +extern UINT16 PROFILLUA2_ubID; extern UINT32 PROFILLUA2_sGridNo; extern BOOLEAN LetHandleLoyaltyChangeForNPCAction(UINT8 ubNPCProfileId , UINT8 Init); @@ -60,8 +60,9 @@ extern BOOLEAN LuaHandleQuestCodeOnSector( INT16 sSectorX, INT16 sSectorY, INT8 //extern BOOLEAN LuaHandleQuestCodeOnSectorEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 Init); void LuaHandleSectorLiberation( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fFirstTime ); -void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, - INT32 sGridNo, UINT8 bLevel, UINT8 ubId, +void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, + INT8 bSectorZ, + INT32 sGridNo, UINT8 bLevel, UINT16 ubId, UINT16 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ); void LuaRecruitRPCAdditionalHandling( UINT8 usProfile ); void LuaHandleSectorTacticalEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fHasEverBeenPlayerControlled ); diff --git a/Strategic/Map Screen Helicopter.cpp b/Strategic/Map Screen Helicopter.cpp index 59033941..a48f9a32 100644 --- a/Strategic/Map Screen Helicopter.cpp +++ b/Strategic/Map Screen Helicopter.cpp @@ -76,7 +76,7 @@ #define HELICOPTER_RETURN_REASON_DAMAGE 2 extern FACETYPE *gpCurrentTalkingFace; -extern UINT8 gubCurrentTalkingID; +extern UINT16 gubCurrentTalkingID; // current temp path for dest char extern PathStPtr pTempHelicopterPath; diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index dafeaf18..faea4fbc 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -205,7 +205,7 @@ INT32 iCurrentInventoryPoolPage = 0; INT32 iLastInventoryPoolPage = 0; INT32 sObjectSourceGridNo = -1;//shadooow: I don't see much of a sense in this, we have gpItemPointerSoldier and we can use gpItemPointerSoldier->sGridNo to do this, this is actually unused -INT8 sObjectSourseSoldierID = -1; +INT16 sObjectSourseSoldierID = -1; // number of unseen items in sector UINT32 uiNumberOfUnSeenItems = 0; diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 0f0619fa..e0645860 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -478,10 +478,10 @@ UINT32 guiMAPCURSORS; UINT32 guiMapPathingArrows; // assignment selection character -INT8 bSelectedAssignChar=-1; +INT16 bSelectedAssignChar=-1; // current contract char -INT8 bSelectedContractChar = -1; +INT16 bSelectedContractChar = -1; // has the temp path for character or helicopter been already drawn? @@ -604,11 +604,11 @@ BOOLEAN SaveHiddenTownToSaveGameFile( HWFILE hFile ); // Flugente: added getter/setter so that we can easily check when a new char is set // we also set a marker determining when we should update the squads data, so that we only check that when required // destination plotting character -INT8 bSelectedDestChar = -1; +INT16 bSelectedDestChar = -1; bool gSquadEncumbranceCheckNecessary = true; -INT8 GetSelectedDestChar() { return bSelectedDestChar; } -void SetSelectedDestChar( INT8 aVal ) +INT16 GetSelectedDestChar() { return bSelectedDestChar; } +void SetSelectedDestChar( INT16 aVal ) { bSelectedDestChar = aVal; gSquadEncumbranceCheckNecessary = true; diff --git a/Strategic/Map Screen Interface Map.h b/Strategic/Map Screen Interface Map.h index 2077ae18..f80ac677 100644 --- a/Strategic/Map Screen Interface Map.h +++ b/Strategic/Map Screen Interface Map.h @@ -372,19 +372,19 @@ extern BOOLEAN fDrawTempHeliPath; extern BOOLEAN fDrawTempMilitiaPath; // selected destination char -INT8 GetSelectedDestChar(); -void SetSelectedDestChar( INT8 aVal ); +INT16 GetSelectedDestChar(); +void SetSelectedDestChar( INT16 aVal ); extern bool gSquadEncumbranceCheckNecessary; // current assignment character -extern INT8 bSelectedAssignChar; +extern INT16 bSelectedAssignChar; // the info character -extern INT8 bSelectedInfoChar; +extern INT16 bSelectedInfoChar; // the contract char -extern INT8 bSelectedContractChar; +extern INT16 bSelectedContractChar; // map arrows graphical index value extern UINT32 guiMAPCURSORS; diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 40974757..4b90b9e5 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -70,8 +70,8 @@ extern UILayout_CharPanelIconRegion UI_CHAR_Icon; extern UILayout_CharList UI_CHARLIST; // marke strogg more mercs -extern UINT8 FIRSTmercTOdisplay = 0 ; -extern UINT8 maxNumberOfMercVisibleInStrategyList = 0; // WANNE: Max merc displayed in the list depends on the resolution +extern UINT16 FIRSTmercTOdisplay = 0 ; +extern UINT16 maxNumberOfMercVisibleInStrategyList = 0; // WANNE: Max merc displayed in the list depends on the resolution // inventory pool position on screen #define MAP_INVEN_POOL_X 300 @@ -227,7 +227,7 @@ extern UINT32 guiSAVEBUFFER; extern BOOLEAN fShowInventoryFlag; extern FACETYPE *gpCurrentTalkingFace; -extern UINT8 gubCurrentTalkingID; +extern UINT16 gubCurrentTalkingID; extern BOOLEAN fMapScreenBottomDirty; extern MOUSE_REGION gMPanelRegion; @@ -1355,7 +1355,7 @@ void HandleDisplayOfSelectedMercArrows( void ) { INT16 sYPosition = 0; HVOBJECT hHandle; - UINT8 ubCount = 0; + UINT16 ubCount = 0; UINT16 selectedCharArrowX = UI_CHARLIST.Region.x + 1; @@ -2119,8 +2119,8 @@ void FindAndSetThisContractSoldier( SOLDIERTYPE *pSoldier ) { if( gCharactersList[ iCounter].usSolID == pSoldier->ubID ) { - ChangeSelectedInfoChar( ( INT8 )iCounter, TRUE ); - bSelectedContractChar = ( INT8 )iCounter; + ChangeSelectedInfoChar( ( INT16 )iCounter, TRUE ); + bSelectedContractChar = ( INT16 )iCounter; fShowContractMenu = TRUE; // create @@ -2373,9 +2373,9 @@ void RandomMercInGroupSaysQuote( GROUP *pGroup, UINT16 usQuoteNum ) { PLAYERGROUP *pPlayer; SOLDIERTYPE *pSoldier; - UINT8 ubMercsInGroup[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + UINT16 ubMercsInGroup[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; // if traversing tactically, don't do this, unless time compression was required for some reason (don't go to sector) @@ -2406,7 +2406,7 @@ void RandomMercInGroupSaysQuote( GROUP *pGroup, UINT16 usQuoteNum ) // At least say quote.... if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ]; TacticalCharacterDialogue( pSoldier, usQuoteNum ); @@ -2454,7 +2454,7 @@ BOOLEAN ValidSelectableCharForNextOrPrev( INT32 iNewCharSlot ) if ( fShowInventoryFlag || fHoldingItem ) { // the new guy must have accessible inventory - if ( !MapCharacterHasAccessibleInventory( ( INT8 ) iNewCharSlot ) ) + if ( !MapCharacterHasAccessibleInventory( ( INT16 ) iNewCharSlot ) ) { return( FALSE ); } @@ -3761,60 +3761,67 @@ void CreatePopUpBoxForMovementBox( void ) // create the pop up box and mouse regions for movement list - // create basic box - CreatePopUpBox(&ghMoveBox, AssignmentDimensions, MovePosition, (POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); + // create basic box + CreatePopUpBox(&ghMoveBox, AssignmentDimensions, MovePosition, ( POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); - // which buffer will box render to - SetBoxBuffer(ghMoveBox, FRAME_BUFFER); + // which buffer will box render to + SetBoxBuffer(ghMoveBox, FRAME_BUFFER); - // border type? - SetBorderType(ghMoveBox,guiPOPUPBORDERS); + // border type? + SetBorderType(ghMoveBox,guiPOPUPBORDERS); - // background texture - SetBackGroundSurface(ghMoveBox, guiPOPUPTEX); + // background texture + SetBackGroundSurface(ghMoveBox, guiPOPUPTEX); - // margin sizes - SetMargins( ghMoveBox, 6, 6, 4, 4 ); + // margin sizes + SetMargins( ghMoveBox, 6, 6, 4, 4 ); - // space between lines - SetLineSpace(ghMoveBox, 2); + // space between lines + SetLineSpace(ghMoveBox, 2); - // set current box to this one - SetCurrentBox( ghMoveBox ); + // set current box to this one + SetCurrentBox( ghMoveBox ); - // add strings - AddStringsToMoveBox( ); + // add strings + AddStringsToMoveBox( ); - // set font type - SetBoxFont(ghMoveBox, MAP_SCREEN_FONT); + // set font type + SetBoxFont(ghMoveBox, MAP_SCREEN_FONT); - // set highlight color - SetBoxHighLight(ghMoveBox, FONT_WHITE); + // set highlight color + SetBoxHighLight(ghMoveBox, FONT_WHITE); - // unhighlighted color - SetBoxForeground(ghMoveBox, FONT_LTGREEN); + // unhighlighted color + SetBoxForeground(ghMoveBox, FONT_LTGREEN); - // make the header line WHITE - SetBoxLineForeground( ghMoveBox, 0, FONT_WHITE ); + // make the header line WHITE + SetBoxLineForeground( ghMoveBox, 0, FONT_WHITE ); - // make the done and cancel lines YELLOW - SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 1, FONT_YELLOW ); + // make the done and cancel lines YELLOW + SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 1, FONT_YELLOW ); if ( IsAnythingSelectedForMoving() ) { SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 2, FONT_YELLOW ); } - // background color - SetBoxBackground(ghMoveBox, FONT_BLACK); + // background color + SetBoxBackground(ghMoveBox, FONT_BLACK); - // shaded color..for darkened text - SetBoxShade( ghMoveBox, FONT_BLACK ); + // shaded color..for darkened text + SetBoxShade( ghMoveBox, FONT_BLACK ); + SetBoxSecondColumnForeground(ghMoveBox, FONT_LTGREEN); + SetBoxSecondColumnBackground(ghMoveBox, FONT_BLACK); + SetBoxSecondColumnHighLight(ghMoveBox, FONT_WHITE); + SetBoxSecondColumnShade(ghMoveBox, FONT_BLACK); + SetBoxSecondColumnFont(ghMoveBox, MAP_SCREEN_FONT); + SetBoxSecondColumnMinimumOffset(ghMoveBox, 1); + SetBoxSecondColumnOffsetAdjustment(ghMoveBox, -50); - // resize box to text - ResizeBoxToText( ghMoveBox ); + // resize box to text + ResizeBoxToText( ghMoveBox ); GetBoxPosition( ghMoveBox, &Position); GetBoxSize( ghMoveBox, &Dimensions ); @@ -3841,7 +3848,9 @@ void AddStringsToMoveBox( void ) CHAR16 sString[ 128 ], sStringB[ 128 ]; UINT32 hStringHandle; BOOLEAN fFirstOne = TRUE; - + const INT32 firstColumnMaxEntries = 4 * gGameOptions.ubSquadSize; + INT32 entries = 0; + bool isFirstColumnFull = false; // set the current box SetCurrentBox( ghMoveBox ); @@ -3854,16 +3863,19 @@ void AddStringsToMoveBox( void ) GetShortSectorString( sSelMapX, sSelMapY, sStringB ); swprintf( sString, L"%s %s", pMovementMenuStrings[ 0 ], sStringB ); AddMonoString(&hStringHandle, sString ); + AddSecondColumnMonoString(&hStringHandle, L""); // blank line AddMonoString(&hStringHandle, L"" ); + AddSecondColumnMonoString(&hStringHandle, L""); // add Select all line if (giNumberOfSquadsInSectorMoving > 1) { swprintf(sString, L"%s", pMovementMenuStrings[4]); AddMonoString(&hStringHandle, sString); + AddSecondColumnMonoString(&hStringHandle, L""); } @@ -3885,7 +3897,15 @@ void AddStringsToMoveBox( void ) else swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] ); } - AddMonoString(&hStringHandle, sString ); + if (!isFirstColumnFull) + { + AddMonoString(&hStringHandle, sString); + } + else + { + AddMonoStringToSecondColumn(&hStringHandle, sString ); + } + entries += 1; // now add all the grunts in it for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) @@ -3901,9 +3921,23 @@ void AddStringsToMoveBox( void ) { swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); } - AddMonoString(&hStringHandle, sString ); + + if (!isFirstColumnFull) + { + AddMonoString(&hStringHandle, sString); + } + else + { + AddMonoStringToSecondColumn(&hStringHandle, sString); + } + entries += 1; } } + + if (entries > firstColumnMaxEntries) + { + isFirstColumnFull = true; + } } @@ -4202,7 +4236,7 @@ void ClearMouseRegionsForMoveBox( void ) INT32 iCounter = 0; // run through list of mouse regions - for( iCounter = 0; iCounter < ( INT32 )GetNumberOfLinesOfTextInBox( ghMoveBox ); iCounter++ ) + for( iCounter = 0; iCounter < ( INT32 )(GetNumberOfLinesOfTextInBox( ghMoveBox ) + GetNumberOfSecondaryLinesOfTextInBox(ghMoveBox)); iCounter++) { // remove this region MSYS_RemoveRegion( &gMoveMenuRegion[ iCounter ] ); @@ -4647,11 +4681,11 @@ void HandleSettingTheSelectedListOfMercs( void ) // yes, then set them as the destination plotting character for movement arrow purposes fFirstOne = FALSE; - SetSelectedDestChar(( INT8 )iCounter ); + SetSelectedDestChar(( INT16 )iCounter ); // make DEST column glow giDestHighLine = iCounter; - ChangeSelectedInfoChar( ( INT8 ) iCounter, TRUE ); + ChangeSelectedInfoChar( ( INT16 ) iCounter, TRUE ); } // add this guy to the selected list of grunts @@ -6185,7 +6219,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber ( !pSoldier->flags.fBetweenSectors ) && gMercProfiles[ ELDIN ].bMercStatus != MERC_IS_DEAD ) { //DBrot: More Rooms - UINT8 /*ubRoom,*/ cnt; + UINT16 /*ubRoom,*/ cnt; UINT16 usRoom; SOLDIERTYPE * pSoldier2; diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 4e0ad4ed..69c19e3a 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -24,8 +24,8 @@ typedef struct FASTHELPREGION { // Flugente: externalised squad names extern std::vector gSquadNameVector; -extern UINT8 FIRSTmercTOdisplay ; -extern UINT8 maxNumberOfMercVisibleInStrategyList; +extern UINT16 FIRSTmercTOdisplay ; +extern UINT16 maxNumberOfMercVisibleInStrategyList; // String Lengths Defines #define MAX_NAME_LENGTH 10 diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index 18e812c3..69b1f419 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -286,7 +286,7 @@ void EndCurrentContractRenewal( ) } } -void HandleMercIsWillingToRenew( UINT8 ubID ) +void HandleMercIsWillingToRenew( UINT16 ubID ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; @@ -306,7 +306,7 @@ void HandleMercIsWillingToRenew( UINT8 ubID ) } -void HandleMercIsNotWillingToRenew( UINT8 ubID ) +void HandleMercIsNotWillingToRenew( UINT16 ubID ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; @@ -746,9 +746,9 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) void HandleBuddiesReactionToFiringMerc(SOLDIERTYPE *pFiredSoldier, INT8 bMoraleEvent ) { - INT8 bMercID; - INT8 bLastTeamID; - SOLDIERTYPE * pSoldier; + UINT16 bMercID; + UINT16 bLastTeamID; + SOLDIERTYPE * pSoldier; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -1456,9 +1456,9 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) SOLDIERTYPE *pSoldier = NULL, *pSoldierWhoWillQuit = NULL; INT32 iCounter= 0, iNumberOnTeam = 0; // WDS - make number of mercenaries, etc. be configurable - UINT8 ubPotentialMercs[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + UINT16 ubPotentialMercs[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; gfFirstMercSayQuote = FALSE; @@ -1538,7 +1538,7 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) // OK, pick one.... if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); HandleImportantMercQuote( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], QUOTE_CONTRACTS_OVER ); diff --git a/Strategic/Merc Contract.h b/Strategic/Merc Contract.h index 88a0fbfb..abfc0ec5 100644 --- a/Strategic/Merc Contract.h +++ b/Strategic/Merc Contract.h @@ -68,8 +68,8 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ); void BeginContractRenewalSequence( ); void HandleContractRenewalSequence( ); void EndCurrentContractRenewal( ); -void HandleMercIsWillingToRenew( UINT8 ubID ); -void HandleMercIsNotWillingToRenew( UINT8 ubID ); +void HandleMercIsWillingToRenew( UINT16 ubID ); +void HandleMercIsNotWillingToRenew( UINT16 ubID ); BOOLEAN ContractIsExpiring( SOLDIERTYPE *pSoldier ); UINT32 GetHourWhenContractDone( SOLDIERTYPE *pSoldier ); diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index f285cd2e..a3bacc9b 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -1728,7 +1728,7 @@ void RetreatMercsCallback( GUI_BUTTON *btn, INT32 reason ) { ///////////////////////////////////////////////////////////////////////////////// // SANDRO - merc records - times retreated counter - for( UINT8 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) + for( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) { if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife >= OKLIFE ) { diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index eb32fe44..0ecf8901 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -600,7 +600,7 @@ UINT8 NumFreeSlots( UINT8 ubTeam ) return ubNumFreeSlots; } - +#pragma optimize("",off) //Called when entering a sector so the campaign AI can automatically insert the //correct number of troops of each type based on the current number in the sector //in global focus (gWorldSectorX/Y) @@ -1152,7 +1152,7 @@ BOOLEAN PrepareEnemyForUndergroundBattle() Assert( FALSE ); return FALSE; } - +#pragma optimize("",on) //The queen AI layer must process the event by subtracting forces, etc. void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) { diff --git a/Strategic/Quest Debug System.cpp b/Strategic/Quest Debug System.cpp index 7a92c874..d4daf16c 100644 --- a/Strategic/Quest Debug System.cpp +++ b/Strategic/Quest Debug System.cpp @@ -2997,9 +2997,9 @@ void DestroyQuestDebugTextInputBoxes() void AddNPCToGridNo( INT32 iGridNo ) { - SOLDIERCREATE_STRUCT MercCreateStruct; - INT16 sSectorX, sSectorY; - UINT8 ubID; + SOLDIERCREATE_STRUCT MercCreateStruct; + INT16 sSectorX, sSectorY; + UINT16 ubID; GetCurrentWorldSector( &sSectorX, &sSectorY ); MercCreateStruct.bTeam = CIV_TEAM; @@ -3670,10 +3670,7 @@ void IncrementActiveDropDownBox( INT16 sIncrementValue ) INT16 IsMercInTheSector( UINT16 usMercID ) { - if( usMercID == -1 ) - return( FALSE ); - - UINT8 cnt; + UINT16 cnt; for ( cnt=0; cnt < TOTAL_SOLDIERS; cnt++ ) { //if the merc is active diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index d8fea66d..0f947a77 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -186,7 +186,7 @@ BOOLEAN CheckNPCWithin( UINT8 ubFirstNPC, UINT8 ubSecondNPC, UINT8 ubMaxDistance return( PythSpacesAway( pFirstNPC->sGridNo, pSecondNPC->sGridNo ) <= ubMaxDistance ); } -BOOLEAN CheckGuyVisible( UINT8 ubNPC, UINT8 ubGuy ) +BOOLEAN CheckGuyVisible( UINT16 ubNPC, UINT16 ubGuy ) { // NB ONLY WORKS IF ON DIFFERENT TEAMS SOLDIERTYPE * pNPC, * pGuy; @@ -304,12 +304,12 @@ UINT32 NumWoundedMercsNearby( UINT8 ubProfileID ) return( bNumber ); } -INT8 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist ) +UINT16 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist ) { - INT8 bNumber = 0; - UINT32 uiLoop; - SOLDIERTYPE * pNPC; - SOLDIERTYPE * pSoldier; + UINT16 bNumber = 0; + UINT32 uiLoop; + SOLDIERTYPE *pNPC; + SOLDIERTYPE *pSoldier; INT32 sGridNo; pNPC = FindSoldierByProfileID( ubProfileID, FALSE ); @@ -399,7 +399,7 @@ BOOLEAN PCInSameRoom( UINT8 ubProfileID ) //DBrot: More Rooms //UINT8 ubRoom; UINT16 usRoom; - INT8 bLoop; + UINT16 bLoop; SOLDIERTYPE * pSoldier; pNPC = FindSoldierByProfileID( ubProfileID, FALSE ); @@ -541,8 +541,8 @@ BOOLEAN FemalePresent( UINT8 ubProfileID ) BOOLEAN CheckPlayerHasHead( void ) { - INT8 bLoop; - SOLDIERTYPE * pSoldier; + UINT16 bLoop; + SOLDIERTYPE * pSoldier; for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLoop++ ) { @@ -1725,7 +1725,7 @@ void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpR { ScreenMsg( FONT_MCOLOR_LTBLUE, MSG_TESTVERSION, L"QUEST COMPLETED - Adding to merc records and awarding experiences (%d).", (bExpReward * gGameExternalOptions.usAwardSpecialExpForQuests) ); - for ( UINT8 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) + for ( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) { if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife >= CONSCIOUSNESS && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && MercPtrs[ i ]->ubProfile != NO_PROFILE && MercPtrs[ i ]->sSectorX == sQuestSectorX && MercPtrs[ i ]->sSectorY == sQuestsSectorY && !MercPtrs[ i ]->flags.fBetweenSectors && MercPtrs[ i ]->bTeam == gbPlayerNum && diff --git a/Strategic/Quests.h b/Strategic/Quests.h index f3a6b017..9ceab069 100644 --- a/Strategic/Quests.h +++ b/Strategic/Quests.h @@ -728,12 +728,12 @@ extern BOOLEAN CheckNPCWounded( UINT8 ubProfileID, BOOLEAN fByPlayerOnly ); extern BOOLEAN CheckNPCInOkayHealth( UINT8 ubProfileID ); extern BOOLEAN CheckNPCBleeding( UINT8 ubProfileID ); extern BOOLEAN CheckNPCWithin( UINT8 ubFirstNPC, UINT8 ubSecondNPC, UINT8 ubMaxDistance ); -extern BOOLEAN CheckGuyVisible( UINT8 ubNPC, UINT8 ubGuy ); +extern BOOLEAN CheckGuyVisible( UINT16 ubNPC, UINT16 ubGuy ); extern BOOLEAN CheckNPCAt( UINT8 ubNPC, INT32 sGridNo ); extern BOOLEAN CheckNPCIsEnemy( UINT8 ubProfileID ); extern BOOLEAN CheckIfMercIsNearNPC( SOLDIERTYPE *pMerc, UINT8 ubProfileId ); extern UINT32 NumWoundedMercsNearby( UINT8 ubProfileID ); -extern INT8 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist ); +extern UINT16 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist ); extern BOOLEAN CheckNPCIsEPC( UINT8 ubProfileID ); //DBrot: More Rooms //extern BOOLEAN NPCInRoom( UINT8 ubProfileID, UINT8 ubRoomID ); diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index f3843865..a3f36349 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -657,7 +657,7 @@ BOOLEAN SortSchedule( SCHEDULENODE *pSchedule ) BOOLEAN BumpAnyExistingMerc( INT32 sGridNo ) { - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; // NB this is the person already in the location, INT32 sNewGridNo; UINT8 ubDir; diff --git a/Strategic/Scheduling.h b/Strategic/Scheduling.h index aa80f5fb..084223fa 100644 --- a/Strategic/Scheduling.h +++ b/Strategic/Scheduling.h @@ -63,7 +63,7 @@ public: UINT32 usData2[MAX_SCHEDULE_ACTIONS]; // Secondary information, not used by most actions UINT8 ubAction[MAX_SCHEDULE_ACTIONS]; UINT8 ubScheduleID; - UINT8 ubSoldierID; + UINT16 ubSoldierID; UINT16 usFlags; public: SCHEDULENODE& operator=(const _OLD_SCHEDULENODE& src); diff --git a/Strategic/Strategic Event Handler.cpp b/Strategic/Strategic Event Handler.cpp index a1207084..266f159a 100644 --- a/Strategic/Strategic Event Handler.cpp +++ b/Strategic/Strategic Event Handler.cpp @@ -55,7 +55,7 @@ UINT32 guiPabloExtraDaysBribed = 0; UINT8 gubCambriaMedicalObjects; -extern INT8 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist ); +extern UINT16 NumMercsNear( UINT8 ubProfileID, UINT8 ubMaxDist ); extern SECTOR_EXT_DATA SectorExternalData[256][4]; diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index 6e131a77..e3541cf5 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -189,7 +189,7 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ) void MercDailyUpdate() { INT32 cnt; - INT8 bLastTeamID; + UINT16 bLastTeamID; SOLDIERTYPE *pSoldier; //SOLDIERTYPE *pQuitList[ 21 ]; MERCPROFILESTRUCT *pProfile; @@ -725,7 +725,7 @@ void HandleMercsAboutToLeave( SOLDIERTYPE *pMercList ) // ATE: This function deals with MERC MERC and NPC's leaving because of not getting paid... // NOT AIM renewals.... -void MercsContractIsFinished( UINT8 ubID ) +void MercsContractIsFinished( UINT16 ubID ) { SOLDIERTYPE *pSoldier; @@ -779,7 +779,7 @@ void MercsContractIsFinished( UINT8 ubID ) } // ATE: Called for RPCs who should now complain about no pay... -void RPCWhineAboutNoPay( UINT8 ubID ) +void RPCWhineAboutNoPay( UINT16 ubID ) { SOLDIERTYPE *pSoldier; @@ -908,17 +908,14 @@ void MercComplainAboutEquipment( UINT8 ubProfile ) void UpdateBuddyAndHatedCounters( void ) { - INT8 bMercID; - INT32 iLoop; - INT8 bOtherID; - INT8 bLastTeamID; - UINT8 ubOtherProfileID; - SOLDIERTYPE *pSoldier; - SOLDIERTYPE *pOtherSoldier; - MERCPROFILESTRUCT *pProfile; - BOOLEAN fSameGroupOnly; - - BOOLEAN fUpdatedTimeTillNextHatedComplaint = FALSE; + UINT16 bMercID, bOtherID, bLastTeamID; + INT32 iLoop; + UINT8 ubOtherProfileID; + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pOtherSoldier; + MERCPROFILESTRUCT *pProfile; + BOOLEAN fSameGroupOnly; + BOOLEAN fUpdatedTimeTillNextHatedComplaint = FALSE; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; @@ -1259,7 +1256,7 @@ void UpdateBuddyAndHatedCounters( void ) void HourlyCamouflageUpdate( void ) { - INT8 bMercID, bLastTeamID; + UINT16 bMercID, bLastTeamID; SOLDIERTYPE * pSoldier; BOOLEAN camoWoreOff = FALSE; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; diff --git a/Strategic/Strategic Merc Handler.h b/Strategic/Strategic Merc Handler.h index 838a24ab..2ea34e9f 100644 --- a/Strategic/Strategic Merc Handler.h +++ b/Strategic/Strategic Merc Handler.h @@ -6,8 +6,8 @@ class SOLDIERTYPE; void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ); void MercDailyUpdate(); -void MercsContractIsFinished( UINT8 ubID ); -void RPCWhineAboutNoPay( UINT8 ubID ); +void MercsContractIsFinished( UINT16 ubID ); +void RPCWhineAboutNoPay( UINT16 ubID ); void MercComplainAboutEquipment( UINT8 ubProfileID ); BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier ); void UpdateBuddyAndHatedCounters( void ); diff --git a/Strategic/Strategic Mines.cpp b/Strategic/Strategic Mines.cpp index 19816871..1e9f0f72 100644 --- a/Strategic/Strategic Mines.cpp +++ b/Strategic/Strategic Mines.cpp @@ -136,7 +136,7 @@ UINT8 gubMonsterMineInfestation[]={ // the static NPC dialogue faces //extern UINT32 uiExternalStaticNPCFaces[]; extern FACETYPE *gpCurrentTalkingFace; -extern UINT8 gubCurrentTalkingID; +extern UINT16 gubCurrentTalkingID; diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 67d0e69d..64693fc9 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -4366,7 +4366,7 @@ BOOLEAN LoadPlayerGroupList( HWFILE hFile, GROUP **pGroup ) //Should never happen Assert( sTempID != -1 ); - pTemp->ubID = (UINT8) sTempID; + pTemp->ubID = (UINT16) sTempID; pTemp->pSoldier = &Menptr[ pTemp->ubID ]; diff --git a/Strategic/Strategic Movement.h b/Strategic/Strategic Movement.h index d8bdfacd..58f95ade 100644 --- a/Strategic/Strategic Movement.h +++ b/Strategic/Strategic Movement.h @@ -52,7 +52,7 @@ typedef struct WAYPOINT typedef struct PLAYERGROUP { UINT8 ubProfileID; //SAVE THIS VALUE ONLY. The others are temp (for quick access) - UINT8 ubID; //index in the Menptr array + UINT16 ubID; //index in the Menptr array SOLDIERTYPE *pSoldier; //direct access to the soldier pointer UINT8 bFlags; //flags referring to individual player soldiers struct PLAYERGROUP *next; //next player in list diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 8fb982ad..802952d2 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -2133,9 +2133,9 @@ BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId ) UINT32 PlayerStrength( void ) { - UINT8 ubLoop; - SOLDIERTYPE * pSoldier; - UINT32 uiStrength, uiTotal = 0; + UINT16 ubLoop; + SOLDIERTYPE * pSoldier; + UINT32 uiStrength, uiTotal = 0; for ( ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++ ) { @@ -2155,9 +2155,9 @@ UINT32 PlayerStrength( void ) UINT32 EnemyStrength( void ) { - UINT8 ubLoop; - SOLDIERTYPE * pSoldier; - UINT32 uiStrength, uiTotal = 0; + UINT16 ubLoop; + SOLDIERTYPE * pSoldier; + UINT32 uiStrength, uiTotal = 0; for ( ubLoop = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) { diff --git a/Strategic/Strategic_VS2019.vcxproj b/Strategic/Strategic_VS2019.vcxproj index 4337e3f2..c87d17eb 100644 --- a/Strategic/Strategic_VS2019.vcxproj +++ b/Strategic/Strategic_VS2019.vcxproj @@ -175,67 +175,67 @@ StaticLibrary true NotSet - v142 + v143 StaticLibrary true NotSet - v142 + v143 StaticLibrary true NotSet - v142 + v143 StaticLibrary true NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 diff --git a/Strategic/Strategic_VS2019.vcxproj.user b/Strategic/Strategic_VS2019.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/Strategic/Strategic_VS2019.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index e9798e15..878484be 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -502,7 +502,7 @@ BOOLEAN gfMapPanelWasRedrawn = FALSE; UINT8 gubMAP_HandInvDispText[ NUM_INV_SLOTS ]; // currently selected character's list index -INT8 bSelectedInfoChar = -1; +INT16 bSelectedInfoChar = -1; // map sort button images INT32 giMapSortButtonImage[ MAX_SORT_METHODS ] = { -1, -1, -1, -1, -1, -1 }; @@ -926,7 +926,6 @@ INT32 GetIndexForthis( SOLDIERTYPE *pSoldier ); void CheckForAndRenderNewMailOverlay(); -BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber ); void CheckForInventoryModeCancellation(); void ChangeMapScreenMaskCursor( UINT16 usCursor ); @@ -1905,16 +1904,14 @@ BOOLEAN InitializeInvPanelCoordsRobot() } // the tries to select a mapscreen character by his soldier ID -BOOLEAN SetInfoChar( UINT8 ubID ) +BOOLEAN SetInfoChar( UINT16 ubID ) { - INT8 bCounter; - - for ( bCounter = 0; bCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++) + for (INT16 bCounter = 0; bCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++) { // skip invalid characters if ( gCharactersList[ bCounter ].fValid == TRUE ) { - if ( gCharactersList[ bCounter ].usSolID == (UINT16)ubID ) + if ( gCharactersList[ bCounter ].usSolID == ubID ) { ChangeSelectedInfoChar( bCounter, TRUE ); return( TRUE ); @@ -3985,7 +3982,7 @@ void AddCharacter( SOLDIERTYPE *pCharacter ) } // copy over soldier id value - gCharactersList[usCount].usSolID = ( UINT16 )pCharacter->ubID; + gCharactersList[usCount].usSolID = pCharacter->ubID; // valid character gCharactersList[usCount].fValid = TRUE; @@ -5338,9 +5335,19 @@ UINT32 MapScreenHandle(void) CreateMouseRegionForPauseOfClock( INTERFACE_CLOCK_X, INTERFACE_CLOCK_Y ); // WANNE: The number of merc we can display in the list, depends on the resolution - if (iResolution >= _640x480 && iResolution < _800x600) + if (isWidescreenUI()) { - maxNumberOfMercVisibleInStrategyList = 22; + if (giMAXIMUM_NUMBER_OF_PLAYER_SLOTS <= 57) + maxNumberOfMercVisibleInStrategyList = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; + else + maxNumberOfMercVisibleInStrategyList = 57; + } + else if (iResolution >= _1024x768) + { + if (giMAXIMUM_NUMBER_OF_PLAYER_SLOTS <= 51) + maxNumberOfMercVisibleInStrategyList = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; + else + maxNumberOfMercVisibleInStrategyList = 51; } else if (iResolution < _1024x768) { @@ -5348,10 +5355,7 @@ UINT32 MapScreenHandle(void) } else { - if (giMAXIMUM_NUMBER_OF_PLAYER_SLOTS <= 51) - maxNumberOfMercVisibleInStrategyList = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; - else - maxNumberOfMercVisibleInStrategyList = 51; + maxNumberOfMercVisibleInStrategyList = 22; } // create mouse regions @@ -7629,9 +7633,9 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if( gCharactersList[ giHighLine ].fValid == TRUE ) { - bSelectedAssignChar = ( INT8 )giHighLine; + bSelectedAssignChar = ( INT16 )giHighLine; RebuildAssignmentsBox( ); - ChangeSelectedInfoChar( ( INT8 ) giHighLine, FALSE ); + ChangeSelectedInfoChar( ( INT16 ) giHighLine, FALSE ); fShowAssignmentMenu = TRUE; } } @@ -7639,7 +7643,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - bSelectedAssignChar = ( INT8 )bSelectedInfoChar; + bSelectedAssignChar = bSelectedInfoChar; RebuildAssignmentsBox( ); fShowAssignmentMenu = TRUE; } @@ -11482,7 +11486,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) return; } - bSelectedAssignChar = ( INT8 ) iValue + FIRSTmercTOdisplay; + bSelectedAssignChar = ( INT16 ) iValue + FIRSTmercTOdisplay; RebuildAssignmentsBox( ); // reset dest character @@ -11740,7 +11744,7 @@ void TeamListDestinationRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // select this character as the one plotting strategic movement - SetSelectedDestChar( (INT8)iValue + FIRSTmercTOdisplay ); + SetSelectedDestChar( (INT16)iValue + FIRSTmercTOdisplay ); // remember the current paths for all selected characters so we can restore them if need be RememberPreviousPathForAllSelectedChars(); @@ -12793,7 +12797,7 @@ void ReBuildCharactersList( void ) void HandleChangeOfInfoChar( void ) { - static INT8 bOldInfoChar = -1; + static INT16 bOldInfoChar = -1; if( bSelectedInfoChar != bOldInfoChar ) { @@ -12849,7 +12853,7 @@ void TestMessageSystem( void ) void EnableDisableTeamListRegionsAndHelpText( void ) { // check if valid character here, if so, then do nothing..other wise set help text timer to a gazillion - INT8 bCharNum; + INT16 bCharNum; for( bCharNum = 0; bCharNum < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCharNum++ ) @@ -13004,10 +13008,10 @@ void UpdatePausedStatesDueToTimeCompression( void ) BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone ) { // continue this grunts dialogue, restore when done - static INT8 bOldSelectedInfoChar = -1; + static INT16 bOldSelectedInfoChar = -1; static BOOLEAN fTalkingingGuy = FALSE; - INT8 bCounter = 0; + UINT16 bCounter = 0; @@ -13665,9 +13669,9 @@ void UpdateStatusOfMapSortButtons( void ) -INT8 GetLastValidCharacterInTeamPanelList( void ) +INT16 GetLastValidCharacterInTeamPanelList( void ) { - INT8 iCounter = 0, iValue = 0; + INT16 iCounter = 0, iValue = 0; // run through the list and find the last valid guy in the list for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) @@ -14543,7 +14547,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse INT32 iCounter = 0, iCounterA = 0; INT16 sEndSectorA, sEndSectorB; INT32 iExpiryTime, iExpiryTimeA; - UINT8 uiID, uiIDA; + UINT16 uiID, uiIDA; SOLDIERTYPE *pSelectedSoldier[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; SOLDIERTYPE *pCurrentSoldier = NULL; SOLDIERTYPE *pPreviousSelectedInfoChar = NULL; @@ -15093,7 +15097,7 @@ BOOLEAN CanToggleSelectedCharInventory( void ) -BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber ) +BOOLEAN MapCharacterHasAccessibleInventory( INT16 bCharNumber ) { SOLDIERTYPE *pSoldier = NULL; @@ -15606,7 +15610,7 @@ INT32 GetContractExpiryTime( SOLDIERTYPE *pSoldier ) -void ChangeSelectedInfoChar( INT8 bCharNumber, BOOLEAN fResetSelectedList ) +void ChangeSelectedInfoChar( INT16 bCharNumber, BOOLEAN fResetSelectedList ) { Assert( ( bCharNumber >= -1 ) && ( bCharNumber < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); @@ -16177,10 +16181,10 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) SOLDIERTYPE *pSoldier = NULL; INT32 iCounter; // WDS - make number of mercenaries, etc. be configurable - UINT8 ubSelectedMercID[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; - UINT8 ubSelectedMercIndex[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + UINT16 ubSelectedMercID[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; + UINT16 ubSelectedMercIndex[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) @@ -16193,7 +16197,7 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) && !pSoldier->flags.fMercAsleep ) { ubSelectedMercID[ ubNumMercs ] = pSoldier->ubID; - ubSelectedMercIndex[ ubNumMercs ] = (UINT8)iCounter; + ubSelectedMercIndex[ ubNumMercs ] = (UINT16)iCounter; ubNumMercs++; } @@ -16202,7 +16206,7 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); // select that merc so that when he speaks we're showing his portrait and not someone else ChangeSelectedInfoChar( ubSelectedMercIndex[ ubChosenMerc ], FALSE ); diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index 16188e05..47ae7936 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -135,7 +135,7 @@ extern BOOLEAN gfInChangeArrivalSectorMode; extern BOOLEAN gfSkyriderEmptyHelpGiven; -BOOLEAN SetInfoChar(UINT8 ubSolId); +BOOLEAN SetInfoChar(UINT16 ubID); void EndMapScreen( BOOLEAN fDuringFade ); void ReBuildCharactersList( void ); @@ -152,7 +152,7 @@ BOOLEAN CanExtendContractForCharSlot( INT8 bCharNumber ); void TellPlayerWhyHeCantCompressTime( void ); -void ChangeSelectedInfoChar( INT8 bCharNumber, BOOLEAN fResetSelectedList ); +void ChangeSelectedInfoChar( INT16 bCharNumber, BOOLEAN fResetSelectedList ); void MAPEndItemPointer(); @@ -169,7 +169,7 @@ void ExplainWhySkyriderCantFly( void ); BOOLEAN CanChangeSleepStatusForCharSlot( INT8 bCharNumber ); BOOLEAN CanChangeSleepStatusForSoldier( SOLDIERTYPE *pSoldier ); -BOOLEAN MapCharacterHasAccessibleInventory( INT8 bCharNumber ); +BOOLEAN MapCharacterHasAccessibleInventory( INT16 bCharNumber ); // CHRISL: New functions to handle initialization of inventory coordinates BOOLEAN InitializeInvPanelCoordsOld( ); diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 03a881c7..47083f91 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -2058,7 +2058,7 @@ void GetCurrentWorldSector( INT16 *psMapX, INT16 *psMapY ) } //not in overhead.h! -extern UINT8 NumEnemyInSector( ); +extern UINT16 NumEnemyInSector( ); void HandleRPCDescriptionOfSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) { @@ -2777,7 +2777,7 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN //UINT8 ubRandomMiner[RANDOM_HEAD_MINERS] = { 106, 156, 157, 158 }; //UINT8 ubMiner, ubMinersPlaced, ubMine; UINT8 ubThisMine; - UINT8 cnt; + UINT16 cnt; SOLDIERTYPE * pSoldier; // are we in a mine sector, on the surface? @@ -4063,7 +4063,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32 // Set initial selected // ATE: moved this towards top... - gubPreferredInitialSelectedGuy = (UINT8)gusSelectedSoldier; + gubPreferredInitialSelectedGuy = gusSelectedSoldier; if ( ubJumpCode == JUMP_ALL_LOAD_NEW || ubJumpCode == JUMP_ALL_NO_LOAD ) { diff --git a/Tactical/Air Raid.cpp b/Tactical/Air Raid.cpp index 7fae23ba..9ecf6bb1 100644 --- a/Tactical/Air Raid.cpp +++ b/Tactical/Air Raid.cpp @@ -310,9 +310,9 @@ BOOLEAN BeginAirRaid( ) INT32 PickLocationNearAnyMercInSector( ) { - UINT8 ubMercsInSector[ 20 ] = { 0 }; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + UINT16 ubMercsInSector[ 20 ] = { 0 }; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt=0; @@ -330,7 +330,7 @@ INT32 PickLocationNearAnyMercInSector( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: looping %d",cnt)); if ( OK_INSECTOR_MERC( pTeamSoldier ) ) { - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ubNumMercs++; } } @@ -339,7 +339,7 @@ INT32 PickLocationNearAnyMercInSector( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: number of guys %d",ubNumMercs)); if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: chosen guy = %d",ubChosenMerc)); return( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->sGridNo ); @@ -1007,7 +1007,7 @@ void DoBombing( ) } // Drop bombs... - InternalIgniteExplosion( NOBODY, CenterX( sBombGridNo ), CenterY( sBombGridNo ), 0, sBombGridNo, usItem, fLocate , (UINT8)IsRoofPresentAtGridNo( sBombGridNo ) ); + InternalIgniteExplosion( NOBODY, CenterX( sBombGridNo ), CenterY( sBombGridNo ), 0, sBombGridNo, usItem, fLocate, (UINT8)IsRoofPresentAtGridNo( sBombGridNo ) ); } diff --git a/Tactical/Animation Data.cpp b/Tactical/Animation Data.cpp index 89222898..63cd8310 100644 --- a/Tactical/Animation Data.cpp +++ b/Tactical/Animation Data.cpp @@ -917,7 +917,7 @@ BOOLEAN DeInitAnimationSystem( ) -STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( UINT8 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState, BOOLEAN fUseAbsolute ) +STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState, BOOLEAN fUseAbsolute ) { INT8 bStructDataType; @@ -946,13 +946,13 @@ STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( UINT8 usSoldierID, UINT16 } -STRUCTURE_FILE_REF *GetAnimationStructureRef( UINT8 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ) +STRUCTURE_FILE_REF *GetAnimationStructureRef( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ) { return( InternalGetAnimationStructureRef( usSoldierID, usSurfaceIndex, usAnimState, FALSE ) ); } -STRUCTURE_FILE_REF *GetDefaultStructureRef( UINT8 usSoldierID ) +STRUCTURE_FILE_REF *GetDefaultStructureRef( UINT16 usSoldierID ) { return( gAnimStructureDatabase[ MercPtrs[ usSoldierID ]->ubBodyType ][ DEFAULT_STRUCT ].pStructureFileRef ); } diff --git a/Tactical/Animation Data.h b/Tactical/Animation Data.h index f194748c..9d6dc7e7 100644 --- a/Tactical/Animation Data.h +++ b/Tactical/Animation Data.h @@ -696,8 +696,8 @@ void ClearAnimationSurfacesUsageHistory( UINT16 usSoldierID ); void DeleteAnimationProfiles( ); BOOLEAN LoadAnimationProfiles( ); -STRUCTURE_FILE_REF *GetAnimationStructureRef( UINT8 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); -STRUCTURE_FILE_REF *GetDefaultStructureRef( UINT8 usSoldierID ); +STRUCTURE_FILE_REF *GetAnimationStructureRef( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); +STRUCTURE_FILE_REF *GetDefaultStructureRef( UINT16 usSoldierID ); // Profile data extern ANIM_PROF *gpAnimProfiles; diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index 4cc5d083..7c5dd899 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -1818,7 +1818,7 @@ void RemoveRandomItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemI } -BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT8 aMercID ) +BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT16 aMercID ) { //Get Dealer ID from from merc Id INT8 bArmsDealer = GetArmsDealerIDFromMercID( usProfileID ); diff --git a/Tactical/Arms Dealer Init.h b/Tactical/Arms Dealer Init.h index cccc3af2..1212f9c7 100644 --- a/Tactical/Arms Dealer Init.h +++ b/Tactical/Arms Dealer Init.h @@ -366,7 +366,7 @@ UINT32 GetTimeToFixItemBeingRepaired( UINT8 ubArmsDealer, UINT16 usItemIndex, UI BOOLEAN CanDealerTransactItem( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ); -BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT8 aMercID ); +BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT16 aMercID ); void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE *pObject ); void CreateObjectForDealer( int usItem, int status, int numObjects, OBJECTTYPE *pObject ); diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index b254fb02..bd5e2309 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -89,7 +89,7 @@ BOOLEAN RemoveFacesForAutoBandage( void ); extern BOOLEAN CanCharacterAutoBandageTeammate( SOLDIERTYPE *pSoldier ); extern BOOLEAN CanCharacterBeAutoBandagedByTeammate( SOLDIERTYPE *pSoldier ); -extern UINT8 NumEnemyInSector( ); +extern UINT16 NumEnemyInSector( ); void BeginAutoBandage( ) { @@ -316,7 +316,7 @@ BOOLEAN CreateAutoBandageString( void ) { INT32 cnt; // WDS - make number of mercenaries, etc. be configurable - UINT8 ubDoctor[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS], ubDoctors = 0; + UINT16 ubDoctor[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS], ubDoctors = 0; UINT32 uiDoctorNameStringLength = 1; // for end-of-string character STR16 sTemp; SOLDIERTYPE * pSoldier; @@ -399,7 +399,7 @@ void SetAutoBandageComplete( void ) void AutoBandage( BOOLEAN fStart ) { SGPRect aRect; - UINT8 ubLoop; + UINT16 ubLoop; INT32 cnt; SOLDIERTYPE * pSoldier; diff --git a/Tactical/Boxing.cpp b/Tactical/Boxing.cpp index 6ff8f35d..3c79b2d5 100644 --- a/Tactical/Boxing.cpp +++ b/Tactical/Boxing.cpp @@ -28,7 +28,7 @@ #endif INT32 gsBoxerGridNo[ NUM_BOXERS ] = { 11393, 11233, 11073 }; -UINT8 gubBoxerID[ NUM_BOXERS ] = { NOBODY, NOBODY, NOBODY }; +UINT16 gubBoxerID[ NUM_BOXERS ] = { NOBODY, NOBODY, NOBODY }; BOOLEAN gfBoxerFought[ NUM_BOXERS ] = { FALSE, FALSE, FALSE }; BOOLEAN gfLastBoxingMatchWonByPlayer = FALSE; UINT8 gubBoxingMatchesWon = 0; @@ -331,7 +331,7 @@ void CountPeopleInBoxingRingAndDoActions( void ) BOOLEAN CheckOnBoxers( void ) { UINT32 uiLoop; - UINT8 ubID; + UINT16 ubID; // repick boxer IDs every time if ( gubBoxerID[0] == NOBODY ) @@ -482,9 +482,9 @@ BOOLEAN AnotherFightPossible( void ) // a player has at least OKLIFE + 5 life // and at least one fight HAS occurred - UINT8 ubLoop; - SOLDIERTYPE * pSoldier; - UINT8 ubAvailable; + UINT16 ubLoop; + SOLDIERTYPE * pSoldier; + UINT8 ubAvailable; ubAvailable = BoxersAvailable(); diff --git a/Tactical/Boxing.h b/Tactical/Boxing.h index 89787494..4d4abf6e 100644 --- a/Tactical/Boxing.h +++ b/Tactical/Boxing.h @@ -20,7 +20,7 @@ enum DisqualificationReasons } ; extern INT32 gsBoxerGridNo[ NUM_BOXERS ]; -extern UINT8 gubBoxerID[ NUM_BOXERS ]; +extern UINT16 gubBoxerID[ NUM_BOXERS ]; extern BOOLEAN gfBoxerFought[ NUM_BOXERS ]; extern INT8 gbBoxingState; extern BOOLEAN gfLastBoxingMatchWonByPlayer; diff --git a/Tactical/Bullets.h b/Tactical/Bullets.h index db087445..2cd3e602 100644 --- a/Tactical/Bullets.h +++ b/Tactical/Bullets.h @@ -30,8 +30,8 @@ typedef struct LEVELNODE* pNodes[BULLET_TRACER_MAX_LENGTH]; //afp-end INT32 iBullet; - UINT8 ubFirerID; - UINT8 ubTargetID; + UINT16 ubFirerID; + UINT16 ubTargetID; INT8 bStartCubesAboveLevelZ; INT8 bEndCubesAboveLevelZ; INT32 sGridNo; @@ -83,7 +83,7 @@ typedef struct extern UINT32 guiNumBullets; -INT32 CreateBullet( UINT8 ubFirer, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ); +INT32 CreateBullet( UINT16 ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ); void RemoveBullet( INT32 iBullet ); void StopBullet( INT32 iBullet ); void UpdateBullets( ); diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 770ebc64..a31dbd56 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1837,7 +1837,7 @@ void TestDumpStatChanges(void) void AwardExperienceBonusToActiveSquad( UINT8 ubExpBonusType ) { UINT16 usXPs = 0; - UINT8 ubGuynum; + UINT16 ubGuynum; SOLDIERTYPE *pSoldier; diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 11318873..38b3d2af 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -1127,7 +1127,7 @@ BOOLEAN LoadCivQuotesFromLoadGameFile( HWFILE hFile ) return( TRUE ); } //-------------------------------------------------------------- - +#pragma optimize("", off) // anv: start enemy taunt with probabilty depending on taunt settings void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 uiTargetID ) { @@ -1342,6 +1342,7 @@ void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 ui StartEnemyTaunt( pCiv, iTauntType, pTarget ); } +#pragma optimize("", on) // SANDRO - soldier taunts void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTarget ) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 2d2efb52..e9c5576f 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -176,7 +176,7 @@ UINT8 gubNumStopTimeQuotes = 2; #define INITIAL_Q_SIZE 10 HQUEUE ghDialogueQ = NULL; FACETYPE *gpCurrentTalkingFace = NULL; -UINT8 gubCurrentTalkingID = NO_PROFILE; +UINT16 gubCurrentTalkingID = NO_PROFILE; INT8 gbUIHandlerID; INT32 giNPCReferenceCount = 0; @@ -763,7 +763,7 @@ void HandleDialogue( ) { SOLDIERTYPE * pMike; INT32 sPlayerGridNo; - UINT8 ubPlayerID; + UINT16 ubPlayerID; pMike = FindSoldierByProfileID( MIKE, FALSE ); if ( pMike ) @@ -949,11 +949,11 @@ void HandleDialogue( ) } else if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_CONTRACT_WANTS_TO_RENEW ) { - HandleMercIsWillingToRenew( (UINT8)QItem->uiSpecialEventData ); + HandleMercIsWillingToRenew( (UINT16)QItem->uiSpecialEventData ); } else if ( QItem->uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_CONTRACT_NOGO_TO_RENEW ) { - HandleMercIsNotWillingToRenew( (UINT8)QItem->uiSpecialEventData ); + HandleMercIsNotWillingToRenew( (UINT16)QItem->uiSpecialEventData ); } else { @@ -2061,7 +2061,7 @@ BOOLEAN SpecialCharacterDialogueEventWithExtraParam( UINT32 uiSpecialEventFlag, } extern INT8 gbSelectedArmsDealerID; -extern UINT8 gusIDOfCivTrader; +extern UINT16 gusIDOfCivTrader; BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 iFaceIndex, UINT8 bUIHandlerID, BOOLEAN fFromSoldier ) { @@ -3176,8 +3176,8 @@ void HandleDialogueEnd( FACETYPE *pFace ) SOLDIERTYPE *pSoldier = FindSoldierByProfileID( gTacticalStatus.ubLastQuoteProfileNUm, FALSE ); if ( pSoldier ) { - UINT8 ubSeenEnemies[ MAX_NUM_SOLDIERS ]; - UINT8 ubSeenEnemiesCnt = 0; + UINT16 ubSeenEnemies[ MAX_NUM_SOLDIERS ]; + UINT16 ubSeenEnemiesCnt = 0; switch( gTacticalStatus.ubLastQuoteSaid ) { case QUOTE_CLOSE_CALL: @@ -3188,7 +3188,7 @@ void HandleDialogueEnd( FACETYPE *pFace ) break; default: // select random enemy, who we see, who sees us and isn't deaf - for(UINT8 cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID ; cnt++ ) + for(UINT16 cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID ; cnt++ ) { if( MercPtrs[cnt] != NULL && MercPtrs[cnt]->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY && MercPtrs[pSoldier->ubID]->aiData.bOppList[cnt] == SEEN_CURRENTLY && !( MercPtrs[cnt]->bDeafenedCounter > 0 ) ) @@ -3359,9 +3359,9 @@ void RenderSubtitleBoxOverlay( VIDEO_OVERLAY *pBlitter ) void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) { // WDS - make number of mercenaries, etc. be configurable - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS, 0); - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS, 0); + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt; @@ -3395,7 +3395,7 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) #endif } - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ubNumMercs++; } } @@ -3403,7 +3403,7 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); // If we are air raid, AND red exists somewhere... if ( usQuoteNum == QUOTE_AIR_RAID ) @@ -3412,7 +3412,7 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) { if ( ubMercsInSector[ cnt ] == 11 ) { - ubChosenMerc = (UINT8)cnt; + ubChosenMerc = (UINT16)cnt; break; } } @@ -3447,7 +3447,7 @@ void SayQuoteFromAnyBodyInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSect // Add guy if he's a candidate... if( pTeamSoldier->sSectorX == sSectorX && pTeamSoldier->sSectorY == sSectorY && pTeamSoldier->bSectorZ == bSectorZ && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ++ubNumMercs; } } @@ -3481,9 +3481,9 @@ void SayQuoteFromAnyBodyInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSect void SayQuoteFromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQuoteNum ) { // WDS - make number of mercenaries, etc. be configurable - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0 ); - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0 ); + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt; @@ -3503,7 +3503,7 @@ void SayQuoteFromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQuo { continue; } - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ubNumMercs++; } } @@ -3511,7 +3511,7 @@ void SayQuoteFromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQuo // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); if (usQuoteNum == 66) { @@ -3526,9 +3526,9 @@ void SayQuoteFromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQuo void SayQuote58FromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQuoteNum, INT8 bSex ) { // WDS - make number of mercenaries, etc. be configurable - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; @@ -3553,7 +3553,7 @@ void SayQuote58FromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQ continue; } - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ++ubNumMercs; } } @@ -3561,7 +3561,7 @@ void SayQuote58FromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQ // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); TacticalCharacterDialogue( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ], usQuoteNum ); } } diff --git a/Tactical/DynamicDialogue.cpp b/Tactical/DynamicDialogue.cpp index 68b69b1d..dd363506 100644 --- a/Tactical/DynamicDialogue.cpp +++ b/Tactical/DynamicDialogue.cpp @@ -1105,7 +1105,7 @@ void SetfDynamicOpinionSpeechInProgress( BOOLEAN aVal ) } -void AddOpinionEvent( UINT8 usProfileA, UINT8 usProfileB, UINT8 usEvent, BOOLEAN fStartDialogue ) +void AddOpinionEvent( UINT16 usProfileA, UINT16 usProfileB, UINT8 usEvent, BOOLEAN fStartDialogue ) { if ( usProfileA == NO_PROFILE || usProfileB == NO_PROFILE ) return; @@ -1669,10 +1669,9 @@ void RolloverDynamicOpinions( UINT8 usProfileA ) // check wether other people are friends with someone else we hate. All persons must be in Arulco void CheckForFriendsofHated( SOLDIERTYPE* pSoldier ) { - INT8 bMercID, bOtherID, bThirdID; + UINT16 bMercID, bOtherID, bThirdID, bLastTeamID; INT8 bOpinion = -1; INT8 bSecondOpinion = -1; - INT8 bLastTeamID; SOLDIERTYPE* pOtherSoldier; SOLDIERTYPE* pThirdSoldier; diff --git a/Tactical/DynamicDialogue.h b/Tactical/DynamicDialogue.h index 2eca4b6b..262fde2b 100644 --- a/Tactical/DynamicDialogue.h +++ b/Tactical/DynamicDialogue.h @@ -452,7 +452,7 @@ BOOLEAN LoadDynamicDialogue( HWFILE hwFile ); // modify usProfileA's opinion of usProfileB because of usEvent -void AddOpinionEvent( UINT8 usProfileA, UINT8 usProfileB, UINT8 usEvent, BOOLEAN fStartDialogue = TRUE ); +void AddOpinionEvent( UINT16 usProfileA, UINT16 usProfileB, UINT8 usEvent, BOOLEAN fStartDialogue = TRUE ); // get usProfileA's opinion of usProfileB on one of the last 4 days INT8 GetDynamicOpinionDay( UINT8 usProfileA, UINT8 usProfileB, UINT8 usDay ); diff --git a/Tactical/End Game.cpp b/Tactical/End Game.cpp index 93e5da86..cc95371f 100644 --- a/Tactical/End Game.cpp +++ b/Tactical/End Game.cpp @@ -182,7 +182,7 @@ void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLev { SOLDIERTYPE *pTeamSoldier; INT32 cnt; - UINT8 ubKillerSoldierID = NOBODY; + UINT16 ubKillerSoldierID = NOBODY; // Start victory music here... SetMusicMode( MUSIC_TACTICAL_VICTORY ); @@ -673,7 +673,7 @@ void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT { // gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( "Killing off a queen ally.\n"); - pTeamSoldier->EVENT_SoldierGotHit( 0, 10000, 0, pTeamSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE ); + pTeamSoldier->EVENT_SoldierGotHit( 0, 10000, 0, pTeamSoldier->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, pTeamSoldier->bAimShotLocation, 0, NOWHERE ); } } } @@ -685,7 +685,7 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLe { SOLDIERTYPE *pTeamSoldier; INT32 cnt; - UINT8 ubKillerSoldierID = NOBODY; + UINT16 ubKillerSoldierID = NOBODY; // Start victory music here... SetMusicMode( MUSIC_TACTICAL_VICTORY ); diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index f1c8c658..28f01135 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -50,8 +50,6 @@ #endif // Defines -#define NUM_FACE_SLOTS 50 - #define END_FACE_OVERLAY_DELAY 2000 @@ -135,7 +133,7 @@ INT32 InitSoldierFace( SOLDIERTYPE *pSoldier ) } -INT32 InitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitFlags ) +INT32 InitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags ) { UINT32 uiBlinkFrequency; UINT32 uiExpressionFrequency; @@ -162,7 +160,7 @@ INT32 InitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitFlags ) } -INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ) +INT32 InternalInitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ) { FACETYPE *pFace; VOBJECT_DESC VObjectDesc; @@ -557,7 +555,7 @@ void DeleteFace( INT32 iFaceIndex ) } -void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, UINT8 ubSoldierID , UINT16 usFaceX, UINT16 usFaceY ) +void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, UINT16 ubSoldierID, UINT16 usFaceX, UINT16 usFaceY ) { if( ubSoldierID == NOBODY ) { @@ -761,7 +759,7 @@ void InternalSetAutoFaceActive( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, } -void SetAutoFaceInActiveFromSoldier( UINT8 ubSoldierID ) +void SetAutoFaceInActiveFromSoldier( UINT16 ubSoldierID ) { // Check for valid soldier CHECKV( ubSoldierID != NOBODY ); @@ -1349,7 +1347,7 @@ void SetFaceShade( SOLDIERTYPE *pSoldier, FACETYPE *pFace, BOOLEAN fExternBlit ) } } -BOOLEAN RenderAutoFaceFromSoldier( UINT8 ubSoldierID ) +BOOLEAN RenderAutoFaceFromSoldier( UINT16 ubSoldierID ) { // Check for valid soldier CHECKF( ubSoldierID != NOBODY ); @@ -2107,10 +2105,10 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // Flugente: are we supplying ammo to someone else? if (gGameExternalOptions.ubExternalFeeding > 0) { - UINT8 ubID1 = 0; + UINT16 ubID1 = 0; UINT16 ubGunSlot1 = 0; UINT16 ubFaceSlot1 = 0; - UINT8 ubID2 = 0; + UINT16 ubID2 = 0; UINT16 ubGunSlot2 = 0; UINT16 ubFaceSlot2 = 0; if (MercPtrs[pFace->ubSoldierID]->IsFeedingExternal(&ubID1, &ubGunSlot1, &ubFaceSlot1, &ubID2, &ubGunSlot2, &ubFaceSlot2)) @@ -2640,7 +2638,7 @@ BOOLEAN RenderAutoFace( INT32 iFaceIndex ) } -BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, UINT8 ubSoldierID, INT16 sX, INT16 sY ) +BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, UINT16 ubSoldierID, INT16 sX, INT16 sY ) { // Check for valid soldier CHECKF( ubSoldierID != NOBODY ); diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 07172191..7f7a995e 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -105,7 +105,7 @@ BOOLEAN DoesSoldierRefuseToEat( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj ) if ( UsingFoodSystem() ) { // static variables to remember the last food someone was forced to eat - static UINT8 lasteater = 0; + static UINT16 lasteater = 0; static UINT16 lastitem = 0; UINT32 foodtype = Item[pObj->usItem].foodtype; @@ -765,8 +765,8 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) void HourlyFoodUpdate( void ) { - INT8 bMercID, bLastTeamID; - SOLDIERTYPE * pSoldier = NULL; + UINT16 bMercID, bLastTeamID; + SOLDIERTYPE * pSoldier = NULL; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; @@ -831,8 +831,8 @@ void SectorFillCanteens( void ) addtemperature = FOOD_WATER_POISONOUS_TEMPERATURE; // first step: fill all canteens in inventories - INT8 bMercID, bLastTeamID; - SOLDIERTYPE * pSoldier = NULL; + UINT16 bMercID, bLastTeamID; + SOLDIERTYPE * pSoldier = NULL; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; @@ -905,8 +905,8 @@ void SectorFillCanteens( void ) INT32 drumsize = Food[Item[pWaterDrum->usItem].foodtype].bDrinkPoints; // first step: fill all canteens in inventories - INT8 bMercID, bLastTeamID; - SOLDIERTYPE * pSoldier = NULL; + UINT16 bMercID, bLastTeamID; + SOLDIERTYPE * pSoldier = NULL; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index 2c0b4fc8..34e7f81c 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -443,10 +443,8 @@ void ProcessImplicationsOfPCMessingWithDoor( SOLDIERTYPE * pSoldier ) // if player is hacking at a door in the brothel and a kingpin guy can see him if ( (InARoom( pSoldier->sGridNo, &usRoom ) && IN_BROTHEL( usRoom )) || (gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_D && gbWorldSectorZ == 0 && (pSoldier->sGridNo == gModSettings.iBrothelDoor1 || pSoldier->sGridNo == gModSettings.iBrothelDoor2 || pSoldier->sGridNo == gModSettings.iBrothelDoor3 ) ) )//11010,11177,11176 { - UINT8 ubLoop; - // see if a kingpin goon can see us - for ( ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) + for (UINT16 ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) { pGoon = MercPtrs[ ubLoop ]; if ( pGoon->ubCivilianGroup == KINGPIN_CIV_GROUP && pGoon->bActive && pGoon->bInSector && pGoon->stats.bLife >= OKLIFE && pGoon->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 7f2ee470..2cf29c80 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -1023,7 +1023,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[usHandItem].toolkit ) { - UINT8 ubMercID; + UINT16 ubMercID; BOOLEAN fVehicle = FALSE; INT32 sVehicleGridNo=-1; @@ -1096,7 +1096,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[usHandItem].gascan ) { - UINT8 ubMercID; + UINT16 ubMercID; INT32 sVehicleGridNo=-1; // For repair, check if we are over a vehicle, then get gridnot to edge of that vehicle! @@ -1390,7 +1390,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - UINT8 ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); + UINT16 ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); // Flugente: apply misc items to other soldiers // sevenfm: check that target soldier is visible @@ -2133,7 +2133,7 @@ void SoldierHandleDropItem( SOLDIERTYPE *pSoldier ) } } - AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); + AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); NotifySoldiersToLookforItems( ); OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); @@ -2376,7 +2376,7 @@ void HandleAutoPlaceFail( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGridNo else { // Add back to world... - AddItemToPool( sGridNo, &(gWorldItems[ iItemIndex ].object ), 1 , pSoldier->pathing.bLevel, 0, -1 ); + AddItemToPool( sGridNo, &(gWorldItems[ iItemIndex ].object ), 1, pSoldier->pathing.bLevel, 0, -1 ); // If we are a merc, say DAMN quote.... if ( pSoldier->bTeam == gbPlayerNum ) @@ -2944,17 +2944,17 @@ void RemoveItemGraphicFromWorld( INVTYPE *pItem, INT32 sGridNo, UINT8 ubLevel, L } // INVENTORY POOL STUFF -OBJECTTYPE* AddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID ) +OBJECTTYPE* AddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID) { return InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, soldierID, NULL ); } -OBJECTTYPE * AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ) +OBJECTTYPE * AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ) { return( InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, soldierID, piItemIndex ) ); } -OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ) +OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ) { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; @@ -4816,7 +4816,7 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) INT32 sGridNo; UINT8 ubDirection; - UINT8 ubTargetMercID; + UINT16 ubTargetMercID; // DO SOME CHECKS IF WE CAN DO ANIMATION..... @@ -4825,7 +4825,7 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) sGridNo = pSoldier->aiData.sPendingActionData2; ubDirection = pSoldier->aiData.bPendingActionData3; - ubTargetMercID = (UINT8)pSoldier->aiData.uiPendingActionData4; + ubTargetMercID = (UINT16)pSoldier->aiData.uiPendingActionData4; usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); @@ -4851,7 +4851,7 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) { if ( pSoldier->pTempObject != NULL ) { - AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); + AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); // Place it on the ground! ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ITEM_HAS_BEEN_PLACED_ON_GROUND_STR ], ShortItemNames[ pSoldier->pTempObject->usItem ] ); @@ -4881,7 +4881,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) INT32 sGridNo; UINT8 ubDirection; - UINT8 ubTargetMercID; + UINT16 ubTargetMercID; UINT16 usItemNum; BOOLEAN fToTargetPlayer = FALSE; @@ -4910,7 +4910,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) sGridNo = pSoldier->aiData.sPendingActionData2; ubDirection = pSoldier->aiData.bPendingActionData3; - ubTargetMercID = (UINT8)pSoldier->aiData.uiPendingActionData4; + ubTargetMercID = (UINT16)pSoldier->aiData.uiPendingActionData4; // ATE: Deduct APs! DeductPoints( pSoldier, GetBasicAPsToPickupItem( pSoldier ), 0 ); // SANDRO @@ -5004,7 +5004,7 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } - AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0 , -1 ); + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); // We could not place it! // Drop it on the ground? @@ -5081,7 +5081,7 @@ INT32 AdjustGridNoForItemPlacement( SOLDIERTYPE *pSoldier, INT32 sGridNo ) BOOLEAN fStructFound = FALSE; UINT8 ubDirection; INT32 sAdjustedGridNo; - UINT8 ubTargetID; + UINT16 ubTargetID; sActionGridNo = sGridNo; @@ -6169,7 +6169,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) { // OJW - 20091029 - disarm explosives if (is_networked && is_client) - send_disarm_explosive( gsBoobyTrapGridNo , gpBoobyTrapItemPool->iItemIndex , gpBoobyTrapSoldier->ubID ); + send_disarm_explosive( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gpBoobyTrapSoldier->ubID ); // remove it from the ground RemoveItemFromPool( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gbBoobyTrapLevel ); } @@ -6191,7 +6191,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) // OJW - 20091029 - disarm explosives if (is_networked && is_client) - send_disarm_explosive( gsBoobyTrapGridNo , gpBoobyTrapItemPool->iItemIndex , gpBoobyTrapSoldier->ubID ); + send_disarm_explosive( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gpBoobyTrapSoldier->ubID ); RemoveItemFromPool( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gbBoobyTrapLevel ); } @@ -6208,7 +6208,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) } // OJW - 20091029 - disarm explosives if (is_networked && is_client) - send_disarm_explosive( gsBoobyTrapGridNo , gpBoobyTrapItemPool->iItemIndex , gpBoobyTrapSoldier->ubID ); + send_disarm_explosive( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gpBoobyTrapSoldier->ubID ); // remove it from the ground RemoveItemFromPool( gsBoobyTrapGridNo, gpBoobyTrapItemPool->iItemIndex, gbBoobyTrapLevel ); @@ -6363,7 +6363,7 @@ void SwitchMessageBoxCallBack( UINT8 ubExitValue ) // Message that switch is activated... ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[ 60 ] ); - SetOffBombsByFrequency( gpTempSoldier->ubID, bTempFrequency ); + SetOffBombsByFrequency( gpTempSoldier->ubID, bTempFrequency ); } } @@ -6733,11 +6733,11 @@ void TestPotentialOwner( SOLDIERTYPE * pSoldier ) void CheckForPickedOwnership( void ) { - ITEM_POOL * pItemPool; - UINT8 ubProfile; - UINT8 ubCivGroup; - SOLDIERTYPE * pSoldier; - UINT8 ubLoop; + ITEM_POOL * pItemPool; + UINT8 ubProfile; + UINT8 ubCivGroup; + SOLDIERTYPE * pSoldier; + UINT16 ubLoop; // LOOP THROUGH LIST TO FIND NODE WE WANT GetItemPool( gsTempGridNo, &pItemPool, gpTempSoldier->pathing.bLevel ); @@ -9403,7 +9403,7 @@ void DoInteractiveAction( INT32 sGridNo, SOLDIERTYPE *pSoldier ) // handle the default result of an interactive action // This is called either if no lua action id is set, or by lua if this should happen as a supplement to whatever lua does -void DoInteractiveActionDefaultResult( INT32 sGridNo, UINT8 ubID, BOOLEAN aSuccess ) +void DoInteractiveActionDefaultResult( INT32 sGridNo, UINT16 ubID, BOOLEAN aSuccess ) { SOLDIERTYPE* pSoldier = NULL; if ( ubID != NOBODY ) diff --git a/Tactical/Handle Items.h b/Tactical/Handle Items.h index b9b20865..ecbb189b 100644 --- a/Tactical/Handle Items.h +++ b/Tactical/Handle Items.h @@ -194,9 +194,9 @@ void AllSoldiersLookforItems( BOOLEAN RevealRoofsAndItems ); void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGridNo, INT8 bZLevel, BOOLEAN *pfSelectionList ); -OBJECTTYPE* AddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID = -1 ); -OBJECTTYPE* AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ); -OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 soldierID, INT32 * piItemIndex ); +OBJECTTYPE* AddItemToPool(INT32 sGridNo, OBJECTTYPE* pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID = -1); +OBJECTTYPE* AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ); +OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ); INT32 AdjustGridNoForItemPlacement( SOLDIERTYPE *pSoldier, INT32 sGridNo ); BOOLEAN GetItemPool( INT32 usMapPos, ITEM_POOL **ppItemPool, UINT8 ubLevel ); @@ -328,7 +328,7 @@ extern ITEM_POOL *gpItemPool;//dnl ch26 210909 // Flugente: interactive actions void DoInteractiveAction( INT32 sGridNo, SOLDIERTYPE *pSoldier ); -void DoInteractiveActionDefaultResult( INT32 sGridNo, UINT8 ubID, BOOLEAN aSuccess ); +void DoInteractiveActionDefaultResult( INT32 sGridNo, UINT16 ubID, BOOLEAN aSuccess ); BOOLEAN SpendMoney( SOLDIERTYPE *pSoldier, UINT32 aAmount ); // character spends money - either from inventory or the account // Flugente: intel diff --git a/Tactical/Handle UI Plan.cpp b/Tactical/Handle UI Plan.cpp index 8c93f84f..11afac49 100644 --- a/Tactical/Handle UI Plan.cpp +++ b/Tactical/Handle UI Plan.cpp @@ -46,7 +46,7 @@ BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) INT8 bDirection; INT32 iLoop; SOLDIERCREATE_STRUCT MercCreateStruct; - UINT8 ubNewIndex; + UINT16 ubNewIndex; // Depeding on stance and direction facing, add guy! @@ -122,7 +122,7 @@ BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) pPlanSoldier->ChangeSoldierState( pPlanSoldier->usUIMovementMode, 0, FALSE ); // Change selected soldier - gusSelectedSoldier = (UINT16)pPlanSoldier->ubID; + gusSelectedSoldier = pPlanSoldier->ubID; // Change global planned mode to this guy! gpUIPlannedSoldier = pPlanSoldier; @@ -165,7 +165,7 @@ BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) if ( TacticalCreateSoldier( &MercCreateStruct, &ubNewIndex ) ) { // Get pointer to soldier - GetSoldier( &pPlanSoldier, (UINT16)ubNewIndex ); + GetSoldier( &pPlanSoldier, ubNewIndex ); pPlanSoldier->sPlannedTargetX = -1; pPlanSoldier->sPlannedTargetY = -1; diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index bd72fab8..287496cf 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -294,7 +294,7 @@ BOOLEAN gfResetUIMovementOptimization = FALSE; BOOLEAN gfResetUIItemCursorOptimization = FALSE; BOOLEAN gfBeginVehicleCursor = FALSE; INT32 gsOutOfRangeGridNo = NOWHERE; -UINT8 gubOutOfRangeMerc = NOBODY; +UINT16 gubOutOfRangeMerc = NOBODY; BOOLEAN gfOKForExchangeCursor = FALSE; UINT32 guiUIInterfaceSwapCursorsTime = 0; INT32 gsJumpOverGridNo = 0; @@ -441,7 +441,7 @@ BOOLEAN gfUIDoNotHighlightSelMerc = FALSE; BOOLEAN gfUIHandleSelection = FALSE; BOOLEAN gfUIHandleSelectionAboveGuy = FALSE; BOOLEAN gfUIInDeadlock = FALSE; -UINT8 gUIDeadlockedSoldier = NOBODY; +UINT16 gUIDeadlockedSoldier = NOBODY; BOOLEAN gfUIHandleShowMoveGrid = FALSE; INT32 gsUIHandleShowMoveGridLocation = NOWHERE ; BOOLEAN gfUIOverItemPool = FALSE; @@ -449,7 +449,7 @@ INT32 gfUIOverItemPoolGridNo = 0; INT16 gsCurrentActionPoints = 1; BOOLEAN gfUIHandlePhysicsTrajectory = FALSE; BOOLEAN gfUIMouseOnValidCatcher = FALSE; -UINT8 gubUIValidCatcherID = 0; +UINT16 gubUIValidCatcherID = 0; @@ -577,7 +577,7 @@ UINT32 HandleTacticalUI( void ) gfUIInterfaceSetBusy = FALSE; //UNLOCK UI - UnSetUIBusy( (UINT8)gusSelectedSoldier ); + UnSetUIBusy( gusSelectedSoldier ); // Decrease global busy counter... gTacticalStatus.ubAttackBusyCount = 0; @@ -1500,7 +1500,7 @@ UINT32 UIHandleTestHit( UI_EVENT *pUIEvent ) // gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( "Testing a hit.\n" ); - pSoldier->EVENT_SoldierGotHit( 1, bDamage, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE ); + pSoldier->EVENT_SoldierGotHit( 1, bDamage, 10, pSoldier->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, pSoldier->bAimShotLocation, 0, NOWHERE ); // callahan update end - put everything as it was } return( GAME_SCREEN ); @@ -1716,7 +1716,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) // THIS IS JUST A CRUDE TEST FOR NOW if ( pSoldier->stats.bLife < OKLIFE ) { - UINT8 ubID; + UINT16 ubID; // Show reg. cursor // GO INTO IDLE MODE // guiPendingOverrideEvent = I_CHANGE_TO_IDLE; @@ -1725,7 +1725,7 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) if ( ubID != NOBODY ) { - SelectSoldier( (INT16)ubID, FALSE, FALSE ); + SelectSoldier( ubID, FALSE, FALSE ); } else { @@ -1963,13 +1963,13 @@ UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) // Set gsOutOfRangeGridNo = MercPtrs[ gusUIFullTargetID ]->sGridNo; - gubOutOfRangeMerc = (UINT8)gusSelectedSoldier; + gubOutOfRangeMerc = gusSelectedSoldier; } } } } - guiNewUICursor = GetProperItemCursor( (UINT8)gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, usMapPos, FALSE ); + guiNewUICursor = GetProperItemCursor( gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, usMapPos, FALSE ); // Show UI ON GUY UIHandleOnMerc( FALSE ); @@ -2123,7 +2123,7 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) STRUCTURE *pStructure; UINT8 ubDirection = 0xff; BOOLEAN fAllMove; - INT8 bLoop; + UINT16 bLoop; LEVELNODE *pIntTile; INT32 sIntTileGridNo; BOOLEAN fOldFastMove; @@ -2745,7 +2745,7 @@ UINT32 UIHandleCAOnTerrain( UI_EVENT *pUIEvent ) if ( GetSoldier( &pSoldier, gusSelectedSoldier ) ) { - guiNewUICursor = GetProperItemCursor( (UINT8)gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, usMapPos, TRUE ); + guiNewUICursor = GetProperItemCursor( gusSelectedSoldier, pSoldier->inv[ HANDPOS ].usItem, usMapPos, TRUE ); UIHandleOnMerc( FALSE ); } @@ -3465,7 +3465,7 @@ BOOLEAN SelectedMercCanAffordMove( ) return( FALSE ); } -void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ) +void GetMercClimbDirection( UINT16 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ) { INT8 bNewDirection; SOLDIERTYPE *pSoldier; @@ -3839,7 +3839,7 @@ UINT32 UIHandleIETOnTerrain( UI_EVENT *pUIEvent ) } -void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) +void UIHandleSoldierStanceChange( UINT16 ubSoldierID, INT8 bNewStance ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ]; @@ -4259,7 +4259,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags ) LEVELNODE *pIntTile; INT8 bReturnCode = 0; BOOLEAN fPlot; - UINT8 ubMercID; + UINT16 ubMercID; if ( (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) || _KeyDown( SHIFT ) ) { @@ -5588,7 +5588,7 @@ UINT32 UIHandleLCLook( UI_EVENT *pUIEvent ) UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) { SOLDIERTYPE *pSoldier; - UINT8 ubTargID; + UINT16 ubTargID; UINT32 uiRange; INT32 usMapPos; BOOLEAN fValidTalkableGuy = FALSE; @@ -5619,7 +5619,7 @@ UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) //CHECK FOR VALID TALKABLE GUY HERE - fValidTalkableGuy = IsValidTalkableNPCFromMouse( &ubTargID, FALSE, TRUE , FALSE ); + fValidTalkableGuy = IsValidTalkableNPCFromMouse( &ubTargID, FALSE, TRUE, FALSE ); // USe cursor based on distance // Get distance away @@ -6374,20 +6374,20 @@ UINT32 UIHandleLAEndLockOurTurn( UI_EVENT *pUIEvent ) -BOOLEAN IsValidTalkableNPCFromMouse( UINT8 *pubSoldierID , BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) +BOOLEAN IsValidTalkableNPCFromMouse( UINT16 * pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) { // Check if there is a guy here to talk to! if ( gfUIFullTargetFound ) { - *pubSoldierID = (UINT8)gusUIFullTargetID; - return( IsValidTalkableNPC( (UINT8)gusUIFullTargetID, fGive, fAllowMercs, fCheckCollapsed ) ); + *pubSoldierID = gusUIFullTargetID; + return( IsValidTalkableNPC( gusUIFullTargetID, fGive, fAllowMercs, fCheckCollapsed ) ); } return( FALSE ); } -BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive , BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) +BOOLEAN IsValidTalkableNPC( UINT16 ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ]; BOOLEAN fValidGuy = FALSE; @@ -6509,7 +6509,7 @@ BOOLEAN HandleTalkInit( ) if ( gfUIFullTargetFound ) { // Is he a valid NPC? - if ( IsValidTalkableNPC( (UINT8)gusUIFullTargetID, FALSE, TRUE , FALSE ) ) + if ( IsValidTalkableNPC( gusUIFullTargetID, FALSE, TRUE, FALSE ) ) { GetSoldier( &pTSoldier, gusUIFullTargetID ); @@ -6716,7 +6716,7 @@ BOOLEAN HandleTalkInit( ) -void SetUIBusy( UINT8 ubID ) +void SetUIBusy( UINT16 ubID ) { if ( (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) && ( gTacticalStatus.ubCurrentTeam == gbPlayerNum ) ) { @@ -6728,7 +6728,7 @@ void SetUIBusy( UINT8 ubID ) } } -void UnSetUIBusy( UINT8 ubID ) +void UnSetUIBusy( UINT16 ubID ) { if ( gfUserTurnRegionActive && (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) && ( gTacticalStatus.ubCurrentTeam == gbPlayerNum ) ) { @@ -7274,7 +7274,8 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fChec INT32 sFourGrids[4], sDistance=0, sSpot, sInBetween, sInBetween2, iDoorGridNo; static const UINT8 sDirs[4] = { NORTH, EAST, SOUTH, WEST }; //INT32 cnt; - UINT8 ubGuyThere, ubMovementCost, ubDirection; + UINT16 ubGuyThere; + UINT8 ubMovementCost, ubDirection; INT8 bTileHeight = 0; // SANDRO: commented out to allow jumping even in cases we could get to the destination normally diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index 5937d911..14b15f1e 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -200,10 +200,10 @@ extern BOOLEAN gfUIHandleSelectionAboveGuy; extern INT32 gsSelectedGridNo; extern INT16 gsSelectedGuy; extern BOOLEAN gfUIInDeadlock; -extern UINT8 gUIDeadlockedSoldier; +extern UINT16 gUIDeadlockedSoldier; extern BOOLEAN gfUIMouseOnValidCatcher; -extern UINT8 gubUIValidCatcherID; +extern UINT16 gubUIValidCatcherID; extern BOOLEAN gUIUseReverse; @@ -320,13 +320,13 @@ void AdjustSoldierCreationStartValues( ); BOOLEAN SelectedMercCanAffordAttack( ); BOOLEAN SelectedMercCanAffordMove( ); -void GetMercClimbDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); +void GetMercClimbDirection( UINT16 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); void ToggleHandCursorMode( UINT32 *puiNewEvent ); void ToggleTalkCursorMode( UINT32 *puiNewEvent ); void ToggleLookCursorMode( UINT32 *puiNewEvent ); -void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ); +void UIHandleSoldierStanceChange( UINT16 ubSoldierID, INT8 bNewStance ); void GetCursorMovementFlags( UINT32 *puiCursorFlags ); BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, INT32 usMapPos, UINT32 uiFlags ); @@ -334,15 +334,15 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ); BOOLEAN UIOkForItemPickup( SOLDIERTYPE *pSoldier, INT32 sGridNo ); -BOOLEAN IsValidTalkableNPCFromMouse( UINT8 *pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); -BOOLEAN IsValidTalkableNPC( UINT8 ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); +BOOLEAN IsValidTalkableNPCFromMouse( UINT16 * pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); +BOOLEAN IsValidTalkableNPC( UINT16 ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); BOOLEAN HandleTalkInit( ); BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustForConfirm ); -void SetUIBusy( UINT8 ubID ); -void UnSetUIBusy( UINT8 ubID ); +void SetUIBusy( UINT16 ubID ); +void UnSetUIBusy( UINT16 ubID ); UINT32 UIHandleLUIEndLock( UI_EVENT *pUIEvent ); diff --git a/Tactical/Interface Control.cpp b/Tactical/Interface Control.cpp index 0960bd08..e1c93628 100644 --- a/Tactical/Interface Control.cpp +++ b/Tactical/Interface Control.cpp @@ -921,7 +921,7 @@ void RenderTopmostTacticalInterface( ) } else { - DrawSelectedUIAboveGuy((UINT16)pSoldier->ubID); + DrawSelectedUIAboveGuy(pSoldier->ubID); } DrawCounters( pSoldier ); diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index 9644aab3..7e9ef7d6 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -187,7 +187,7 @@ BOOLEAN InternalInitiateConversation( SOLDIERTYPE *pDestSoldier, SOLDIERTYPE *pS extern void EndGameMessageBoxCallBack( UINT8 ubExitValue ); extern INT32 FindNearestOpenableNonDoor( INT32 sStartGridNo ); extern void RecalculateOppCntsDueToBecomingNeutral( SOLDIERTYPE * pSoldier ); -extern UINT8 NumCapableEnemyInSector( ); +extern UINT16 NumCapableEnemyInSector( ); #ifdef JA2UB //JA25 UB @@ -1042,7 +1042,7 @@ void TalkPanelClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) // open inv panel... gfSwitchPanel = TRUE; gbNewPanel = SM_PANEL; - gubNewPanelParam = (UINT8)gpSrcSoldier->ubID; + gubNewPanelParam = gpSrcSoldier->ubID; // Wait! gpDestSoldier->aiData.bNextAction = AI_ACTION_WAIT; @@ -1560,7 +1560,7 @@ void HandleNPCTriggerNPC( UINT8 ubTargetNPC, UINT8 ubTargetRecord, BOOLEAN fShow guiWaitingForTriggerTime = GetJA2Clock( ); // Setup locator! - ShowRadioLocator( (UINT8)pSoldier->ubID, SHOW_LOCATOR_FAST ); + ShowRadioLocator( pSoldier->ubID, SHOW_LOCATOR_FAST ); // If he's visible, locate... if ( pSoldier->bVisible != -1 ) @@ -1589,7 +1589,7 @@ void HandleNPCTrigger( ) { SOLDIERTYPE *pSoldier; INT32 sPlayerGridNo; - UINT8 ubPlayerID; + UINT16 ubPlayerID; pSoldier = FindSoldierByProfileID( gubTargetNPC, FALSE ); if (!pSoldier) @@ -2481,7 +2481,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if (pSoldier) { DeleteTalkingMenu(); - pSoldier->EVENT_SoldierGotHit( 1, 100, 10, pSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); + pSoldier->EVENT_SoldierGotHit( 1, 100, 10, pSoldier->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); } break; @@ -2826,7 +2826,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum bItemIn = FindObj( pSoldier, DEED ); if (bItemIn != NO_SLOT) { - AddItemToPool( 12541, &(pSoldier->inv[bItemIn]), -1 , 0, 0, 0 ); + AddItemToPool( 12541, &(pSoldier->inv[bItemIn]), -1, 0, 0, 0 ); DeleteObj( &(pSoldier->inv[ bItemIn ]) ); RemoveObjectFromSoldierProfile( ubTargetNPC, DEED ); } @@ -3225,7 +3225,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier ) { INT32 sNearestPC; - UINT8 ubID; + UINT16 ubID; INT8 bMoneySlot; INT8 bEmptySlot; @@ -3358,7 +3358,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - UINT8 ubTargetID; + UINT16 ubTargetID; SOLDIERTYPE *pTarget; // Target a different merc.... @@ -3478,7 +3478,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - UINT8 ubTargetID; + UINT16 ubTargetID; SOLDIERTYPE *pTarget; INT32 cnt; BOOLEAN fGoodTarget = FALSE; @@ -3901,7 +3901,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( !gfInTalkPanel ) { INT32 sNearestPC; - UINT8 ubID; + UINT16 ubID; pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if ( pSoldier ) @@ -4850,7 +4850,7 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) { // He tried to lie..... // Find the best conscious merc with a chance.... - UINT8 cnt; + UINT16 cnt; SOLDIERTYPE * pLier = NULL; SOLDIERTYPE * pSoldier; diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 9ea7ae75..53d6ebb2 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -238,7 +238,7 @@ extern MOUSE_REGION gMPanelRegion; extern BOOLEAN fMapInventoryItem; extern BOOLEAN gfAddingMoneyToMercFromPlayersAccount; extern SOLDIERTYPE *gpSMCurrentMerc; -extern UINT8 gubSelectSMPanelToMerc; +extern UINT16 gubSelectSMPanelToMerc; extern MOUSE_REGION gSM_SELMERCMoneyRegion; extern UINT32 guiMapInvSecondHandBlockout; @@ -8829,7 +8829,7 @@ void DrawItemTileCursor( ) { INT32 usMapPos; UINT16 usIndex; - UINT8 ubSoldierID; + UINT16 ubSoldierID; INT16 sAPCost; BOOLEAN fRecalc; UINT32 uiCursorFlags; @@ -8935,7 +8935,7 @@ void DrawItemTileCursor( ) { // OK, on a valid pass gfUIMouseOnValidCatcher = 4; - gubUIValidCatcherID = (UINT8)gusUIFullTargetID; + gubUIValidCatcherID = gusUIFullTargetID; } else { @@ -8944,7 +8944,7 @@ void DrawItemTileCursor( ) { // OK, set global that this buddy can see catch... gfUIMouseOnValidCatcher = TRUE; - gubUIValidCatcherID = (UINT8)gusUIFullTargetID; + gubUIValidCatcherID = gusUIFullTargetID; } } } @@ -8978,7 +8978,7 @@ void DrawItemTileCursor( ) // OK, set global that this buddy can see catch... gfUIMouseOnValidCatcher = 2; - gubUIValidCatcherID = (UINT8)gusUIFullTargetID; + gubUIValidCatcherID = gusUIFullTargetID; // If this is a robot, change to say 'reload' if ( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) @@ -9175,7 +9175,7 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) UINT8 ubDirection; - UINT8 ubSoldierID; + UINT16 ubSoldierID; UINT16 usItem; INT16 sAPCost; SOLDIERTYPE *pSoldier=NULL; @@ -9411,7 +9411,7 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) case ANIM_CROUCH: case ANIM_PRONE: - AddItemToPool( usMapPos, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0 , -1 ); + AddItemToPool( usMapPos, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0, -1 ); NotifySoldiersToLookforItems( ); break; } @@ -10960,7 +10960,7 @@ BOOLEAN InitializeItemPickupMenu( SOLDIERTYPE *pSoldier, INT32 sGridNo, ITEM_POO // Change to INV panel if not there already... gfSwitchPanel = TRUE; gbNewPanel = SM_PANEL; - gubNewPanelParam = (UINT8)pSoldier->ubID; + gubNewPanelParam = pSoldier->ubID; //Determine total # cnt = 0; @@ -12761,7 +12761,7 @@ void CancelItemPointer( ) if ( !AutoPlaceObject( gpItemPointerSoldier, gpItemPointer, FALSE ) ) { // Alright, place of the friggen ground! - AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0 , -1 ); + AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0, -1 ); NotifySoldiersToLookforItems( ); } } @@ -12769,7 +12769,7 @@ void CancelItemPointer( ) else { // We drop it here..... - AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0 , -1 ); + AddItemToPool( gpItemPointerSoldier->sGridNo, gpItemPointer, 1, gpItemPointerSoldier->pathing.bLevel, 0, -1 ); NotifySoldiersToLookforItems( ); } EndItemPointer( ); @@ -12920,7 +12920,7 @@ BOOLEAN InitializeStealItemPickupMenu( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOppo // Change to INV panel if not there already... gfSwitchPanel = TRUE; gbNewPanel = SM_PANEL; - gubNewPanelParam = (UINT8)pSoldier->ubID; + gubNewPanelParam = pSoldier->ubID; gItemPickupMenu.ubTotalItems = ubCount; diff --git a/Tactical/Interface Items.h b/Tactical/Interface Items.h index 607890ff..e08f44e3 100644 --- a/Tactical/Interface Items.h +++ b/Tactical/Interface Items.h @@ -166,11 +166,12 @@ public: BOOLEAN Save(HWFILE hFile); BOOLEAN Load(HWFILE hFile); - UINT8 ubSoldierID; + UINT16 ubSoldierID; UINT8 ubInvSlot; BOOLEAN fCursorActive; OBJECTTYPE ItemPointerInfo; }; +#define SIZEOF_ITEM_CURSOR_SAVE_INFO_POD offsetof( ITEM_CURSOR_SAVE_INFO, ItemPointerInfo ) // HEADROCK HAM 5: Enums for big-item display attachment asterisks. enum diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 8f859f37..ddc3ada5 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -394,7 +394,7 @@ INT32 giSMZipperButton = -1; BOOLEAN gfSwitchPanel = FALSE; UINT8 gbNewPanel = SM_PANEL; -UINT8 gubNewPanelParam = 0; +UINT16 gubNewPanelParam = 0; BOOLEAN gfUIStanceDifferent = FALSE; BOOLEAN gfAllDisabled = FALSE; @@ -405,7 +405,7 @@ BOOLEAN gfAddingMoneyToMercFromPlayersAccount = FALSE; BOOLEAN gfCheckForMouseOverItem = FALSE; UINT32 guiMouseOverItemTime = 0; INT8 gbCheckForMouseOverItemPos = 0; -UINT8 gubSelectSMPanelToMerc = NOBODY; +UINT16 gubSelectSMPanelToMerc = NOBODY; BOOLEAN gfReEvaluateDisabledINVPanelButtons = FALSE; UINT32 guiBrownBackgroundForTeamPanel; @@ -573,7 +573,7 @@ void UpdateSelectedSoldier( UINT16 usSoldierID, BOOLEAN fSelect ); void CheckForFacePanelStartAnims( SOLDIERTYPE *pSoldier, INT16 sPanelX, INT16 sPanelY ); void HandleSoldierFaceFlash( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY ); -BOOLEAN PlayerExistsInSlot( UINT8 ubID ); +BOOLEAN PlayerExistsInSlot( UINT16 ubID ); void UpdateStatColor( UINT32 uiTimer, BOOLEAN fIncrease, BOOLEAN fDamaged, BOOLEAN fAugmented ); // SANDRO - added argument // Flugente - me too extern void UpdateItemHatches(); @@ -597,7 +597,7 @@ void CheckForDisabledForGiveItem( ) INT8 bDestLevel; INT32 cnt; SOLDIERTYPE *pSoldier; - UINT8 ubSrcSoldier; + UINT16 ubSrcSoldier; // CHRISL: If Merc hasn't been set, default to first merc if(gpSMCurrentMerc==NULL) @@ -638,7 +638,7 @@ void CheckForDisabledForGiveItem( ) } else { - ubSrcSoldier = (UINT8)gusSelectedSoldier; + ubSrcSoldier = gusSelectedSoldier; if ( gpItemPointer != NULL ) { @@ -690,7 +690,7 @@ void CheckForDisabledForGiveItem( ) } } -void SetSMPanelCurrentMerc( UINT8 ubNewID ) +void SetSMPanelCurrentMerc( UINT16 ubNewID ) { gubSelectSMPanelToMerc = NOBODY; @@ -3729,7 +3729,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else // item in cursor { - UINT8 ubSrcID, ubDestID; + UINT16 ubSrcID, ubDestID; BOOLEAN fOKToGo = FALSE; BOOLEAN fDeductPoints = FALSE; @@ -4217,7 +4217,7 @@ BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) } } MoveItemToLBEItem( pSoldier, BPACKPOCKPOS ); - AddItemToPoolAndGetIndex(pSoldier->sGridNo, &pSoldier->inv[BPACKPOCKPOS], 1, pSoldier->pathing.bLevel, 0 , -1, pSoldier->ubID, &worldKey ); + AddItemToPoolAndGetIndex(pSoldier->sGridNo, &pSoldier->inv[BPACKPOCKPOS], 1, pSoldier->pathing.bLevel, 0, -1, pSoldier->ubID, &worldKey ); // Item successfully added to world if(worldKey != ITEM_NOT_FOUND) { @@ -4829,7 +4829,7 @@ void BtnPrevMercCallback(GUI_BUTTON *btn,INT32 reason) sID = FindPrevActiveAndAliveMerc( gpSMCurrentMerc, TRUE, TRUE ); - gubSelectSMPanelToMerc = (UINT8)sID; + gubSelectSMPanelToMerc = (UINT16)sID; if ( !gfInItemPickupMenu ) { @@ -4878,7 +4878,7 @@ void BtnNextMercCallback(GUI_BUTTON *btn,INT32 reason) sID = FindNextActiveAndAliveMerc( gpSMCurrentMerc, TRUE, TRUE ); // Give him the panel! - gubSelectSMPanelToMerc = (UINT8)sID; + gubSelectSMPanelToMerc = (UINT16)sID; if ( !gfInItemPickupMenu ) { @@ -5893,7 +5893,7 @@ void BtnSquadCallback(GUI_BUTTON *btn,INT32 reason) } -void SetTEAMPanelCurrentMerc( UINT8 ubNewID ) +void SetTEAMPanelCurrentMerc( UINT16 ubNewID ) { // Ignore ther ID given! // ALWYAS USE CURRENT MERC! @@ -6026,10 +6026,10 @@ void HandleMouseOverTeamFaceForContMove( BOOLEAN fOn ) void MercFacePanelMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT8 ubID, ubSoldierID; + UINT16 ubID, ubSoldierID; SOLDIERTYPE *pSoldier; - ubID = (UINT8) MSYS_GetRegionUserData( pRegion, 0 ); + ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); // If our flags are set to do this, gofoit! if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) @@ -6072,9 +6072,9 @@ void MercFacePanelMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT8 ubID, ubSoldierID; + UINT16 ubID, ubSoldierID; - ubID = (UINT8) MSYS_GetRegionUserData( pRegion, 0 ); + ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); if ( ubID == NOBODY ) { @@ -6127,9 +6127,9 @@ void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT8 ubID, ubSoldierID; + UINT16 ubID, ubSoldierID; - ubID = (UINT8) MSYS_GetRegionUserData( pRegion, 0 ); + ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); // If our flags are set to do this, gofoit! if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) @@ -6248,7 +6248,7 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) { gfSwitchPanel = TRUE; gbNewPanel = SM_PANEL; - gubNewPanelParam = (UINT8)ubSoldierID; + gubNewPanelParam = ubSoldierID; // silversurfer: This needs to be reset to TRUE because inventory view only allows radar screen to be displayed and not the squad list. fRenderRadarScreen = TRUE; } @@ -6259,7 +6259,7 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) extern void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ); -void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) +void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) { BOOLEAN fSelect = FALSE; @@ -6386,7 +6386,7 @@ void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ) -void ShowRadioLocator( UINT8 ubID, UINT8 ubLocatorSpeed ) +void ShowRadioLocator( UINT16 ubID, UINT8 ubLocatorSpeed ) { RESETTIMECOUNTER( MercPtrs[ ubID ]->timeCounters.FlashSelCounter, FLASH_SELECTOR_DELAY ); @@ -6413,7 +6413,7 @@ void ShowRadioLocator( UINT8 ubID, UINT8 ubLocatorSpeed ) } } -void EndRadioLocator( UINT8 ubID ) +void EndRadioLocator( UINT16 ubID ) { MercPtrs[ ubID ]->flags.fFlashLocator = FALSE; MercPtrs[ ubID ]->flags.fShowLocator = FALSE; @@ -6681,9 +6681,9 @@ void RenderSoldierTeamInv( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY, UINT8 ubPa void TMFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT8 ubID, ubSoldierID; + UINT16 ubID, ubSoldierID; - ubID = (UINT8) MSYS_GetRegionUserData( pRegion, 0 ); + ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); // If our flags are set to do this, gofoit! if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) @@ -6731,10 +6731,10 @@ void TMFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT8 ubID, ubSoldierID; + UINT16 ubID, ubSoldierID; UINT16 usOldHandItem; - ubID = (UINT8) MSYS_GetRegionUserData( pRegion, 0 ); + ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); if ( ubID == NOBODY ) @@ -6777,10 +6777,10 @@ void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT8 ubID, ubSoldierID; + UINT16 ubID, ubSoldierID; UINT16 usOldHandItem; - ubID = (UINT8) MSYS_GetRegionUserData( pRegion, 0 ); + ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); if ( ubID == NOBODY ) return; @@ -6822,7 +6822,7 @@ void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) } -BOOLEAN PlayerExistsInSlot( UINT8 ubID ) +BOOLEAN PlayerExistsInSlot( UINT16 ubID ) { INT32 cnt; @@ -6841,7 +6841,7 @@ BOOLEAN PlayerExistsInSlot( UINT8 ubID ) } -INT8 GetTeamSlotFromPlayerID( UINT8 ubID ) +INT8 GetTeamSlotFromPlayerID( UINT16 ubID ) { INT8 cnt; @@ -6860,7 +6860,7 @@ INT8 GetTeamSlotFromPlayerID( UINT8 ubID ) } -BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT8 ubMercID ) +BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT16 ubMercID ) { INT32 cnt; @@ -6880,7 +6880,7 @@ BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT8 ubMercID ) } -void AddPlayerToInterfaceTeamSlot( UINT8 ubID ) +void AddPlayerToInterfaceTeamSlot( UINT16 ubID ) { INT32 cnt; @@ -6964,7 +6964,7 @@ BOOLEAN InitTEAMSlots( ) } -BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT8 *pubID ) +BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT16 * pubID ) { if ( ubPanelSlot >= gGameOptions.ubSquadSize ) { @@ -7141,7 +7141,7 @@ void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) } } -UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) +UINT16 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { INT32 cnt; INT32 bFirstID; @@ -7174,14 +7174,14 @@ UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife { if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)gTeamPanel[ cnt ].ubID ); + return( gTeamPanel[ cnt ].ubID ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)gTeamPanel[ cnt ].ubID ); + return( gTeamPanel[ cnt ].ubID ); } } } @@ -7234,14 +7234,14 @@ UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife { if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && pTeamSoldier->bAssignment < ON_DUTY && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)gTeamPanel[ cnt ].ubID ); + return( gTeamPanel[ cnt ].ubID ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)gTeamPanel[ cnt ].ubID ); + return( gTeamPanel[ cnt ].ubID ); } } } @@ -7462,7 +7462,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else { - UINT8 ubSrcID, ubDestID; + UINT16 ubSrcID, ubDestID; BOOLEAN fOKToGo = FALSE; BOOLEAN fDeductPoints = FALSE; @@ -7473,7 +7473,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } // ATE: OK, get source, dest guy if different... check for and then charge appropriate APs - ubSrcID = ( UINT8 )gCharactersList[ bSelectedInfoChar ].usSolID; + ubSrcID = gCharactersList[ bSelectedInfoChar ].usSolID; if ( gpItemPointerSoldier ) { ubDestID = gpItemPointerSoldier->ubID; diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 923eb108..0e1bd050 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -77,18 +77,18 @@ void UpdateTEAMPanel( ); */ BOOLEAN InitializeTEAMPanelCoords( ); -void SetSMPanelCurrentMerc( UINT8 ubNewID ); -void SetTEAMPanelCurrentMerc( UINT8 ubNewID ); +void SetSMPanelCurrentMerc( UINT16 ubNewID ); +void SetTEAMPanelCurrentMerc( UINT16 ubNewID ); UINT16 GetSMPanelCurrentMerc( ); void UpdateSMPanel( ); BOOLEAN InitTEAMSlots( ); -void AddPlayerToInterfaceTeamSlot( UINT8 ubID ); +void AddPlayerToInterfaceTeamSlot( UINT16 ubID ); BOOLEAN RemovePlayerFromInterfaceTeamSlot( UINT8 ubID ); -BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT8 *pubID ); +BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT16 * pubID ); void RemoveAllPlayersFromSlot( ); -BOOLEAN PlayerExistsInSlot( UINT8 ubID ); -BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT8 ubMercID ); +BOOLEAN PlayerExistsInSlot( UINT16 ubID ); +BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT16 ubMercID ); void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ); void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ); @@ -107,8 +107,8 @@ extern INT8 gbNewItem[ NUM_INV_SLOTS ]; extern INT8 gbNewItemCycle[ NUM_INV_SLOTS ]; extern UINT8 gubNewItemMerc; -void ShowRadioLocator( UINT8 ubID, UINT8 ubLocatorSpeed ); -void EndRadioLocator( UINT8 ubID ); +void ShowRadioLocator( UINT16 ubID, UINT8 ubLocatorSpeed ); +void EndRadioLocator( UINT16 ubID ); extern MOUSE_REGION gSMPanelRegion; @@ -118,7 +118,7 @@ extern BOOLEAN gfDisableTacticalPanelButtons; typedef struct { - UINT8 ubID; + UINT16 ubID; BOOLEAN fOccupied; } TEAM_PANEL_SLOTS_TYPE; @@ -149,7 +149,7 @@ void GoToMapScreenFromTactical( void ); void FinishAnySkullPanelAnimations( ); -UINT8 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); +UINT16 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); // CHRISL: New callback functions for backpack buttons BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus); diff --git a/Tactical/Interface Utils.cpp b/Tactical/Interface Utils.cpp index 46d043aa..2031ba35 100644 --- a/Tactical/Interface Utils.cpp +++ b/Tactical/Interface Utils.cpp @@ -498,7 +498,7 @@ void RenderSoldierFace( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY, BOOLE } else { - SetAutoFaceActiveFromSoldier( FRAME_BUFFER, guiSAVEBUFFER, pSoldier->ubID , sFaceX, sFaceY ); + SetAutoFaceActiveFromSoldier( FRAME_BUFFER, guiSAVEBUFFER, pSoldier->ubID, sFaceX, sFaceY ); // SetAutoFaceActiveFromSoldier( FRAME_BUFFER, FACE_AUTO_RESTORE_BUFFER, pSoldier->ubID , sFaceX, sFaceY ); } } diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index bf953ebe..5bd9d75e 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -126,8 +126,8 @@ extern BOOLEAN gfCannotGetThrough; // will use it when showing red laser dot extern void SoldierTooltip(SOLDIERTYPE*); BOOLEAN gfProgBarActive = FALSE; -UINT8 gubProgNumEnemies = 0; -UINT8 gubProgCurEnemy = 0; +UINT16 gubProgNumEnemies = 0; +UINT16 gubProgCurEnemy = 0; UINT32 guiPORTRAITICONS; @@ -192,7 +192,7 @@ BOOLEAN gfPanelAllocated = FALSE; extern MOUSE_REGION gDisableRegion; extern MOUSE_REGION gUserTurnRegion; extern BOOLEAN gfUserTurnRegionActive; -extern UINT8 gubSelectSMPanelToMerc; +extern UINT16 gubSelectSMPanelToMerc; extern BOOLEAN gfIgnoreOnSelectedGuy; enum @@ -670,7 +670,7 @@ void ShutdownCurrentPanel( ) -void SetCurrentTacticalPanelCurrentMerc( UINT8 ubID ) +void SetCurrentTacticalPanelCurrentMerc( UINT16 ubID ) { SOLDIERTYPE *pSoldier; @@ -696,7 +696,7 @@ void SetCurrentTacticalPanelCurrentMerc( UINT8 ubID ) break; case TEAM_PANEL: - SetTEAMPanelCurrentMerc( (UINT8)gusSelectedSoldier ); + SetTEAMPanelCurrentMerc( gusSelectedSoldier ); break; } @@ -734,7 +734,7 @@ void SetCurrentInterfacePanel( UINT8 ubNewPanel ) void ToggleTacticalPanels( ) { gfSwitchPanel = TRUE; - gubNewPanelParam = (UINT8)gusSelectedSoldier; + gubNewPanelParam = gusSelectedSoldier; if ( gsCurInterfacePanel == SM_PANEL ) { @@ -764,7 +764,7 @@ void RemoveCurrentTacticalPanelButtons( ) } -BOOLEAN IsMercPortraitVisible( UINT8 ubSoldierID ) +BOOLEAN IsMercPortraitVisible( UINT16 ubSoldierID ) { if ( gsCurInterfacePanel == TEAM_PANEL ) { @@ -4244,7 +4244,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, GetAPsToOpenDoor( gOpenDoorMenu.pSoldier ), APBPConstants[BP_OPEN_DOOR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); if ( gOpenDoorMenu.fClosingDoor ) { @@ -4269,7 +4269,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_BOOT_DOOR], APBPConstants[BP_BOOT_DOOR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_FORCE ); } @@ -4286,7 +4286,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_UNLOCK_DOOR], APBPConstants[BP_UNLOCK_DOOR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_UNLOCK ); } @@ -4303,7 +4303,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, GetAPsToPicklock( gOpenDoorMenu.pSoldier ), APBPConstants[BP_PICKLOCK], FALSE ) ) // SANDRO { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_LOCKPICK ); } @@ -4320,7 +4320,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_EXAMINE_DOOR], APBPConstants[BP_EXAMINE_DOOR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_EXAMINE ); } @@ -4361,7 +4361,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, GetAPsToBombDoor( gOpenDoorMenu.pSoldier ), APBPConstants[BP_EXPLODE_DOOR], FALSE ) ) // SANDRO { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_EXPLODE ); } @@ -4379,7 +4379,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, GetAPsToUntrapDoor( gOpenDoorMenu.pSoldier ), APBPConstants[BP_UNTRAP_DOOR], FALSE ) ) // SANDRO { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_UNTRAP ); } @@ -4420,7 +4420,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_USE_CROWBAR], APBPConstants[BP_USE_CROWBAR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_CROWBAR ); } @@ -5178,7 +5178,7 @@ void PauseRT( BOOLEAN fPause ) } -void InitEnemyUIBar( UINT8 ubNumEnemies, UINT8 ubDoneEnemies ) +void InitEnemyUIBar( UINT16 ubNumEnemies, UINT16 ubDoneEnemies ) { // OK, set value gubProgNumEnemies = ubNumEnemies + ubDoneEnemies; @@ -5218,7 +5218,7 @@ void InitPlayerUIBar( BOOLEAN fInterrupt ) { SOLDIERTYPE *pTeamSoldier; INT32 cnt = 0; - INT8 bNumOK = 0, bNumNotOK = 0; + INT16 bNumOK = 0, bNumNotOK = 0; if ( !gGameOptions.fTurnTimeLimit ) { diff --git a/Tactical/Interface.h b/Tactical/Interface.h index e531076b..adbd2f21 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -366,7 +366,7 @@ enum extern BOOLEAN gfSwitchPanel; extern BOOLEAN gfUIStanceDifferent; extern UINT8 gbNewPanel; -extern UINT8 gubNewPanelParam; +extern UINT16 gubNewPanelParam; extern INT16 gsCurInterfacePanel; extern UINT32 guiRENDERBUFFER; @@ -458,9 +458,9 @@ BOOLEAN DrawCTHIndicator(); void CreateCurrentTacticalPanelButtons( ); void RemoveCurrentTacticalPanelButtons( ); -void SetCurrentTacticalPanelCurrentMerc( UINT8 ubID ); +void SetCurrentTacticalPanelCurrentMerc( UINT16 ubID ); void SetCurrentInterfacePanel( UINT8 ubNewPanel ); -BOOLEAN IsMercPortraitVisible( UINT8 ubSoldierID ); +BOOLEAN IsMercPortraitVisible( UINT16 ubSoldierID ); BOOLEAN InitializeCurrentPanel( ); void ShutdownCurrentPanel( ); @@ -475,7 +475,7 @@ void HandleUpDownArrowBackgrounds( ); void EndDeadlockMsg( ); -void HandleLocateSelectMerc( UINT8 ubID, INT8 bFlag ); +void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ); void DirtyMercPanelInterface( SOLDIERTYPE *pSoldier, UINT8 ubDirtyLevel ); @@ -515,7 +515,7 @@ void EndTopMessage( ); void PauseRT( BOOLEAN fPause ); -void InitEnemyUIBar( UINT8 ubNumEnemies, UINT8 ubDoneEnemies ); +void InitEnemyUIBar( UINT16 ubNumEnemies, UINT16 ubDoneEnemies ); STR16 GetSoldierHealthString( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 55bd75b2..2c213d9e 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -125,7 +125,7 @@ bool IsSlotASmallPocket(int slot) return false; } -void CreateLBE (OBJECTTYPE* pObj, UINT8 ubID, int numSubPockets) +void CreateLBE (OBJECTTYPE* pObj, UINT16 ubID, int numSubPockets) { int uniqueID; LBENODE* pLBE = NULL; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 3e91212c..fac26280 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -259,7 +259,7 @@ public: #define SIZEOF_LBENODE_POD (offsetof(LBENODE, endOfPOD)) bool checkLBEArrayIntegrity(bool verbose=false); // BOB: checks all worldItems for missing LBE info -void CreateLBE(OBJECTTYPE* pObj, UINT8 ubID, int numSubPockets); +void CreateLBE(OBJECTTYPE* pObj, UINT16 ubID, int numSubPockets); bool DestroyLBEIfEmpty(OBJECTTYPE* pObj, int stackIndex = 0); void DestroyLBE(OBJECTTYPE* pObj, int stackIndex = 0); void GetLBESlots(UINT32 LBEType, std::vector& LBESlots); @@ -415,7 +415,7 @@ namespace ObjectDataStructs { INT8 bDelay; // >=0 values used only INT8 bFrequency; // >=0 values used only }; - UINT8 ubBombOwner; // side which placed the bomb + UINT16 ubBombOwner; // side which placed the bomb UINT8 bActionValue; // this is used by the ACTION_ITEM fake item union { diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 8ddaaf69..01e07f7a 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -9397,7 +9397,7 @@ void CheckEquipmentForFragileItemDamage( SOLDIERTYPE *pSoldier, INT32 iDamage ) } -BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, UINT8 ubOwner ) +BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, UINT16 ubOwner ) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; @@ -15411,10 +15411,10 @@ BOOLEAN ObjectIsExternalFeeder(SOLDIERTYPE* pSoldier, OBJECTTYPE * pObject) if ( !pSoldier || !pObject) return( FALSE ); - UINT8 usSoldierFeedingTarget1 = 0; + UINT16 usSoldierFeedingTarget1 = 0; UINT16 usGunSlot1 = 0; UINT16 usAmmoSlot1 = 0; - UINT8 usSoldierFeedingTarget2 = 0; + UINT16 usSoldierFeedingTarget2 = 0; UINT16 usGunSlot2 = 0; UINT16 usAmmoSlot2 = 0; if ( pSoldier->IsFeedingExternal(&usSoldierFeedingTarget1, &usGunSlot1, &usAmmoSlot1, &usSoldierFeedingTarget2, &usGunSlot2, &usAmmoSlot2) ) @@ -15469,10 +15469,10 @@ OBJECTTYPE* GetExternalFeedingObject(SOLDIERTYPE* pSoldier, OBJECTTYPE * pObject continue; // we check if that guy is feeding someone, and that someone is really us - UINT8 usTeamSoldierFeedingTarget1 = 0; + UINT16 usTeamSoldierFeedingTarget1 = 0; UINT16 usGunSlot1 = 0; UINT16 usAmmoSlot1 = 0; - UINT8 usTeamSoldierFeedingTarget2 = 0; + UINT16 usTeamSoldierFeedingTarget2 = 0; UINT16 usGunSlot2 = 0; UINT16 usAmmoSlot2 = 0; if ( pTeamSoldier->IsFeedingExternal(&usTeamSoldierFeedingTarget1, &usGunSlot1, &usAmmoSlot1, &usTeamSoldierFeedingTarget2, &usGunSlot2, &usAmmoSlot2) ) diff --git a/Tactical/Items.h b/Tactical/Items.h index d0e2649b..f25b10e4 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -227,7 +227,7 @@ UINT16 StandardGunListReplacement( UINT16 usGun ); UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType); UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UINT16 usNewGun ); -BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, UINT8 ubOwner ); +BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, UINT16 ubOwner ); BOOLEAN CompatibleFaceItem( UINT16 usItem1, UINT16 usItem2 ); diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 36f866b6..25318a2a 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -2433,7 +2433,7 @@ INT32 SoldierTo3DLocationLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT32 sGr { FLOAT dStartZPos, dEndZPos; INT16 sXPos, sYPos; - UINT8 ubTargetID; + UINT16 ubTargetID; BOOLEAN fOk; CHECKF( pStartSoldier ); @@ -4385,7 +4385,7 @@ UINT8 SoldierToSoldierBodyPartChanceToGetThrough( SOLDIERTYPE * pStartSoldier, S return( ChanceToGetThrough( pStartSoldier, (FLOAT) CenterX( pEndSoldier->sGridNo ), (FLOAT) CenterY( pEndSoldier->sGridNo ), dEndZPos ) ); } -UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, UINT8 ubTargetID ) +UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, UINT16 ubTargetID ) { FLOAT dEndZPos; INT16 sXPos; @@ -4637,7 +4637,7 @@ void CalculateFiringIncrementsSimple( DOUBLE ddHorizAngle, DOUBLE ddVerticAngle, pBullet->qIncrZ = FloatToFixed( (FLOAT) ( sin( ddVerticAngle ) / sin( (PI/2) - ddVerticAngle ) * HEIGHTUNITS_PER_CELL ) );//dnl ch60 010913 } -INT8 FireBullet( UINT8 ubFirer, BULLET * pBullet, BOOLEAN fFake ) +INT8 FireBullet( UINT16 ubFirer, BULLET * pBullet, BOOLEAN fFake ) { //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("FireBullet")); @@ -5782,7 +5782,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA // Note that this function does not make provisions for Fake Firing. There is no need for it, and it would needlessly // complicate things anyway. // Also note we receive start coordinates from the bomb itself, because there's nowhere else to get them. -INT8 FireFragmentGivenTarget( UINT8 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ) +INT8 FireFragmentGivenTarget( UINT16 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ) { // Artificial... dStartZ++; @@ -7023,7 +7023,7 @@ void MoveBullet( INT32 iBullet ) FIXEDPT qLastZ; SOLDIERTYPE * pTarget; - UINT8 ubTargetID; + UINT16 ubTargetID; BOOLEAN fIntended; BOOLEAN fStopped; INT8 bOldLOSIndexX; @@ -9930,7 +9930,7 @@ UINT32 CalcCounterForceAccuracy(SOLDIERTYPE *pShooter, OBJECTTYPE *pWeapon, UINT // If we can't see the target, but buddies can see it, CF-Accuracy drops by 50% // If we can't see the target and neither can buddies, CF-Accuracy drops by 75% - UINT8 ubTargetID = WhoIsThere2( pShooter->sTargetGridNo, pShooter->bTargetLevel ); // Target ubID + UINT16 ubTargetID = WhoIsThere2( pShooter->sTargetGridNo, pShooter->bTargetLevel ); // Target ubID INT16 sDistVis = pShooter->GetMaxDistanceVisible(pShooter->sTargetGridNo, pShooter->bTargetLevel, CALC_FROM_ALL_DIRS ) * CELL_X_SIZE; gbForceWeaponNotReady = true; INT16 sDistVisNoScope = pShooter->GetMaxDistanceVisible(pShooter->sTargetGridNo, pShooter->bTargetLevel, CALC_FROM_ALL_DIRS ) * CELL_X_SIZE; diff --git a/Tactical/LOS.h b/Tactical/LOS.h index 64c3fc80..01bd9679 100644 --- a/Tactical/LOS.h +++ b/Tactical/LOS.h @@ -69,7 +69,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA // HEADROCK HAM 4: Changed the name of one argument to avoid confusion with the new CTH system. INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usHandItem, INT16 sApertureRatio, BOOLEAN fBuckshot, BOOLEAN fFake ); // HEADROCK HAM 5: Function for fragments ejected from an explosion. -INT8 FireFragmentGivenTarget( UINT8 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ); +INT8 FireFragmentGivenTarget( UINT16 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ); // Flugente: fire a shot from a gun that has no user (used for traps with attached guns) INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT32 gridno, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, INT16 sHitBy); @@ -152,7 +152,7 @@ UINT8 SoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTY UINT8 SoldierToSoldierBodyPartChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier, UINT8 ubAimLocation ); UINT8 AISoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier ); UINT8 AISoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel ); -UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, UINT8 ubTargetID ); +UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, UINT16 ubTargetID ); INT32 SoldierToLocationWindowTest( SOLDIERTYPE * pStartSoldier, INT32 sEndGridNo ); // sevenfm: AI LOS functions INT32 LOS_Raised(SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier, int iTileSightLimit = CALC_FROM_ALL_DIRS, UINT8 ubAimLocation = LOS_POS); diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index 6a425878..aaffbf2f 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -359,7 +359,7 @@ UINT8 ubHeliScripts[ NUM_HELI_STATES ][ MAX_HELI_SCRIPT ] = BOOLEAN gfHandleHeli = FALSE; -UINT8 gusHeliSeats[ MAX_MERC_IN_HELI ]; +UINT16 gusHeliSeats[ MAX_MERC_IN_HELI ]; INT8 gbNumHeliSeatsOccupied = 0; BOOLEAN gfFirstGuyDown = FALSE; @@ -396,7 +396,7 @@ void ResetHeliSeats( ) gbNumHeliSeatsOccupied = 0; } -void AddMercToHeli( UINT8 ubID ) +void AddMercToHeli( UINT16 ubID ) { if ( gbNumHeliSeatsOccupied < MAX_MERC_IN_HELI ) { @@ -1028,7 +1028,7 @@ void HandleFirstHeliDropOfGame( ) CharacterDialogueWithSpecialEvent( 0, 0, 0, DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 ); } -UINT8 SpawnAirDropElite( INT32 sGridNo ) +UINT16 SpawnAirDropElite( INT32 sGridNo ) { SOLDIERTYPE *pSoldier; @@ -1079,7 +1079,7 @@ void InitiateEnemyAirDropSoldiers( INT32 sGridNo ) for ( int i = 0; i < 6; ++i ) { - UINT8 id = SpawnAirDropElite( gMapInformation.sSouthGridNo + i ); + UINT16 id = SpawnAirDropElite( gMapInformation.sSouthGridNo + i ); if ( id == NOBODY ) return; diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 62cded8b..c61e1ae1 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -131,7 +131,7 @@ UINT16 GetInitialHeliRandomTime(); INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) { SOLDIERTYPE *pSoldier; - UINT8 iNewIndex; + UINT16 iNewIndex; UINT8 ubCurrentSoldier = pHireMerc->ubProfileID; MERCPROFILESTRUCT *pMerc; SOLDIERCREATE_STRUCT MercCreateStruct; @@ -429,7 +429,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) } -void MercArrivesCallback( UINT8 ubSoldierID ) +void MercArrivesCallback( UINT16 ubSoldierID ) { MERCPROFILESTRUCT *pMerc; SOLDIERTYPE *pSoldier; @@ -502,7 +502,7 @@ void MercArrivesCallback( UINT8 ubSoldierID ) { bool force_helidrop = true; SOLDIERTYPE *pTeamSoldier; - for (UINT8 cnt = 0; cnt < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; cnt++) + for (UINT16 cnt = 0; cnt < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; cnt++) { if (gCharactersList[cnt].fValid) { @@ -671,12 +671,12 @@ BOOLEAN IsTheSoldierAliveAndConcious( SOLDIERTYPE *pSoldier ) return(FALSE); } -UINT8 NumberOfMercsOnPlayerTeam() +UINT16 NumberOfMercsOnPlayerTeam() { - INT8 cnt; + UINT16 cnt; SOLDIERTYPE *pSoldier; - INT16 bLastTeamID; - UINT8 ubCount=0; + UINT16 bLastTeamID; + UINT16 ubCount=0; // Set locator to first merc cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -702,7 +702,7 @@ UINT8 NumberOfMercsOnPlayerTeam() void HandleMercArrivesQuotes( SOLDIERTYPE *pSoldier ) { - UINT8 cnt, usLastTeamID; + UINT16 cnt, usLastTeamID; INT8 bHated; SOLDIERTYPE *pTeamSoldier; #ifdef JA2UB diff --git a/Tactical/Merc Hiring.h b/Tactical/Merc Hiring.h index 78dcf93b..d083788d 100644 --- a/Tactical/Merc Hiring.h +++ b/Tactical/Merc Hiring.h @@ -46,10 +46,10 @@ extern INT16 gsMercArriveSectorY; INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc); -void MercArrivesCallback( UINT8 ubSoldierID ); +void MercArrivesCallback( UINT16 ubSoldierID ); BOOLEAN IsMercHireable( UINT8 ubMercID ); BOOLEAN IsMercDead( UINT8 ubMercID ); -UINT8 NumberOfMercsOnPlayerTeam(); +UINT16 NumberOfMercsOnPlayerTeam(); BOOLEAN IsTheSoldierAliveAndConcious( SOLDIERTYPE *pSoldier ); void HandleMercArrivesQuotes( SOLDIERTYPE *pSoldier ); void UpdateAnyInTransitMercsWithGlobalArrivalSector( ); diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index 76331c01..f03aa926 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -347,7 +347,7 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll) void HandleMilitiaPromotions( void ) { - UINT8 cnt; + UINT16 cnt; SOLDIERTYPE* pTeamSoldier; gbGreenToElitePromotions = 0; @@ -1442,7 +1442,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_ATTACK ): if (fAllowSectorOrder) { - UINT8 cnt; + UINT16 cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; @@ -1479,7 +1479,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_HOLD ): if (fAllowSectorOrder) { - UINT8 cnt; + UINT16 cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; @@ -1515,7 +1515,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_RETREAT ): if (fAllowSectorOrder) { - UINT8 cnt; + UINT16 cnt; INT16 sActionGridNo; SOLDIERTYPE *pTeamSoldier; @@ -1578,7 +1578,8 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_COMETOME ): if (fAllowSectorOrder) { - UINT8 cnt, ubDirection; + UINT16 cnt; + UINT8 ubDirection; INT32 sActionGridNo, sGridNo, sAdjustedGridNo; SOLDIERTYPE *pTeamSoldier; @@ -1634,7 +1635,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_SPREAD ): if (fAllowSectorOrder) { - UINT8 cnt; + UINT16 cnt; INT32 sActionGridNo; SOLDIERTYPE *pTeamSoldier; @@ -1687,7 +1688,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_GETDOWN ): if (fAllowSectorOrder) { - UINT8 cnt; + UINT16 cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; @@ -1725,7 +1726,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_CROUCH ): if (fAllowSectorOrder) { - UINT8 cnt; + UINT16 cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; @@ -1763,7 +1764,7 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_TAKE_COVER ): if (fAllowSectorOrder) { - UINT8 cnt; + UINT16 cnt; INT16 sActionGridNo; INT32 iDummy; SOLDIERTYPE *pTeamSoldier; diff --git a/Tactical/Morale.cpp b/Tactical/Morale.cpp index 131f9b4d..2a41793f 100644 --- a/Tactical/Morale.cpp +++ b/Tactical/Morale.cpp @@ -257,7 +257,7 @@ void DecayStrategicMorale( SOLDIERTYPE * pSoldier ) void DecayTacticalMoraleModifiers( void ) { SOLDIERTYPE * pSoldier; - UINT8 ubLoop, ubLoop2; + UINT16 ubLoop, ubLoop2; BOOLEAN fHandleNervous; ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -364,7 +364,7 @@ void DecayTacticalMoraleModifiers( void ) void DecayStrategicMoraleModifiers( void ) { SOLDIERTYPE * pSoldier; - UINT8 ubLoop; + UINT16 ubLoop; ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; for ( pSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pSoldier++ ) @@ -730,7 +730,7 @@ void HandleMoraleEventForSoldier( SOLDIERTYPE * pSoldier, INT8 bMoraleEvent ) void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { - UINT8 ubLoop; + UINT16 ubLoop; SOLDIERTYPE * pTeamSoldier; MERCPROFILESTRUCT * pProfile; @@ -1144,14 +1144,13 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I void HourlyMoraleUpdate( void ) { - INT8 bMercID, bOtherID; + UINT16 bMercID, bOtherID, bLastTeamID; INT8 bActualTeamOpinion; INT8 bTeamMoraleModChange, bTeamMoraleModDiff; INT8 bOpinion=-1; INT32 iTotalOpinions; INT8 bNumTeamMembers; INT8 bHighestTeamLeadership = 0; - INT8 bLastTeamID; SOLDIERTYPE * pSoldier; SOLDIERTYPE * pOtherSoldier; MERCPROFILESTRUCT * pProfile; diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index a7e4326d..f321b9bb 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -276,31 +276,32 @@ const int startingZ = 0; // ENUMERATION OF SOLDIER POSIITONS IN GLOBAL SOLDIER LIST // WDS - make number of mercenaries, etc. be configurable -#define CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS 32 -extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS; +#define CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS 254 +extern UINT16 giMAXIMUM_NUMBER_OF_PLAYER_MERCS; #define CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES 6 -extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES; +extern UINT16 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES; #define CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS+CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES -extern UINT8 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; -#define CODE_MAXIMUM_NUMBER_OF_ENEMIES 64 -extern UINT8 giMAXIMUM_NUMBER_OF_ENEMIES; +extern UINT16 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; +#define CODE_MAXIMUM_NUMBER_OF_ENEMIES 256 +extern UINT16 giMAXIMUM_NUMBER_OF_ENEMIES; #define CODE_MAXIMUM_NUMBER_OF_CREATURES 40 -extern UINT8 giMAXIMUM_NUMBER_OF_CREATURES; +extern UINT16 giMAXIMUM_NUMBER_OF_CREATURES; #define CODE_MAXIMUM_NUMBER_OF_REBELS 64 -extern UINT8 giMAXIMUM_NUMBER_OF_REBELS; +extern UINT16 giMAXIMUM_NUMBER_OF_REBELS; #define CODE_MAXIMUM_NUMBER_OF_CIVS 40 -extern UINT8 giMAXIMUM_NUMBER_OF_CIVS; +extern UINT16 giMAXIMUM_NUMBER_OF_CIVS; // The following should be the largest from the above set of constants. // Note: Is there any way to compute this via the preprocessor? -#define LARGEST_NUMBER_IN_ANY_GROUP 64 +#define LARGEST_NUMBER_IN_ANY_GROUP 260 #define MAX_NUM_SOLDIERS (CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS+CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES+CODE_MAXIMUM_NUMBER_OF_ENEMIES+CODE_MAXIMUM_NUMBER_OF_CREATURES+CODE_MAXIMUM_NUMBER_OF_REBELS+CODE_MAXIMUM_NUMBER_OF_CIVS) #define NUM_PLANNING_MERCS 8 -#define TOTAL_SOLDIERS ( NUM_PLANNING_MERCS + MAX_NUM_SOLDIERS ) +//#define TOTAL_SOLDIERS ( NUM_PLANNING_MERCS + MAX_NUM_SOLDIERS ) +#define TOTAL_SOLDIERS (MAX_NUM_SOLDIERS ) // If there are more than (one less the size of the field used to store IDs (currently a char)) then fail -#if TOTAL_SOLDIERS > 254 +#if TOTAL_SOLDIERS > 2048 #error Too many! #endif #if CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS > LARGEST_NUMBER_IN_ANY_GROUP diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index ef446769..8dca851e 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -143,19 +143,19 @@ #include "GameInitOptionsScreen.h" // OJW - 20090419 -UINT8 giMAXIMUM_NUMBER_OF_PLAYER_MERCS = CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS; -UINT8 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES = CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES; -UINT8 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; -UINT8 giMAXIMUM_NUMBER_OF_ENEMIES = CODE_MAXIMUM_NUMBER_OF_ENEMIES; -UINT8 giMAXIMUM_NUMBER_OF_CREATURES = CODE_MAXIMUM_NUMBER_OF_CREATURES; -UINT8 giMAXIMUM_NUMBER_OF_REBELS = CODE_MAXIMUM_NUMBER_OF_REBELS; -UINT8 giMAXIMUM_NUMBER_OF_CIVS = CODE_MAXIMUM_NUMBER_OF_CIVS; +UINT16 giMAXIMUM_NUMBER_OF_PLAYER_MERCS = CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS; +UINT16 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES = CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES; +UINT16 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS = CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; +UINT16 giMAXIMUM_NUMBER_OF_ENEMIES = CODE_MAXIMUM_NUMBER_OF_ENEMIES; +UINT16 giMAXIMUM_NUMBER_OF_CREATURES = CODE_MAXIMUM_NUMBER_OF_CREATURES; +UINT16 giMAXIMUM_NUMBER_OF_REBELS = CODE_MAXIMUM_NUMBER_OF_REBELS; +UINT16 giMAXIMUM_NUMBER_OF_CIVS = CODE_MAXIMUM_NUMBER_OF_CIVS; //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; - +extern void HandleTBPickUpBackpacks(BOOLEAN fAll); extern void HandleBestSightingPositionInRealtime(); extern INT32 GetCurrentBalance( void ); @@ -372,7 +372,7 @@ CHAR8 gzDirectionStr[][ 30 ] = }; // TEMP VALUES FOR TEAM DEFAULT POSITIONS -UINT8 bDefaultTeamRangesMP[ MAXTEAMS ][ 2 ] = +UINT16 bDefaultTeamRangesMP[ MAXTEAMS ][ 2 ] = { 0, 19, //20 US @@ -388,7 +388,7 @@ UINT8 bDefaultTeamRangesMP[ MAXTEAMS ][ 2 ] = MAX_NUM_SOLDIERS, TOTAL_SOLDIERS - 1 // PLANNING SOLDIERS }; -UINT8 bDefaultTeamRanges[ MAXTEAMS_SP ][ 2 ] = +UINT16 bDefaultTeamRanges[ MAXTEAMS_SP ][ 2 ] = { 0, CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS+CODE_MAXIMUM_NUMBER_OF_PLAYER_VEHICLES-1, @@ -420,16 +420,16 @@ COLORVAL bDefaultTeamColors[ MAXTEAMS ] = }; // UTILITY FUNCTIONS -INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); -UINT8 NumEnemyInSector( ); -UINT8 NumEnemyInSectorExceptCreatures(); -UINT8 NumCapableEnemyInSector( ); +UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); +UINT16 NumEnemyInSector( ); +UINT16 NumEnemyInSectorExceptCreatures(); +UINT16 NumCapableEnemyInSector( ); BOOLEAN KillIncompacitatedEnemyInSector( ); BOOLEAN CheckForLosingEndOfBattle( ); void EndBattleWithUnconsciousGuysCallback( UINT8 bExitValue ); -UINT8 NumEnemyInSectorNotDeadOrDying( ); -UINT8 NumBloodcatsInSectorNotDeadOrDying( ); +UINT16 NumEnemyInSectorNotDeadOrDying( ); +UINT16 NumBloodcatsInSectorNotDeadOrDying( ); UINT8 gubWaitingForAllMercsToExitCode = 0; UINT8 gusNumMercsUntilWaitingOver = 0; @@ -659,7 +659,7 @@ void ShutdownTacticalEngine( ) BOOLEAN InitOverhead( ) { UINT32 cnt; - UINT8 cnt2; + UINT16 cnt2; // Set pointers list for( cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) @@ -1331,7 +1331,7 @@ BOOLEAN ExecuteOverhead( ) } // OK, if we are the selected soldier, refresh some UI stuff - if ( pSoldier->ubID == (UINT8)gusSelectedSoldier ) + if ( pSoldier->ubID == gusSelectedSoldier ) { gfUIRefreshArrows = TRUE; } @@ -3378,7 +3378,7 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF UpdateForContOverPortrait( pOldSoldier, FALSE ); } - gusSelectedSoldier = (UINT16)usSoldierID; + gusSelectedSoldier = usSoldierID; // find which squad this guy is, then set selected squad to this guy if( pSoldier->bAssignment == VEHICLE ) @@ -3405,7 +3405,7 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF //pSoldier->SetCheckSoldierLightFlag( ); // Set interface to reflect new selection! - SetCurrentTacticalPanelCurrentMerc( (UINT8)usSoldierID ); + SetCurrentTacticalPanelCurrentMerc( usSoldierID ); // PLay ATTN SOUND if ( fAcknowledge ) @@ -3513,11 +3513,11 @@ void LocateSoldier( UINT16 usID, BOOLEAN fSetLocator) { if ( fSetLocator == SETLOCATOR || fSetLocator == 10 ) { - ShowRadioLocator((UINT8)usID, SHOW_LOCATOR_NORMAL ); + ShowRadioLocator(usID, SHOW_LOCATOR_NORMAL ); } else { - ShowRadioLocator((UINT8)usID, SHOW_LOCATOR_FAST ); + ShowRadioLocator(usID, SHOW_LOCATOR_FAST ); } } } @@ -3569,7 +3569,7 @@ void SlideTo(INT32 sGridNo, UINT16 usSoldierID , UINT16 usReasonID, BOOLEAN fSet // Locate even if on screen if (fSetLocator) - ShowRadioLocator((UINT8) usSoldierID, SHOW_LOCATOR_NORMAL ); + ShowRadioLocator( usSoldierID, SHOW_LOCATOR_NORMAL ); // FIRST CHECK IF WE ARE ON SCREEN if ( GridNoOnScreen( MercPtrs[ usSoldierID ]->sGridNo ) ) @@ -4167,7 +4167,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) // killing crows/cows is not worth any experience! if ( ( pSoldierOld->ubBodyType != CROW ) && ( pSoldierOld->ubBodyType != COW ) ) //&& pSoldierOld->ubLastDamageReason != TAKE_DAMAGE_BLOODLOSS ) // SANDRO - why not give exp for bleeding out? { - UINT8 ubAssister = NOBODY; + UINT16 ubAssister = NOBODY; // if it was a kill by a player's merc if (pSoldierOld->ubAttackerID != NOBODY && MercPtrs[ pSoldierOld->ubAttackerID ]->bTeam == gbPlayerNum ) @@ -4267,7 +4267,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) CheckForEndOfBattle( FALSE ); } -UINT8 LastActiveTeamMember( UINT8 ubTeam ) +UINT16 LastActiveTeamMember( UINT16 ubTeam ) { INT32 cnt; SOLDIERTYPE *pSoldier; @@ -4279,7 +4279,7 @@ UINT8 LastActiveTeamMember( UINT8 ubTeam ) { if ( pSoldier->bActive ) { - return( (INT8)cnt ); + return( (UINT16)cnt ); } } @@ -4542,9 +4542,9 @@ void MakeCivHostile(SOLDIERTYPE *pSoldier) UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked ) { - SOLDIERTYPE * pSoldier; - UINT8 ubFirstProfile = NO_PROFILE; - UINT8 cnt; + SOLDIERTYPE * pSoldier; + UINT8 ubFirstProfile = NO_PROFILE; + UINT16 cnt; if ( pAttacked->ubCivilianGroup == NON_CIV_GROUP ) { @@ -4584,11 +4584,11 @@ UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked ) SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked ) { - SOLDIERTYPE * pNew; - SOLDIERTYPE * pNewAttacked = pAttacked; - SOLDIERTYPE * pSoldier; - UINT8 cnt; - UINT8 ubFirstProfile = NO_PROFILE; + SOLDIERTYPE * pNew; + SOLDIERTYPE * pNewAttacked = pAttacked; + SOLDIERTYPE * pSoldier; + UINT16 cnt; + UINT8 ubFirstProfile = NO_PROFILE; if ( pAttacked->ubCivilianGroup == NON_CIV_GROUP ) { @@ -4778,11 +4778,11 @@ gTacticalStatus.fCivGroupHostile[ ubLoop ] = CIV_GROUP_HOSTILE; } */ -INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) +UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) { INT32 cnt; SOLDIERTYPE *pSoldier; - UINT8 ubCount = 0; + UINT16 ubCount = 0; cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; @@ -4799,10 +4799,10 @@ INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) } -UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) +UINT16 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { - UINT8 bLastTeamID; - INT32 cnt; + UINT16 bLastTeamID; + UINT16 cnt; SOLDIERTYPE *pTeamSoldier; cnt = pSoldier->ubID + 1; @@ -4823,14 +4823,14 @@ UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL { if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && ( pTeamSoldier->bAssignment < ON_DUTY || pTeamSoldier->bAssignment == VEHICLE ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( cnt ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( cnt ); } } } @@ -4854,14 +4854,14 @@ UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL { if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && ( pTeamSoldier->bAssignment < ON_DUTY || pTeamSoldier->bAssignment == VEHICLE ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( cnt ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( cnt ); } } } @@ -4913,9 +4913,9 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier ) } -UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) +UINT16 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { - UINT8 bLastTeamID; + UINT16 bLastTeamID; INT32 cnt; SOLDIERTYPE *pTeamSoldier; @@ -4939,14 +4939,14 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL // Check for bLife > 0 if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && ( pTeamSoldier->bAssignment < ON_DUTY || pTeamSoldier->bAssignment == VEHICLE ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( (UINT16)cnt ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( (UINT16)cnt ); } } } @@ -4969,14 +4969,14 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL { if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && ( pTeamSoldier->bAssignment < ON_DUTY || pTeamSoldier->bAssignment == VEHICLE ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( (UINT16)cnt ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT8)cnt ); + return( (UINT16)cnt ); } } } @@ -4990,8 +4990,8 @@ UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKL BOOLEAN CheckForPlayerTeamInMissionExit( ) { INT32 cnt; - SOLDIERTYPE *pSoldier; - UINT8 bGuysIn = 0; + SOLDIERTYPE *pSoldier; + UINT16 bGuysIn = 0; // End the turn of player charactors cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -5087,10 +5087,10 @@ extern BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel // NB if making changes don't forget to update NewOKDestinationAndDirection BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel ) { - UINT8 bPerson; - STRUCTURE * pStructure; - INT16 sDesiredLevel; - BOOLEAN fOKCheckStruct; + UINT16 bPerson; + STRUCTURE *pStructure; + INT16 sDesiredLevel; + BOOLEAN fOKCheckStruct; // sevenfm: allow civilians and NPCs with profile to go off screen if (!GridNoOnVisibleWorldTile(sGridNo) && (pCurrSoldier->bTeam != CIV_TEAM || pCurrSoldier->ubProfile == NO_PROFILE)) @@ -5228,10 +5228,10 @@ BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPe // NB if making changes don't forget to update NewOKDestination INT16 NewOKDestinationAndDirection( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, INT8 bDirection, BOOLEAN fPeopleToo, INT8 bLevel ) { - UINT8 bPerson; - STRUCTURE * pStructure; - INT16 sDesiredLevel; - BOOLEAN fOKCheckStruct; + UINT16 bPerson; + STRUCTURE *pStructure; + INT16 sDesiredLevel; + BOOLEAN fOKCheckStruct; if (fPeopleToo && ( bPerson = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY ) { @@ -5439,7 +5439,7 @@ BOOLEAN IsLocationSittableExcludingPeople( INT32 iMapIndex, BOOLEAN fOnRoof ) BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange) { - UINT8 bLoop; + UINT16 bLoop; SOLDIERTYPE * pSoldier; for (bLoop=gTacticalStatus.Team[bTeam].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[bTeam].bLastID; ++bLoop, pSoldier++) @@ -5832,14 +5832,14 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub //INT32 cnt; INT32 sClosest = -1, sSpot, sSpot2; INT32 sCloseGridNo = NOWHERE; - UINT32 uiMercFlags; - UINT16 usSoldierIndex; - UINT8 ubDir; - STRUCTURE *pDoor; - UINT8 ubWallOrientation; - BOOLEAN fCheckGivenGridNo = TRUE; - UINT8 ubTestDirection; - UINT8 ubWhoIsThere; + UINT32 uiMercFlags; + UINT16 usSoldierIndex; + UINT8 ubDir; + STRUCTURE *pDoor; + UINT8 ubWallOrientation; + BOOLEAN fCheckGivenGridNo = TRUE; + UINT8 ubTestDirection; + UINT16 ubWhoIsThere; // CHECK IF WE WANT TO FORCE GRIDNO TO PERSON if ( psAdjustedGridNo != NULL ) @@ -6145,7 +6145,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub INT32 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier, INT32 * psAdjustedTargetGridNo, UINT8 * pubDirection ) { INT32 sSpot; - UINT8 ubGuyThere; + UINT16 ubGuyThere; for ( UINT8 cnt = 0; cnt < NUM_WORLD_DIRECTIONS; ++cnt ) { @@ -6883,9 +6883,9 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) { // WDS - make number of mercenaries, etc. be configurable // UINT8 ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt; @@ -6900,7 +6900,7 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ubNumMercs++; } } @@ -6908,7 +6908,7 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); MercPtrs[ ubChosenMerc ]->DoMercBattleSound( (UINT8)iBattleSnd ); } @@ -7402,10 +7402,6 @@ void UpdateWoundedFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { SOLDIERTYPE *pSoldier; INT32 cnt = 0; - UINT8 ubNumPrisoners = 0; - UINT8 ubNumPrisonerAdmin = 0; - UINT8 ubNumPrisonerTroop = 0; - UINT8 ubNumPrisonerElite = 0; // Check if the battle is won! // Loop through all mercs and make go @@ -7543,7 +7539,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if (fBattleLost) { // sevenfm: count alive/dead/not covert mercs in sector/retreating from sector - UINT8 ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; + UINT16 ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; BOOLEAN fFoundNotCovertMerc = FALSE; BOOLEAN fFoundAliveMerc = FALSE; BOOLEAN fFoundDeadMerc = FALSE; @@ -7592,7 +7588,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) memset(&(gTacticalStatus.bNumFoughtInBattle), 0, MAXTEAMS); // If here, the battle has been lost! - UnSetUIBusy((UINT8)gusSelectedSoldier); + UnSetUIBusy(gusSelectedSoldier); if (gTacticalStatus.uiFlags & INCOMBAT) { @@ -7725,7 +7721,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // battle for us EndAllAITurns( ); - UnSetUIBusy( (UINT8)gusSelectedSoldier ); + UnSetUIBusy( gusSelectedSoldier ); // ATE: // If we ended battle in any team other than the player's @@ -8011,7 +8007,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // Flugente: in any case, reset creature attack variables ResetCreatureAttackVariables(); - // sevenfm: switch off radio + // sevenfm: pick up dropped backpacks + HandleTBPickUpBackpacks(TRUE); + + // sevenfm: switch off radio //SwitchOffAllRadio(); // If we are the server, we escape this function at the top if we think the game should still be running @@ -8154,7 +8153,7 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) // If we are > ok start, this is the one! if ( cnt > pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT8)cnt; + pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); @@ -8182,7 +8181,7 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) // If we are > ok start, this is the one! if ( cnt > pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT8)cnt; + pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); @@ -8217,7 +8216,7 @@ void CycleVisibleEnemiesBackward( SOLDIERTYPE *pSrcSoldier ) // If we are > ok start, this is the one! if ( cnt < pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT8)cnt; + pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); @@ -8246,7 +8245,7 @@ void CycleVisibleEnemiesBackward( SOLDIERTYPE *pSrcSoldier ) // If we are > ok start, this is the one! if ( cnt < pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT8)cnt; + pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); @@ -8289,11 +8288,11 @@ BOOLEAN PlayerTeamFull( ) return( TRUE ); } -UINT8 NumPCsInSector( ) +UINT16 NumPCsInSector( ) { SOLDIERTYPE *pTeamSoldier; UINT32 cnt = 0; - UINT8 ubNumPlayers = 0; + UINT16 ubNumPlayers = 0; // Check if the battle is won! // Loop through all mercs and make go @@ -8314,11 +8313,11 @@ UINT8 NumPCsInSector( ) } -UINT8 NumEnemyInSector( ) +UINT16 NumEnemyInSector( ) { SOLDIERTYPE *pTeamSoldier; INT32 cnt = 0; - UINT8 ubNumEnemies = 0; + UINT16 ubNumEnemies = 0; // Check if the battle is won! // Loop through all mercs and make go @@ -8338,11 +8337,11 @@ UINT8 NumEnemyInSector( ) } -UINT8 NumZombiesInSector( ) +UINT16 NumZombiesInSector( ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; - UINT8 ubNumZombies = 0; + INT32 cnt = 0; + UINT16 ubNumZombies = 0; for ( pTeamSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; ++pTeamSoldier, ++cnt ) { @@ -8358,11 +8357,11 @@ UINT8 NumZombiesInSector( ) return( ubNumZombies ); } -UINT8 NumEnemyInSectorExceptCreatures() +UINT16 NumEnemyInSectorExceptCreatures() { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; - UINT8 ubNumEnemies = 0; + INT32 cnt = 0; + UINT16 ubNumEnemies = 0; // Check if the battle is won! // Loop through all mercs and make go @@ -8383,11 +8382,11 @@ UINT8 NumEnemyInSectorExceptCreatures() } -UINT8 NumEnemyInSectorNotDeadOrDying( ) +UINT16 NumEnemyInSectorNotDeadOrDying( ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; - UINT8 ubNumEnemies = 0; + INT32 cnt = 0; + UINT16 ubNumEnemies = 0; // Check if the battle is won! // Loop through all mercs and make go @@ -8418,11 +8417,11 @@ UINT8 NumEnemyInSectorNotDeadOrDying( ) } -UINT8 NumBloodcatsInSectorNotDeadOrDying( ) +UINT16 NumBloodcatsInSectorNotDeadOrDying( ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; - UINT8 ubNumEnemies = 0; + INT32 cnt = 0; + UINT16 ubNumEnemies = 0; // Check if the battle is won! // Loop through all mercs and make go @@ -8457,11 +8456,11 @@ UINT8 NumBloodcatsInSectorNotDeadOrDying( ) } -UINT8 NumCapableEnemyInSector( ) +UINT16 NumCapableEnemyInSector( ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; - UINT8 ubNumEnemies = 0; + INT32 cnt = 0; + UINT16 ubNumEnemies = 0; // Check if the battle is won! // Loop through all mercs and make go @@ -8505,7 +8504,7 @@ BOOLEAN CheckForLosingEndOfBattle( ) { SOLDIERTYPE *pTeamSoldier; INT32 cnt = 0; - INT8 bNumDead = 0, bNumNotOK = 0, bNumInBattle = 0, bNumNotOKRealMercs = 0; + UINT16 bNumDead = 0, bNumNotOK = 0, bNumInBattle = 0, bNumNotOKRealMercs = 0; BOOLEAN fMadeCorpse; BOOLEAN fDoCapture = FALSE; BOOLEAN fOnlyEPCsLeft = TRUE; @@ -8864,9 +8863,9 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier ) return( bTolerance ); } -extern void IncrementWatchedLoc(UINT8 ubID, INT32 sGridNo, INT8 bLevel); +extern void IncrementWatchedLoc(UINT16 ubID, INT32 sGridNo, INT8 bLevel); -void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) +void HandleSuppressionFire( UINT16 ubTargetedMerc, UINT16 ubCausedAttacker ) { /////////////////////////////////////////////////////////////////////////////// // @@ -9245,7 +9244,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker ) // "Soldier is pinned down!" ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113HAMMessage[1], pSoldier->GetName() ); // HEADROCK HAM 3.2: Added a radio locator! - ShowRadioLocator( (UINT8)pSoldier->ubID, SHOW_LOCATOR_NORMAL ); + ShowRadioLocator( pSoldier->ubID, SHOW_LOCATOR_NORMAL ); } } } @@ -9653,7 +9652,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) SOLDIERTYPE * pTarget; BOOLEAN fEnterCombat = FALSE; UINT32 cnt; - UINT8 ubID; + UINT16 ubID; #if 0 // 0verhaul: None of this is necessary anymore with the new attack busy system @@ -9997,7 +9996,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) if ( gTacticalStatus.uiFlags & CHECK_SIGHT_AT_END_OF_ATTACK ) { - UINT8 ubLoop; + UINT16 ubLoop; SOLDIERTYPE * pSightSoldier; AllTeamsLookForAll( FALSE ); @@ -10317,7 +10316,7 @@ void RemoveManFromTeam( INT8 bTeam ) void RemoveSoldierFromTacticalSector( SOLDIERTYPE *pSoldier, BOOLEAN fAdjustSelected ) { - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE *pNewSoldier; // reset merc's opplist @@ -10661,9 +10660,9 @@ void HandleCreatureTenseQuote( ) { // WDS - make number of mercenaries, etc. be configurable // UINT8 ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt; INT32 uiTime; @@ -10691,7 +10690,7 @@ void HandleCreatureTenseQuote( ) // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ubNumMercs++; } } @@ -10699,7 +10698,7 @@ void HandleCreatureTenseQuote( ) // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); DoCreatureTensionQuote ( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ] ); } @@ -10812,7 +10811,7 @@ INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier ) INT8 bLevelDifference = 0; // Run through each friendly. - for ( UINT8 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) { pLeader = MercPtrs[ iCounter ]; // Make sure that character is alive, not too shocked, and conscious, and of higher experience level @@ -10904,7 +10903,7 @@ INT8 CheckStatusNearbyFriendliesSimple(SOLDIERTYPE *pSoldier) } // Run through each friendly. - for (UINT8 ubFriend = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; ubFriend <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ubFriend ++) + for (UINT16 ubFriend = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; ubFriend <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ubFriend ++) { pFriend = MercPtrs[ ubFriend ]; @@ -11047,7 +11046,7 @@ void HandleDisplayingOfPlayerLostDialogue( ) } #endif -static UINT8 prisonerdialoguetargetID = NOBODY; +static UINT16 prisonerdialoguetargetID = NOBODY; void TurnCoatAttemptMessageBoxCallBack( UINT8 ubExitValue ) { @@ -11605,7 +11604,7 @@ void TeamRestock(UINT8 bTeam) } // are we allowed to steal access this guy's inventory? -BOOLEAN AllowedToStealFromTeamMate( UINT8 ubID, UINT8 ubTargetID ) +BOOLEAN AllowedToStealFromTeamMate( UINT16 ubID, UINT16 ubTargetID ) { if ( gGameExternalOptions.fAccessOtherMercInventories && ubID != ubTargetID && MercPtrs[ubID]->bTeam == MercPtrs[ubTargetID]->bTeam && !AM_AN_EPC(MercPtrs[ubTargetID]) && !IsVehicle(MercPtrs[ubTargetID]) ) return TRUE; @@ -11764,11 +11763,11 @@ INT8 CalcEffectiveShockLevel( SOLDIERTYPE * pSoldier ) } // Flugente: count number of enemy officers -UINT8 HighestEnemyOfficersInSector( UINT8& aType ) +UINT16 HighestEnemyOfficersInSector( UINT8& aType ) { SOLDIERTYPE* pSoldier; INT32 cnt = 0; - UINT8 num = 0; + UINT16 num = 0; UINT8 type = OFFICER_NONE; for ( cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID, pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; pSoldier++, ++cnt ) @@ -11794,7 +11793,7 @@ UINT16 NumSoldiersWithFlagInSector( UINT8 aTeam, UINT32 aFlag ) { SOLDIERTYPE* pSoldier; INT32 cnt = 0; - UINT8 num = 0; + UINT16 num = 0; for ( cnt = gTacticalStatus.Team[aTeam].bFirstID, pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[aTeam].bLastID; pSoldier++, ++cnt ) { diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 47d93653..96f92eaa 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -23,12 +23,12 @@ enum // TACTICAL ENGINE STATUS FLAGS typedef struct { - UINT8 bFirstID; - UINT8 bLastID; + UINT16 bFirstID; + UINT16 bLastID; COLORVAL RadarColor; INT8 bSide; - INT8 bMenInSector; - UINT8 ubLastMercToRadio; + INT16 bMenInSector; + UINT16 ubLastMercToRadio; INT8 bTeamActive; INT8 bAwareOfOpposition; INT8 bHuman; @@ -69,8 +69,8 @@ struct TacticalStatusType INT8 fPanicFlags; INT32 sPanicTriggerGridNoUnused; INT16 sHandGrid; - UINT8 ubSpottersCalledForBy; - UINT8 ubTheChosenOne; + UINT16 ubSpottersCalledForBy; + UINT16 ubTheChosenOne; UINT32 uiTimeOfLastInput; UINT32 uiTimeSinceDemoOn; UINT32 uiCountdownToRestart; @@ -89,13 +89,13 @@ struct TacticalStatusType INT8 bRealtimeSpeed; UINT8 ubEnemyIntention; UINT8 ubEnemyIntendedRetreatDirection; - UINT8 ubEnemySightingOnTheirTurnEnemyID; - UINT8 ubEnemySightingOnTheirTurnPlayerID; + UINT16 ubEnemySightingOnTheirTurnEnemyID; + UINT16 ubEnemySightingOnTheirTurnPlayerID; BOOLEAN fEnemySightingOnTheirTurn; BOOLEAN fAutoBandageMode; UINT8 ubAttackBusyCount; INT8 bNumEnemiesFoughtInBattleUnused; - UINT8 ubEngagedInConvFromActionMercID; + UINT16 ubEngagedInConvFromActionMercID; UINT16 usTactialTurnLimitCounter; BOOLEAN fInTopMessage; UINT8 ubTopMessageType; @@ -114,7 +114,7 @@ struct TacticalStatusType BOOLEAN fSaidCreatureFlavourQuote; BOOLEAN fHaveSeenCreature; BOOLEAN fKilledEnemyOnAttack; - UINT8 ubEnemyKilledOnAttack; + UINT16 ubEnemyKilledOnAttack; INT8 bEnemyKilledOnAttackLevel; UINT16 ubEnemyKilledOnAttackLocation; BOOLEAN fItemsSeenOnAttack; @@ -128,7 +128,7 @@ struct TacticalStatusType BOOLEAN fCantGetThrough; INT32 sCantGetThroughGridNo; INT32 sCantGetThroughSoldierGridNo; - UINT8 ubCantGetThroughID; + UINT16 ubCantGetThroughID; BOOLEAN fDidGameJustStart; BOOLEAN fStatChangeCheatOn; UINT8 ubLastRequesterTargetID; @@ -142,10 +142,9 @@ struct TacticalStatusType BOOLEAN fHasAGameBeenStarted; INT8 bConsNumTurnsWeHaventSeenButEnemyDoes; BOOLEAN fSomeoneHit; - UINT8 ubPaddingSmall; UINT32 uiTimeSinceLastOpplistDecay; INT8 bMercArrivingQuoteBeingUsed; - UINT8 ubEnemyKilledOnAttackKiller; + UINT16 ubEnemyKilledOnAttackKiller; BOOLEAN fCountingDownForGuideDescription; INT8 bGuideDescriptionCountDown; UINT8 ubGuideDescriptionToUse; @@ -159,7 +158,7 @@ struct TacticalStatusType UINT16 sCreatureTenseQuoteDelay; UINT32 uiCreatureTenseQuoteLastUpdate; // SANDRO - added these - UINT8 ubLastRequesterSurgeryTargetID; + UINT16 ubLastRequesterSurgeryTargetID; UINT8 ubInterruptPending; // sevenfm: Ctrl+D disable interrupts BOOLEAN ubDisablePlayerInterrupts; @@ -240,11 +239,11 @@ void SlideToLocation( UINT16 usReasonID, INT32 sDestGridNo ); void RebuildAllSoldierShadeTables( ); void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ); -UINT8 LastActiveTeamMember( UINT8 ubTeam ); +UINT16 LastActiveTeamMember( UINT16 ubTeam ); BOOLEAN SoldierOnVisibleWorldTile( SOLDIERTYPE *pSoldier ); -UINT8 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); -UINT8 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); +UINT16 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); +UINT16 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); BOOLEAN CheckForPlayerTeamInMissionExit( ); void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldier ); @@ -261,7 +260,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ); BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange); -BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID ); +BOOLEAN IsValidTargetMerc( UINT16 ubSoldierID ); // FUNCTIONS FOR MANIPULATING MERC SLOTS - A LIST OF ALL ACTIVE MERCS INT32 GetFreeMercSlot( ); @@ -323,7 +322,7 @@ BOOLEAN HostileBloodcatsPresent( ); BOOLEAN HostileZombiesPresent( ); BOOLEAN HostileCreaturesPresent(); -UINT8 NumPCsInSector( ); +UINT16 NumPCsInSector( ); void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier ); void SetSoldierNeutral( SOLDIERTYPE * pSoldier ); @@ -351,10 +350,10 @@ extern BOOLEAN gogglewarning; // will a sam site under the players control shoot down an airraid? BOOLEAN WillAirRaidBeStopped( INT16 sSectorX, INT16 sSectorY ); // HEADROCK HAM 3.5: Externalized for First Arrival enemy check -extern UINT8 NumEnemyInSector(); +extern UINT16 NumEnemyInSector(); // Flugente -extern UINT8 NumZombiesInSector(); +extern UINT16 NumZombiesInSector(); // Flugente: offer the enemy the chance to surrender void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ); @@ -371,7 +370,7 @@ void TeamDropAll(UINT8 bTeam, BOOLEAN fForce = FALSE); void TeamRestock(UINT8 bTeam); // are we allowed to steal access this guy's inventory? -BOOLEAN AllowedToStealFromTeamMate( UINT8 aAccessorID, UINT8 aTargetID ); +BOOLEAN AllowedToStealFromTeamMate( UINT16 ubID, UINT16 ubTargetID ); // Flugente: is an soldier profile already used? BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr); @@ -402,7 +401,7 @@ enum { }; // Flugente: return number of enemy officers and highest rank found -UINT8 HighestEnemyOfficersInSector(UINT8& aType); +UINT16 HighestEnemyOfficersInSector(UINT8& aType); // count all soldiers in the current sector that have a specific flag set UINT16 NumSoldiersWithFlagInSector(UINT8 aTeam, UINT32 aFlag); diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 829fee54..1409f396 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -2517,7 +2517,7 @@ b=GetJA2Clock();//return s->sGridNo+6; INT8 bLoopState = LOOPING_CLOCKWISE; //BOOLEAN fLoopForwards = FALSE; BOOLEAN fCheckedBehind = FALSE; - UINT8 ubMerc; + UINT16 ubMerc; INT32 iDestX,iDestY, iLocX, iLocY, dx, dy; INT32 newLoc,curLoc; //INT32 curY; diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index c4747611..d0684864 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -1545,7 +1545,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) { if( gfUIFullTargetFound ) { - if ( IsValidTalkableNPC( (UINT8)gusUIFullTargetID, FALSE, FALSE, FALSE ) && !_KeyDown( SHIFT ) && !AM_AN_EPC( pSoldier ) && MercPtrs[ gusUIFullTargetID ]->bTeam != ENEMY_TEAM && !ValidQuickExchangePosition( ) ) + if ( IsValidTalkableNPC( gusUIFullTargetID, FALSE, FALSE, FALSE ) && !_KeyDown( SHIFT ) && !AM_AN_EPC( pSoldier ) && MercPtrs[ gusUIFullTargetID ]->bTeam != ENEMY_TEAM && !ValidQuickExchangePosition( ) ) { uiMoveTargetSoldierId = gusUIFullTargetID; *puiNewEvent = T_CHANGE_TO_TALKING; @@ -1588,7 +1588,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) //if ( gfUIFullTargetFound ) { - if ( IsValidTargetMerc( (UINT8)gusUIFullTargetID ) ) + if ( IsValidTargetMerc( gusUIFullTargetID ) ) { guiUITargetSoldierId = gusUIFullTargetID; @@ -2077,7 +2077,7 @@ void HandleAltMouseRTX2Button(UINT32 *puiNewEvent) // sevenfm: original mouse commands functionality void HandleMouseRTWheel( void ) { - UINT8 bID; + UINT16 bID; // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ NEXTMERC_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) @@ -2205,7 +2205,7 @@ void HandleMouseRTX2Button( UINT32 *puiNewEvent ) // For each guy on squad... { SOLDIERTYPE *pTeamSoldier; - INT8 bLoop; + INT16 bLoop; BOOLEAN fStealthOn = FALSE; // Check if at least one guy is on stealth.... diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 26f476ec..bc3348dd 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1165,7 +1165,7 @@ void AddCrowToCorpse( ROTTING_CORPSE *pCorpse ) { SOLDIERCREATE_STRUCT MercCreateStruct; INT8 ubBodyType = CROW; - UINT8 iNewIndex; + UINT16 iNewIndex; INT32 sGridNo; UINT8 ubDirection; SOLDIERTYPE *pSoldier; @@ -2970,13 +2970,13 @@ void CreateZombiefromCorpse( ROTTING_CORPSE * pCorpse, UINT16 usAnimState ) MercCreateStruct.fVisible = TRUE; - INT8 iNewIndex; - if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) + UINT16 iNewIndex; + if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { /* certain values have to be set afterwards - the alternative would be to edit each and every function that gets called from TacticalCreateSoldier() subsequently and * make an exception for zombies every time... */ - SOLDIERTYPE* pNewSoldier = MercPtrs[ (UINT8)iNewIndex ]; + SOLDIERTYPE* pNewSoldier = MercPtrs[ iNewIndex ]; pNewSoldier->bActionPoints = 60; pNewSoldier->bInitialActionPoints = 60; diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index cc7bc8bb..58c12d0e 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -299,7 +299,7 @@ INT32 giSKIMessageBox=-1; INT8 gbSelectedArmsDealerID = -1; //Contains the enum value for the currently selected arms dealer // Flugente: while we're trading, store the ID of non-NPC dealers -UINT8 gusIDOfCivTrader = NOBODY; +UINT16 gusIDOfCivTrader = NOBODY; //the quote that is in progress, in certain circumstances, we don't want queuing of related but different quotes INT32 giShopKeepDialogueEventinProgress = - 1; @@ -360,7 +360,7 @@ BOOLEAN gfDoneBusinessThisSession = FALSE; // this is used within SKI exclusively, to handle small faces UINT8 gubArrayOfEmployedMercs[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; UINT32 guiSmallSoldiersFace[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; -UINT8 gubNumberMercsInArray; +UINT16 gubNumberMercsInArray; //The subutitled text for what the merc is saying CHAR16 gsShopKeeperTalkingText[ SKI_SUBTITLE_TEXT_SIZE ]; @@ -392,7 +392,7 @@ extern OBJECTTYPE *gpItemDescObject; extern OBJECTTYPE *gpItemDescPrevObject; extern OBJECTTYPE *gpItemDescPrevObject; extern void HandleShortCutExitState( void ); -extern UINT8 gubSelectSMPanelToMerc; +extern UINT16 gubSelectSMPanelToMerc; extern INT32 giItemDescAmmoButton; extern BOOLEAN BltVSurfaceUsingDD( HVSURFACE hDestVSurface, HVSURFACE hSrcVSurface, UINT32 fBltFlags, INT32 iDestX, INT32 iDestY, RECT *SrcRect ); @@ -875,8 +875,8 @@ BOOLEAN EnterShopKeeperInterface() //Reinitialize the team panel to be the SM panel SetCurrentInterfacePanel( SM_PANEL ); - SetCurrentTacticalPanelCurrentMerc( (UINT8)gusSelectedSoldier ); - SetSMPanelCurrentMerc( (UINT8)gusSelectedSoldier ); + SetCurrentTacticalPanelCurrentMerc( gusSelectedSoldier ); + SetSMPanelCurrentMerc( gusSelectedSoldier ); // load the Main trade screen background image VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; @@ -1132,7 +1132,7 @@ BOOLEAN ExitShopKeeperInterface() UnloadButtonImage( guiSKI_InvPageDownButtonImage ); //loop through the area and delete small faces - for (UINT8 ubCnt=0; ubCnt gTemplateVector; extern void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name ); -extern INT8 bSelectedInfoChar; +extern INT16 bSelectedInfoChar; // sevenfm: need this for correct calculation of traits menu position extern INT16 gsInterfaceLevel; @@ -395,7 +395,7 @@ SkillSelection::Functions( UINT32 aVal ) if ( pSoldier == NULL ) return; - UINT8 ubID = WhoIsThere2(sTraitsMenuTargetGridNo, 0 ); + UINT16 ubID = WhoIsThere2(sTraitsMenuTargetGridNo, 0 ); BOOLEAN result = pSoldier->UseSkill(aVal, sTraitsMenuTargetGridNo, ubID); diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index ebc29b83..7d13ceef 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1136,8 +1136,7 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U return(sGridNo); } - -BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ) +BOOLEAN InternalAddSoldierToSector(UINT16 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ) { UINT8 ubDirection = 0; UINT8 ubCalculatedDirection = 0; @@ -1334,20 +1333,19 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO return( FALSE ); } - -BOOLEAN AddSoldierToSector( UINT8 ubID ) +BOOLEAN AddSoldierToSector( UINT16 ubID ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierToSector")); return( InternalAddSoldierToSector( ubID, TRUE, FALSE, 0 , 0) ); } -BOOLEAN AddSoldierToSectorNoCalculateDirection( UINT8 ubID ) +BOOLEAN AddSoldierToSectorNoCalculateDirection( UINT16 ubID ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierToSectorNoCalculateDirection")); return( InternalAddSoldierToSector( ubID, FALSE, FALSE, 0, 0 ) ); } -BOOLEAN AddSoldierToSectorNoCalculateDirectionUseAnimation( UINT8 ubID, UINT16 usAnimState, UINT16 usAnimCode ) +BOOLEAN AddSoldierToSectorNoCalculateDirectionUseAnimation( UINT16 ubID, UINT16 usAnimState, UINT16 usAnimCode ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierToSectorNoCalculateDirectionUseAnimation")); return( InternalAddSoldierToSector( ubID, FALSE, TRUE, usAnimState, usAnimCode ) ); @@ -1777,8 +1775,8 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDir BOOLEAN IsMercOnTeam(UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive) { UINT16 cnt; - UINT8 ubLastTeamID; - SOLDIERTYPE *pTeamSoldier; + UINT16 ubLastTeamID; + SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; diff --git a/Tactical/Soldier Add.h b/Tactical/Soldier Add.h index bb96f44e..4d4ba01b 100644 --- a/Tactical/Soldier Add.h +++ b/Tactical/Soldier Add.h @@ -30,11 +30,11 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U // Adds a soldier ( already created in mercptrs[] array )! // Finds a good placement based on data in the loaded sector and if they are enemy's or not, etc... -BOOLEAN AddSoldierToSector( UINT8 ubID ); +BOOLEAN AddSoldierToSector( UINT16 ubID ); -BOOLEAN AddSoldierToSectorNoCalculateDirection( UINT8 ubID ); +BOOLEAN AddSoldierToSectorNoCalculateDirection( UINT16 ubID ); -BOOLEAN AddSoldierToSectorNoCalculateDirectionUseAnimation( UINT8 ubID, UINT16 usAnimState, UINT16 usAnimCode ); +BOOLEAN AddSoldierToSectorNoCalculateDirectionUseAnimation( UINT16 ubID, UINT16 usAnimState, UINT16 usAnimCode ); // IsMercOnTeam() checks to see if the passed in Merc Profile ID is currently on the player's team BOOLEAN IsMercOnTeam( UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive ); diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 431f08b9..f5774ae6 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -107,10 +107,10 @@ BOOLEAN HandleUnjamAnimation( SOLDIERTYPE *pSoldier ); extern void HandleSystemNewAISituation( SOLDIERTYPE *pSoldier, BOOLEAN fResetABC ); extern void PlaySoldierFootstepSound( SOLDIERTYPE *pSoldier ); -extern UINT8 NumCapableEnemyInSector( ); +extern UINT16 NumCapableEnemyInSector( ); extern BOOLEAN gfKillingGuysForLosingBattle; -extern UINT8 gubInterruptProvoker; +extern UINT16 gubInterruptProvoker; extern UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOLEAN fHipStance ); @@ -1167,7 +1167,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { if (pSoldier->bTeam == 0 || (pSoldier->bTeam == 1 && is_server)) { - send_grenade( pSoldier->pTempObject , pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, pSoldier->sTargetGridNo, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, iRealObjectID , true); + send_grenade( pSoldier->pTempObject, pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, pSoldier->sTargetGridNo, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, iRealObjectID, true); } } @@ -1789,7 +1789,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) pSoldier->uiTimeOfLastRandomAction = 0; // Don't play these generally if this is the guy selected by player, as this one is "awaiting orders" - if (pSoldier->ubID != (UINT8)gusSelectedSoldier || Random( 10 ) == 0 ) + if (pSoldier->ubID != gusSelectedSoldier || Random( 10 ) == 0 ) { // Don't do any in water! // Also don't play if we are in the middle of something @@ -3130,7 +3130,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Reload robot.... { - UINT8 ubPerson; + UINT16 ubPerson; SOLDIERTYPE *pRobot; // Get pointer... @@ -3307,7 +3307,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // REFUELING A VEHICLE // THE GAS_CAN IS IN THE MERCS MAIN HAND AT THIS TIME { - UINT8 ubPerson; + UINT16 ubPerson; SOLDIERTYPE *pVehicle; // Get pointer to vehicle... @@ -3559,13 +3559,13 @@ BOOLEAN ShouldMercSayHappyWithGunQuote( SOLDIERTYPE *pSoldier ) void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ) { // WDS - make number of mercenaries, etc. be configurable - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); // UINT8 ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; std::vector bBuddyIndex (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, -1); // INT8 bBuddyIndex[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { -1 }; INT8 bTempBuddyIndex; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; INT32 cnt; UINT16 usQuoteNum; @@ -3651,7 +3651,7 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, } // OK, a good candidate... - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; bBuddyIndex[ ubNumMercs ] = bTempBuddyIndex; ++ubNumMercs; } @@ -3661,7 +3661,7 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); switch( bBuddyIndex[ ubChosenMerc ] ) { @@ -3751,10 +3751,9 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier SOLDIERTYPE *pTeamSoldier; INT32 cnt; // WDS - make number of mercenaries, etc. be configurable - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); -// UINT8 ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; BOOLEAN fDoSomeoneElse = FALSE; gfLastMercTalkedAboutKillingID = pKilledSoldier->ubID; @@ -3822,7 +3821,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier // Can we see location? if ( SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, bLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ubNumMercs++; } } @@ -3832,7 +3831,7 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier // Did we find anybody? if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); // We have a random chance of not saying our we killed a guy quote if ( Random( 100 ) < 50 ) @@ -4000,8 +3999,8 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) { ////////////////////////////////////////////////////////////// // SANDRO - some changes here - UINT8 ubAttacker = pSoldier->ubAttackerID; - UINT8 ubAssister = pSoldier->ubPreviousAttackerID; + UINT16 ubAttacker = pSoldier->ubAttackerID; + UINT16 ubAssister = pSoldier->ubPreviousAttackerID; // If attacker is nobody, and we died, then set the last attacker(if exists) as our killer if ( ubAttacker == NOBODY ) { diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index e3fe1d3a..9a6ff96d 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -157,7 +157,7 @@ extern BOOLEAN gfShiftBombPlant; #include "connect.h" extern void TeleportSelectedSoldier( void ); -extern BOOLEAN AddSoldierToSectorNoCalculateDirectionUseAnimation( UINT8 ubID, UINT16 usAnimState, UINT16 usAnimCode ); +extern BOOLEAN AddSoldierToSectorNoCalculateDirectionUseAnimation( UINT16 ubID, UINT16 usAnimState, UINT16 usAnimCode ); // Flugente: external sector data extern SECTOR_EXT_DATA SectorExternalData[256][4]; @@ -695,7 +695,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->sLastTwoLocations[1] = src.sLastTwoLocations[1]; this->ubID = src.ubID; - this->bReserved1 = src.bReserved1; + //this->bReserved1 = src.bReserved1; this->ubBodyType = src.ubBodyType; this->bActionPoints = src.bActionPoints; @@ -1730,7 +1730,7 @@ void AdjustForFastTurnAnimation( SOLDIERTYPE *pSoldier ); UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ); void SelectFallAnimation( SOLDIERTYPE *pSoldier ); BOOLEAN FullStructAlone( INT32 sGridNo, UINT8 ubRadius ); -void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); +void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); @@ -5870,9 +5870,9 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL // extern SOLDIERTYPE * FreeUpAttackerGivenTarget( UINT8 ubID, UINT8 ubTargetID ); // extern SOLDIERTYPE * ReduceAttackBusyGivenTarget( UINT8 ubID, UINT8 ubTargetID ); - +#pragma optimize("", off) // ATE: THIS FUNCTION IS USED FOR ALL SOLDIER TAKE DAMAGE FUNCTIONS! -void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGrid ) +void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGrid ) { UINT8 ubCombinedLoss, ubVolume, ubReason; // SOLDIERTYPE * pNewSoldier; @@ -6603,12 +6603,18 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 if ( Item[usWeaponIndex].usItemClass & IC_GUN ) { PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_GUNFIRE, ubAttackerID ); - PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_GUNFIRE, this->ubID ); + if (ubAttackerID != NOBODY) + { + PossiblyStartEnemyTaunt(MercPtrs[ubAttackerID], TAUNT_HIT_GUNFIRE, this->ubID); + } } else { PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_THROWING_KNIFE, ubAttackerID ); - PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_THROWING_KNIFE, this->ubID ); + if (ubAttackerID != NOBODY) + { + PossiblyStartEnemyTaunt(MercPtrs[ubAttackerID], TAUNT_HIT_THROWING_KNIFE, this->ubID); + } } } if ( Item[usWeaponIndex].usItemClass & IC_BLADE ) @@ -6637,7 +6643,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // anv: taunts are called from UseHandToHand() } } - +#pragma optimize("", on) UINT8 CalcScreamVolume( SOLDIERTYPE * pSoldier, UINT8 ubCombinedLoss ) { // NB explosions are so loud they should drown out screams @@ -6719,7 +6725,7 @@ void DoGenericHit( SOLDIERTYPE *pSoldier, UINT8 ubSpecial, INT16 bDirection ) } -void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) +void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) { INT32 usNewGridNo; BOOLEAN fBlownAway = FALSE; @@ -9740,7 +9746,7 @@ void SOLDIERTYPE::BeginSoldierClimbUpRoof(void) } INT8 bNewDirection; - UINT8 ubWhoIsThere; + UINT16 ubWhoIsThere; if (FindHeigherLevel(this, this->sGridNo, this->ubDirection, &bNewDirection) && (this->pathing.bLevel == 0)) { @@ -9914,7 +9920,7 @@ void SOLDIERTYPE::BeginSoldierClimbWindow( void ) void SOLDIERTYPE::BeginSoldierClimbWall( void ) { INT8 bNewDirection; - UINT8 ubWhoIsThere; + UINT16 ubWhoIsThere; if ( FindWallJumpDirection( this, this->sGridNo, this->ubDirection, &bNewDirection ) && (this->pathing.bLevel == 0) ) { @@ -9951,7 +9957,7 @@ void SOLDIERTYPE::BeginSoldierClimbWall( void ) void SOLDIERTYPE::BeginSoldierClimbWallUp( void ) { INT8 bNewDirection; - UINT8 ubWhoIsThere; + UINT16 ubWhoIsThere; if ( FindLowerLevelWall( this, this->sGridNo, this->ubDirection, &bNewDirection ) && (this->pathing.bLevel > 0) ) { @@ -10249,7 +10255,7 @@ void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReaso } -UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, UINT8 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ) +UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, UINT16 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ) { #ifdef JA2BETAVERSION if ( is_networked ) { @@ -11573,7 +11579,7 @@ BOOLEAN SOLDIERTYPE::CheckSoldierHitRoof( void ) void SOLDIERTYPE::BeginSoldierClimbDownRoof(void) { INT8 bNewDirection; - UINT8 ubWhoIsThere; + UINT16 ubWhoIsThere; if (FindLowerLevel(this, this->sGridNo, this->ubDirection, &bNewDirection) && (this->pathing.bLevel > 0)) { @@ -12835,7 +12841,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirectio if ( this->flags.uiStatusFlags & SOLDIER_MONSTER ) { // Is there an unconscious guy at gridno...... - UINT8 ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); + UINT16 ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); if ( ubTargetID != NOBODY && ((MercPtrs[ubTargetID]->stats.bLife < OKLIFE && MercPtrs[ubTargetID]->stats.bLife > 0) || (MercPtrs[ubTargetID]->bBreath < OKBREATH && MercPtrs[ubTargetID]->bCollapsed)) ) { @@ -13573,7 +13579,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection ) this->sTargetGridNo = sGridNo; // SET PARTNER ID - this->ubServicePartner = (UINT8)usSoldierIndex; + this->ubServicePartner = usSoldierIndex; // SET PARTNER'S COUNT REFERENCE pTSoldier->ubServiceCount++; @@ -15104,7 +15110,7 @@ BOOLEAN SOLDIERTYPE::IsWeaponMounted( void ) if ( !IsLocationSittable( nextGridNoinSight, 0 ) ) { // resting our gun on people is allowed sometimes - UINT usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + UINT16 usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); if ( usPersonID == NOBODY ) applybipod = TRUE; else @@ -15178,7 +15184,7 @@ BOOLEAN SOLDIERTYPE::IsWeaponMounted( void ) if ( !IsLocationSittable( nextGridNoinSight, 0 ) ) { // resting our gun on people is allowed sometimes - UINT usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + UINT16 usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); if ( usPersonID == NOBODY ) applybipod = TRUE; else @@ -15480,7 +15486,7 @@ void SOLDIERTYPE::InventoryExplosion( void ) } // Flugente: do we currently provide ammo (pAmmoSlot) for someone else's (pubId) gun (pGunSlot)? -BOOLEAN SOLDIERTYPE::IsFeedingExternal( UINT8* pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, UINT8* pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2 ) +BOOLEAN SOLDIERTYPE::IsFeedingExternal( UINT16 * pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, UINT16 * pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2 ) { // make sure we have to check this... if ( gGameExternalOptions.ubExternalFeeding == 0 ) @@ -16166,7 +16172,7 @@ BOOLEAN SOLDIERTYPE::EquipmentTooGood( BOOLEAN fCloselook ) // are we in covert mode? we need to have the correct flag set, and not wear anything suspicious, or behave in a suspicious way -BOOLEAN SOLDIERTYPE::SeemsLegit( UINT8 ubObserverID ) +BOOLEAN SOLDIERTYPE::SeemsLegit( UINT16 ubObserverID ) { SOLDIERTYPE* pSoldier = MercPtrs[ubObserverID]; @@ -16454,7 +16460,7 @@ BOOLEAN SOLDIERTYPE::SeemsLegit( UINT8 ubObserverID ) } // do we recognize someone else as a combatant? -BOOLEAN SOLDIERTYPE::RecognizeAsCombatant( UINT8 ubTargetID ) +BOOLEAN SOLDIERTYPE::RecognizeAsCombatant( UINT16 ubTargetID ) { // this will only work with the new trait system if ( !gGameOptions.fNewTraitSystem ) @@ -16550,7 +16556,7 @@ void SOLDIERTYPE::LooseDisguise( void ) // rehandle sight for everybody SOLDIERTYPE* pSoldier; - UINT8 iLoop = gTacticalStatus.Team[OUR_TEAM].bFirstID; + UINT16 iLoop = gTacticalStatus.Team[OUR_TEAM].bFirstID; for ( pSoldier = MercPtrs[iLoop]; iLoop <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++iLoop, ++pSoldier ) { if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) @@ -16793,7 +16799,7 @@ BOOLEAN SOLDIERTYPE::FreePrisoner( ) // we can only free people we are facing INT32 nextGridNoinSight = NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ); - UINT8 target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + UINT16 target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); // is there somebody? if ( target != NOBODY ) @@ -19050,7 +19056,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN // as of 2013-09-25, I say it is no longer necessary to fire a signal shell first. The player can fire a signal shell (by mortar or hand) manually to mark one or more targets if he wants // if he does not do so, active vox operators will be targetted. Who knows, the vox operator might be doing a heroic last stand for all we know... - UINT8 radiooperatorID = 0; + UINT16 radiooperatorID = 0; //BOOLEAN signalshellfired = FALSE; UINT8 mortaritemcnt = 0; UINT16 mortararray[5]; @@ -19585,7 +19591,7 @@ BOOLEAN SOLDIERTYPE::AIDoctorFriend( ) // we can only free people we are facing INT32 nextGridNoinSight = NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ); - UINT8 target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + UINT16 target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); // is there somebody? if ( target != NOBODY ) @@ -22573,7 +22579,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginCutFence( INT32 sGridNo, UINT8 ubDirection ) void SOLDIERTYPE::EVENT_SoldierBeginRepair( INT32 sGridNo, UINT8 ubDirection ) { INT8 bRepairItem; - UINT8 ubID; + UINT16 ubID; // Make sure we have a structure here.... bRepairItem = IsRepairableStructAtGridNo( sGridNo, &ubID ); @@ -22618,7 +22624,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginRepair( INT32 sGridNo, UINT8 ubDirection ) void SOLDIERTYPE::EVENT_SoldierBeginRefuel( INT32 sGridNo, UINT8 ubDirection ) { INT8 bRefuelItem; - UINT8 ubID; + UINT16 ubID; // Make sure we have a structure here.... bRefuelItem = IsRefuelableStructAtGridNo( sGridNo, &ubID ); @@ -22792,7 +22798,7 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection if ( !gGameExternalOptions.fAllowPrisonerSystem ) return; - UINT8 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( ubPerson != NOBODY && MercPtrs[ubPerson]->CanBeCaptured( ) ) { @@ -22935,7 +22941,7 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirection ) { - UINT8 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( ubPerson != NOBODY ) { @@ -23071,7 +23077,7 @@ void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirecti void SOLDIERTYPE::EVENT_SoldierTakeBloodFromPerson( INT32 sGridNo, UINT8 ubDirection ) { - UINT8 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( ubPerson != NOBODY && ubPerson != this->ubID ) { @@ -23142,7 +23148,7 @@ void SOLDIERTYPE::EVENT_SoldierTakeBloodFromPerson( INT32 sGridNo, UINT8 ubDirec void SOLDIERTYPE::EVENT_SoldierApplySplintToPerson( INT32 sGridNo, UINT8 ubDirection ) { - UINT8 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( ubPerson != NOBODY && ubPerson != this->ubID ) { @@ -23211,7 +23217,7 @@ void SOLDIERTYPE::EVENT_SoldierInteractiveAction( INT32 sGridNo, UINT16 usAction void SOLDIERTYPE::EVENT_SoldierBeginReloadRobot( INT32 sGridNo, UINT8 ubDirection, UINT8 ubMercSlot ) { - UINT8 ubPerson; + UINT16 ubPerson; // Make sure we have a robot here.... ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); @@ -23442,7 +23448,7 @@ void AbandonBoxingDueToSurrenderCallback(UINT8 ubExitValue) } SOLDIERTYPE *pTMilitiaSoldier;//global pointer -BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValidate ) +BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT16 ubTargetID, BOOLEAN fValidate ) { INT16 sFacingDir, sXPos, sYPos, sAPCost; SOLDIERTYPE *pTSoldier; @@ -23460,7 +23466,7 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid { // OK, since we locked this guy from moving // we should be close enough, so talk ( unless he is now dead ) - if ( !IsValidTalkableNPC( (UINT8)ubTargetID, FALSE, FALSE, FALSE ) ) + if ( !IsValidTalkableNPC( ubTargetID, FALSE, FALSE, FALSE ) ) { return(FALSE); } @@ -24386,7 +24392,7 @@ void SetSoldierPersonalLightLevel( SOLDIERTYPE *pSoldier ) void BeginSoldierClimbWallUp( SOLDIERTYPE *pSoldier ) { INT8 bNewDirection; - UINT8 ubWhoIsThere; + UINT16 ubWhoIsThere; if ( FindLowerLevelWall( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && (pSoldier->pathing.bLevel > 0) ) { @@ -24724,7 +24730,7 @@ INT8 NUM_SKILL_TRAITS( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber ) UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHigherLevel, BOOLEAN fDontCheckDistance ) { - UINT8 cnt = 0; + UINT16 cnt = 0; UINT8 ubNumberSL = 0; // loop through all soldiers around @@ -25091,7 +25097,7 @@ BOOLEAN ResolvePendingInterrupt( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType ) ///////////////////////////// SOLDIERTYPE *pInterrupter; UINT8 ubInterruptersFound = 0; - UINT8 ubaInterruptersList[64]; + UINT16 ubaInterruptersList[64]; UINT16 uCnt = 0, uiReactionTime; INT16 iInjuryPenalty; @@ -25609,7 +25615,7 @@ UINT16 GridNoSpotterCTHBonus( SOLDIERTYPE* pSniper, INT32 sGridNo, INT8 bTeam ) { BOOLEAN targetseen = FALSE; - UINT usID = WhoIsThere2( sGridNo, pSniper->bTargetLevel ); + UINT16 usID = WhoIsThere2( sGridNo, pSniper->bTargetLevel ); // is someone is at the sGridNo, check wether the spotter can see any part of him check wether head can be seen) if ( usID != NOBODY && SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[usID], 0, NO_DISTANCE_LIMIT, AIM_SHOT_HEAD ) > 0 ) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index eff711d0..024f635b 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -809,7 +809,7 @@ public: INT32 sNoiseGridno; UINT8 ubNoiseVolume; INT8 bLastAttackHit; - UINT8 ubXRayedBy; + UINT16 ubXRayedBy; FLOAT dHeightAdjustment; INT8 bMorale; INT8 bTeamMoraleMod; @@ -829,7 +829,7 @@ public: INT8 bMoved; INT8 bHunting; UINT8 ubLastCall; - UINT8 ubCaller; + UINT16 ubCaller; INT32 sCallerGridNo; UINT8 bCallPriority; INT8 bCallActedUpon; @@ -1096,8 +1096,7 @@ public: // properly until it is all fixed and the files updated. public: // ID - UINT8 ubID; - UINT8 bReserved1; + UINT16 ubID; CHAR16 name[ 10 ]; INT16 GetMaxDistanceVisible(INT32 sGridNo = -1, INT8 bLevel = -1, int calcAsType = -1); @@ -1128,7 +1127,7 @@ public: UINT8 ubWaitActionToDo; INT8 ubInsertionDirection; INT8 bGunType; - UINT8 ubOppNum; + UINT16 ubOppNum; INT8 bLastRenderVisibleValue; UINT8 ubAttackingHand; INT16 sWeightCarriedAtTurnStart; @@ -1185,8 +1184,8 @@ public: UINT32 uiAIDelay; INT16 sReloadDelay; - UINT8 ubAttackerID; - UINT8 ubPreviousAttackerID; + UINT16 ubAttackerID; + UINT16 ubPreviousAttackerID; INT32 sInsertionGridNo; @@ -1255,7 +1254,7 @@ public: UINT16 *pCurrentShade; UINT8 ubFadeLevel; UINT8 ubServiceCount; - UINT8 ubServicePartner; + UINT16 ubServicePartner; THROW_PARAMS *pThrowParams; INT8 bReverse; LEVELNODE *pLevelNode; @@ -1391,7 +1390,7 @@ public: UINT8 ubSoldierClass; //admin, elite, troop (creature types?) Nav: 2 seems to mean elite, 3 troop so admin is 1 UINT8 ubAPsLostToSuppression; - UINT8 ubSuppressorID; + UINT16 ubSuppressorID; //Squad merging vars UINT8 ubDesiredSquadAssignment; @@ -1410,7 +1409,7 @@ public: INT8 bBlockedByAnotherMercDirection; UINT16 usAttackingWeapon; INT8 bWeaponMode; - UINT8 ubTargetID; + UINT16 ubTargetID; INT8 bAIScheduleProgress; INT32 sOffWorldGridNo; struct TAG_anitile *pAniTile; @@ -1431,8 +1430,8 @@ public: INT8 bOldBattleSnd; INT32 iBurstSoundID; INT8 bSlotItemTakenFrom; - UINT8 ubAutoBandagingMedic; - UINT8 ubRobotRemoteHolderID; + UINT16 ubAutoBandagingMedic; + UINT16 ubRobotRemoteHolderID; UINT32 uiTimeOfLastContractUpdate; INT8 bTypeOfLastContract; INT8 bTurnsCollapsed; @@ -1457,7 +1456,7 @@ public: INT8 bRegenBoostersUsedToday; // Flugente: not used anymore! INT8 bNumPelletsHitBy; INT32 sSkillCheckGridNo; - UINT8 ubLastEnemyCycledID; + UINT16 ubLastEnemyCycledID; UINT8 ubPrevSectorID; UINT8 ubNumTilesMovesSinceLastForget; @@ -1468,7 +1467,7 @@ public: UINT8 ubNumLocateCycles; UINT8 ubDelayedMovementFlags; - UINT8 ubCTGTTargetID; + UINT16 ubCTGTTargetID; UINT32 uiMercChecksum; @@ -1508,7 +1507,7 @@ public: UINT8 ubLastDamageReason; INT32 sLastTwoLocations[2]; INT32 uiTimeSinceLastBleedGrunt; - UINT8 ubNextToPreviousAttackerID; + UINT16 ubNextToPreviousAttackerID; UINT8 bDoAutofire; INT8 numFlanks; INT32 lastFlankSpot; @@ -1539,7 +1538,7 @@ public: UINT8 ubMilitiaAssists; // Flugente: stores militia assists INT8 sNonNPCTraderID; // Flugente: we can set up non-NPC soldiers to be merchants, we store their dealer id here (value > 0 means arms dealer entry x) //INT8 bUnusedINT8_3; - UINT8 usDragPersonID; // Flugente: id of person we are dragging + UINT16 usDragPersonID; // Flugente: id of person we are dragging //INT16 bUnusedINT16_4; INT16 sDragCorpseID; // Flugente: id of corpse we are dragging @@ -1676,7 +1675,7 @@ public: void EVENT_SetSoldierDirection( UINT16 usNewDirection ); void EVENT_SetSoldierDesiredDirection( UINT16 usNewDirection ); void EVENT_FireSoldierWeapon( INT32 sTargetGridNo ); - void EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection , UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGridNo ); + void EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGridNo ); void EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirection ); void EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirection ); void EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection ); @@ -1717,7 +1716,7 @@ public: void ChangeSoldierStance( UINT8 ubDesiredStance ); void StopSoldier( void ); void ReviveSoldier( void ); - UINT8 SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, UINT8 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ); + UINT8 SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, UINT16 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ); // Palette functions for soldiers @@ -1810,7 +1809,7 @@ public: BOOLEAN CheckSoldierHitRoof( void ); BOOLEAN CheckForBreathCollapse( void ); - BOOLEAN PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValidate ); + BOOLEAN PlayerSoldierStartTalking( UINT16 ubTargetID, BOOLEAN fValidate ); BOOLEAN InternalIsValidStance( INT8 bDirection, INT8 bNewStance ); BOOLEAN IsValidSecondHandShot( void ); BOOLEAN IsValidSecondHandBurst( void ); @@ -1841,7 +1840,7 @@ public: void InventoryExplosion( void ); // Flugente: do we currently provide ammo (pAmmoSlot) for someone else's (pubId) gun (pGunSlot)? - BOOLEAN IsFeedingExternal(UINT8* pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, UINT8* pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2); + BOOLEAN IsFeedingExternal(UINT16 * pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, UINT16 * pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2); // Flugente: return first found object with a specific flag from our inventory OBJECTTYPE* GetObjectWithFlag( UINT64 aFlag ); @@ -1861,10 +1860,10 @@ public: BOOLEAN EquipmentTooGood( BOOLEAN fCloselook ); // does soldier ubObserverID recognize us as his enemy? - BOOLEAN SeemsLegit( UINT8 ubObserverID ); + BOOLEAN SeemsLegit( UINT16 ubObserverID ); // do we recognize someone else as a combatant? - BOOLEAN RecognizeAsCombatant(UINT8 ubTargetID); + BOOLEAN RecognizeAsCombatant(UINT16 ubTargetID); // loose covert property void LooseDisguise( void ); diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 192b82a0..eb87056f 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -576,15 +576,15 @@ void DecideToAssignSniperOrders( SOLDIERCREATE_STRUCT * pp ) // This causes an issue if someone enters a sector from an adjacent sector - they should be affected by their point of origin, not the current sector // For this reason, we add a little helper variable that stores such a sector. INT16 gsStrategicDiseaseOriginSector = -1; - -SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *pubID ) +#pragma optimize("", off) +SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ) { - SOLDIERTYPE Soldier; - INT32 cnt; - SOLDIERTYPE *pTeamSoldier; - BOOLEAN fGuyAvail = FALSE; - UINT8 bLastTeamID; - UINT8 ubVehicleID = 0; + SOLDIERTYPE Soldier; + INT32 cnt; + SOLDIERTYPE *pTeamSoldier; + BOOLEAN fGuyAvail = FALSE; + UINT16 bLastTeamID; + UINT8 ubVehicleID = 0; *pubID = NOBODY; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("TacticalCreateSoldier")); @@ -800,7 +800,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * } // OK, set ID - Soldier.ubID = (UINT8)cnt; + Soldier.ubID = (UINT16)cnt; *pubID = Soldier.ubID; } @@ -1273,6 +1273,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 * return pSoldier; } } +#pragma optimize("", on) BOOLEAN TacticalCopySoldierFromProfile( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruct ) { @@ -1843,9 +1844,9 @@ BOOLEAN TacticalCopySoldierFromCreateStruct( SOLDIERTYPE *pSoldier, SOLDIERCREAT { if ( HAS_SKILL_TRAIT( pSoldier, SQUADLEADER_NT) ) { - UINT8 numenemies = NumEnemyInSector(); + UINT16 numenemies = NumEnemyInSector(); UINT8 officertype = OFFICER_NONE; - UINT8 numofficers = HighestEnemyOfficersInSector( officertype ); + UINT16 numofficers = HighestEnemyOfficersInSector( officertype ); // this guy becomes an officer if there are enough soldiers around, and we aren't already at max of officers if ( numenemies > gGameExternalOptions.usEnemyOfficersPerTeamSize * numofficers && numofficers < gGameExternalOptions.usEnemyOfficersMax && !RebelCommand::NeutraliseRole(pSoldier) ) @@ -3083,7 +3084,7 @@ SOLDIERTYPE* TacticalCreateAdministrator() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3116,7 +3117,7 @@ SOLDIERTYPE* TacticalCreateArmyTroop() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3150,7 +3151,7 @@ SOLDIERTYPE* TacticalCreateEliteEnemy() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3192,7 +3193,7 @@ SOLDIERTYPE* TacticalCreateEnemyTank() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3232,7 +3233,7 @@ SOLDIERTYPE* TacticalCreateEnemyJeep( ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if ( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3273,7 +3274,7 @@ SOLDIERTYPE* TacticalCreateEnemyRobot() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if ( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3314,7 +3315,7 @@ SOLDIERTYPE* TacticalCreateZombie() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3388,7 +3389,7 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass, INT16 sX, INT16 sY ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if (gpBattleGroup && @@ -3429,7 +3430,7 @@ SOLDIERTYPE* TacticalCreateCreature( INT8 bCreatureBodyType ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3455,7 +3456,7 @@ SOLDIERTYPE* TacticalCreateArmedCivilian( UINT8 usSoldierClass ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier = NULL; // this needs the covert ops trait, and thus the new trait system @@ -3504,7 +3505,7 @@ SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8 if ( guiCurrentScreen == AUTORESOLVE_SCREEN ) return NULL; - UINT8 ubID = NOBODY; + UINT16 ubID = NOBODY; SOLDIERTYPE* pSoldier = NULL; SOLDIERCREATE_STRUCT MercCreateStruct; @@ -3603,7 +3604,7 @@ SOLDIERTYPE* TacticalCreateEnemyAssassin(UINT8 disguisetype) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; // this needs the covert ops trait, and thus the new trait system @@ -3668,7 +3669,7 @@ SOLDIERTYPE* TacticalCreateBandit() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE * pSoldier; if ( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3859,7 +3860,7 @@ void CreatePrisonerOfWar() } SOLDIERCREATE_STRUCT MercCreateStruct; - UINT8 ubID; + UINT16 ubID; static INT8 bPowBodyType = REGMALE; @@ -3941,7 +3942,7 @@ void CreateDownedPilot( ) while ( TileIsOutOfBounds( sGridNo ) || FindStructure( sGridNo, STRUCTURE_BLOCKSMOVES ) || TERRAIN_IS_WATER( gpWorldLevelData[sGridNo].ubTerrainID ) || GridNoNearPlayerMercs( sGridNo, 25 ) ); SOLDIERCREATE_STRUCT MercCreateStruct; - UINT8 ubID; + UINT16 ubID; MercCreateStruct.initialize( ); MercCreateStruct.bTeam = CIV_TEAM; @@ -4101,9 +4102,9 @@ void RandomizeRelativeLevel( INT8 *pbRelLevel, UINT8 ubSoldierClass ) void QuickCreateProfileMerc( INT8 bTeam, UINT8 ubProfileID ) { // Create guy # X - SOLDIERCREATE_STRUCT MercCreateStruct; - INT16 sWorldX, sWorldY, sSectorX, sSectorY, sGridX, sGridY; - UINT8 ubID; + SOLDIERCREATE_STRUCT MercCreateStruct; + INT16 sWorldX, sWorldY, sSectorX, sSectorY, sGridX, sGridY; + UINT16 ubID; INT32 usMapPos; if ( GetMouseXY( &sGridX, &sGridY ) ) diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index d98f9c01..d8791d30 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -460,7 +460,7 @@ void RandomizeNewSoldierStats( SOLDIERCREATE_STRUCT *pCreateStruct ); //Kris: //Modified return type from BOOLEAN to SOLDIERTYPE* -SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *pubID ); +SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ); //Randomly generated enemies used by strategic AI. SOLDIERTYPE* TacticalCreateAdministrator(); diff --git a/Tactical/Soldier Find.cpp b/Tactical/Soldier Find.cpp index 3d3a699e..0e688cfa 100644 --- a/Tactical/Soldier Find.cpp +++ b/Tactical/Soldier Find.cpp @@ -70,7 +70,7 @@ UINT32 gScrollSlideInertiaDirection[ NUM_WORLD_DIRECTIONS ] = typedef struct { INT8 bNum; - UINT8 ubIDs[ MAX_STACKED_MERCS ]; + UINT16 ubIDs[ MAX_STACKED_MERCS ]; INT8 bCur; BOOLEAN fUseGridNo; INT32 sUseGridNoGridNo; @@ -204,7 +204,7 @@ BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, INT16 sXMapPos, sYMapPos, sScreenX, sScreenY; INT16 sMaxScreenMercY, sHeighestMercScreenY = -32000; BOOLEAN fDoFull; - UINT8 ubBestMerc = NOBODY; + UINT16 ubBestMerc = NOBODY; UINT16 usAnimSurface; INT32 iMercScreenX, iMercScreenY; BOOLEAN fInScreenRect = FALSE; @@ -525,7 +525,7 @@ BOOLEAN CycleSoldierFindStack( INT32 usMapPos ) SOLDIERTYPE * SimpleFindSoldier( INT32 sGridNo, INT8 bLevel ) { - UINT8 ubID; + UINT16 ubID; ubID = WhoIsThere2( sGridNo, bLevel ); if ( ubID == NOBODY ) @@ -538,7 +538,7 @@ SOLDIERTYPE * SimpleFindSoldier( INT32 sGridNo, INT8 bLevel ) } } -BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID ) +BOOLEAN IsValidTargetMerc( UINT16 ubSoldierID ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ]; @@ -1008,7 +1008,7 @@ BOOLEAN FindRelativeSoldierPosition( SOLDIERTYPE *pSoldier, UINT16 *usFlags, INT } // VERY quickly finds a soldier at gridno , ( that is visible ) -UINT8 QuickFindSoldier( INT32 sGridNo ) +UINT16 QuickFindSoldier( INT32 sGridNo ) { UINT32 cnt; SOLDIERTYPE *pSoldier = NULL; @@ -1022,7 +1022,7 @@ UINT8 QuickFindSoldier( INT32 sGridNo ) { if ( pSoldier->sGridNo == sGridNo && pSoldier->bVisible != -1 ) { - return( (UINT8)cnt ); + return( (UINT16)cnt ); } } diff --git a/Tactical/Soldier Find.h b/Tactical/Soldier Find.h index de256761..6616dfb4 100644 --- a/Tactical/Soldier Find.h +++ b/Tactical/Soldier Find.h @@ -48,7 +48,7 @@ void GetSoldierTRUEScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *ps BOOLEAN IsPointInSoldierBoundingBox( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY ); BOOLEAN FindRelativeSoldierPosition( SOLDIERTYPE *pSoldier, UINT16 *usFlags, INT16 sX, INT16 sY ); -UINT8 QuickFindSoldier( INT32 sGridNo ); +UINT16 QuickFindSoldier( INT32 sGridNo ); void GetGridNoScreenPos( INT32 sGridNo, UINT8 ubLevel, INT16 *psScreenX, INT16 *psScreenY ); diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index ad719347..847629c3 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -581,13 +581,13 @@ void SortSoldierInitList() } extern FLOAT gAmbushRadiusModifier; - +#pragma optimize("",off) BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) { UINT8 ubProfile; SOLDIERCREATE_STRUCT tempDetailedPlacement; SOLDIERTYPE *pSoldier; - UINT8 ubID; + UINT16 ubID; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld")); // First check if this guy has a profile and if so check his location such that it matches! @@ -859,7 +859,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) if(is_server) ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"report this MP error (AddPlacementToWorld-FAIL!)"); return FALSE; } - +#pragma optimize("",on) void AddPlacementToWorldByProfileID( UINT8 ubProfile ) { SOLDIERINITNODE * curr; @@ -1050,7 +1050,7 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) return ubNumAdded; } - +#pragma optimize("",off) void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTroops, UINT8 ubTotalElite, UINT8 ubTotalRobots, UINT8 ubTotalTanks, UINT8 ubTotalJeeps ) { SOLDIERINITNODE *mark; @@ -1605,7 +1605,7 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr curr = curr->next; } } - +#pragma optimize("",on) //If we are adding militia to our map, then we do a few things differently. //First of all, they exist exclusively to the enemy troops, so if the militia exists in the //sector, then they get to use the enemy placements. However, we remove any orders from @@ -2377,8 +2377,8 @@ BOOLEAN SaveSoldierInitListLinks( HWFILE hfile ) { return FALSE; } - FileWrite( hfile, &curr->ubSoldierID, 1, &uiNumBytesWritten ); - if( uiNumBytesWritten != 1 ) + FileWrite( hfile, &curr->ubSoldierID, 2, &uiNumBytesWritten ); + if( uiNumBytesWritten != 2 ) { return FALSE; } @@ -2391,7 +2391,8 @@ BOOLEAN LoadSoldierInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubSoldierID, ubNodeID; + UINT8 ubSlots, ubNodeID; + UINT16 ubSoldierID; FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) @@ -2664,7 +2665,7 @@ void AddProfilesUsingProfileInsertionData() if( !pSoldier ) { //Create a new soldier, as this one doesn't exist SOLDIERCREATE_STRUCT MercCreateStruct; - UINT8 ubID; + UINT16 ubID; //Set up the create struct so that we can properly create the profile soldier. MercCreateStruct.initialize(); @@ -2802,7 +2803,8 @@ BOOLEAN NewWayOfLoadingEnemySoldierInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubSoldierID, ubNodeID; + UINT8 ubSlots, ubNodeID; + UINT16 ubSoldierID; FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) @@ -2816,8 +2818,8 @@ BOOLEAN NewWayOfLoadingEnemySoldierInitListLinks( HWFILE hfile ) { return FALSE; } - FileRead( hfile, &ubSoldierID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSoldierID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } @@ -2848,7 +2850,8 @@ BOOLEAN NewWayOfLoadingCivilianInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubSoldierID, ubNodeID; + UINT8 ubSlots, ubNodeID; + UINT16 ubSoldierID; FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) @@ -2862,8 +2865,8 @@ BOOLEAN NewWayOfLoadingCivilianInitListLinks( HWFILE hfile ) { return FALSE; } - FileRead( hfile, &ubSoldierID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSoldierID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } @@ -2894,7 +2897,8 @@ BOOLEAN LookAtButDontProcessEnemySoldierInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubSoldierID, ubNodeID; + UINT8 ubSlots, ubNodeID; + UINT16 ubSoldierID; FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); if( uiNumBytesRead != 1 ) @@ -2908,8 +2912,8 @@ BOOLEAN LookAtButDontProcessEnemySoldierInitListLinks( HWFILE hfile ) { return FALSE; } - FileRead( hfile, &ubSoldierID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSoldierID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } diff --git a/Tactical/Soldier Init List.h b/Tactical/Soldier Init List.h index ac47d25d..ed1002a2 100644 --- a/Tactical/Soldier Init List.h +++ b/Tactical/Soldier Init List.h @@ -7,7 +7,7 @@ typedef struct SOLDIERINITNODE { UINT8 ubNodeID; - UINT8 ubSoldierID; + UINT16 ubSoldierID; BASIC_SOLDIERCREATE_STRUCT *pBasicPlacement; SOLDIERCREATE_STRUCT *pDetailedPlacement; SOLDIERTYPE *pSoldier; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index f9fbce1a..b18b23fb 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1502,7 +1502,7 @@ INT16 CalcMedicalDeposit( MERCPROFILESTRUCT * pProfile ) SOLDIERTYPE * FindSoldierByProfileID( UINT8 ubProfileID, BOOLEAN fPlayerMercsOnly ) { - UINT8 ubLoop, ubLoopLimit; + UINT16 ubLoop, ubLoopLimit; SOLDIERTYPE * pSoldier; // sevenfm: fix for last soldier in player team @@ -1531,13 +1531,13 @@ SOLDIERTYPE * FindSoldierByProfileID( UINT8 ubProfileID, BOOLEAN fPlayerMercsOnl SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) { - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE *pNewSoldier = NULL; SOLDIERCREATE_STRUCT MercCreateStruct; UINT32 cnt; INT32 sOldGridNo; - UINT8 ubOldID; + UINT16 ubOldID; UINT32 uiOldUniqueId; UINT32 uiSlot; diff --git a/Tactical/Soldier Tile.cpp b/Tactical/Soldier Tile.cpp index 6a9f16d8..ec7e0da2 100644 --- a/Tactical/Soldier Tile.cpp +++ b/Tactical/Soldier Tile.cpp @@ -101,7 +101,7 @@ void OutputDebugInfoForTurnBasedNextTileWaiting( SOLDIERTYPE * pSoldier ) void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT32 sCauseGridNo, INT8 bValue ) { - UINT8 ubPerson; + UINT16 ubPerson; // Cancel AI Action // CancelAIAction( pSoldier, TRUE ); @@ -210,7 +210,7 @@ void UnMarkMovementReserved( SOLDIERTYPE *pSoldier ) INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 bLevel ) { - UINT8 ubPerson; + UINT16 ubPerson; INT32 sTempDestGridNo; INT32 sNewGridNo; BOOLEAN fSwapInDoor = FALSE; @@ -519,7 +519,7 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) INT32 sCost; INT32 sNewGridNo, sCheckGridNo; UINT8 ubDirection, bCauseDirection; - UINT8 ubPerson; + UINT16 ubPerson; UINT8 fFlags = 0; diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index dc6176c9..9c3c5734 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -1000,7 +1000,7 @@ void RebuildCurrentSquad( void ) void ExamineCurrentSquadLights( void ) { // rebuilds current squad to reset faces in tactical - UINT8 ubLoop; + UINT16 ubLoop; // OK, we should add lights for any guy currently bInSector who is not bad OKLIFE... ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -1331,7 +1331,7 @@ void RebuildSquad( INT8 bSquadValue ) void UpdateCurrentlySelectedMerc( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) { - UINT8 ubID; + UINT16 ubID; // if this squad is the current one and and the psoldier is the currently selected soldier, get rid of 'em if( bSquadValue != iCurrentTacticalSquad ) diff --git a/Tactical/Strategic Exit GUI.cpp b/Tactical/Strategic Exit GUI.cpp index b56531d0..4f101117 100644 --- a/Tactical/Strategic Exit GUI.cpp +++ b/Tactical/Strategic Exit GUI.cpp @@ -85,7 +85,7 @@ typedef struct UINT8 ubLeaveSectorCode; UINT8 ubDirection; UINT8 ubNumPeopleOnSquad; - INT8 bSingleMoveWillIsolateEPC; //if not -1, then that means the slot number is an EPC + INT16 bSingleMoveWillIsolateEPC; //if not -1, then that means the slot number is an EPC INT8 bHandled; BOOLEAN fRender; BOOLEAN fGotoSector; @@ -266,8 +266,8 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// { //check to see if we have one selected merc and one or more EPCs. //If so, don't allow the selected merc to leave by himself. //Assuming that the matching squad assignment is in the same sector. - UINT8 ubNumMercs = 1; //selected soldier is a merc - UINT8 ubNumEPCs = 0; + UINT16 ubNumMercs = 1; //selected soldier is a merc + UINT16 ubNumEPCs = 0; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { if( i == gusSelectedSoldier ) @@ -282,7 +282,7 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// //record the slot of the epc. If there are more than one EPCs, then //it doesn't matter. This is used in building the text message explaining //why the selected merc can't leave. This is how we extract the EPC's name. - gExitDialog.bSingleMoveWillIsolateEPC = (INT8)i; + gExitDialog.bSingleMoveWillIsolateEPC = (INT16)i; } else { //We have more than one merc, so we will allow the selected merc to leave alone if diff --git a/Tactical/Structure Wrap.cpp b/Tactical/Structure Wrap.cpp index cbf36b96..2123504f 100644 --- a/Tactical/Structure Wrap.cpp +++ b/Tactical/Structure Wrap.cpp @@ -522,9 +522,9 @@ BOOLEAN IsCuttableWireFenceAtGridNo( INT32 sGridNo ) } -BOOLEAN IsRepairableStructAtGridNo( INT32 sGridNo, UINT8 *pubID ) +BOOLEAN IsRepairableStructAtGridNo( INT32 sGridNo, UINT16 * pubID ) { - UINT8 ubMerc; + UINT16 ubMerc; // OK, first look for a vehicle.... ubMerc = WhoIsThere2( sGridNo, 0 ); @@ -558,9 +558,9 @@ BOOLEAN IsRepairableStructAtGridNo( INT32 sGridNo, UINT8 *pubID ) } -BOOLEAN IsRefuelableStructAtGridNo( INT32 sGridNo, UINT8 *pubID ) +BOOLEAN IsRefuelableStructAtGridNo( INT32 sGridNo, UINT16 * pubID ) { - UINT8 ubMerc; + UINT16 ubMerc; // OK, first look for a vehicle.... ubMerc = WhoIsThere2( sGridNo, 0 ); diff --git a/Tactical/Structure Wrap.h b/Tactical/Structure Wrap.h index 0679e26c..5187f3b1 100644 --- a/Tactical/Structure Wrap.h +++ b/Tactical/Structure Wrap.h @@ -36,8 +36,8 @@ BOOLEAN CutWireFence( INT32 sGridNo ); BOOLEAN IsCuttableWireFenceAtGridNo( INT32 sGridNo ); BOOLEAN IsCutWireFenceAtGridNo( INT32 sGridNo ); -BOOLEAN IsRepairableStructAtGridNo( INT32 sGridNo, UINT8 *pubID ); -BOOLEAN IsRefuelableStructAtGridNo( INT32 sGridNo, UINT8 *pubID ); +BOOLEAN IsRepairableStructAtGridNo( INT32 sGridNo, UINT16 * pubID ); +BOOLEAN IsRefuelableStructAtGridNo( INT32 sGridNo, UINT16 * pubID ); BOOLEAN IsFortificationPossibleAtGridNo( INT32 sGridNo ); // added by Flugente UINT16 InteractiveActionPossibleAtGridNo( INT32 sGridNo, UINT8 usLevel, UINT16& arusStructIndex ); // added by Flugente diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index a4fcf717..5c70a612 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -2161,8 +2161,8 @@ BOOLEAN DoesTempFileExistsForMap( UINT32 uiType, INT16 sMapX, INT16 sMapY, INT8 INT16 GetSoldierIDFromAnyMercID(UINT8 ubMercID) { UINT16 cnt; - UINT8 ubLastTeamID; - SOLDIERTYPE *pTeamSoldier; + UINT16 ubLastTeamID; + SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; @@ -2582,7 +2582,7 @@ BOOLEAN SetSectorFlag( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, UINT32 uiFlagToSet UpdateLastDayOfPlayerActivity( (UINT16) GetWorldDay() ); } - for ( UINT8 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) + for ( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) { if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && MercPtrs[ i ]->ubProfile != NO_PROFILE && MercPtrs[ i ]->sSectorX == sMapX && MercPtrs[ i ]->sSectorY == sMapY && MercPtrs[ i ]->bSectorZ == bMapZ && !MercPtrs[ i ]->flags.fBetweenSectors && diff --git a/Tactical/Tactical Turns.cpp b/Tactical/Tactical Turns.cpp index 42fd6adf..9ae4a7d2 100644 --- a/Tactical/Tactical Turns.cpp +++ b/Tactical/Tactical Turns.cpp @@ -35,7 +35,7 @@ extern void DecayPublicOpplist( INT8 bTeam ); //not in overhead.h! -extern UINT8 NumEnemyInSector(); +extern UINT16 NumEnemyInSector(); #ifdef JA2UB @@ -45,10 +45,10 @@ extern UINT8 NumEnemyInSector(); void HandleRPCDescription( ) { // WDS - make number of mercenaries, etc. be configurable - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); // UINT8 ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc = 0; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc = 0; SOLDIERTYPE *pTeamSoldier; INT32 cnt2; BOOLEAN fSAMSite = FALSE; @@ -120,7 +120,7 @@ void HandleRPCDescription( ) pTeamSoldier->ubProfile == CARLOS || pTeamSoldier->ubProfile == DIMITRI ) { - ubMercsInSector[ubNumMercs] = (UINT8)cnt2; + ubMercsInSector[ubNumMercs] = (UINT16)cnt2; ++ubNumMercs; } } @@ -130,7 +130,7 @@ void HandleRPCDescription( ) // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ubMercsInSector[ubChosenMerc]], gTacticalStatus.ubGuideDescriptionToUse, DIALOGUE_SPECIAL_EVENT_USE_ALTERNATE_FILES, 0, 0 ); } diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index d299f2cc..b9d6c0d8 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -95,15 +95,15 @@ void RecalculateSoldiersAniSpeed() extern void DecayPublicOpplist(INT8 bTeam); extern void VerifyAndDecayOpplist(SOLDIERTYPE *pSoldier); void EndInterrupt( BOOLEAN fMarkInterruptOccurred ); -void DeleteFromIntList( UINT8 ubIndex, BOOLEAN fCommunicate); +void DeleteFromIntList( UINT16 ubIndex, BOOLEAN fCommunicate); #define END_OF_INTERRUPTS 255 -UINT8 gubOutOfTurnOrder[MAXMERCS] = { END_OF_INTERRUPTS, 0 }; -UINT8 gubOutOfTurnPersons = 0; +UINT16 gubOutOfTurnOrder[MAXMERCS] = { END_OF_INTERRUPTS, 0 }; +UINT16 gubOutOfTurnPersons = 0; #define LATEST_INTERRUPT_GUY (gubOutOfTurnOrder[gubOutOfTurnPersons]) -#define REMOVE_LATEST_INTERRUPT_GUY() (DeleteFromIntList( (UINT8) (gubOutOfTurnPersons), TRUE )) +#define REMOVE_LATEST_INTERRUPT_GUY() (DeleteFromIntList( (gubOutOfTurnPersons), TRUE )) #define INTERRUPTS_OVER (gubOutOfTurnPersons == 1) INT16 InterruptOnlyGuynum = NOBODY; @@ -116,7 +116,7 @@ extern UINT8 gubSightFlags; typedef struct { - UINT8 ubOutOfTurnPersons; + UINT16 ubOutOfTurnPersons; INT16 InterruptOnlyGuynum; INT16 sWhoThrewRock; @@ -510,7 +510,7 @@ void BeginTeamTurn( UINT8 ubTeam ) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"BeginTeamTurn"); INT32 cnt; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE *pSoldier; //rain @@ -792,7 +792,7 @@ void DisplayHiddenTurnbased( SOLDIERTYPE * pActingSoldier ) BOOLEAN EveryoneInInterruptListOnSameTeam( void ) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"EveryoneInInterruptListOnSameTeam"); - UINT8 ubLoop; + UINT16 ubLoop; UINT8 ubTeam = 255; for (ubLoop = 1; ubLoop <= gubOutOfTurnPersons; ubLoop++) @@ -814,11 +814,11 @@ BOOLEAN EveryoneInInterruptListOnSameTeam( void ) void StartInterrupt( void ) { - UINT8 ubFirstInterrupter; + UINT16 ubFirstInterrupter; INT8 bTeam; SOLDIERTYPE * pSoldier; SOLDIERTYPE * pTempSoldier; - UINT8 ubInterrupter; + UINT16 ubInterrupter; INT32 cnt; DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StartInterrupt"); @@ -1120,12 +1120,12 @@ void StartInterrupt( void ) void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) { - UINT8 ubInterruptedSoldier; - SOLDIERTYPE * pSoldier; - SOLDIERTYPE * pTempSoldier; - INT32 cnt; - BOOLEAN fFound; - INT16 ubMinAPsToAttack; + UINT16 ubInterruptedSoldier; + SOLDIERTYPE * pSoldier; + SOLDIERTYPE * pTempSoldier; + INT32 cnt; + BOOLEAN fFound; + INT16 ubMinAPsToAttack; DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"EndInterrupt"); @@ -1172,7 +1172,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) } else { - UINT8 nubFirstInterrupter; + UINT16 nubFirstInterrupter; INT8 nbTeam; SOLDIERTYPE * npSoldier; @@ -1499,7 +1499,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) } -BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, INT8 bOldOppList) +BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, INT8 bOldOppList) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StandardInterruptConditionsMet"); // UINT8 ubAniType; @@ -1801,7 +1801,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent } -INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN fUseWatchSpots ) +INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN fUseWatchSpots ) { INT32 iPoints; INT8 bLightLevel; @@ -2080,11 +2080,11 @@ BOOLEAN InterruptDuel( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent) } -void DeleteFromIntList( UINT8 ubIndex, BOOLEAN fCommunicate) +void DeleteFromIntList( UINT16 ubIndex, BOOLEAN fCommunicate) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"DeleteFromIntList"); - UINT8 ubLoop; - UINT8 ubID; + UINT16 ubLoop; + UINT16 ubID; if ( ubIndex > gubOutOfTurnPersons) { @@ -2122,10 +2122,10 @@ void DeleteFromIntList( UINT8 ubIndex, BOOLEAN fCommunicate) */ } -void AddToIntList( UINT8 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ) +void AddToIntList( UINT16 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"AddToIntList"); - UINT8 ubLoop; + UINT16 ubLoop; // ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%d added to int list", ubID ); DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("INTERRUPT: adding ID %d who %s", ubID, fGainControl ? "gains control" : "loses control" ) ); @@ -2186,11 +2186,11 @@ void AddToIntList( UINT8 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ) void VerifyOutOfTurnOrderArray() { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"VerifyOutOfTurnOrderArray"); - UINT8 ubTeamHighest[ MAXTEAMS ] = { 0 }; + UINT16 ubTeamHighest[ MAXTEAMS ] = { 0 }; UINT8 ubTeamsInList; - UINT8 ubNextInArrayOnTeam, ubNextIndex; + UINT16 ubNextInArrayOnTeam, ubNextIndex; UINT8 ubTeam; - UINT8 ubLoop, ubLoop2; + UINT16 ubLoop, ubLoop2; BOOLEAN fFoundLoop = FALSE; for (ubLoop = 1; ubLoop <= gubOutOfTurnPersons; ubLoop++) @@ -2308,9 +2308,9 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter { StartInterrupt(); } - else + else { - UINT8 nubFirstInterrupter; + UINT16 nubFirstInterrupter; INT8 nbTeam; SOLDIERTYPE * npSoldier; @@ -2384,13 +2384,14 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,String("ResolveInterruptsVs: Soldier ID = %d, APs = %d (interrupt type = %d)",pSoldier->ubID,pSoldier->bActionPoints, ubInterruptType)); - UINT8 ubTeam, ubOpp; - UINT8 ubIntCnt; - UINT8 ubIntList[MAXMERCS]; + UINT8 ubTeam; + UINT16 ubOpp; + UINT16 ubIntCnt; + UINT16 ubIntList[MAXMERCS]; UINT8 ubIntDiff[MAXMERCS]; UINT8 ubSmallestDiff; - UINT8 ubSlot, ubSmallestSlot; - UINT8 ubLoop; + UINT16 ubSlot, ubSmallestSlot; + UINT16 ubLoop; BOOLEAN fIntOccurs; SOLDIERTYPE * pOpponent; BOOLEAN fControlChanged = FALSE; @@ -2594,8 +2595,8 @@ BOOLEAN SaveTeamTurnsToTheSaveGameFile( HWFILE hFile ) TEAM_TURN_SAVE_STRUCT TeamTurnStruct; //Save the gubTurn Order Array - FileWrite( hFile, gubOutOfTurnOrder, sizeof( UINT8 ) * MAXMERCS, &uiNumBytesWritten ); - if( uiNumBytesWritten != sizeof( UINT8 ) * MAXMERCS ) + FileWrite( hFile, gubOutOfTurnOrder, sizeof( UINT16 ) * MAXMERCS, &uiNumBytesWritten ); + if( uiNumBytesWritten != sizeof( UINT16 ) * MAXMERCS ) { return( FALSE ); } @@ -2627,8 +2628,8 @@ BOOLEAN LoadTeamTurnsFromTheSavedGameFile( HWFILE hFile ) TEAM_TURN_SAVE_STRUCT TeamTurnStruct; //Load the gubTurn Order Array - FileRead( hFile, gubOutOfTurnOrder, sizeof( UINT8 ) * MAXMERCS, &uiNumBytesRead ); - if( uiNumBytesRead != sizeof( UINT8 ) * MAXMERCS ) + FileRead( hFile, gubOutOfTurnOrder, sizeof( UINT16 ) * MAXMERCS, &uiNumBytesRead ); + if( uiNumBytesRead != sizeof( UINT16 ) * MAXMERCS ) { return( FALSE ); } diff --git a/Tactical/TeamTurns.h b/Tactical/TeamTurns.h index 1d14dbcf..a53c0489 100644 --- a/Tactical/TeamTurns.h +++ b/Tactical/TeamTurns.h @@ -3,19 +3,19 @@ #include "Soldier Control.h" -extern UINT8 gubOutOfTurnPersons; -extern UINT8 gubOutOfTurnOrder[MAXMERCS] ; +extern UINT16 gubOutOfTurnPersons; +extern UINT16 gubOutOfTurnOrder[MAXMERCS] ; extern BOOLEAN gfHiddenInterrupt; extern BOOLEAN gfHiddenTurnbased; #define INTERRUPT_QUEUED (gubOutOfTurnPersons > 0) -extern BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, INT8 bOldOppList); -extern INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT8 ubOpponentID, BOOLEAN fUseWatchSpots ); +extern BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, INT8 bOldOppList); +extern INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN fUseWatchSpots ); extern void EndAITurn( void ); extern void DisplayHiddenInterrupt( SOLDIERTYPE * pSoldier ); extern BOOLEAN InterruptDuel( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent); -extern void AddToIntList( UINT8 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ); +extern void AddToIntList( UINT16 ubID, BOOLEAN fGainControl, BOOLEAN fCommunicate ); extern void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInterruptType); void FreezeInterfaceForEnemyTurn( void ); diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 603f7b1e..3c963248 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -295,7 +295,7 @@ void ItemCreationCallBack( UINT8 ubResult ); void CheatCreateItem(); // silversurfer: added for merc portrait swapping in tactical void SwapMercPortraits ( SOLDIERTYPE *pSoldier, INT8 bDirection ); -extern INT8 GetTeamSlotFromPlayerID( UINT8 ubID ); +extern INT8 GetTeamSlotFromPlayerID( UINT16 ubID ); extern FACETYPE *gpCurrentTalkingFace; // Flugente: toggle display of enemy role indicators @@ -1263,7 +1263,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) if ( MercPtrs[ gusUIFullTargetID ]->bTeam != ENEMY_TEAM ) { uiMoveTargetSoldierId = gusUIFullTargetID; - if ( IsValidTalkableNPC( (UINT8)gusUIFullTargetID, FALSE, FALSE, FALSE ) && !_KeyDown( SHIFT ) && !AM_AN_EPC( pSoldier ) && !ValidQuickExchangePosition( ) ) + if ( IsValidTalkableNPC( gusUIFullTargetID, FALSE, FALSE, FALSE ) && !_KeyDown( SHIFT ) && !AM_AN_EPC( pSoldier ) && !ValidQuickExchangePosition( ) ) { *puiNewEvent = T_CHANGE_TO_TALKING; return; @@ -1286,7 +1286,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) //if ( gfUIFullTargetFound ) { - if ( IsValidTargetMerc( (UINT8)gusUIFullTargetID ) ) + if ( IsValidTargetMerc( gusUIFullTargetID ) ) { guiUITargetSoldierId = gusUIFullTargetID; @@ -2444,7 +2444,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( gusSelectedSoldier != NOBODY ) { //Select next merc - UINT8 bID; + UINT16 bID; bID = FindNextMercInTeamPanel( MercPtrs[ gusSelectedSoldier ], FALSE, FALSE ); @@ -4159,7 +4159,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // swap sungoggles and nightgoggles / put on gas masks case 'N': SOLDIERTYPE *pTeamSoldier; - INT8 bLoop; + UINT16 bLoop; // emergency command: everybody in this sector puts on gasmasks if ( fAlt ) @@ -5443,7 +5443,7 @@ void SetScopeMode( INT32 usMapPos ) ManLooksForOtherTeams( MercPtrs[ gusSelectedSoldier ] ); } } - +#pragma optimize("", off) void ObliterateSector() { INT32 cnt; @@ -5455,8 +5455,8 @@ void ObliterateSector() #ifdef JA2BETAVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Obliterating Sector!" ); #endif - - for ( pTSoldier = MercPtrs[ cnt ]; cnt < MAX_NUM_SOLDIERS; pTSoldier++, cnt++ ) + const INT32 end = MAX_NUM_SOLDIERS; + for ( pTSoldier = MercPtrs[ cnt ]; cnt < end; pTSoldier++, cnt++ ) { if ( pTSoldier->bActive && !pTSoldier->aiData.bNeutral && (pTSoldier->bSide != gbPlayerNum ) ) { @@ -5473,10 +5473,11 @@ void ObliterateSector() // CreateAnimationTile( &AniParams ); //PlayJA2Sample( EXPLOSION_1, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); - pTSoldier->EVENT_SoldierGotHit( 1, 400, 0, pTSoldier->ubDirection, 320, NOBODY , FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE ); + pTSoldier->EVENT_SoldierGotHit( 1, 400, 0, pTSoldier->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, pTSoldier->bAimShotLocation, 0, NOWHERE ); } } } +#pragma optimize("", on) void RandomizeMercProfile() { @@ -5501,8 +5502,6 @@ void CreateNextCivType() // Get Grid Corrdinates of mouse if ( GetMouseMapPos( &usMapPos ) ) { - INT8 iNewIndex; - MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; @@ -5521,7 +5520,8 @@ void CreateNextCivType() MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); - if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) + UINT16 iNewIndex; + if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5557,8 +5557,6 @@ void CreateCow() // Get Grid Corrdinates of mouse if ( GetMouseMapPos( &usMapPos ) ) { - INT8 iNewIndex; - MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; @@ -5569,7 +5567,8 @@ void CreateCow() MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); - if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) + UINT16 iNewIndex; + if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5587,8 +5586,6 @@ void CreateBloodCat() // Get Grid Corrdinates of mouse if ( GetMouseMapPos( &usMapPos ) ) { - INT8 iNewIndex; - MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; @@ -5599,7 +5596,8 @@ void CreateBloodCat() MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); - if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) + UINT16 iNewIndex; + if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5617,8 +5615,6 @@ void CreatePlayerControlledCow() // Get Grid Corrdinates of mouse if ( GetMouseMapPos( &usMapPos ) ) { - INT8 iNewIndex; - MercCreateStruct.ubProfile = 12; MercCreateStruct.sSectorX = gWorldSectorX; MercCreateStruct.sSectorY = gWorldSectorY; @@ -5630,7 +5626,8 @@ void CreatePlayerControlledCow() RandomizeNewSoldierStats( &MercCreateStruct ); - if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) + UINT16 iNewIndex; + if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5694,7 +5691,7 @@ void CreatePlayerControlledMonster() if ( GetMouseMapPos( &usMapPos ) ) { SOLDIERCREATE_STRUCT MercCreateStruct; - INT8 iNewIndex; + UINT16 iNewIndex; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; @@ -5711,7 +5708,7 @@ void CreatePlayerControlledMonster() MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); - if ( TacticalCreateSoldier( &MercCreateStruct, (UINT8 *)&iNewIndex ) ) + if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); } @@ -6309,7 +6306,7 @@ void ChangeCurrentSquad( INT32 iSquad ) void HandleSelectMercSlot( UINT8 ubPanelSlot, INT8 bCode ) { - UINT8 ubID; + UINT16 ubID; if ( GetPlayerIDFromInterfaceTeamSlot( ubPanelSlot, &ubID ) ) { @@ -6363,7 +6360,7 @@ void TestMeanWhile( INT32 iID ) void EscapeUILock( ) { //UNLOCK UI - UnSetUIBusy( (UINT8)gusSelectedSoldier ); + UnSetUIBusy( gusSelectedSoldier ); // Decrease global busy counter... gTacticalStatus.ubAttackBusyCount = 0; @@ -6455,7 +6452,7 @@ void HandleStanceChangeFromUIKeys( UINT8 ubAnimHeight ) { if( gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ (UINT8)gusSelectedSoldier ]; + pSoldier = MercPtrs[ gusSelectedSoldier ]; // silversurfer: If we decide to stand up or press "s" again while we are standing we should reset movement to walk mode. // If we want to run we have to press "r" which is handled elsewhere. if ( ubAnimHeight == ANIM_STAND ) @@ -7321,8 +7318,8 @@ void SwapMercPortraits ( SOLDIERTYPE *pSoldier, INT8 bDirection ) if ( gpCurrentTalkingFace != NULL ) return; - UINT8 ubSourceMerc = (UINT8)gusSelectedSoldier; - UINT8 ubTargetMerc; + UINT16 ubSourceMerc = gusSelectedSoldier; + UINT16 ubTargetMerc; INT32 iSourceFace; INT32 iTargetFace; UINT8 ubGroupID = pSoldier->ubGroupID; @@ -7553,7 +7550,7 @@ void HandleAltMouseTBX2Button(UINT32 *puiNewEvent) // sevenfm: these functions keep original mouse code functionality void HandleMouseTBWheel( void ) { - UINT8 bID; + UINT16 bID; if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ NEXTMERC_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) @@ -7787,41 +7784,41 @@ void HandleTBJumpThroughWindow( void ){ } void HandleTBToggleStealthAll( void ) { - // Toggle squad's stealth mode..... - // For each guy on squad... - SOLDIERTYPE *pTeamSoldier; - INT8 bLoop; - BOOLEAN fStealthOn = FALSE; + // Toggle squad's stealth mode..... + // For each guy on squad... + SOLDIERTYPE *pTeamSoldier; + UINT16 bLoop; + BOOLEAN fStealthOn = FALSE; - // Check if at least one guy is on stealth.... - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) - { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) ) - { - if ( pTeamSoldier->bStealthMode ) - fStealthOn = TRUE; - } - } + // Check if at least one guy is on stealth.... + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + { + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) ) + { + if ( pTeamSoldier->bStealthMode ) + fStealthOn = TRUE; + } + } - fStealthOn = !fStealthOn; + fStealthOn = !fStealthOn; - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) - { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) - { - if ( gpSMCurrentMerc != NULL && bLoop == gpSMCurrentMerc->ubID ) - gfUIStanceDifferent = TRUE; - pTeamSoldier->bStealthMode = fStealthOn; - } - } + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + { + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) + { + if ( gpSMCurrentMerc != NULL && bLoop == gpSMCurrentMerc->ubID ) + gfUIStanceDifferent = TRUE; + pTeamSoldier->bStealthMode = fStealthOn; + } + } - fInterfacePanelDirty = DIRTYLEVEL2; + fInterfacePanelDirty = DIRTYLEVEL2; - // OK, display message - if ( fStealthOn ) - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ON_STEALTHMODE ] ); - else - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_OFF_STEALTHMODE ] ); + // OK, display message + if ( fStealthOn ) + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ON_STEALTHMODE ] ); + else + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_OFF_STEALTHMODE ] ); } void HandleTBToggleFireMode( void ) { @@ -7956,7 +7953,7 @@ void HandleTBSwapSidearm( void ) void HandleTBSwapGoogles( void ) { SOLDIERTYPE *pTeamSoldier; - INT8 bLoop; + UINT16 bLoop; for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) { @@ -8056,7 +8053,7 @@ void HandleTBReloadAll( void ) if (! ( gTacticalStatus.fEnemyInSector ) ) { SOLDIERTYPE *pTeamSoldier; - UINT8 bLoop; + UINT16 bLoop; UINT16 bullets; OBJECTTYPE *pGun, *pAmmo, *pAmmoMags; @@ -8259,7 +8256,7 @@ void HandleTBReloadAll( void ) else { SOLDIERTYPE *pTeamSoldier; - UINT8 bLoop; + UINT16 bLoop; OBJECTTYPE *pGun, *pAmmo; for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop, pTeamSoldier++) @@ -8359,7 +8356,7 @@ void HandleTBGotoLowerStance( void ) } void HandleTBLocateNextMerc( void ) { - UINT8 bID; + UINT16 bID; if ( gusSelectedSoldier != NOBODY ) { //Select next merc bID = FindNextMercInTeamPanel( MercPtrs[ gusSelectedSoldier ], FALSE, FALSE ); @@ -8370,7 +8367,7 @@ void HandleTBLocateNextMerc( void ) } void HandleTBLocatePrevMerc( void ) { - UINT8 bID; + UINT16 bID; if ( gusSelectedSoldier != NOBODY ) { bID = FindPrevActiveAndAliveMerc( MercPtrs[ gusSelectedSoldier ], TRUE, TRUE ); @@ -8419,7 +8416,7 @@ void HandleTBDropBackpacks( void ) { //SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; SOLDIERTYPE *pTeamSoldier; - UINT8 ubLoop; + UINT16 ubLoop; INT16 sAPCost = APBPConstants[AP_BACK_PACK]; INT32 iBPCost = APBPConstants[BP_BACK_PACK]; @@ -8457,7 +8454,7 @@ void HandleTBPickUpBackpacks( void ) { //SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; SOLDIERTYPE *pTeamSoldier; - UINT8 ubLoop; + UINT16 ubLoop; INT16 sAPCost = APBPConstants[AP_BACK_PACK]; INT32 iBPCost = APBPConstants[BP_BACK_PACK]; @@ -8504,7 +8501,7 @@ void HandleTBSoldierRun( void ) && pSoldier->usUIMovementMode != WALKING_DUAL_RDY && pSoldier->usUIMovementMode != WALKING_ALTERNATIVE_RDY ) { - UIHandleSoldierStanceChange( (UINT8)pSoldier->ubID, ANIM_STAND ); + UIHandleSoldierStanceChange( pSoldier->ubID, ANIM_STAND ); pSoldier->flags.fUIMovementFast = 1; } else @@ -9674,3 +9671,45 @@ BOOLEAN CheckAutoBandage(void) return FALSE; } + +void HandleTBPickUpBackpacks(BOOLEAN fAll) +{ + if (UsingNewInventorySystem() && (fAll || gusSelectedSoldier != NOBODY)) + { + SOLDIERTYPE* pSoldier = NULL; + SOLDIERTYPE* pTeamSoldier; + UINT16 ubLoop; + + if (gusSelectedSoldier != NOBODY) + { + pSoldier = MercPtrs[gusSelectedSoldier]; + } + + INT16 sAPCost = APBPConstants[AP_BACK_PACK]; + INT32 iBPCost = APBPConstants[BP_BACK_PACK]; + + for (ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++) + { + pTeamSoldier = MercPtrs[ubLoop]; + + if (pTeamSoldier && + OK_CONTROLLABLE_MERC(pTeamSoldier) && + OK_INTERRUPT_MERC(pTeamSoldier) && + !AM_A_ROBOT(pTeamSoldier) && + //!pTeamSoldier->IsBoxer() && + EnoughPoints(pTeamSoldier, sAPCost, iBPCost, FALSE) && + (fAll || pTeamSoldier->bAssignment == pSoldier->bAssignment) && + !pTeamSoldier->inv[BPACKPOCKPOS].exists() && + pTeamSoldier->flags.DropPackFlag) + { + if (ChangeDropPackStatus(pTeamSoldier, FALSE)) + { + ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[11], pTeamSoldier->GetName()); + } + } + } + + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } +} diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 3e035934..d6f1dd6b 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -138,7 +138,7 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs // FUNCTIONS FOR CURSOR DETERMINATION! -UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ) +UINT8 GetProperItemCursor( UINT16 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ) { SOLDIERTYPE *pSoldier; UINT32 uiCursorFlags; @@ -222,7 +222,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos if ( fRecalc && gfUIFullTargetFound ) { // ATE: Check for ammo - if ( IsValidTargetMerc( (UINT8)gusUIFullTargetID ) && EnoughAmmo( pSoldier, FALSE, HANDPOS ) && + if ( IsValidTargetMerc( gusUIFullTargetID ) && EnoughAmmo( pSoldier, FALSE, HANDPOS ) && (!pSoldier->IsValidSecondHandShotForReloadingPurposes( ) || EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) { // IF it's an ememy, goto confirm action mode @@ -393,7 +393,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos, BOOLEA // Determine where we are shooting / aiming //if ( fRecalc ) { - DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, TRUE, TRUE ); + DetermineCursorBodyLocation( gusSelectedSoldier, TRUE, TRUE ); } UINT8 ubMaxBullets = 1; INT8 bMaxAim; @@ -1238,7 +1238,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos , BO if (( ( gTacticalStatus.uiFlags & REALTIME ) || !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { //DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, FALSE, fRecalc ); - DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, fShowAPs, fRecalc ); + DetermineCursorBodyLocation( gusSelectedSoldier, fShowAPs, fRecalc ); if ( pSoldier->flags.fReloading || pSoldier->flags.fPauseAim ) { @@ -1273,7 +1273,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos , BO if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT ) ) { - DetermineCursorBodyLocation( (UINT8)gusSelectedSoldier, fShowAPs, fRecalc ); + DetermineCursorBodyLocation( gusSelectedSoldier, fShowAPs, fRecalc ); gsCurrentActionPoints = CalcTotalAPsToAttack( pSoldier, usMapPos, TRUE, (INT8)(pSoldier->aiData.bShownAimTime ) ); @@ -1387,7 +1387,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos , BO } -void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ) +void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ) { INT32 usMapPos; SOLDIERTYPE *pTargetSoldier = NULL, *pSoldier; @@ -2230,7 +2230,7 @@ UINT8 HandleBloodbagCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActiv if ( HasItemFlag( ( &( pSoldier->inv[HANDPOS] ) )->usItem, EMPTY_BLOOD_BAG ) ) { // is there a person here? - UINT8 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); + UINT16 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { if ( usSoldierIndex != pSoldier->ubID && MercPtrs[usSoldierIndex]->IsValidBloodDonor() ) @@ -2265,7 +2265,7 @@ UINT8 HandleSplintCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivat } // is there a person here? - UINT8 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); + UINT16 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { if ( usSoldierIndex != pSoldier->ubID && MercPtrs[usSoldierIndex]->CanReceiveSplint() ) @@ -2351,7 +2351,7 @@ UINT8 HandleHandcuffCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCurso if ( HasItemFlag( (&(pSoldier->inv[HANDPOS]))->usItem, HANDCUFFS ) ) { // is there a person here? - UINT8 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); + UINT16 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if (usSoldierIndex != NOBODY && MercPtrs[usSoldierIndex] && MercPtrs[usSoldierIndex]->bVisible >= 0 && MercPtrs[usSoldierIndex]->CanBeCaptured()) { return( HANDCUFF_GREY_UICURSOR ); @@ -2373,7 +2373,7 @@ UINT8 HandleApplyItemCursor(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCurso if (ItemCanBeAppliedToOthers((&(pSoldier->inv[HANDPOS]))->usItem)) { // is there a person here? - UINT8 ubPerson = WhoIsThere2(sGridNo, pSoldier->pathing.bLevel); + UINT16 ubPerson = WhoIsThere2(sGridNo, pSoldier->pathing.bLevel); if (ubPerson != NOBODY && MercPtrs[ubPerson] && MercPtrs[ubPerson]->bVisible >= 0) { return(APPLYITEM_GREY_UICURSOR); @@ -2989,7 +2989,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) if ( GetMouseMapPos( &usMapPos ) ) { // is there a person here? - UINT8 ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); + UINT16 ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); if (ubPerson != NOBODY && MercPtrs[ubPerson] && MercPtrs[ubPerson]->bVisible >= 0) { ubCursor = APPLYITEMCURS; diff --git a/Tactical/UI Cursors.h b/Tactical/UI Cursors.h index c74a1804..b20e97f3 100644 --- a/Tactical/UI Cursors.h +++ b/Tactical/UI Cursors.h @@ -9,8 +9,8 @@ #define REFINE_KNIFE_2 (gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedBladedAttackes*2 : 6) -UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ); -void DetermineCursorBodyLocation( UINT8 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ); +UINT8 GetProperItemCursor( UINT16 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ); +void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ); void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ); void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos ); diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index d16281c3..c3542022 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -53,7 +53,7 @@ VEHICLETYPE *pVehicleList = NULL; // number of vehicle slots on the list UINT8 ubNumberOfVehicles = 0; -// the sqaud mvt groups +// the squad mvt groups extern INT8 SquadMovementGroups[ ]; @@ -180,7 +180,7 @@ INT16 sVehicleInternalOrigArmorValues[ NUMBER_OF_TYPES_OF_VEHICLES ][ NUMBER_OF_ // set the driver of the vehicle -void SetDriver( INT32 iID, UINT8 ubID ); +void SetDriver( INT32 iID, UINT16 ubID ); //void RemoveSoldierFromVehicleBetweenSectors( pSoldier, iId ); @@ -669,7 +669,7 @@ BOOLEAN AddSoldierToVehicle( SOLDIERTYPE *pSoldier, INT32 iId, UINT8 ubSeatIndex // anv: are we taking driver's seat if( gNewVehicle[ pVehicleList[ iId ].ubVehicleType ].VehicleSeats[ubFinalSeatIndex].fDriver ) { - SetDriver( iId , pSoldier->ubID ); + SetDriver( iId, pSoldier->ubID ); } else { @@ -1577,7 +1577,7 @@ SOLDIERTYPE *GetDriver( INT32 iID ) } -void SetDriver( INT32 iID, UINT8 ubID ) +void SetDriver( INT32 iID, UINT16 ubID ) { // anv: first make sure previous driver won't be driver anymore if( pVehicleList[ iID ].ubDriver != NOBODY && MercPtrs[ pVehicleList[ iID ].ubDriver ]->iVehicleId == iID ) @@ -1986,7 +1986,7 @@ void AddPassangersToTeamPanel( INT32 iId ) } -void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo, UINT8 ubAttackerID ) +void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo, UINT16 ubAttackerID ) { if ( ubReason != TAKE_DAMAGE_GAS_FIRE && ubReason != TAKE_DAMAGE_GAS_NOTFIRE ) { @@ -2015,7 +2015,7 @@ void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo } -void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, UINT8 ubAttackerID ) +void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, UINT16 ubAttackerID ) { // check state the armor was s'posed to be in vs. the current state..the difference / orig state is % chance // that a critical hit will occur @@ -2317,7 +2317,7 @@ BOOLEAN SaveVehicleInformationToSaveGameFile( HWFILE hFile ) //loop through the passengers for( ubPassengerCnt=0; ubPassengerCnt<10; ubPassengerCnt++) { - TempVehicle.pPassengers[ ubPassengerCnt ] = ( SOLDIERTYPE * )NO_PROFILE; + TempVehicle.pPassengers[ ubPassengerCnt ] = ( SOLDIERTYPE * )NO_PROFILE; //if there is a passenger here if( pVehicleList[cnt].pPassengers[ ubPassengerCnt ] ) @@ -2428,28 +2428,28 @@ BOOLEAN LoadVehicleInformationFromSavedGameFile( HWFILE hFile, UINT32 uiSavedGam //loop through all the passengers for(ubPassengerCnt=0; ubPassengerCnt<10; ubPassengerCnt++) { - if ( uiSavedGameVersion < 86 ) - { - if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != 0 ) + if ( uiSavedGameVersion < 86 ) { - // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back - // ! to a UINT8 so we can get the REAL pointer to the soldier. - pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)(pVehicleList[cnt].pPassengers[ ubPassengerCnt ]), FALSE ); + if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != 0 ) + { + // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back + // ! to a UINT8 so we can get the REAL pointer to the soldier. + pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)(pVehicleList[cnt].pPassengers[ ubPassengerCnt ]), FALSE ); } - } - else - { - if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != ( SOLDIERTYPE * )NO_PROFILE ) + } + else { - // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back - // ! to a UINT8 so we can get the REAL pointer to the soldier. - pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)(pVehicleList[cnt].pPassengers[ ubPassengerCnt ]), FALSE ); + if( pVehicleList[cnt].pPassengers[ubPassengerCnt] != ( SOLDIERTYPE * )NO_PROFILE ) + { + // ! The id of the soldier was saved in the passenger pointer. The passenger pointer is converted back + // ! to a UINT8 so we can get the REAL pointer to the soldier. + pVehicleList[cnt].pPassengers[ubPassengerCnt] = FindSoldierByProfileID( (UINT8)(pVehicleList[cnt].pPassengers[ ubPassengerCnt ]), FALSE ); } - else - { - pVehicleList[cnt].pPassengers[ubPassengerCnt] = NULL; - } - } + else + { + pVehicleList[cnt].pPassengers[ubPassengerCnt] = NULL; + } + } } diff --git a/Tactical/Vehicles.h b/Tactical/Vehicles.h index 571fa98e..ceef6143 100644 --- a/Tactical/Vehicles.h +++ b/Tactical/Vehicles.h @@ -289,7 +289,7 @@ typedef struct BOOLEAN fBetweenSectors; // between sectors? INT32 sGridNo; // location in tactical SOLDIERTYPE *pPassengers[ MAXPASSENGERS ]; - UINT8 ubDriver; + UINT16 ubDriver; INT16 sInternalHitLocations[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; INT16 sArmourType; INT16 sExternalArmorLocationsStatus[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; @@ -404,7 +404,7 @@ BOOLEAN SwapVehicleSeat( SOLDIERTYPE *pVehicle, SOLDIERTYPE *pSoldier, UINT8 ubS void AddPassangersToTeamPanel( INT32 iId ); -void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo , UINT8 ubAttackerID ); +void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo , UINT16 ubAttackerID ); // the soldiertype containing this tactical incarnation of this vehicle SOLDIERTYPE * GetSoldierStructureForVehicle( INT32 iId ); @@ -415,7 +415,7 @@ void AdjustVehicleAPs( SOLDIERTYPE *pSoldier, INT16 *pubPoints ); //INT16 GetOrigInternalArmorValueForVehicleInLocation( UINT8 ubID, UINT8 ubLocation ); // handle crit hit to vehicle in this location -void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, UINT8 ubAttackerID ); +void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, UINT16 ubAttackerID ); // ste up armor values for this vehicle void SetUpArmorForVehicle( UINT8 ubID ); diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 59dac718..06ced271 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -2443,7 +2443,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) //CHAR8 zBurstString[512]; UINT8 ubDirection; INT32 sNewGridNo; - UINT8 ubMerc; + UINT16 ubMerc; BOOLEAN fGonnaHit = FALSE; FLOAT dExpGain = 0; UINT32 uiDepreciateTest; @@ -3227,7 +3227,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // CHAR8 zBurstString[512]; UINT8 ubDirection; INT32 sNewGridNo; - UINT8 ubMerc; + UINT16 ubMerc; BOOLEAN fGonnaHit = FALSE; UINT16 usExpGain = 0; UINT32 uiDepreciateTest; @@ -4933,7 +4933,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) { UINT32 uiHitChance; INT8 bLoop; - UINT8 ubTargetID; + UINT16 ubTargetID; SOLDIERTYPE * pTargetSoldier; //INT16 sAPCost = 0;//dnl ch72 180913 @@ -5277,7 +5277,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) { if (pSoldier->bTeam == 0 || (pSoldier->bTeam == 1 && is_server)) { - send_grenade( pSoldier->pTempObject , pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, sTargetGridNo, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, iID , false); + send_grenade( pSoldier->pTempObject, pSoldier->pThrowParams->dLifeSpan, pSoldier->pThrowParams->dX, pSoldier->pThrowParams->dY, pSoldier->pThrowParams->dZ, pSoldier->pThrowParams->dForceX, pSoldier->pThrowParams->dForceY, pSoldier->pThrowParams->dForceZ, sTargetGridNo, pSoldier->ubID, pSoldier->pThrowParams->ubActionCode, pSoldier->pThrowParams->uiActionData, iID, false); } } @@ -5304,7 +5304,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) return( TRUE ); } -BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, UINT16 usWeaponIndex, INT32 sGridNo, INT16 sXPos, INT16 sYPos, INT16 sZPos, BOOLEAN fSoundOnly, BOOLEAN fFreeupAttacker, INT32 iBullet ) +BOOLEAN DoSpecialEffectAmmoMiss( UINT16 ubAttackerID, UINT16 usWeaponIndex, INT32 sGridNo, INT16 sXPos, INT16 sYPos, INT16 sZPos, BOOLEAN fSoundOnly, BOOLEAN fFreeupAttacker, INT32 iBullet ) { ANITILE_PARAMS AniParams; UINT8 ubAmmoType = 0; @@ -5467,7 +5467,7 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT8 ubAttackerID, UINT16 usWeaponIndex, INT32 } -void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange , UINT8 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ) +void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange, UINT16 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ) { SOLDIERTYPE* pTargetSoldier = NULL; SOLDIERTYPE* pSoldier = NULL; @@ -5543,7 +5543,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s else if ( AmmoTypes[ubAmmoType].explosionSize > 1) { // re-routed the Highexplosive value to define exposion type - IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos ), AmmoTypes[ubAmmoType].highExplosive , pTargetSoldier->pathing.bLevel ); + IgniteExplosion( ubAttackerID, sXPos, sYPos, 0, GETWORLDINDEXFROMWORLDCOORDS( sYPos, sXPos ), AmmoTypes[ubAmmoType].highExplosive, pTargetSoldier->pathing.bLevel ); // pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.usGunAmmoItem = NONE; } } @@ -5578,7 +5578,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s } -void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT8 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ) +void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT16 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ) { BOOLEAN fDoMissForGun = FALSE; ANITILE *pNode; @@ -6237,7 +6237,7 @@ BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT32 sGridNo ) return( FALSE ); } - +#pragma optimize("", off) UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ) { @@ -6258,7 +6258,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi UINT16 usInHand; OBJECTTYPE * pInHand; INT16 sDistVis, sDistVisNoScope; - UINT8 ubTargetID; + UINT16 ubTargetID; bool fCantSeeTarget = false; FLOAT scopeRangeMod = 0.0f; @@ -6589,6 +6589,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi return ((INT32)fFinalChance); } +#pragma optimize("", on) UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ) @@ -6616,7 +6617,8 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT16 usInHand, usShockPenalty, MIN_RANGE_FOR_FULL_COWER, MAX_TARGET_COWERING_PENALTY; UINT16 iBulletsLeft, iTracersFired = 0, iBulletsPerTracer, iBulletsSinceLastTracer=0, iRoundsFiredPreviously; INT8 bBandaged, maxClickBonus = 10, AIM_PENALTY_PER_TARGET_SHOCK; - UINT8 ubTargetID, bLightLevel, ubCoweringDivisor, ubAutoPenaltySinceLastTracer=0; + UINT16 ubTargetID; + UINT8 bLightLevel, ubCoweringDivisor, ubAutoPenaltySinceLastTracer = 0; FLOAT maxBonus, aimTimeBonus, scopeRangeMod = 0.0f, iAimBonus; bool fCantSeeTarget = false, fCoverObscured = false; @@ -9036,7 +9038,7 @@ INT32 HTHImpact( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget, INT32 iHitBy, BO return( iImpact ); } -void ShotMiss( UINT8 ubAttackerID, INT32 iBullet ) +void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) { BOOLEAN fDoMissForGun = FALSE; SOLDIERTYPE* pAttacker = NULL; @@ -12118,7 +12120,7 @@ FLOAT CalcNewChanceToHitAimTraitBonus(SOLDIERTYPE *pSoldier, FLOAT fAimCap, FLOA extern BOOLEAN IsRoofPresentAtGridNo( INT32 sGridNo ); // Flugente: fire item from A to B (intended for mortarshells and launchable grenades) -BOOLEAN ArtilleryStrike( UINT16 usItem, UINT8 ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ) +BOOLEAN ArtilleryStrike( UINT16 usItem, UINT16 ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ) { FLOAT dForce, dDegrees; INT16 sDestX, sDestY, sSrcX, sSrcY; diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 45c9f266..657b34cf 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -454,12 +454,12 @@ extern INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier ); // Flugente: fire resistance INT16 ArmourVersusFirePercent( SOLDIERTYPE * pSoldier ); extern BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ); -extern void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange , UINT8 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ); -extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT8 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ); +extern void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange, UINT16 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ); +extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT16 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ); extern void WindowHit( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce ); // HEADROCK HAM 5.1: Moved to Bullets.h extern BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT32 sGridNo ); -extern void ShotMiss( UINT8 ubAttackerID, INT32 iBullet ); +extern void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ); extern UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ); extern UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ); extern UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos, INT8 bTargetLevel, UINT16 usAnimState);//dnl ch59 180813 @@ -536,7 +536,7 @@ FLOAT GetOverheatJamThreshold( OBJECTTYPE *pObj ); FLOAT GetOverheatDamageThresholdModifier( OBJECTTYPE *pObj ); FLOAT GetOverheatDamageThreshold( OBJECTTYPE *pObj ); -BOOLEAN ArtilleryStrike( UINT16 usItem, UINT8 ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ); +BOOLEAN ArtilleryStrike( UINT16 usItem, UINT16 ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ); // Flugente: functions for using several barrels at once UINT8 GetNextBarrelMode( UINT16 usItem, UINT8 aBarrelMode ); diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index 8feac68c..0b0e1a50 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -609,7 +609,7 @@ void ResizeWorldItems(void)//dnl ch75 271013 #endif } -INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID ) +INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT16 soldierID ) { UINT32 iItemIndex; INT32 iReturn; diff --git a/Tactical/World Items.h b/Tactical/World Items.h index 524b67b8..04a07697 100644 --- a/Tactical/World Items.h +++ b/Tactical/World Items.h @@ -72,7 +72,7 @@ public: //Because this value is zero in the saved maps, we can't change it to 100, hence the reversal method. //This check is only performed the first time a map is loaded. Later, it is entirely skipped. UINT8 ubNonExistChance; - INT8 soldierID; + INT16 soldierID; char endOfPod; OBJECTTYPE object; }; @@ -100,13 +100,29 @@ public: OBJECTTYPE object; }; // _OLD_WORLDITEM +class _WORLDITEM_INT8_ID +{ +public: + BOOLEAN fExists; + INT32 sGridNo; + UINT8 ubLevel; + UINT16 usFlags; + INT8 bRenderZHeightAboveLevel; + INT8 bVisible; + UINT8 ubNonExistChance; + INT8 soldierID; + char endOfPod; + OBJECTTYPE object; +}; + #define SIZEOF_WORLDITEM_POD (offsetof(WORLDITEM, endOfPod)) #define _OLD_SIZEOF_WORLDITEM_POD (offsetof(_OLD_WORLDITEM, endOfPod)) +#define _SIZEOF_WORLDITEM_INT8_ID_POD (offsetof(_WORLDITEM_INT8_ID, endOfPod)) extern std::vector gWorldItems;//dnl ch75 261013 extern UINT32 guiNumWorldItems; -INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT8 soldierID ); +INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT16 soldierID ); void RemoveItemFromWorld( INT32 iItemIndex ); INT32 FindWorldItem( UINT16 usItem ); diff --git a/Tactical/bullets.cpp b/Tactical/bullets.cpp index e9b8fda9..d04ee742 100644 --- a/Tactical/bullets.cpp +++ b/Tactical/bullets.cpp @@ -76,7 +76,7 @@ void RecountBullets(void) } -INT32 CreateBullet( UINT8 ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ) +INT32 CreateBullet( UINT16 ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ) { INT32 iBulletIndex; BULLET *pBullet; diff --git a/Tactical/faces.h b/Tactical/faces.h index 3e374974..4ecc2b6c 100644 --- a/Tactical/faces.h +++ b/Tactical/faces.h @@ -9,7 +9,7 @@ #include "soldier profile type.h" // Defines -#define NUM_FACE_SLOTS 50 +#define NUM_FACE_SLOTS NUM_PROFILES struct audio_gap { @@ -123,7 +123,7 @@ typedef struct UINT32 uiSoundID; // Sound ID if one being played - UINT8 ubSoldierID; // SoldierID if one specified + UINT16 ubSoldierID; // SoldierID if one specified UINT8 ubCharacterNum; // Profile ID num UINT16 usFaceX; // X location to render face @@ -200,14 +200,14 @@ extern FACETYPE gFacesData[ NUM_FACE_SLOTS ]; // FACE HANDLING // // Faces are done like this: Call -INT32 InitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitFlags ); +INT32 InitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags ); // The first parameter is the profile ID and the second is the soldier ID ( which for most cases // will be NOBODY if the face is not created from a SOLDIERTYPE ) // This function allocates a slot in the table for the face, loads it's STI file, sets some // values for X,Y locations of eyes from the profile. Does not mkae the face visible or anything like that // INternal init face, called if you don;t want to give a profile ID ( send NO_PROFILE ) for ID -INT32 InternalInitFace( UINT8 usMercProfileID, UINT8 ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ); +INT32 InternalInitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ); // Removes the face from the internal table, deletes any memory allocated if any. @@ -279,10 +279,10 @@ void HandleTalkingAutoFaces( ); // Same Functions but taking soldier ID first to get profile ID INT32 InitSoldierFace( SOLDIERTYPE *pSoldier ); void DeleteSoldierFace( SOLDIERTYPE *pSoldier ); -void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, UINT8 ubSoldierID , UINT16 usFaceX, UINT16 usFaceY ); -void SetAutoFaceInActiveFromSoldier( UINT8 ubSoldierID ); -BOOLEAN RenderAutoFaceFromSoldier( UINT8 ubSoldierID ); -BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, UINT8 ubSoldierID, INT16 sX, INT16 sY ); +void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, UINT16 ubSoldierID, UINT16 usFaceX, UINT16 usFaceY ); +void SetAutoFaceInActiveFromSoldier( UINT16 ubSoldierID ); +BOOLEAN RenderAutoFaceFromSoldier( UINT16 ubSoldierID ); +BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, UINT16 ubSoldierID, INT16 sX, INT16 sY ); diff --git a/Tactical/fov.cpp b/Tactical/fov.cpp index 12a99df7..79812c23 100644 --- a/Tactical/fov.cpp +++ b/Tactical/fov.cpp @@ -299,7 +299,6 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo INT8 itemVisible = FALSE; INT8 Blocking,twoMoreTiles,markerDir; INT8 nextDir=0; - UINT8 who; //,itemIndex; // for each square checked UINT8 dir,range,Path2; //DBrot: More Rooms //UINT8 ubRoomNo; @@ -359,7 +358,6 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo MercLooksForDoors( pSoldier, TRUE ); - who = pSoldier->ubID; dir = pSoldier->ubDirection; //NumMessage("good old reveal",dir); diff --git a/Tactical/merc entering.h b/Tactical/merc entering.h index 8043d1b1..30b80744 100644 --- a/Tactical/merc entering.h +++ b/Tactical/merc entering.h @@ -4,7 +4,7 @@ extern BOOLEAN gfIngagedInDrop; void ResetHeliSeats( ); -void AddMercToHeli( UINT8 ubID ); +void AddMercToHeli( UINT16 ubID ); // Flugente: we might want to set the helicopter dropoff point without starting it at the same time void SetHelicopterDroppoint( INT32 sGridNo ); @@ -14,7 +14,7 @@ void StartHelicopterRun(); void HandleHeliDrop( BOOLEAN fPlayer = TRUE ); -UINT8 SpawnAirDropElite( INT32 sGridNo ); +UINT16 SpawnAirDropElite( INT32 sGridNo ); void InitiateEnemyAirDropSoldiers( INT32 sGridNo ); void HandleEnemyAirdrop( ); diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 8f6db0d0..85a5a752 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -74,16 +74,16 @@ extern void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier ); // HEADROCK HAM 3.6: Moved to header //void MakeBloodcatsHostile( void ); -void OurNoise( UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ); -void TheirNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); -void ProcessNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ); +void TheirNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT8 ubNoiseType, UINT8 ubBaseVolume, UINT8 ubTerrType1, UINT8 ubTerrType2); -void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen); -void TellPlayerAboutNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage = NULL ); +void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen); +void TellPlayerAboutNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage = NULL ); void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumNewEnemies ); -void IncrementWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel ); -void SetWatchedLocAsUsed( UINT8 ubID, INT32 sGridNo, INT8 bLevel ); +void IncrementWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel ); +void SetWatchedLocAsUsed( UINT16 ubID, INT32 sGridNo, INT8 bLevel ); void DecayWatchedLocs( INT8 bTeam ); void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT8 * pPersOL, INT8 * pbPublOL ); @@ -91,7 +91,7 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT // The_Bob - real time sneaking code 01/06/09 extern void CancelItemPointer(void); extern BOOLEAN NobodyAlerted(void); -extern void ShowRadioLocator( UINT8 ubID, UINT8 ubLocatorSpeed ); +extern void ShowRadioLocator( UINT16 ubID, UINT8 ubLocatorSpeed ); //#define TESTOPPLIST // for ManSeesMan() @@ -120,7 +120,7 @@ BOOLEAN gfMikeShouldSayHi = FALSE; BOOLEAN gfMorrisShouldSayHi = FALSE; #endif -UINT8 gubBestToMakeSighting[BEST_SIGHTING_ARRAY_SIZE]; +UINT16 gubBestToMakeSighting[BEST_SIGHTING_ARRAY_SIZE]; UINT8 gubBestToMakeSightingSize = 0; //BOOLEAN gfHumanSawSomeoneInRealtime; @@ -128,11 +128,11 @@ BOOLEAN gfDelayResolvingBestSightingDueToDoor = FALSE; #define SHOULD_BECOME_HOSTILE_SIZE 32 -UINT8 gubShouldBecomeHostileOrSayQuote[ SHOULD_BECOME_HOSTILE_SIZE ]; +UINT16 gubShouldBecomeHostileOrSayQuote[ SHOULD_BECOME_HOSTILE_SIZE ]; UINT8 gubNumShouldBecomeHostileOrSayQuote; // NB this ID is set for someone opening a door -UINT8 gubInterruptProvoker = NOBODY; +UINT16 gubInterruptProvoker = NOBODY; INT8 gbPublicOpplist[MAXTEAMS][TOTAL_SOLDIERS]; INT8 gbSeenOpponents[TOTAL_SOLDIERS][TOTAL_SOLDIERS]; @@ -360,7 +360,7 @@ INT16 AdjustMaxSightRangeForEnvEffects( SOLDIERTYPE *pSoldier, INT8 bLightLevel, void SwapBestSightingPositions( INT8 bPos1, INT8 bPos2 ) { - UINT8 ubTemp; + UINT16 ubTemp; ubTemp = gubBestToMakeSighting[ bPos1 ]; gubBestToMakeSighting[ bPos1 ] = gubBestToMakeSighting[ bPos2 ]; @@ -483,7 +483,7 @@ void HandleBestSightingPositionInRealtime( void ) // This function is called for handling interrupts when opening a door in non-combat or // just sighting in non-combat, deciding who gets the first turn - UINT8 ubLoop; + UINT16 ubLoop; if ( gfDelayResolvingBestSightingDueToDoor ) { @@ -513,7 +513,7 @@ void HandleBestSightingPositionInRealtime( void ) CancelItemPointer(); // select (and center screen on) the merc who saw the enemy // HEADROCK HAM 3.6: A much-requested toggle. - if (gusSelectedSoldier != (UINT16)MercPtrs[gubBestToMakeSighting[ 0 ]]->ubID && + if (gusSelectedSoldier != MercPtrs[gubBestToMakeSighting[ 0 ]]->ubID && !gGameExternalOptions.fNoAutoFocusChangeInRealtimeSneak) SelectSoldier (MercPtrs[gubBestToMakeSighting[ 0 ]]->ubID, false, true); // if not quiet, emit a message warning the player @@ -582,7 +582,7 @@ void HandleBestSightingPositionInTurnbased( void ) { // This function is called for handling interrupts when opening a door in turnbased - UINT8 ubLoop, ubLoop2; + UINT16 ubLoop, ubLoop2; BOOLEAN fOk = FALSE; if ( gubBestToMakeSighting[ 0 ] != NOBODY ) @@ -676,9 +676,9 @@ void InitSightArrays( void ) } } -void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ) +void AddToShouldBecomeHostileOrSayQuoteList( UINT16 ubID ) { - UINT8 ubLoop; + UINT16 ubLoop; Assert( gubNumShouldBecomeHostileOrSayQuote < SHOULD_BECOME_HOSTILE_SIZE ); @@ -700,9 +700,9 @@ void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ) gubNumShouldBecomeHostileOrSayQuote++; } -UINT8 SelectSpeakerFromHostileOrSayQuoteList( void ) +UINT16 SelectSpeakerFromHostileOrSayQuoteList( void ) { - UINT8 ubProfileList[ SHOULD_BECOME_HOSTILE_SIZE ]; // NB list of merc IDs, not profiles! + UINT16 ubProfileList[ SHOULD_BECOME_HOSTILE_SIZE ]; // NB list of merc IDs, not profiles! UINT8 ubLoop, ubNumProfiles = 0; SOLDIERTYPE * pSoldier; @@ -749,7 +749,7 @@ void CheckHostileOrSayQuoteList( void ) } else { - UINT8 ubSpeaker, ubLoop; + UINT16 ubSpeaker, ubLoop; SOLDIERTYPE * pSoldier; ubSpeaker = SelectSpeakerFromHostileOrSayQuoteList(); @@ -992,11 +992,11 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) } -void OurTeamRadiosRandomlyAbout(UINT8 ubAbout) +void OurTeamRadiosRandomlyAbout(UINT16 ubAbout) { INT32 iLoop; // WDS - make number of mercenaries, etc. be configurable -INT8 radioCnt = 0,radioMan[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; +INT16 radioCnt = 0,radioMan[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; SOLDIERTYPE *pSoldier; @@ -1025,7 +1025,7 @@ INT8 radioCnt = 0,radioMan[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; // if this merc is active, in this sector, and well enough to look if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE)) // put him on our list, and increment the counter - radioMan[radioCnt++] = (INT8)iLoop; + radioMan[radioCnt++] = (INT16)iLoop; } @@ -1061,7 +1061,7 @@ INT8 radioCnt = 0,radioMan[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; -INT16 TeamNoLongerSeesMan( UINT8 ubTeam, SOLDIERTYPE *pOpponent, UINT8 ubExcludeID, INT8 bIteration ) +INT16 TeamNoLongerSeesMan( UINT8 ubTeam, SOLDIERTYPE *pOpponent, UINT16 ubExcludeID, INT8 bIteration ) { UINT16 bLoop; SOLDIERTYPE *pMate; @@ -1542,7 +1542,7 @@ void TurnOffEveryonesMuzzleFlashes( void ) void TurnOffTeamsMuzzleFlashes( UINT8 ubTeam ) { - UINT8 ubLoop; + UINT16 ubLoop; SOLDIERTYPE * pSoldier; for (ubLoop = gTacticalStatus.Team[ ubTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ ubTeam ].bLastID; ubLoop++) @@ -3062,16 +3062,16 @@ void RemoveManAsTarget(SOLDIERTYPE *pSoldier) { SOLDIERTYPE *pOpponent; - UINT8 ubTarget,ubLoop; + UINT16 ubTarget,ubLoop; ubTarget = pSoldier->ubID; // clean up the public opponent lists and locations for (ubLoop = 0; ubLoop < MAXTEAMS; ubLoop++) - // never causes any additional looks - UpdatePublic(ubLoop,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); - + { // never causes any additional looks + UpdatePublic(ubLoop, ubTarget, NOT_HEARD_OR_SEEN, NOWHERE, 0); + } /* @@ -3142,7 +3142,7 @@ IAN COMMENTED THIS OUT MAY 1997 - DO WE NEED THIS? -void UpdatePublic(UINT8 ubTeam, UINT8 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) +void UpdatePublic(UINT8 ubTeam, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) { INT32 cnt; INT8 *pbPublOL; @@ -3203,7 +3203,7 @@ void UpdatePublic(UINT8 ubTeam, UINT8 ubID, INT8 bNewOpplist, INT32 sGridNo, INT -void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT8 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) +void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) { /* #ifdef RECORDOPPLIST @@ -3464,8 +3464,8 @@ void BetweenTurnsVisibilityAdjustments(void) void SaySeenQuote( SOLDIERTYPE *pSoldier, BOOLEAN fSeenCreature, BOOLEAN fVirginSector, BOOLEAN fSeenJoey ) { SOLDIERTYPE *pTeamSoldier; - UINT8 ubNumEnemies = 0; - UINT8 ubNumAllies = 0; + UINT16 ubNumEnemies = 0; + UINT16 ubNumAllies = 0; UINT32 cnt; #ifdef JA2UB //Ja25 No meanwhiles @@ -3683,12 +3683,12 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN } -void RadioSightings(SOLDIERTYPE *pSoldier, UINT8 ubAbout, UINT8 ubTeamToRadioTo ) +void RadioSightings(SOLDIERTYPE *pSoldier, UINT16 ubAbout, UINT8 ubTeamToRadioTo ) { SOLDIERTYPE *pOpponent; INT32 iLoop; - UINT8 start,end,revealedEnemies = 0,unknownEnemies = 0,stillUnseen=TRUE; - UINT8 scrollToGuynum = NOBODY,sightedHatedOpponent = FALSE; + UINT16 start,end,revealedEnemies = 0,unknownEnemies = 0,stillUnseen=TRUE; + UINT16 scrollToGuynum = NOBODY,sightedHatedOpponent = FALSE; //UINT8 oppIsCivilian; INT8 *pPersOL,*pbPublOL; //,dayQuote; BOOLEAN fContactSeen; @@ -5596,7 +5596,7 @@ UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier ) return( ubDoorNoise ); } -void MakeNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) +void MakeNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { EV_S_NOISE SNoise; @@ -5693,7 +5693,7 @@ void MakeNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, } -void OurNoise( UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) +void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { #ifdef BYPASSNOISE return; @@ -5724,7 +5724,8 @@ void OurNoise( UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, -void TheirNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, +void TheirNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, + UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { // SOLDIERTYPE *pSoldier; @@ -5784,15 +5785,18 @@ void TheirNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType // else if noiseMaker's NOBODY, no opplist changes or interrupts are possible } -void ProcessNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) +void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { SOLDIERTYPE *pSoldier; - UINT8 bLoop, bTeam; + UINT16 bLoop; + UINT8 bTeam; UINT8 ubLoudestEffVolume, ubEffVolume; // UINT8 ubPlayVolume; - UINT8 ubSourceTerrType, ubSource; + UINT8 ubSourceTerrType; + UINT16 ubSource; INT8 bTellPlayer = FALSE, bHeard, bSeen; - UINT8 ubHeardLoudestBy = NOBODY, ubNoiseDir = 0xff, ubLoudestNoiseDir = 0xff; + UINT16 ubHeardLoudestBy = NOBODY; + UINT8 ubNoiseDir = 0xff, ubLoudestNoiseDir = 0xff; #ifdef RECORDOPPLIST @@ -6425,8 +6429,8 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT8 ubN -void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, - UINT8 ubNoiseType, UINT8 *ubSeen) +void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, + UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen) { INT16 sNoiseX, sNoiseY; INT8 bHadToTurn = FALSE, bSourceSeen = FALSE; @@ -6781,7 +6785,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bL plan_lib->update_plan(pSoldier->bAIIndex, pSoldier, ai_input); } -void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage ) +void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage ) { UINT8 ubVolumeIndex; @@ -7509,10 +7513,10 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT void CheckForAlertWhenEnemyDies( SOLDIERTYPE * pDyingSoldier ) { - UINT8 ubID; - SOLDIERTYPE * pSoldier; - INT8 bDir; - INT16 sDistAway, sDistVisible; + UINT16 ubID; + SOLDIERTYPE * pSoldier; + INT8 bDir; + INT16 sDistAway, sDistVisible; for ( ubID = gTacticalStatus.Team[ pDyingSoldier->bTeam ].bFirstID; ubID <= gTacticalStatus.Team[ pDyingSoldier->bTeam ].bLastID; ubID++ ) { @@ -7547,8 +7551,8 @@ void CheckForAlertWhenEnemyDies( SOLDIERTYPE * pDyingSoldier ) BOOLEAN ArmyKnowsOfPlayersPresence( void ) { - UINT8 ubID; - SOLDIERTYPE * pSoldier; + UINT16 ubID; + SOLDIERTYPE * pSoldier; // if anyone is still left... if (gTacticalStatus.Team[ ENEMY_TEAM ].bTeamActive && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector > 0 ) @@ -7568,7 +7572,7 @@ BOOLEAN ArmyKnowsOfPlayersPresence( void ) BOOLEAN MercSeesCreature( SOLDIERTYPE * pSoldier ) { - UINT8 ubID; + UINT16 ubID; if (pSoldier->aiData.bOppCnt > 0) { @@ -7584,7 +7588,7 @@ BOOLEAN MercSeesCreature( SOLDIERTYPE * pSoldier ) } -INT8 FindUnusedWatchedLoc( UINT8 ubID ) +INT8 FindUnusedWatchedLoc( UINT16 ubID ) { INT8 bLoop; @@ -7601,7 +7605,7 @@ INT8 FindUnusedWatchedLoc( UINT8 ubID ) return( -1 ); } -INT8 FindWatchedLocWithLessThanXPointsLeft( UINT8 ubID, UINT8 ubPointLimit ) +INT8 FindWatchedLocWithLessThanXPointsLeft( UINT16 ubID, UINT8 ubPointLimit ) { INT8 bLoop; @@ -7615,7 +7619,7 @@ INT8 FindWatchedLocWithLessThanXPointsLeft( UINT8 ubID, UINT8 ubPointLimit ) return( -1 ); } -INT8 FindWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) +INT8 FindWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel ) { INT8 bLoop; @@ -7632,7 +7636,7 @@ INT8 FindWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) return( -1 ); } -INT8 GetWatchedLocPoints( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) +INT8 GetWatchedLocPoints( UINT16 ubID, INT32 sGridNo, INT8 bLevel ) { INT8 bLoc; @@ -7657,7 +7661,7 @@ INT8 GetWatchedLocPoints( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) } -INT8 GetHighestVisibleWatchedLoc( UINT8 ubID ) +INT8 GetHighestVisibleWatchedLoc( UINT16 ubID ) { INT8 bLoop; INT8 bHighestLoc = -1; @@ -7678,7 +7682,7 @@ INT8 GetHighestVisibleWatchedLoc( UINT8 ubID ) return( bHighestLoc ); } -INT8 GetHighestWatchedLocPoints( UINT8 ubID ) +INT8 GetHighestWatchedLocPoints( UINT16 ubID ) { INT8 bLoop; INT8 bHighestPoints = 0; @@ -7694,10 +7698,10 @@ INT8 GetHighestWatchedLocPoints( UINT8 ubID ) } -void CommunicateWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoints ) +void CommunicateWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoints ) { - UINT8 ubLoop; - INT8 bTeam, bLoopPoint, bPoint; + UINT16 ubLoop; + INT8 bTeam, bLoopPoint, bPoint; bTeam = MercPtrs[ ubID ]->bTeam; @@ -7739,7 +7743,7 @@ void CommunicateWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoin } -void IncrementWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) +void IncrementWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel ) { INT8 bPoint; @@ -7778,7 +7782,7 @@ void IncrementWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) } } -void SetWatchedLocAsUsed( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) +void SetWatchedLocAsUsed( UINT16 ubID, INT32 sGridNo, INT8 bLevel ) { INT8 bPoint; @@ -7792,7 +7796,7 @@ void SetWatchedLocAsUsed( UINT8 ubID, INT32 sGridNo, INT8 bLevel ) BOOLEAN WatchedLocLocationIsEmpty( INT32 sGridNo, INT8 bLevel, INT8 bTeam ) { // look to see if there is anyone near the watched loc who is not on this team - UINT8 ubID; + UINT16 ubID; INT32 sTempGridNo; INT16 sX, sY; @@ -7817,7 +7821,7 @@ BOOLEAN WatchedLocLocationIsEmpty( INT32 sGridNo, INT8 bLevel, INT8 bTeam ) void DecayWatchedLocs( INT8 bTeam ) { - UINT8 cnt, cnt2; + UINT16 cnt, cnt2; // loop through all soldiers for ( cnt = gTacticalStatus.Team[ bTeam ].bFirstID; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; cnt++ ) diff --git a/Tactical/opplist.h b/Tactical/opplist.h index 9330b7e6..b8791758 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -117,7 +117,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, void DecideTrueVisibility(SOLDIERTYPE *pSoldier, UINT8 ubLocate); void AddOneOpponent(SOLDIERTYPE *pSoldier); void RemoveOneOpponent(SOLDIERTYPE *pSoldier); -void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT8 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel); +void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel); INT16 MaxNormalDistanceVisible( void ); INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, INT32 sSubjectGridNo, INT8 bLevel, const BOOLEAN& isCowering, const UINT8& tunnelVision); void ResetLastKnownLocs(SOLDIERTYPE *ptr); @@ -129,9 +129,9 @@ void InitOpponentKnowledgeSystem(void); void InitSoldierOppList(SOLDIERTYPE *pSoldier); void BetweenTurnsVisibilityAdjustments(void); void RemoveManAsTarget(SOLDIERTYPE *pSoldier); -void UpdatePublic(UINT8 ubTeam, UINT8 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel ); -void RadioSightings(SOLDIERTYPE *pSoldier, UINT8 ubAbout, UINT8 ubTeamToRadioTo ); -void OurTeamRadiosRandomlyAbout(UINT8 ubAbout); +void UpdatePublic(UINT8 ubTeam, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel ); +void RadioSightings(SOLDIERTYPE *pSoldier, UINT16 ubAbout, UINT8 ubTeamToRadioTo ); +void OurTeamRadiosRandomlyAbout(UINT16 ubAbout); void DebugSoldierPage1( ); void DebugSoldierPage2( ); void DebugSoldierPage3( ); @@ -139,8 +139,8 @@ void DebugSoldierPage4( ); UINT8 MovementNoise( SOLDIERTYPE *pSoldier ); UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier ); -void MakeNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); -void OurNoise( UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void MakeNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType); @@ -151,9 +151,9 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT BOOLEAN MercSeesCreature( SOLDIERTYPE * pSoldier ); -INT8 GetWatchedLocPoints( UINT8 ubID, INT32 sGridNo, INT8 bLevel ); -INT8 GetHighestVisibleWatchedLoc( UINT8 ubID ); -INT8 GetHighestWatchedLocPoints( UINT8 ubID ); +INT8 GetWatchedLocPoints( UINT16 ubID, INT32 sGridNo, INT8 bLevel ); +INT8 GetHighestVisibleWatchedLoc( UINT16 ubID ); +INT8 GetHighestWatchedLocPoints( UINT16 ubID ); void TurnOffEveryonesMuzzleFlashes( void ); void TurnOffTeamsMuzzleFlashes( UINT8 ubTeam ); @@ -164,7 +164,7 @@ void CheckHostileOrSayQuoteList( void ); void InitOpplistForDoorOpening( void ); UINT8 DoorOpeningNoise( SOLDIERTYPE * pSoldier ); -void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ); +void AddToShouldBecomeHostileOrSayQuoteList( UINT16 ubID ); //extern INT8 gbLightSighting[1][16]; diff --git a/TacticalAI/AIInternals.h b/TacticalAI/AIInternals.h index cc7afa94..4373a496 100644 --- a/TacticalAI/AIInternals.h +++ b/TacticalAI/AIInternals.h @@ -131,7 +131,7 @@ class ATTACKTYPE { public: UINT8 ubPossible; // is this attack form possible - UINT8 ubOpponent; // which soldier is the victim + UINT16 ubOpponent; // which soldier is the victim //CHANGED STRUCTURE VALUE BY GOTTHARD 7/14/07 INT16 ubAimTime; // how many extra APs to spend on aiming INT16 ubChanceToReallyHit; // chance to hit * chance to get through cover @@ -213,7 +213,7 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pCreature ); // sevenfm: void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow); void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow); -void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT8 ubOpponentID); +void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT16 ubOpponentID); INT32 FindTossSpotInDirection(INT32 sSpot, INT8 bLevel, INT32 sTargetSpot, BOOLEAN fCheckAdjacentDirections, BOOLEAN fCheckFarther); void CheckTossGrenadeAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT8 ubGrenadeType); @@ -319,7 +319,7 @@ BOOLEAN GetBestAoEGridNo(SOLDIERTYPE *pSoldier, INT32* pGridNo, INT16 aRadius, U // Get the ID of the farthest opponent we can see, with an optional minimum range // puID - ID of the farthest opponent pSoldier can see // sRange - only return true and give an idea if opponent found is further away than this -BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, UINT8* puID, INT16 sRange); +BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, UINT16 * puID, INT16 sRange); // are there more allies than friends in adjacent sectors? BOOLEAN MoreFriendsThanEnemiesinNearbysectors(UINT8 ausTeam, INT16 aX, INT16 aY, INT8 aZ); \ No newline at end of file diff --git a/TacticalAI/AIList.cpp b/TacticalAI/AIList.cpp index 8dc6f568..85d12220 100644 --- a/TacticalAI/AIList.cpp +++ b/TacticalAI/AIList.cpp @@ -28,11 +28,11 @@ AILIST gAIList[ AI_LIST_SIZE ]; AILIST * gpFirstAIListEntry = NULL; -BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, BOOLEAN fDoRandomChecks ); +BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT16 * pubDoneCount, BOOLEAN fDoRandomChecks ); void ClearAIList( void ) { - UINT8 ubLoop; + UINT16 ubLoop; for ( ubLoop = 0; ubLoop < AI_LIST_SIZE; ubLoop++ ) { @@ -50,9 +50,9 @@ void DeleteAIListEntry( AILIST * pEntry ) pEntry->pNext = NULL; } -UINT8 FindEmptyAIListEntry( void ) +UINT16 FindEmptyAIListEntry( void ) { - UINT8 ubLoop; + UINT16 ubLoop; for ( ubLoop = 0; ubLoop < AI_LIST_SIZE; ubLoop++ ) { @@ -65,7 +65,7 @@ UINT8 FindEmptyAIListEntry( void ) return( AI_LIST_SIZE ); } -AILIST * CreateNewAIListEntry( UINT8 ubNewEntry, UINT8 ubID, INT8 bPriority ) +AILIST * CreateNewAIListEntry( UINT16 ubNewEntry, UINT16 ubID, INT8 bPriority ) { gAIList[ ubNewEntry ].ubID = ubID; gAIList[ ubNewEntry ].bPriority = bPriority; @@ -73,10 +73,10 @@ AILIST * CreateNewAIListEntry( UINT8 ubNewEntry, UINT8 ubID, INT8 bPriority ) return( &(gAIList[ ubNewEntry ]) ); } -UINT8 RemoveFirstAIListEntry( void ) +UINT16 RemoveFirstAIListEntry( void ) { - AILIST * pOldFirstEntry; - UINT8 ubID; + AILIST *pOldFirstEntry; + UINT16 ubID; while ( gpFirstAIListEntry != NULL) { @@ -98,7 +98,7 @@ UINT8 RemoveFirstAIListEntry( void ) return( NOBODY ); } -void RemoveAIListEntryForID( UINT8 ubID ) +void RemoveAIListEntryForID( UINT16 ubID ) { AILIST * pEntry; AILIST * pPrevEntry; @@ -127,9 +127,9 @@ void RemoveAIListEntryForID( UINT8 ubID ) // none found, that's okay } -BOOLEAN InsertIntoAIList( UINT8 ubID, INT8 bPriority ) +BOOLEAN InsertIntoAIList( UINT16 ubID, INT8 bPriority ) { - UINT8 ubNewEntry; + UINT16 ubNewEntry; AILIST * pEntry, * pNewEntry, * pPrevEntry = NULL; ubNewEntry = FindEmptyAIListEntry(); @@ -182,7 +182,7 @@ BOOLEAN InsertIntoAIList( UINT8 ubID, INT8 bPriority ) return( FALSE ); } -BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, BOOLEAN fDoRandomChecks ) +BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT16 * pubDoneCount, BOOLEAN fDoRandomChecks ) { if ( (gTacticalStatus.bBoxingState == BOXING) && !(pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) ) { @@ -280,12 +280,12 @@ BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT8 * pubDoneCount, return( TRUE ); } -BOOLEAN MoveToFrontOfAIList( UINT8 ubID ) +BOOLEAN MoveToFrontOfAIList( UINT16 ubID ) { // we'll have to fake this guy's alert status (in the list) to be the same as the current // front of the list INT8 bPriority; - UINT8 ubNewEntry; + UINT16 ubNewEntry; AILIST * pNewEntry; if ( !SatisfiesAIListConditions( MercPtrs[ ubID ], NULL, FALSE ) ) @@ -320,8 +320,8 @@ BOOLEAN BuildAIListForTeam( INT8 bTeam ) BOOLEAN fInsertRet; SOLDIERTYPE * pSoldier; BOOLEAN fRet = FALSE; - UINT8 ubCount = 0; - UINT8 ubDoneCount = 0; + UINT16 ubCount = 0; + UINT16 ubDoneCount = 0; INT8 bPriority; // this team is being given control so reset their muzzle flashes diff --git a/TacticalAI/AIList.h b/TacticalAI/AIList.h index d67bfc6d..bb44ac29 100644 --- a/TacticalAI/AIList.h +++ b/TacticalAI/AIList.h @@ -2,7 +2,7 @@ typedef struct AILIST { - UINT8 ubID; + UINT16 ubID; INT8 bPriority; UINT8 ubUnused; struct AILIST * pNext; @@ -11,8 +11,8 @@ typedef struct AILIST #define MAX_AI_PRIORITY 100 extern void ClearAIList( void ); -extern AILIST * CreateNewAIListEntry( UINT8 ubNewEntry, UINT8 ubID, INT8 bAlertStatus ); -extern BOOLEAN InsertIntoAIList( UINT8 ubID, INT8 bAlertStatus ); -extern UINT8 RemoveFirstAIListEntry( void ); +extern AILIST * CreateNewAIListEntry( UINT16 ubNewEntry, UINT16 ubID, INT8 bAlertStatus ); +extern BOOLEAN InsertIntoAIList( UINT16 ubID, INT8 bAlertStatus ); +extern UINT16 RemoveFirstAIListEntry( void ); extern BOOLEAN BuildAIListForTeam( INT8 bTeam ); -extern BOOLEAN MoveToFrontOfAIList( UINT8 ubID ); +extern BOOLEAN MoveToFrontOfAIList( UINT16 ubID ); diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index 50342612..075021ef 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -402,7 +402,7 @@ BOOLEAN InitAI( void ) // remove all individual files CHAR8 buf[1024]; - for (UINT8 cnt = 0; cnt < TOTAL_SOLDIERS; cnt++) + for (UINT16 cnt = 0; cnt < TOTAL_SOLDIERS; cnt++) { sprintf(buf, "Logs\\AI_Decisions [%d].txt", cnt); remove(buf); @@ -883,7 +883,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) { - UINT8 ubID; + UINT16 ubID; if (gfTurnBasedAI) { @@ -1174,12 +1174,12 @@ INT32 FindAdjacentSpotBeside(SOLDIERTYPE *pSoldier, INT32 sGridNo) return(sCheapestDest); } -UINT8 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ) +UINT16 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ) { UINT32 uiLoop; INT32 iThreatVal,iMinThreat = 30000; SOLDIERTYPE *pTargetSoldier; - UINT8 ubTargetSoldier = NOBODY; + UINT16 ubTargetSoldier = NOBODY; // Loop through all mercs @@ -1263,7 +1263,7 @@ void FreeUpNPCFromPendingAction( SOLDIERTYPE *pSoldier ) } } -void FreeUpNPCFromAttacking(UINT8 ubID) +void FreeUpNPCFromAttacking(UINT16 ubID) { SOLDIERTYPE *pSoldier; @@ -2659,7 +2659,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) case AI_ACTION_USE_SKILL: { - UINT8 ubID = WhoIsThere2( pSoldier->aiData.usActionData, 0 ); + UINT16 ubID = WhoIsThere2( pSoldier->aiData.usActionData, 0 ); BOOLEAN result = pSoldier->UseSkill(pSoldier->usAISkillUse, pSoldier->aiData.usActionData, ubID); diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index c577b762..ff6ceda0 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -837,7 +837,7 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier) { UINT32 uiLoop; UINT16 usMaxDist; - UINT8 ubFriendCount, ubFriendIDs[MAXMERCS], ubFriendID; + UINT16 ubFriendCount, ubFriendIDs[MAXMERCS], ubFriendID; UINT8 ubDirection; UINT8 ubDirsLeft; BOOLEAN fDirChecked[8]; @@ -1385,7 +1385,7 @@ INT32 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, BOOLEAN * pfChangeLevel } -INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, UINT8 *pubOpponentID) +INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, UINT16 * pubOpponentID) { INT32 *psLastLoc,sGridNo, sClosestOpponent = NOWHERE; UINT32 uiLoop; @@ -1710,7 +1710,7 @@ INT32 ClosestPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ) // NOTE: skips EPCs! - UINT8 ubLoop; + UINT16 ubLoop; SOLDIERTYPE *pTargetSoldier; INT32 sMinDist = WORLD_MAX; INT32 sDist; @@ -1769,7 +1769,7 @@ INT32 ClosestUnDisguisedPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ) // used by NPCs... find the closest PC // NOTE: skips EPCs! - UINT8 ubLoop; + UINT16 ubLoop; SOLDIERTYPE *pTargetSoldier; INT32 sMinDist = WORLD_MAX; INT32 sDist; @@ -2028,7 +2028,7 @@ INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT32 sDestGridNo, INT BOOLEAN GuySawEnemy( SOLDIERTYPE * pSoldier, UINT8 ubMax ) { UINT8 ubTeamLoop; - UINT8 ubIDLoop; + UINT16 ubIDLoop; SOLDIERTYPE *pOpponent; for ( ubTeamLoop = 0; ubTeamLoop < MAXTEAMS; ++ubTeamLoop ) @@ -2181,7 +2181,7 @@ INT32 ClosestReachableFriendInTrouble(SOLDIERTYPE *pSoldier, BOOLEAN * pfClimbin INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ) { // find the distance to the closest person on the same team - UINT8 ubLoop; + UINT16 ubLoop; SOLDIERTYPE *pTargetSoldier; INT16 sMinDist = 1000; INT16 sDist; @@ -3452,9 +3452,9 @@ INT32 CalcStraightThreatValue( SOLDIERTYPE *pEnemy ) } // Flugente: get the id of the closest soldier with a specific flag that we can currently see -UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight ) +UINT16 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight ) { - UINT8 id = NOBODY; + UINT16 id = NOBODY; UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; @@ -3505,9 +3505,9 @@ UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au } // get the id of the closest soldier (closer than x tiles) of a specific team that is wounded that we can currently see -UINT8 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) +UINT16 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) { - UINT8 id = NOBODY; + UINT16 id = NOBODY; UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; @@ -3554,9 +3554,9 @@ UINT8 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au } // get the id of the closest medic (closer than x tiles) of a specific team -UINT8 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) +UINT16 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) { - UINT8 id = NOBODY; + UINT16 id = NOBODY; UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; @@ -3618,18 +3618,18 @@ INT16 MaxNormalVisionDistance( void ) // sevenfm: check friendly soldiers between me and noise gridno // count only friends that are active and not stationary/onguard/sniper -UINT8 CountFriendsInDirection( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) +UINT16 CountFriendsInDirection( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) { SOLDIERTYPE * pFriend; UINT8 ubFriendDir, ubMyDir; - UINT8 ubFriends = 0; + UINT16 ubFriends = 0; CHECKF(pSoldier); ubMyDir = atan8(CenterX(sTargetGridNo),CenterY(sTargetGridNo),CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo)); // Run through each friendly. - for ( UINT8 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) { pFriend = MercPtrs[ iCounter ]; ubFriendDir = atan8(CenterX(sTargetGridNo),CenterY(sTargetGridNo),CenterX(pFriend->sGridNo),CenterY(pFriend->sGridNo)); @@ -3651,17 +3651,17 @@ UINT8 CountFriendsInDirection( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) } // sevenfm: count nearby friend soldiers -UINT8 CountNearbyFriends( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDistance ) +UINT16 CountNearbyFriends( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDistance ) { SOLDIERTYPE * pFriend; - UINT8 ubFriendCount = 0; + UINT16 ubFriendCount = 0; // safety check if( !pSoldier ) return 0; // Run through each friendly. - for ( UINT8 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) { pFriend = MercPtrs[ iCounter ]; // Make sure that character is alive, not too shocked, and conscious, and of higher experience level @@ -3970,7 +3970,7 @@ BOOLEAN WeAttack(INT8 bTeam) SOLDIERTYPE * pFriend; // Run through each friendly. - for (UINT8 iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; iCounter++) + for (UINT16 iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; iCounter++) { pFriend = MercPtrs[iCounter]; @@ -3994,7 +3994,7 @@ UINT8 CountNearbyFriendsLastAttackHit( SOLDIERTYPE *pSoldier, INT32 sGridNo, UIN UINT8 ubFriendCount = 0; // Run through each friendly. - for ( UINT8 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) { pFriend = MercPtrs[ iCounter ]; @@ -4034,7 +4034,7 @@ UINT8 CountFriendsFlankSameSpot(SOLDIERTYPE *pSoldier, INT32 sSpot) } // Run through each friendly. - for (UINT8 iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; iCounter++) + for (UINT16 iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; iCounter++) { pFriend = MercPtrs[iCounter]; @@ -4116,7 +4116,7 @@ UINT8 CountFriendsBlack( SOLDIERTYPE *pSoldier, INT32 sClosestOpponent ) } // Run through each friendly. - for ( UINT8 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) { pFriend = MercPtrs[ iCounter ]; @@ -4145,17 +4145,17 @@ UINT8 CountFriendsBlack( SOLDIERTYPE *pSoldier, INT32 sClosestOpponent ) } // count friends under fire or with shock -UINT8 CountTeamUnderAttack(INT8 bTeam, INT32 sGridNo, INT16 sDistance) +UINT16 CountTeamUnderAttack(INT8 bTeam, INT32 sGridNo, INT16 sDistance) { SOLDIERTYPE * pFriend; - UINT8 ubFriendCount = 0; + UINT16 ubFriendCount = 0; // safety check if (bTeam >= MAXTEAMS) return 0; // Run through each friendly. - for (UINT8 iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; iCounter++) + for (UINT16 iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; iCounter++) { pFriend = MercPtrs[iCounter]; @@ -4397,10 +4397,10 @@ BOOLEAN EnemySeenSoldierRecently( SOLDIERTYPE *pSoldier, UINT8 ubMax ) return FALSE; } -UINT8 CountTeamSeeSoldier( INT8 bTeam, SOLDIERTYPE *pSoldier ) +UINT16 CountTeamSeeSoldier( INT8 bTeam, SOLDIERTYPE *pSoldier ) { SOLDIERTYPE *pFriend; - UINT8 ubFriends = 0; + UINT16 ubFriends = 0; CHECKF( pSoldier ); @@ -4846,13 +4846,13 @@ BOOLEAN AnyCoverFromSpot( INT32 sSpot, INT8 bLevel, INT32 sThreatLoc, INT8 bThre return FALSE; } -UINT8 CountSeenEnemiesLastTurn( SOLDIERTYPE* pSoldier ) +UINT16 CountSeenEnemiesLastTurn( SOLDIERTYPE* pSoldier ) { CHECKF(pSoldier); UINT8 ubTeamLoop; - UINT8 ubIDLoop; - UINT8 cnt = 0; + UINT16 ubIDLoop; + UINT16 cnt = 0; for( ubTeamLoop = 0; ubTeamLoop < MAXTEAMS; ubTeamLoop++ ) { @@ -5677,7 +5677,7 @@ BOOLEAN DuskLight(void) return FALSE; } -BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) +BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) { INT8 bPersonalKnowledge; INT8 bPublicKnowledge; @@ -5701,7 +5701,7 @@ BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) return FALSE; } -INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) +INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5716,7 +5716,7 @@ INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) return PublicKnowledge(pSoldier->bTeam, ubOpponentID); } -INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) +INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5731,7 +5731,7 @@ INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) return KnownPublicLocation(pSoldier->bTeam, ubOpponentID); } -INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) +INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5746,7 +5746,7 @@ INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) return KnownPublicLevel(pSoldier->bTeam, ubOpponentID); } -INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) +INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5756,7 +5756,7 @@ INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) return pSoldier->aiData.bOppList[ubOpponentID]; } -INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) +INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5770,7 +5770,7 @@ INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) return gsLastKnownOppLoc[pSoldier->ubID][ubOpponentID]; } -INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) +INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5780,7 +5780,7 @@ INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID) return gbLastKnownOppLevel[pSoldier->ubID][ubOpponentID]; } -INT8 PublicKnowledge(UINT8 bTeam, UINT8 ubOpponentID) +INT8 PublicKnowledge(UINT8 bTeam, UINT16 ubOpponentID) { if (bTeam >= MAXTEAMS || ubOpponentID == NOBODY) { @@ -5790,7 +5790,7 @@ INT8 PublicKnowledge(UINT8 bTeam, UINT8 ubOpponentID) return gbPublicOpplist[bTeam][ubOpponentID]; } -INT32 KnownPublicLocation(UINT8 bTeam, UINT8 ubOpponentID) +INT32 KnownPublicLocation(UINT8 bTeam, UINT16 ubOpponentID) { if (bTeam >= MAXTEAMS || ubOpponentID == NOBODY) { @@ -5804,7 +5804,7 @@ INT32 KnownPublicLocation(UINT8 bTeam, UINT8 ubOpponentID) return gsPublicLastKnownOppLoc[bTeam][ubOpponentID]; } -INT8 KnownPublicLevel(UINT8 bTeam, UINT8 ubOpponentID) +INT8 KnownPublicLevel(UINT8 bTeam, UINT16 ubOpponentID) { if (bTeam >= MAXTEAMS || ubOpponentID == NOBODY) { @@ -5945,14 +5945,14 @@ INT32 RandomizeOpponentLocation(INT32 sSpot, SOLDIERTYPE *pOpponent, INT16 sMaxD } // first call PrepareThreatlist to make threat list -UINT8 ClosestKnownThreatID(SOLDIERTYPE *pSoldier) +UINT16 ClosestKnownThreatID(SOLDIERTYPE *pSoldier) { CHECKF(pSoldier); UINT32 uiLoop; INT32 sClosestOpponent = NOWHERE; INT32 iRange, iClosestRange; - UINT8 ubClosestOpponentID = NOBODY; + UINT16 ubClosestOpponentID = NOBODY; // use global defined threat list for (uiLoop = 0; uiLoop < guiThreatCnt; uiLoop++) @@ -5975,14 +5975,14 @@ UINT8 ClosestKnownThreatID(SOLDIERTYPE *pSoldier) } // first call PrepareThreatlist to make threat list -UINT8 ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT8 ubMax) +UINT16 ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT8 ubMax) { CHECKF(pSoldier); UINT32 uiLoop; INT32 sClosestOpponent = NOWHERE; INT32 iRange, iClosestRange; - UINT8 ubClosestOpponentID = NOBODY; + UINT16 ubClosestOpponentID = NOBODY; // use global defined threat list for (uiLoop = 0; uiLoop < guiThreatCnt; uiLoop++) @@ -6103,7 +6103,7 @@ void PrepareThreatlist(SOLDIERTYPE *pSoldier) } } -UINT8 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 sDistance) +UINT16 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 sDistance) { CHECKF(pSoldier); @@ -6113,7 +6113,7 @@ UINT8 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 sDista INT32 sThreatLoc; INT8 iThreatLevel; - UINT8 ubNum = 0; + UINT16 ubNum = 0; // loop through all the enemies for (uiLoop = 0; uiLoop < guiNumMercSlots; ++uiLoop) @@ -6157,7 +6157,7 @@ UINT8 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 sDista return ubNum; } -UINT8 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier) +UINT16 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier) { CHECKF(pSoldier); @@ -6167,7 +6167,7 @@ UINT8 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier) INT32 sThreatLoc; INT8 iThreatLevel; - UINT8 ubNum = 0; + UINT16 ubNum = 0; // loop through all the enemies for (uiLoop = 0; uiLoop < guiNumMercSlots; ++uiLoop) diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index b3fee114..fb7df79f 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -850,13 +850,13 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow"); // September 9, 1998: added code for LAWs (CJC) - UINT8 ubLoop, ubLoop2; + UINT16 ubLoop, ubLoop2; INT32 iAttackValue; INT32 iHitRate, iThreatValue, iTotalThreatValue,iOppThreatValue[MAXMERCS]; INT32 sGridNo, sEndGridNo, sFriendTile[MAXMERCS], sOpponentTile[MAXMERCS]; INT8 bFriendLevel[MAXMERCS], bOpponentLevel[MAXMERCS]; INT32 iEstDamage; - UINT8 ubFriendCnt = 0,ubOpponentCnt = 0, ubOpponentID[MAXMERCS]; + UINT16 ubFriendCnt = 0,ubOpponentCnt = 0, ubOpponentID[MAXMERCS]; UINT8 ubMaxPossibleAimTime; INT16 sRawAPCost, sMinAPcost; UINT8 ubChanceToHit, ubChanceToGetThrough, ubChanceToReallyHit, ubFriendlyFireChance; @@ -3484,9 +3484,9 @@ UINT8 UnderFire::Chance(INT8 bTeam, INT8 bSide, BOOLEAN fCheckNeutral) // if an enemy soldier fulfils taboo, make sure to not hit him at all! BOOLEAN GetBestAoEGridNo(SOLDIERTYPE *pSoldier, INT32* pGridNo, INT16 aRadius, UINT8 uCheckFriends, UINT8 aMinRating, SOLDIER_CONDITION cond, SOLDIER_CONDITION taboo) { - UINT8 ubLoop, ubLoop2; + UINT16 ubLoop, ubLoop2; INT32 sGridNo, sFriendTile[MAXMERCS], sOpponentTile[MAXMERCS], sTabooTile[MAXMERCS]; - UINT8 ubFriendCnt = 0,ubOpponentCnt = 0, ubTabooCnt = 0, ubOpponentID[MAXMERCS]; + UINT16 ubFriendCnt = 0,ubOpponentCnt = 0, ubTabooCnt = 0, ubOpponentID[MAXMERCS]; INT32 bMaxLeft,bMaxRight,bMaxUp,bMaxDown, i, j; INT8 bPersOL, bPublOL; SOLDIERTYPE *pFriend; @@ -3676,7 +3676,7 @@ BOOLEAN GetBestAoEGridNo(SOLDIERTYPE *pSoldier, INT32* pGridNo, INT16 aRadius, U // Get the ID of the farthest opponent we can see, with an optional minimum range // puID - ID of the farthest opponent pSoldier can see // sRange - only return an true and give an idea if opponent found is further away than this -BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, UINT8* puID, INT16 sRange) +BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, UINT16 * puID, INT16 sRange) { INT32 sGridNo; UINT32 uiLoop; @@ -3800,9 +3800,7 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) INT8 bTargetLevel = bLevel; INT32 sClosestThreat; - UINT8 ubClosestThreatID; - - ubClosestThreatID = pSoldier->ubPreviousAttackerID; + UINT16 ubClosestThreatID = pSoldier->ubPreviousAttackerID; // try to find good spot for smoke if (ubClosestThreatID != NOBODY && @@ -3901,7 +3899,7 @@ void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) SOLDIERTYPE * pFriend; INT32 sClosestFriendSpot = NOWHERE; INT8 bClosestFriendLevel = 0; - UINT8 ubClosestFriendID = NOBODY; + UINT16 ubClosestFriendID = NOBODY; INT32 sFriendSpot; INT8 bFriendLevel; @@ -3914,7 +3912,7 @@ void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) UINT8 ubDirection; // Run through each friendly. - for (UINT8 iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; iCounter++) + for (UINT16 iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; iCounter++) { pFriend = MercPtrs[iCounter]; @@ -4012,7 +4010,7 @@ void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // check if we can toss grenade at spot, and prepare attack data // grenade should be in hand -void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT8 ubOpponentID) +void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT16 ubOpponentID) { UINT16 usInHand, usGrenade; INT32 iTossRange; diff --git a/TacticalAI/CreatureDecideAction.cpp b/TacticalAI/CreatureDecideAction.cpp index fe0ac6f5..4cdf9380 100644 --- a/TacticalAI/CreatureDecideAction.cpp +++ b/TacticalAI/CreatureDecideAction.cpp @@ -70,7 +70,7 @@ INT8 gbHuntCallPriority[NUM_CREATURE_CALLS] = void CreatureCall( SOLDIERTYPE * pCaller ) { UINT8 ubCallerType=0; - UINT8 ubReceiver; + UINT16 ubReceiver; INT8 bFullPriority; INT8 bPriority; SOLDIERTYPE * pReceiver; diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index 5732115d..2aaa460b 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -47,7 +47,7 @@ extern BOOLEAN gfHiddenInterrupt; extern BOOLEAN gfUseAlternateQueenPosition; extern UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOLEAN fHipStance ); -extern void IncrementWatchedLoc(UINT8 ubID, INT32 sGridNo, INT8 bLevel); +extern void IncrementWatchedLoc(UINT16 ubID, INT32 sGridNo, INT8 bLevel); void LogDecideInfo(SOLDIERTYPE *pSoldier); void LogKnowledgeInfo(SOLDIERTYPE *pSoldier); @@ -759,7 +759,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) { // WANNE: This should fix the bug if any merc are still under PC control. This could happen after boxing in SAN MONA. SOLDIERTYPE *pTeamSoldier; - for (INT8 bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++) + for (UINT16 bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++) { pTeamSoldier=MercPtrs[bLoop]; @@ -938,7 +938,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // Flugente: if we see one of our buddies in handcuffs, its a clear sign of enemy activity! if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM && !gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition ) { - UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); + UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); if ( ubPerson != NOBODY ) { @@ -950,7 +950,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // if we are a doctor with medical gear, we might be able to help a wounded ally if ( pSoldier->CanMedicAI() ) { - UINT8 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); + UINT16 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); // are we ourselves the patient? if ( ubPerson == pSoldier->ubID ) @@ -1004,7 +1004,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // if we are not a medic, but are wounded, seek a medic else if ( pSoldier->iHealableInjury >= gGameExternalOptions.sEnemyMedicsWoundMinAmount ) { - UINT8 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); + UINT16 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); if ( ubPerson != NOBODY ) { @@ -1661,7 +1661,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // Flugente: if we see one of our buddies captured, it is a clear sign of enemy activity! if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM ) { - UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); + UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); if ( ubPerson != NOBODY ) { @@ -1705,7 +1705,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // if we are a doctor with medical gear, we might be able to help a wounded ally if ( pSoldier->CanMedicAI() ) { - UINT8 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); + UINT16 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); // are we ourselves the patient? if ( ubPerson == pSoldier->ubID ) @@ -1759,7 +1759,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // if we are not a medic, but are wounded, seek a medic else if ( pSoldier->iHealableInjury >= gGameExternalOptions.sEnemyMedicsWoundMinAmount ) { - UINT8 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); + UINT16 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); if ( ubPerson != NOBODY ) { @@ -3286,7 +3286,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) // Flugente: if we see one of our buddies captured, it is a clear sign of enemy activity! if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM ) { - UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); + UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); if ( ubPerson != NOBODY ) { @@ -3325,7 +3325,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) // if we are a doctor with medical gear, we might be able to help a wounded ally if ( pSoldier->CanMedicAI() ) { - UINT8 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); + UINT16 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); // are we ourselves the patient? if ( ubPerson == pSoldier->ubID ) @@ -3379,7 +3379,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) // if we are not a medic, but are wounded, seek a medic else if ( pSoldier->iHealableInjury >= gGameExternalOptions.sEnemyMedicsWoundMinAmount ) { - UINT8 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); + UINT16 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); if ( ubPerson != NOBODY ) { @@ -6842,7 +6842,7 @@ L_NEWAIM: { DebugAI(AI_MSG_TOPIC, pSoldier, String("[Make boxer close if possible]")); - UINT8 ubOpponentID; + UINT16 ubOpponentID; sClosestOpponent = ClosestKnownOpponent(pSoldier, NULL, NULL, &ubOpponentID); DebugAI(AI_MSG_INFO, pSoldier, String("boxer: found closest opponent [%d] at %d", ubOpponentID, sClosestOpponent)); diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 5cc98c7c..4ed9142d 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -123,7 +123,7 @@ void AICenterXY( INT32 sGridNo, FLOAT * pdX, FLOAT * pdY ) *pdY = (FLOAT) (sYPos * CELL_Y_SIZE + CELL_Y_SIZE / 2); } -INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) +INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) { // When considering a gridno for cover, we want to take into account cover if we // lie down, so we return the LOWEST chance to get through for that location. @@ -162,7 +162,7 @@ INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sOpp return( bWorstCTGT ); } -INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) +INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) { // When considering a gridno for cover, we want to take into account cover if we // lie down, so we return the LOWEST chance to get through for that location. @@ -196,7 +196,7 @@ INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sO } -INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) +INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) { // NOTE: CTGT stands for "ChanceToGetThrough..." @@ -595,7 +595,8 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT32 sMyGridNo, INT32 iMyThreat, INT32 i UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo ) { - UINT8 ubLoop, ubCount, ubWhoIsThere; + UINT8 ubLoop, ubCount; + UINT16 ubWhoIsThere; INT32 sTempGridNo; ubCount = 0; diff --git a/TacticalAI/Medical.cpp b/TacticalAI/Medical.cpp index 86bf9eb8..4d38e791 100644 --- a/TacticalAI/Medical.cpp +++ b/TacticalAI/Medical.cpp @@ -44,9 +44,9 @@ BOOLEAN FindAutobandageClimbPoint( INT32 sDesiredGridNo, BOOLEAN fClimbUp ) { // checks for existance of location to climb up to building, not occupied by a medic BUILDING * pBuilding; - UINT8 ubNumClimbSpots; + UINT8 ubNumClimbSpots; UINT8 ubLoop; - UINT8 ubWhoIsThere; + UINT16 ubWhoIsThere; pBuilding = FindBuilding( sDesiredGridNo ); if (!pBuilding) @@ -76,8 +76,8 @@ BOOLEAN FindAutobandageClimbPoint( INT32 sDesiredGridNo, BOOLEAN fClimbUp ) BOOLEAN FullPatientCheck( SOLDIERTYPE * pPatient ) { - UINT8 cnt; - SOLDIERTYPE * pSoldier; + UINT16 cnt; + SOLDIERTYPE * pSoldier; if ( CanCharacterAutoBandageTeammate( pPatient ) ) { @@ -123,10 +123,10 @@ BOOLEAN FullPatientCheck( SOLDIERTYPE * pPatient ) BOOLEAN CanAutoBandage( BOOLEAN fDoFullCheck ) { // returns false if we should stop being in auto-bandage mode - UINT8 cnt; - UINT8 ubMedics = 0, ubPatients = 0; + UINT16 cnt; + UINT16 ubMedics = 0, ubPatients = 0; SOLDIERTYPE * pSoldier; - static UINT8 ubIDForFullCheck = NOBODY; + static UINT16 ubIDForFullCheck = NOBODY; // run though the list of chars on team cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -231,18 +231,19 @@ BOOLEAN CanCharacterBeAutoBandagedByTeammate( SOLDIERTYPE *pSoldier ) INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) { - UINT8 cnt, cnt2; - INT32 bBestPriority = 0, sBestAdjGridNo = NOWHERE; - INT32 sPatientGridNo = NOWHERE, sBestPatientGridNo = NOWHERE; - INT16 sShortestPath = 1000, sPathCost, sOtherMedicPathCost; - SOLDIERTYPE * pPatient; - SOLDIERTYPE * pBestPatient = NULL; - SOLDIERTYPE * pOtherMedic; - INT8 bPatientPriority; - UINT8 ubDirection; + UINT16 cnt; + UINT8 cnt2; + INT32 bBestPriority = 0, sBestAdjGridNo = NOWHERE; + INT32 sPatientGridNo = NOWHERE, sBestPatientGridNo = NOWHERE; + INT16 sShortestPath = 1000, sPathCost, sOtherMedicPathCost; + SOLDIERTYPE * pPatient; + SOLDIERTYPE * pBestPatient = NULL; + SOLDIERTYPE * pOtherMedic; + INT8 bPatientPriority; + UINT8 ubDirection; INT32 sAdjustedGridNo, sAdjacentGridNo, sOtherAdjacentGridNo; - INT32 sClimbGridNo, sBestClimbGridNo = NOWHERE, sShortestClimbPath = 1000; - BOOLEAN fClimbingNecessary; + INT32 sClimbGridNo, sBestClimbGridNo = NOWHERE, sShortestClimbPath = 1000; + BOOLEAN fClimbingNecessary; gubGlobalPathFlags = PATH_THROUGH_PEOPLE; @@ -478,7 +479,7 @@ INT8 DecideAutoBandage( SOLDIERTYPE * pSoldier ) BOOLEAN DoctorIsPresent( SOLDIERTYPE * pPatient, BOOLEAN fOnDoctorAssignmentCheck ) { SOLDIERTYPE * pMedic = NULL; - UINT8 cnt; + UINT16 cnt; INT8 bSlot; BOOLEAN fDoctorHasBeenFound = FALSE; diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 3a501194..c7d08178 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -2566,7 +2566,8 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData INT32 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc ) { INT32 sMyGridNo, sDist, sDesiredMercDist = 100; - UINT8 ubNPC, ubMerc, ubDesiredMerc = NOBODY; + UINT8 ubNPC; + UINT16 ubMerc, ubDesiredMerc = NOBODY; UINT8 ubTalkDesire, ubHighestTalkDesire = 0; SOLDIERTYPE * pMerc; SOLDIERTYPE * pDesiredMerc = NULL; @@ -2913,9 +2914,9 @@ BOOLEAN PCDoesFirstAidOnNPC( UINT8 ubNPC ) void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) { // Loop through all mercs, gather closest mercs who can see and trigger one! - UINT8 ubMercsInSector[ 40 ] = { 0 }; - UINT8 ubNumMercs = 0; - UINT8 ubChosenMerc; + UINT16 ubMercsInSector[CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS] = { 0 }; //std::vector would probably be better here + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt; @@ -2933,7 +2934,7 @@ void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { - ubMercsInSector[ ubNumMercs ] = (UINT8)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; ubNumMercs++; } } @@ -2941,7 +2942,7 @@ void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); // Post action to close panel NPCClosePanel( ); @@ -3649,12 +3650,12 @@ BOOLEAN LoadBackupNPCInfoFromSavedGameFile( HWFILE hFile, UINT32 uiSaveGameVersi void TriggerFriendWithHostileQuote( UINT8 ubNPC ) { - UINT8 ubMercsAvailable[ 40 ] = { 0 }; - UINT8 ubNumMercsAvailable = 0, ubChosenMerc; - SOLDIERTYPE * pTeamSoldier; - SOLDIERTYPE * pSoldier; - INT32 cnt; - INT8 bTeam; + UINT16 ubMercsAvailable[CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS] = { 0 }; + UINT16 ubNumMercsAvailable = 0, ubChosenMerc; + SOLDIERTYPE * pTeamSoldier; + SOLDIERTYPE * pSoldier; + INT32 cnt; + INT8 bTeam; // First get pointer to NPC pSoldier = FindSoldierByProfileID( ubNPC, FALSE ); @@ -3697,7 +3698,7 @@ void TriggerFriendWithHostileQuote( UINT8 ubNPC ) if (ubNumMercsAvailable > 0) { PauseAITemporarily(); - ubChosenMerc = (UINT8) Random( ubNumMercsAvailable ); + ubChosenMerc = (UINT16) Random( ubNumMercsAvailable ); TriggerNPCWithIHateYouQuote( ubMercsAvailable[ ubChosenMerc ] ); } else diff --git a/TacticalAI/PanicButtons.cpp b/TacticalAI/PanicButtons.cpp index 970879b9..64471ef4 100644 --- a/TacticalAI/PanicButtons.cpp +++ b/TacticalAI/PanicButtons.cpp @@ -19,7 +19,7 @@ void MakeClosestEnemyChosenOne() UINT32 cnt; INT16 sPathCost, sShortestPath = 1000; INT8 bOldKeys = -1; - UINT8 ubClosestEnemy = NOBODY; + UINT16 ubClosestEnemy = NOBODY; SOLDIERTYPE * pSoldier; INT8 bPanicTrigger; INT32 sPanicTriggerGridNo; diff --git a/TacticalAI/ZombieDecideAction.cpp b/TacticalAI/ZombieDecideAction.cpp index 9ed67fb8..c21c50a7 100644 --- a/TacticalAI/ZombieDecideAction.cpp +++ b/TacticalAI/ZombieDecideAction.cpp @@ -575,7 +575,7 @@ INT8 ZombieDecideActionRed(SOLDIERTYPE *pSoldier) INT8 bInWater, bInDeepWater; INT8 bSeekPts = 0, bHelpPts = 0, bWatchPts = 0; BOOLEAN fClimb; - UINT8 ubThreatID = NOBODY; + UINT16 ubThreatID = NOBODY; INT32 sThreatSpot = NOWHERE; INT8 bThreatLevel = 0; @@ -914,7 +914,7 @@ INT8 ZombieDecideActionBlack(SOLDIERTYPE *pSoldier) INT8 bWeaponIn; BOOLEAN fClimb; INT32 iDummy; - UINT8 ubThreatID = NOBODY; + UINT16 ubThreatID = NOBODY; INT32 sThreatSpot = NOWHERE; INT8 bThreatLevel = 0; diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index c30be8cb..41508367 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -175,7 +175,7 @@ void CheckForChangingOrders(SOLDIERTYPE *pSoldier ); INT8 ClosestPanicTrigger( SOLDIERTYPE * pSoldier ); -INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, UINT8 *pubOpponentID = NULL); +INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, UINT16 * pubOpponentID = NULL); INT32 ClosestPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ); INT32 ClosestUnDisguisedPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ); // Flugente: like ClosestPC(...), but does not account for covert or not visible mercs BOOLEAN CanAutoBandage( BOOLEAN fDoFullCheck ); @@ -220,7 +220,7 @@ BOOLEAN FindRoofClimbingPoints( SOLDIERTYPE * pSoldier, INT16 sDesiredSpot ); INT32 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier); INT32 FindSweetCoverSpot(SOLDIERTYPE *pSoldier); -void FreeUpNPCFromAttacking(UINT8 ubID); +void FreeUpNPCFromAttacking(UINT16 ubID); void FreeUpNPCFromPendingAction( SOLDIERTYPE * pSoldier ); void FreeUpNPCFromTurning(SOLDIERTYPE *pSoldier, INT8 bLook); void FreeUpNPCFromStanceChange(SOLDIERTYPE *pSoldier ); @@ -228,7 +228,7 @@ void FreeUpNPCFromLoweringGun( SOLDIERTYPE *pSoldier ); void FreeUpNPCFromRoofClimb(SOLDIERTYPE *pSoldier ); UINT8 GetClosestOpponent( SOLDIERTYPE *pSoldier ); -UINT8 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ); +UINT16 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ); void HandleSoldierAI( SOLDIERTYPE *pSoldier ); void HandleInitialRedAlert( INT8 bTeam, UINT8 ubCommunicate); @@ -271,19 +271,19 @@ INT32 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT32 sPos, INT8 bAction ); BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ); // HEADROCK HAM 3.6: Adding includes for A* cover calculations -INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); -INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); -INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); +INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); +INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); +INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo ); // Flugente: get the id of the closest soldier (coser than x tiles) of a specific team with a specific flag that we can currently see -UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight = TRUE ); +UINT16 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight = TRUE ); // get the id of the closest soldier (closer than x tiles) of a specific team that is wounded that we can currently see -UINT8 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); +UINT16 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); // get the id of the closest medic (closer than x tiles) of a specific team -UINT8 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); +UINT16 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); // sevenfm: BOOLEAN NightLight(void); @@ -291,15 +291,15 @@ BOOLEAN DuskLight(void); BOOLEAN InSmokeNearby(INT32 sGridNo, INT8 bLevel); INT16 MaxNormalVisionDistance( void ); UINT8 MinFlankDirections( SOLDIERTYPE *pSoldier ); -UINT8 CountFriendsInDirection( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ); +UINT16 CountFriendsInDirection( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ); BOOLEAN GuySawEnemy( SOLDIERTYPE * pSoldier, UINT8 ubMax = SEEN_3_TURNS_AGO ); -UINT8 CountNearbyFriends( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDistance ); +UINT16 CountNearbyFriends( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDistance ); UINT8 CountNearbyFriendsLastAttackHit( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDistance ); UINT8 CountFriendsFlankSameSpot(SOLDIERTYPE *pSoldier, INT32 sSpot = NOWHERE); UINT8 CountFriendsBlack( SOLDIERTYPE *pSoldier, INT32 sClosestOpponent = NOWHERE ); -UINT8 CountTeamUnderAttack(INT8 bTeam, INT32 sGridNo, INT16 sDistance); -UINT8 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 sDistance); -UINT8 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier); +UINT16 CountTeamUnderAttack(INT8 bTeam, INT32 sGridNo, INT16 sDistance); +UINT16 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 sDistance); +UINT16 CountPublicKnownEnemies(SOLDIERTYPE *pSoldier); UINT8 SectorCurfew(BOOLEAN fNight); UINT8 TeamPercentKilled(INT8 bTeam); @@ -308,15 +308,15 @@ UINT8 ArmyPercentKilled(void); UINT8 ArmyPercentKilledTolerance(void); BOOLEAN EnemySeenSoldierRecently( SOLDIERTYPE *pSoldier, UINT8 ubMax = SEEN_3_TURNS_AGO ); -UINT8 CountTeamSeeSoldier( INT8 bTeam, SOLDIERTYPE *pSoldier ); +UINT16 CountTeamSeeSoldier( INT8 bTeam, SOLDIERTYPE *pSoldier ); BOOLEAN AICheckFriendsNoContact( SOLDIERTYPE *pSoldier ); BOOLEAN AICheckIsFlanking( SOLDIERTYPE *pSoldier ); INT8 CalcMoraleNew(SOLDIERTYPE *pSoldier); void PrepareThreatlist(SOLDIERTYPE *pSoldier); -UINT8 ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT8 ubMax = SEEN_CURRENTLY); // first call PrepareThreatlist to make threat list -UINT8 ClosestKnownThreatID(SOLDIERTYPE *pSoldier); // first call PrepareThreatlist to make threat list +UINT16 ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT8 ubMax = SEEN_CURRENTLY); // first call PrepareThreatlist to make threat list +UINT16 ClosestKnownThreatID(SOLDIERTYPE *pSoldier); // first call PrepareThreatlist to make threat list BOOLEAN ProneSightCoverAtSpot(SOLDIERTYPE *pSoldier, INT32 sSpot, BOOLEAN fUnlimited); BOOLEAN SightCoverAtSpot(SOLDIERTYPE *pSoldier, INT32 sSpot, BOOLEAN fUnlimited); @@ -336,7 +336,7 @@ UINT8 TerrainDensity(INT32 sSpot, INT8 bLevel, UINT8 ubDistance, BOOLEAN fGrass) BOOLEAN FindNearbyExplosiveStructure(INT32 sSpot, INT8 bLevel); INT16 DistanceToClosestActiveOpponent(SOLDIERTYPE *pSoldier, INT32 sSpot); BOOLEAN ValidOpponent(SOLDIERTYPE* pSoldier, SOLDIERTYPE* pOpponent); -UINT8 CountSeenEnemiesLastTurn( SOLDIERTYPE *pSoldier ); +UINT16 CountSeenEnemiesLastTurn( SOLDIERTYPE *pSoldier ); BOOLEAN FindObstacleNearSpot(INT32 sSpot, INT8 bLevel); BOOLEAN CheckNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridNo); UINT8 SpotDangerLevel(SOLDIERTYPE *pSoldier, INT32 sGridNo); @@ -387,19 +387,19 @@ BOOLEAN AICheckSpecialRole(SOLDIERTYPE *pSoldier); // Knowledge functions // ************************************************************* -INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID); -INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID); -INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID); +INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); +INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); +INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); -BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID); +BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); -INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID); -INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID); -INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT8 ubOpponentID); +INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); +INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); +INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); -INT8 PublicKnowledge(UINT8 bTeam, UINT8 ubOpponentID); -INT32 KnownPublicLocation(UINT8 bTeam, UINT8 ubOpponentID); -INT8 KnownPublicLevel(UINT8 bTeam, UINT8 ubOpponentID); +INT8 PublicKnowledge(UINT8 bTeam, UINT16 ubOpponentID); +INT32 KnownPublicLocation(UINT8 bTeam, UINT16 ubOpponentID); +INT8 KnownPublicLevel(UINT8 bTeam, UINT16 ubOpponentID); #define MAX_FLANKS_RED 25 #define MAX_FLANKS_YELLOW 25 diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index b4fbfb45..258d73c5 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -69,19 +69,19 @@ BOOLEAN HookerInRoom( UINT16 usRoom ); // MODULE FOR EXPLOSIONS // Spreads the effects of explosions... -BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ); +BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT16 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ); // Flashbang effect on soldier UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOLEAN fInBuilding); // HEADROCK HAM 5.1: Explosion Fragments launcher -void FireFragments( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection = DIRECTION_IRRELEVANT ); +void FireFragments( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection = DIRECTION_IRRELEVANT ); // Flugente: shoot a gun without anyone operating it (used for makeshift traps wih guns) void FireFragmentsTrapGun( SOLDIERTYPE* pThrower, INT32 gridno, INT16 sZ, OBJECTTYPE* pObj, UINT8 ubDirection = NORTH ); extern INT8 gbSAMGraphicList[ MAX_NUMBER_OF_SAMS ]; -extern void AddToShouldBecomeHostileOrSayQuoteList( UINT8 ubID ); +extern void AddToShouldBecomeHostileOrSayQuoteList( UINT16 ubID ); extern void RecompileLocalMovementCostsForWall( INT32 sGridNo, UINT8 ubOrientation ); void FatigueCharacter( SOLDIERTYPE *pSoldier ); @@ -182,11 +182,11 @@ UINT8 gubElementsOnExplosionQueue = 0; BOOLEAN gfExplosionQueueActive = FALSE; BOOLEAN gfExplosionQueueMayHaveChangedSight = FALSE; -UINT8 gubPersonToSetOffExplosions = NOBODY; +UINT16 gubPersonToSetOffExplosions = NOBODY; INT32 gsTempActionGridNo = NOWHERE; -extern UINT8 gubInterruptProvoker; +extern UINT16 gubInterruptProvoker; #define NUM_EXPLOSION_SLOTS 100 @@ -198,7 +198,7 @@ UINT32 guiNumExplosions = 0; INT32 GetFreeExplosion( void ); void RecountExplosions( void ); void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ); -void HandleBuldingDestruction( INT32 sGridNo, UINT8 ubOwner ); +void HandleBuldingDestruction( INT32 sGridNo, UINT16 ubOwner ); #ifdef JA2UB //JA25 UB @@ -251,7 +251,7 @@ void RecountExplosions( void ) extern void HandleLoyaltyForDemolitionOfBuilding( SOLDIERTYPE *pSoldier, INT16 sPointsDmg ); // GENERATE EXPLOSION -void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) +void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) { #ifdef JA2BETAVERSION if (is_networked) { @@ -392,7 +392,7 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 } -void IgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) +void IgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) { InternalIgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, usItem, TRUE, bLevel, ubDirection, pObj ); } @@ -654,8 +654,9 @@ void HandleFencePartnerCheck( INT32 sStructGridNo ) -INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, - BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel, +INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT32 sGridNo, INT16 sWoundAmt, + UINT32 uiDist, + BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT16 ubOwner, INT8 bLevel, UINT8 ubReason ) { #ifdef JA2BETAVERSION @@ -1335,8 +1336,10 @@ INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextC STRUCTURE *gStruct; -void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, - BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel, +void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, + BOOLEAN *pfRecompileMovementCosts, + BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT16 ubOwner, + INT8 bLevel, UINT8 ubReason ) { #ifdef JA2BETAVERSION @@ -1519,7 +1522,7 @@ void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLE } -BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent , BOOL fFromRemoteClient ) +BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent, BOOL fFromRemoteClient ) { // OJW - 20091028 if (is_networked && is_client) @@ -1889,12 +1892,12 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo if (IsOurSoldier(pSoldier) || (pSoldier->bTeam == 1 && is_server) && !fFromRemoteClient) { // if it gets here then we can let the other clients know our merc took damage - send_explosivedamage( ubPerson , ubOwner , sBombGridNo , sNewWoundAmt , sBreathAmt , uiDist , usItem , sSubsequent ); + send_explosivedamage( ubPerson, ubOwner, sBombGridNo, sNewWoundAmt, sBreathAmt, uiDist, usItem, sSubsequent ); } } // OJW - 20091028 - If from a remote client, use unadjusted damage amount - pSoldier->EVENT_SoldierGotHit( usItem, (fFromRemoteClient ? sWoundAmt : sNewWoundAmt) , sBreathAmt, ubDirection, (INT16)uiDist, ubOwner, ubSpecial, ANIM_CROUCH, sSubsequent, sBombGridNo ); + pSoldier->EVENT_SoldierGotHit( usItem, (fFromRemoteClient ? sWoundAmt : sNewWoundAmt), sBreathAmt, ubDirection, (INT16)uiDist, ubOwner, ubSpecial, ANIM_CROUCH, sSubsequent, sBombGridNo ); pSoldier->ubMiscSoldierFlags |= SOLDIER_MISC_HURT_BY_EXPLOSION; @@ -1906,7 +1909,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo return( TRUE ); } -BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner , BOOL fFromRemoteClient ) +BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner, BOOL fFromRemoteClient ) { // OJW - 20091028 if (is_networked && is_client) @@ -2154,7 +2157,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN // and align them with our random number generator if (IsOurSoldier(pSoldier) || (pSoldier->bTeam == 1 && is_server) && !fFromRemoteClient) { - send_gasdamage( pSoldier , pExplosive->uiIndex , sSubsequent , fRecompileMovementCosts , sWoundAmt , sBreathAmt , ubOwner ); + send_gasdamage( pSoldier, pExplosive->uiIndex, sSubsequent, fRecompileMovementCosts, sWoundAmt, sBreathAmt, ubOwner ); } } @@ -2171,7 +2174,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN return( fRecompileMovementCosts ); } -BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT8 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ) +BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT16 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ) { #ifdef JA2BETAVERSION if (is_networked) { @@ -2182,7 +2185,7 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte #endif INT16 sWoundAmt = 0,sBreathAmt = 0, /* sNewWoundAmt = 0, sNewBreathAmt = 0, */ sStructDmgAmt; - UINT8 ubPerson; + UINT16 ubPerson; SOLDIERTYPE *pSoldier; EXPLOSIVETYPE *pExplosive; INT16 sX, sY; @@ -2307,7 +2310,7 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte // ATE: Make sure guys get pissed at us! - HandleBuldingDestruction( sGridNo ,ubOwner ); + HandleBuldingDestruction( sGridNo,ubOwner ); if ( fBlastEffect ) @@ -2374,7 +2377,7 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte } } - ExplosiveDamageGridNo( sGridNo, sStructDmgAmt, uiDist, &fRecompileMovementCosts, FALSE, -1, 0 , ubOwner, bLevel, STRUCTURE_DAMAGE_EXPLOSION ); + ExplosiveDamageGridNo( sGridNo, sStructDmgAmt, uiDist, &fRecompileMovementCosts, FALSE, -1, 0, ubOwner, bLevel, STRUCTURE_DAMAGE_EXPLOSION ); // ATE: Look for damage to walls ONLY for next two gridnos sNewGridNo = NewGridNo( sGridNo, DirectionInc( NORTH ) ); @@ -2926,7 +2929,7 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE -void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID , BOOL fFromRemoteClient , BOOL fNewSmokeEffect ) +void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID, BOOL fFromRemoteClient, BOOL fNewSmokeEffect ) { if (is_networked && is_client) { @@ -3291,7 +3294,7 @@ void BillyBlocksDoorCallback( void ) BOOLEAN HookerInRoom( UINT16 usRoom ) { //DBrot: More Rooms - UINT8 ubLoop;//, ubTempRoom; + UINT16 ubLoop;//, ubTempRoom; UINT16 usTempRoom; SOLDIERTYPE * pSoldier; @@ -3804,7 +3807,7 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemo WORLDITEM wi = gWorldItems[iWorldIndex]; if (wi.fExists) { - INT8 soldierID = wi.soldierID; // bomb's owner + INT16 soldierID = wi.soldierID; // bomb's owner if (soldierID == -1) soldierID = wi.object[0]->data.misc.ubBombOwner - 2; // undo the hack @@ -3835,7 +3838,7 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemo } // Flugente: activate everything connected to a tripwire in the surrounding if sGridNo on level bLevel with regard to the tripwire netwrok and hierarchy determined by ubFlag -BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ) +BOOLEAN ActivateSurroundingTripwire( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ) { UINT32 uiTimeStamp= GetJA2Clock(); BOOLEAN fFoundMine = FALSE; @@ -3970,7 +3973,7 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN } // Flugente: A special function for tripwire gun traps. Search if pObj has a gun attached. If so, fire a shot from that gun in a specific direction. Afterwards place the gun on the ground -void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT8 ubId, UINT8 ubDirection ) +void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT16 ubId, UINT8 ubDirection ) { if ( !pObj ) return; @@ -4063,7 +4066,7 @@ void HandleExplosionQueue( void ) if ( sSoundID > NO_ALT_SOUND ) PlayJA2Sample( sSoundID, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); - UINT8 ubID = WhoIsThere2( sGridNo, ubLevel ); + UINT16 ubID = WhoIsThere2( sGridNo, ubLevel ); if ( ubID != NOBODY ) { @@ -4294,7 +4297,7 @@ void HandleExplosionQueue( void ) if (gfExplosionQueueMayHaveChangedSight) { - UINT8 ubLoop; + UINT16 ubLoop; SOLDIERTYPE * pTeamSoldier; // set variable so we may at least have someone to resolve interrupts vs @@ -4669,7 +4672,7 @@ void DecayBombTimers( void ) } } -void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency ) +void SetOffBombsByFrequency( UINT16 ubID, INT8 bFrequency ) { UINT32 uiWorldBombIndex; UINT32 uiTimeStamp; @@ -4749,7 +4752,7 @@ void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency ) // OJW - 20091029 - disarm explosives if (is_networked && is_client) - send_disarm_explosive( sGridNo , gWorldBombs[uiWorldBombIndex].iItemIndex, ubID ); + send_disarm_explosive( sGridNo, gWorldBombs[uiWorldBombIndex].iItemIndex, ubID ); // set back ubWireNetworkFlag and bDefuseFrequency, but not the direction... bomb is still aimed, it is just turned off (*pObj)[0]->data.ubWireNetworkFlag = 0; @@ -4857,7 +4860,7 @@ void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency ) } } -void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger ) +void SetOffPanicBombs( UINT16 ubID, INT8 bPanicTrigger ) { // need to turn off gridnos & flags in gTacticalStatus gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ] = NOWHERE; @@ -4895,7 +4898,7 @@ void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger ) } } -BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ) +BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ) { UINT32 uiWorldBombIndex; UINT32 uiTimeStamp; @@ -5006,7 +5009,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 return( fFoundMine ); } -void ActivateSwitchInGridNo( UINT8 ubID, INT32 sGridNo ) +void ActivateSwitchInGridNo( UINT16 ubID, INT32 sGridNo ) { UINT32 uiWorldBombIndex; OBJECTTYPE * pObj; @@ -5307,10 +5310,10 @@ void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) // loop through civ team and find // anybody who is an NPC and // see if they get angry -void HandleBuldingDestruction( INT32 sGridNo, UINT8 ubOwner ) +void HandleBuldingDestruction( INT32 sGridNo, UINT16 ubOwner ) { SOLDIERTYPE * pSoldier; - UINT8 cnt; + UINT16 cnt; if ( ubOwner == NOBODY ) { @@ -5432,7 +5435,7 @@ UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOL // HEADROCK HAM 5.1: This handles launching fragments out of an explosion. The number of fragments is read from // the Explosives.XML file, and they each have a set amount of damage and range as well. They are currently // fired at completely random trajectories. -void FireFragments( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection ) +void FireFragments( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection ) { // WANNE: Disable Fragments in a multiplayer game, because this can lead to crashes when stepping on mines, ... if (is_networked) @@ -5951,7 +5954,7 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN NewLightEffect( sGridNo, (UINT8)Explosive[ Item[iter->usItem].ubClassIndex ].ubDuration, (UINT8)Explosive[iter->usItem].ubStartRadius ); } else { - IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, Item[iter->usItem].uiIndex, bLevel, direction , NULL ); + IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, Item[iter->usItem].uiIndex, bLevel, direction, NULL ); } fAttFound = TRUE; } @@ -5960,17 +5963,17 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN { if(Item[iter->usItem].gascan) { - IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, GAS_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); + IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, GAS_EXPLOSION, bLevel, DIRECTION_IRRELEVANT, NULL ); fAttFound = TRUE; } if ( Item[iter->usItem].alcohol > 0.0f ) { - IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, MOLOTOV_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); + IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, MOLOTOV_EXPLOSION, bLevel, DIRECTION_IRRELEVANT, NULL ); fAttFound = TRUE; } if(Item[iter->usItem].marbles) { - IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, FRAG_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); + IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, FRAG_EXPLOSION, bLevel, DIRECTION_IRRELEVANT, NULL ); fAttFound = TRUE; } } diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index acea7f41..b668dd86 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -15,7 +15,7 @@ typedef struct { UINT32 uiFlags; - UINT8 ubOwner; + UINT16 ubOwner; INT8 ubTypeID; UINT16 usItem; @@ -100,8 +100,8 @@ extern EXPLOSIONTYPE gExplosionData[ NUM_EXPLOSION_SLOTS ]; extern UINT8 gubElementsOnExplosionQueue; extern BOOLEAN gfExplosionQueueActive; -void IgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); -void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); +void IgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); +void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ); @@ -110,10 +110,10 @@ void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ); void HandleExplosionWarningAnimations( ); void DecayBombTimers( void ); -void SetOffBombsByFrequency( UINT8 ubID, INT8 bFrequency ); -BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ); -void ActivateSwitchInGridNo( UINT8 ubID, INT32 sGridNo ); -void SetOffPanicBombs( UINT8 ubID, INT8 bPanicTrigger ); +void SetOffBombsByFrequency( UINT16 ubID, INT8 bFrequency ); +BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ); +void ActivateSwitchInGridNo( UINT16 ubID, INT32 sGridNo ); +void SetOffPanicBombs( UINT16 ubID, INT8 bPanicTrigger ); void UpdateExplosionFrame( INT32 iIndex, INT16 sCurrentFrame ); void RemoveExplosionData( INT32 iIndex ); @@ -136,16 +136,16 @@ void RemoveActiveExplosionMarkers(); #define GASMASK_MIN_STATUS 70 // OJW - 20091028 - Explosion damage sync -BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent , BOOL fFromRemoteClient = FALSE ); -BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner , BOOL fFromRemoteClient = FALSE ); -void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectNum , BOOL fFromRemoteClient = FALSE , BOOL fNewSmokeEffect = FALSE ); +BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent, BOOL fFromRemoteClient = FALSE ); +BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner, BOOL fFromRemoteClient = FALSE ); +void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectNum, BOOL fFromRemoteClient = FALSE, BOOL fNewSmokeEffect = FALSE ); void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemoteClient = FALSE ); // Flugente: activate everything connected to a tripwire in the surrounding if sGridNo on level bLevel with regard to the tripwire netwrok and hierarchy determined by ubFlag -BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ); +BOOLEAN ActivateSurroundingTripwire( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ); // Flugente: A special function for tripwire gun traps. Search if pObj has a gun attached. If so, fire a shot from that gun in a specific direction. Afterwards place the gun on the ground -void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT8 ubId, UINT8 ubDirection ); +void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT16 ubId, UINT8 ubDirection ); extern void ToggleActionItemsByFrequency( INT8 bFrequency ); extern void PerformItemAction( INT32 sGridNo, OBJECTTYPE * pObj ); @@ -168,8 +168,10 @@ extern void HandleSeeingPowerGenFan( UINT32 sGridNo ); extern void HandleSeeingFortifiedDoor( UINT32 sGridNo );//Ja25 UB #endif -void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, - BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT8 ubOwner, INT8 bLevel, +void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, + BOOLEAN *pfRecompileMovementCosts, + BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT16 ubOwner, + INT8 bLevel, UINT8 ubReason ); // Flugente: handle secondary explosive effects diff --git a/TileEngine/LightEffects.cpp b/TileEngine/LightEffects.cpp index 91a0669a..d11e7fe7 100644 --- a/TileEngine/LightEffects.cpp +++ b/TileEngine/LightEffects.cpp @@ -538,7 +538,7 @@ void ResetLightEffects() } // Flugente: create and destroy light sources tied to a person -void CreatePersonalLight( INT32 sGridNo, UINT8 ubID ) +void CreatePersonalLight( INT32 sGridNo, UINT16 ubID ) { INT32 iLightIndex = NewLightEffectInternal( sGridNo, 0, 1 ); @@ -549,7 +549,7 @@ void CreatePersonalLight( INT32 sGridNo, UINT8 ubID ) } } -void RemovePersonalLights( UINT8 ubID ) +void RemovePersonalLights( UINT16 ubID ) { LIGHTEFFECT *pLight; diff --git a/TileEngine/LightEffects.h b/TileEngine/LightEffects.h index 783f6695..869d2e82 100644 --- a/TileEngine/LightEffects.h +++ b/TileEngine/LightEffects.h @@ -25,7 +25,7 @@ typedef struct // Flugente: added variables necessary for dynamic (flash-)lighting INT32 flags; - UINT8 ubOwner; + UINT16 ubOwner; } LIGHTEFFECT; @@ -55,7 +55,7 @@ void ResetLightEffects(); BOOLEAN IsLightEffectAtTile( INT32 sGridNo ); // Flugente: create and destroy light sources tied to a person -void CreatePersonalLight( INT32 sGridNo, UINT8 ubID ); -void RemovePersonalLights( UINT8 ubID ); +void CreatePersonalLight( INT32 sGridNo, UINT16 ubID ); +void RemovePersonalLights( UINT16 ubID ); #endif \ No newline at end of file diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 798d8488..78213ddc 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -196,7 +196,7 @@ UINT16 FromSmokeTypeToWorldFlags( INT8 bType ) -INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, BOOL fFromRemoteClient ) +INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, BOOL fFromRemoteClient ) { SMOKEEFFECT *pSmoke; INT32 iSmokeIndex; @@ -331,12 +331,12 @@ INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, } // ATE: FALSE into subsequent-- it's the first one! - SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, FALSE, bLevel, iSmokeIndex , fFromRemoteClient , TRUE ); + SpreadEffect( pSmoke->sGridNo, pSmoke->ubRadius, pSmoke->usItem, pSmoke->ubOwner, FALSE, bLevel, iSmokeIndex, fFromRemoteClient, TRUE ); return( iSmokeIndex ); } -INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, BOOLEAN fFromRemoteClient, UINT8 ubDuration, UINT8 ubRadius, UINT8 ubGeneration) +INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, BOOLEAN fFromRemoteClient, UINT8 ubDuration, UINT8 ubRadius, UINT8 ubGeneration) { SMOKEEFFECT *pSmoke; INT32 iSmokeIndex; diff --git a/TileEngine/SmokeEffects.h b/TileEngine/SmokeEffects.h index 996a40d6..590f1d8a 100644 --- a/TileEngine/SmokeEffects.h +++ b/TileEngine/SmokeEffects.h @@ -33,7 +33,7 @@ typedef struct TAG_SMOKE_EFFECT BOOLEAN fAllocated; INT8 bType; UINT16 usItem; - UINT8 ubOwner; + UINT16 ubOwner; UINT8 ubGeneration; UINT32 uiTimeOfLastUpdate; INT8 iMPTeamIndex; @@ -57,7 +57,7 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT32 sGridNo, INT8 void RemoveSmokeEffectFromTile( INT32 sGridNo, INT8 bLevel ); -INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, BOOLEAN fFromRemoteClient = 0, UINT8 ubDuration = 0, UINT8 ubRadius = 0, UINT8 ubGeneration = 0); +INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, BOOLEAN fFromRemoteClient = 0, UINT8 ubDuration = 0, UINT8 ubRadius = 0, UINT8 ubGeneration = 0); BOOLEAN SaveSmokeEffectsToSaveGameFile( HWFILE hFile ); BOOLEAN LoadSmokeEffectsFromLoadGameFile( HWFILE hFile ); diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index ddad42f9..134f0d65 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -751,7 +751,7 @@ void GoIntoOverheadMap( ) // Make sure we are in team panel mode... gfSwitchPanel = TRUE; gbNewPanel = TEAM_PANEL; - gubNewPanelParam = (UINT8)gusSelectedSoldier; + gubNewPanelParam = gusSelectedSoldier; fInterfacePanelDirty = DIRTYLEVEL2; // Disable tactical buttons...... @@ -772,7 +772,7 @@ void HandleOverheadUI(void) { INT32 sMousePos = 0; InputAtom InputEvent; - UINT8 ubID; + UINT16 ubID; // CHECK FOR MOUSE OVER REGIONS... if(GetOverheadMouseGridNo(&sMousePos)) diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index b3a15711..d9b8dfff 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -218,7 +218,7 @@ void RecountObjectSlots(void) } -INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ) +INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ) { INT32 iObjectIndex; FLOAT mass; diff --git a/TileEngine/physics.h b/TileEngine/physics.h index e27d8aad..81effb21 100644 --- a/TileEngine/physics.h +++ b/TileEngine/physics.h @@ -118,7 +118,7 @@ public: FLOAT dLifeSpan; BOOLEAN fFirstTimeMoved; INT32 sFirstGridNo; - UINT8 ubOwner; + UINT16 ubOwner; UINT8 ubActionCode; UINT32 uiActionData; BOOLEAN fDropItem; @@ -153,7 +153,7 @@ extern REAL_OBJECT ObjectSlots[ NUM_OBJECT_SLOTS ]; // OBJECT LIST STUFF -INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ); +INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ); BOOLEAN RemoveObjectSlot( INT32 iObject ); void RemoveAllPhysicsObjects( ); // OJW - 20091002 - mp explosives diff --git a/TileEngine/pits.cpp b/TileEngine/pits.cpp index 2194a51d..fc875bb9 100644 --- a/TileEngine/pits.cpp +++ b/TileEngine/pits.cpp @@ -211,7 +211,7 @@ void RemoveAllPits() void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT32 sGridNo, INT16 sRadius ) { INT32 x, y, sNewGridNo; - UINT8 ubID; + UINT16 ubID; SOLDIERTYPE *pSoldier; @@ -241,7 +241,7 @@ void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT32 sGridNo, INT16 s } } -void HandleFallIntoPitFromAnimation( UINT8 ubID ) +void HandleFallIntoPitFromAnimation( UINT16 ubID ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; EXITGRID ExitGrid; diff --git a/TileEngine/pits.h b/TileEngine/pits.h index 0ffb99c1..5050fe6f 100644 --- a/TileEngine/pits.h +++ b/TileEngine/pits.h @@ -14,7 +14,7 @@ void RemoveAllPits(); extern BOOLEAN gfShowPits; extern BOOLEAN gfLoadPitsWithoutArming; -void HandleFallIntoPitFromAnimation( UINT8 ubID ); +void HandleFallIntoPitFromAnimation( UINT16 ubID ); #endif \ No newline at end of file diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 1b2fb135..3af1798c 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1788,7 +1788,7 @@ BOOLEAN StructureDensity( STRUCTURE * pStructure, UINT8 * pubLevel0, UINT8 * pub return( TRUE ); } -INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner, INT32 sAntiMaterialImpact ) +INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT16 ubOwner, INT32 sAntiMaterialImpact ) { // do damage to a structure; returns TRUE if the structure should be removed STRUCTURE *pBase; diff --git a/TileEngine/structure.h b/TileEngine/structure.h index d9fd6793..2870deac 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -91,7 +91,7 @@ STRUCTURE* GetTallestStructureOnGridnoDrag( INT32 sGridNo, INT8 bLevel ); // FUNCTIONS FOR DETERMINING STUFF THAT BLOCKS VIEW FOR TILE_bASED LOS INT8 GetBlockingStructureInfo( INT32 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock ); -INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT8 ubOwner, INT32 sAntiMaterialImpact = 0 ); +INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT16 ubOwner, INT32 sAntiMaterialImpact = 0 ); // Material armour type enumeration enum diff --git a/TileEngine/worlddef.h b/TileEngine/worlddef.h index 0d60208e..acac1b00 100644 --- a/TileEngine/worlddef.h +++ b/TileEngine/worlddef.h @@ -36,7 +36,7 @@ class OBJECTTYPE; class SOLDIERTYPE; // SB: new map version, with map dimensions added -#define MAJOR_MAP_VERSION 7.0 +#define MAJOR_MAP_VERSION 8.0 // 7.0 -> 8.0 Due to increased teamsizes. //Current minor map version updater. #define MINOR_MAP_OVERHEATING 28 // 27 -> 28: Flugente:: increased to 28 because of included weapon overheated and tripwire feature. See ObjectClass for the new Tags! //#define MINOR_MAP_VERSION 29 // 28 -> 29: increased range of roomnumbers to full UINT16 by DBrot @@ -273,7 +273,7 @@ typedef struct UINT8 ubAdjacentSoldierCnt; UINT8 ubTerrainID; - UINT8 ubReservedSoldierID; + UINT16 ubReservedSoldierID; UINT8 ubBloodInfo; UINT8 ubSmellInfo; } MAP_ELEMENT; diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index 68880690..0526775f 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -3758,7 +3758,7 @@ BOOLEAN IsRoofVisible2( INT32 sMapPos ) } -UINT8 WhoIsThere2( INT32 sGridNo, INT8 bLevel ) +UINT16 WhoIsThere2( INT32 sGridNo, INT8 bLevel ) { STRUCTURE * pStructure; @@ -3782,7 +3782,7 @@ UINT8 WhoIsThere2( INT32 sGridNo, INT8 bLevel ) { // found a person, on the right level! // structure ID and merc ID are identical for merc structures - return( (UINT8) pStructure->usStructureID ); + return( pStructure->usStructureID ); } } pStructure = pStructure->pNext; @@ -3790,7 +3790,7 @@ UINT8 WhoIsThere2( INT32 sGridNo, INT8 bLevel ) } - return( (UINT8)NOBODY ); + return( NOBODY ); } UINT8 GetTerrainType( INT32 sGridNo ) @@ -4167,7 +4167,7 @@ void UpdateTreeVisibility() // find visible soldier near spot if (!TileIsOutOfBounds(sSpot) && !fHideTree) { - for (UINT8 uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) + for (UINT16 uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pOpponent = MercSlots[uiLoop]; diff --git a/TileEngine/worldman.h b/TileEngine/worldman.h index 7e504d12..eed5ca67 100644 --- a/TileEngine/worldman.h +++ b/TileEngine/worldman.h @@ -128,7 +128,7 @@ BOOLEAN RemoveShadowFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode ); BOOLEAN AddMercToHead( INT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fAddStructInfo ); BOOLEAN RemoveMerc( INT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolder ); -UINT8 WhoIsThere2( INT32 sGridNo, INT8 bLevel ); +UINT16 WhoIsThere2( INT32 sGridNo, INT8 bLevel ); BOOLEAN AddMercStructureInfo( INT32 sGridNo, SOLDIERTYPE *pSoldier ); BOOLEAN AddMercStructureInfoFromAnimSurface( INT32 sGridNo, SOLDIERTYPE *pSoldier, UINT16 usAnimSurface, UINT16 usAnimState ); BOOLEAN UpdateMercStructureInfo( SOLDIERTYPE *pSoldier ); diff --git a/Utils/Event Pump.h b/Utils/Event Pump.h index 536d0ab5..066f648e 100644 --- a/Utils/Event Pump.h +++ b/Utils/Event Pump.h @@ -163,7 +163,7 @@ typedef struct INT16 sYPos; INT16 sZPos; INT16 sRange; - UINT8 ubAttackerID; + UINT16 ubAttackerID; BOOLEAN fHit; UINT8 ubSpecial; UINT8 ubLocation; @@ -179,7 +179,7 @@ typedef struct INT16 sZPos; UINT16 usWeaponIndex; INT16 bWeaponStatus; - UINT8 ubAttackerID; + UINT16 ubAttackerID; UINT16 usStructureID; INT32 iImpact; INT32 iBullet; @@ -193,19 +193,19 @@ typedef struct UINT16 usStructureID; BOOLEAN fBlowWindowSouth; BOOLEAN fLargeForce; - UINT8 ubAttackerID; + UINT16 ubAttackerID; INT32 iBullet; } EV_S_WINDOWHIT; typedef struct { - UINT8 ubAttackerID; + UINT16 ubAttackerID; INT32 iBullet; } EV_S_MISS; typedef struct { - UINT8 ubNoiseMaker; + UINT16 ubNoiseMaker; INT32 sGridNo; UINT8 bLevel; UINT8 ubTerrType; @@ -231,7 +231,7 @@ typedef struct typedef struct { - UINT8 usSoldierID; + UINT16 usSoldierID; // UINT32 uiUniqueId; UINT16 usPathDataSize; // Size of Path INT32 sAtGridNo; // Owner merc is at this tile when sending packet @@ -249,7 +249,7 @@ typedef struct typedef struct { - UINT8 usSoldierID; + UINT16 usSoldierID; //UINT32 uiUniqueId; INT32 sAtGridNo; // Owner merc is at this tile when sending packet INT8 bActionPoints; // current A.P. value diff --git a/Utils/PopUpBox.cpp b/Utils/PopUpBox.cpp index 26480dd1..f0bfc3c8 100644 --- a/Utils/PopUpBox.cpp +++ b/Utils/PopUpBox.cpp @@ -395,7 +395,7 @@ void AddMonoString(UINT32 *hStringHandle, STR16 pString) } -// adds a SECOND column string to the CURRENT popup box +// Adds string to the current popup box 2nd column. !!! String's position is the LAST used position in the 1st column !!! void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ) { STR16 pLocalString=NULL; @@ -441,6 +441,52 @@ void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ) return; } +// Adds a string to the first available slot in the second column +void AddMonoStringToSecondColumn(UINT32* hStringHandle, STR16 pString) +{ + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; + + + if ((guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT)) + return; + + Assert(PopUpBoxList[guiCurrentBox] != NULL); + + // find the free text string index in 2nd column + for (iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter] != NULL); iCounter++); + + if (iCounter >= MAX_POPUP_BOX_STRING_COUNT) + { + // using too many text lines, or not freeing them up properly + Assert(0); + return; + } + + pStringSt = (POPUPSTRING*)(MemAlloc(sizeof(POPUPSTRING))); + if (pStringSt == NULL) + return; + + pLocalString = (STR16)MemAlloc((wcslen(pString) + 1) * sizeof(CHAR16)); + if (pLocalString == NULL) + return; + + wcscpy(pLocalString, pString); + + RemoveCurrentBoxSecondaryText(iCounter); + + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter] = pStringSt; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fColorFlag = FALSE; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->pString = pLocalString; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; + + *hStringHandle = iCounter; + + return; +} + // Adds a COLORED first column string to the CURRENT box void AddColorString(INT32 *hStringHandle, STR16 pString) @@ -543,6 +589,27 @@ UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ) } +UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle) +{ + INT32 iCounter = 0; + + if ((hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT)) + return(0); + + // count number of lines + // check string size + for (iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++) + { + if (PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] == NULL) + { + break; + } + } + + return(iCounter); +} + + void SetBoxFont(INT32 hBoxHandle, UINT32 uiFont) { @@ -585,6 +652,15 @@ void SetBoxSecondColumnCurrentOffset( INT32 hBoxHandle, UINT32 uiCurrentOffset ) return; } +void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x) +{ + if ((hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT)) + return; + + PopUpBoxList[hBoxHandle]->usSecondColumnOffsetAdjustment = x; + return; +} + void SetBoxSecondColumnFont(INT32 hBoxHandle, UINT32 uiFont) { UINT32 iCounter=0; @@ -1284,7 +1360,7 @@ BOOLEAN DrawBox(UINT32 uiCounter) usTopX=(UINT16)PopUpBoxList[uiCounter]->Position.iX; usTopY=(UINT16)PopUpBoxList[uiCounter]->Position.iY; - usWidth=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->Dimensions.iLeft)); + usWidth=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->Dimensions.iLeft + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); usHeight=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->Dimensions.iTop)); //CHRISL: Adjust position for screen limits @@ -1306,7 +1382,7 @@ BOOLEAN DrawBox(UINT32 uiCounter) } // make sure it will fit on screen! - Assert( usTopX + usWidth <= SCREEN_WIDTH ); + Assert( usTopX + usWidth <= SCREEN_WIDTH ); Assert( usTopY + usHeight <= SCREEN_HEIGHT ); // subtract 4 because the 2 2-pixel corners are handled separately @@ -1392,100 +1468,94 @@ BOOLEAN DrawBoxText(UINT32 uiCounter) // there is text in this line? if(PopUpBoxList[uiCounter]->Text[uiCount]) { - // set font - SetFont(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont); + SetFont(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont); // are we highlighting?...shading?..or neither if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fShadeFlag == FALSE) &&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == FALSE ) ) { // neither - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubForegroundColor); + SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubForegroundColor); } - else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == TRUE ) ) + else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == TRUE ) ) { - // highlight - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubHighLight); + SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubHighLight); } else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == TRUE ) ) { SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubSecondaryShade); } - else + else { //shading SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubShade); } // set background - SetFontBackground(PopUpBoxList[uiCounter]->Text[uiCount]->ubBackgroundColor); + SetFontBackground(PopUpBoxList[uiCounter]->Text[uiCount]->ubBackgroundColor); // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->Text[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->Text[uiCount]->pString)+1); + wcsncpy(sString, PopUpBoxList[uiCounter]->Text[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->Text[uiCount]->pString)+1); - // cnetering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) + // centering? + if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->Text[uiCount]->uiFont) ,&uX, &uY); + FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->Text[uiCount]->uiFont) ,&uX, &uY); } - else + else { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); + uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)); + uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); } // print - //gprintfdirty(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString ); - mprintf(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString); + mprintf(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString); } // there is secondary text in this line? if(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]) { - // set font - SetFont(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont); + SetFont(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont); // are we highlighting?...shading?..or neither if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fShadeFlag == FALSE) ) { // neither - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubForegroundColor); + SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubForegroundColor); } - else if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == TRUE ) ) + else if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == TRUE ) ) { - // highlight - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubHighLight); + SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubHighLight); } - else + else { //shading SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubShade); } // set background - SetFontBackground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubBackgroundColor); + SetFontBackground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubBackgroundColor); // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString)+1); + wcsncpy(sString, PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString)+1); - // cnetering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) + // centering? + if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont) ,&uX, &uY); + FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont) ,&uX, &uY); } - else + else { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin + PopUpBoxList[uiCounter]->uiSecondColumnCurrentOffset ) ); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); + uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin + PopUpBoxList[uiCounter]->uiSecondColumnCurrentOffset + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); + uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); } // print - //gprintfdirty(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString ); - mprintf(uX,uY,PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString); + mprintf(uX,uY,PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString); } } @@ -1550,6 +1620,13 @@ void ResizeBoxToText(INT32 hBoxHandle) // Flugente we shouldn't have added more popup options than we can display anyway, but I have no idea where to stop that, so at least we can fix this PopUpBoxList[hBoxHandle]->Dimensions.iBottom = min( iHeight, SCREEN_HEIGHT - PopUpBoxList[hBoxHandle]->Position.iY); PopUpBoxList[hBoxHandle]->Dimensions.iRight = min( iWidth, SCREEN_WIDTH - PopUpBoxList[hBoxHandle]->Position.iX ); + + // Constrain popup box height to background graphics max height. Otherwise we get blue graphics glitches + const auto popupBoxHeight = PopUpBoxList[hBoxHandle]->Dimensions.iBottom - PopUpBoxList[hBoxHandle]->Dimensions.iTop; + if (popupBoxHeight > 480) + { + PopUpBoxList[hBoxHandle]->Dimensions.iBottom = PopUpBoxList[hBoxHandle]->Dimensions.iTop + 480; + } } diff --git a/Utils/PopUpBox.h b/Utils/PopUpBox.h index 033e6227..4f3b6dd7 100644 --- a/Utils/PopUpBox.h +++ b/Utils/PopUpBox.h @@ -46,6 +46,7 @@ struct popupbox{ UINT32 uiBuffer; UINT32 uiSecondColumnMinimunOffset; UINT32 uiSecondColumnCurrentOffset; + INT16 usSecondColumnOffsetAdjustment; UINT32 uiBoxMinWidth; BOOLEAN fUpdated; BOOLEAN fShowBox; @@ -74,6 +75,7 @@ void SetBoxBuffer(INT32 hBoxHandle, UINT32 uiBuffer); void SetBoxPosition(INT32 hBoxHandle,SGPPoint Position); void GetBoxPosition( INT32 hBoxHandle, SGPPoint *Position ); UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ); +UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle); void SetBoxSize( INT32 hBoxHandle, SGPRect Dimensions ); void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ); void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags); @@ -136,6 +138,7 @@ void HideAllBoxes( void ); // add the second column monocrome string void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ); +void AddMonoStringToSecondColumn(UINT32* hStringHandle, STR16 pString); // set the 2nd column font for this box void SetBoxSecondColumnFont(INT32 hBoxHandle, UINT32 uiFont); @@ -156,6 +159,8 @@ void SetBoxSecondColumnForeground(INT32 hBoxHandle, UINT8 ubColor); void SetBoxSecondColumnBackground(INT32 hBoxHandle, UINT8 ubColor); void SetBoxSecondColumnHighLight(INT32 hBoxHandle, UINT8 ubColor); void SetBoxSecondColumnShade(INT32 hBoxHandle, UINT8 ubColor); +// Manual adjustment for 2nd column offset, eg. when 1st column has a title text that's wider than the rest and you want to move 2nd column texts towards the 1st column some. +void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x); // secondary shades for boxes diff --git a/builddefines.h b/builddefines.h index 5e48f506..4ca80242 100644 --- a/builddefines.h +++ b/builddefines.h @@ -33,7 +33,9 @@ // ----------------------------- // Map Editor version - you should use the MapEditor configuration instead of messing with these defines (ChrisL) -//#define JA2BETAVERSION +#ifndef JA2BETAVERSION +#define JA2BETAVERSION +#endif //#define JA2EDITOR // Normal test version //#define JA2TESTVERSION diff --git a/gamescreen.cpp b/gamescreen.cpp index a6a05c8a..3c5be8e6 100644 --- a/gamescreen.cpp +++ b/gamescreen.cpp @@ -117,7 +117,7 @@ BOOLEAN gfExitToNewSector = FALSE; BOOLEAN gfGameScreenLocateToSoldier = FALSE; BOOLEAN gfEnteringMapScreen = FALSE; UINT32 uiOldMouseCursor; -UINT8 gubPreferredInitialSelectedGuy = NOBODY; +UINT16 gubPreferredInitialSelectedGuy = NOBODY; BOOLEAN gfTacticalIsModal = FALSE; MOUSE_REGION gTacticalDisableRegion; @@ -1030,7 +1030,7 @@ void TacticalScreenLocateToSoldier( ) { INT32 cnt; SOLDIERTYPE *pSoldier; - INT16 bLastTeamID; + UINT16 bLastTeamID; BOOLEAN fPreferedGuyUsed = FALSE; if ( gubPreferredInitialSelectedGuy != NOBODY ) @@ -1075,7 +1075,7 @@ void UpdateTeamPanelAssignments( ) { INT32 cnt; SOLDIERTYPE *pSoldier; - INT16 bLastTeamID; + UINT16 bLastTeamID; // Remove all players RemoveAllPlayersFromSlot( ); diff --git a/gamescreen.h b/gamescreen.h index 38403749..49a65019 100644 --- a/gamescreen.h +++ b/gamescreen.h @@ -16,7 +16,7 @@ typedef void (*MODAL_HOOK)( void ); extern BOOLEAN gfGameScreenLocateToSoldier; extern BOOLEAN gfEnteringMapScreen; -extern UINT8 gubPreferredInitialSelectedGuy; +extern UINT16 gubPreferredInitialSelectedGuy; void EnterMapScreen( ); diff --git a/lua/lua_VS2019.vcxproj b/lua/lua_VS2019.vcxproj index 3052380a..863ddc7b 100644 --- a/lua/lua_VS2019.vcxproj +++ b/lua/lua_VS2019.vcxproj @@ -78,67 +78,67 @@ StaticLibrary true NotSet - v142 + v143 StaticLibrary true NotSet - v142 + v143 StaticLibrary true NotSet - v142 + v143 StaticLibrary true NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 StaticLibrary false false NotSet - v142 + v143 diff --git a/lua/lua_VS2019.vcxproj.user b/lua/lua_VS2019.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/lua/lua_VS2019.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file From 5c1317042466ee9e67e6715e836ad19cefc421e7 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 10 Oct 2022 15:58:11 +0300 Subject: [PATCH 002/571] Create .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..f77e4723 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +lib/ From 9ac53cac32d8d274153f985a6af82162f051bace Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 27 Jul 2023 21:29:37 +0300 Subject: [PATCH 003/571] Fix UINT8 references to pSoldier->ubID to UINT16 --- Laptop/insurance Contract.cpp | 4 ++-- Laptop/insurance Contract.h | 6 +++--- Strategic/Game Event Hook.cpp | 4 ++-- Strategic/Rebel Command.cpp | 14 +++++++------- Tactical/PATHAI.cpp | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index c7114942..0e23acc6 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -1355,7 +1355,7 @@ BOOLEAN AddLifeInsurancePayout( SOLDIERTYPE *pSoldier ) } -void StartInsuranceInvestigation( UINT8 ubPayoutID ) +void StartInsuranceInvestigation( UINT16 ubPayoutID ) { UINT8 ubDays; @@ -1408,7 +1408,7 @@ void StartInsuranceInvestigation( UINT8 ubPayoutID ) } -void EndInsuranceInvestigation( UINT8 ubPayoutID ) +void EndInsuranceInvestigation( UINT16 ubPayoutID ) { // send an email telling player the investigation is over if ( gMercProfiles[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubMercID ].ubSuspiciousDeath == VERY_SUSPICIOUS_DEATH ) diff --git a/Laptop/insurance Contract.h b/Laptop/insurance Contract.h index 1be525a9..d795d277 100644 --- a/Laptop/insurance Contract.h +++ b/Laptop/insurance Contract.h @@ -19,8 +19,8 @@ void DailyUpdateOfInsuredMercs(); BOOLEAN AddLifeInsurancePayout( SOLDIERTYPE *pSoldier ); void InsuranceContractPayLifeInsuranceForDeadMerc( UINT16 ubPayoutID ); -void StartInsuranceInvestigation( UINT8 ubPayoutID ); -void EndInsuranceInvestigation( UINT8 ubPayoutID ); +void StartInsuranceInvestigation( UINT16 ubPayoutID ); +void EndInsuranceInvestigation( UINT16 ubPayoutID ); INT32 CalculateInsuranceContractCost( INT32 iLength, UINT8 ubMercID ); @@ -28,4 +28,4 @@ void InsuranceContractEndGameShutDown(); void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsuranceLength ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index 1a971658..845c0b6a 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -392,10 +392,10 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) HandleEnricoEmail(); break; case EVENT_INSURANCE_INVESTIGATION_STARTED: - StartInsuranceInvestigation( (UINT8) pEvent->uiParam ); + StartInsuranceInvestigation( (UINT16) pEvent->uiParam ); break; case EVENT_INSURANCE_INVESTIGATION_OVER: - EndInsuranceInvestigation( (UINT8) pEvent->uiParam ); + EndInsuranceInvestigation( (UINT16) pEvent->uiParam ); break; case EVENT_TEMPERATURE_UPDATE: UpdateTemperature( (UINT8) pEvent->uiParam ); diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index b5ce30aa..a11bedfc 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -2178,7 +2178,7 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index) // temp/fixme std::vector mercs; - for (UINT8 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { SOLDIERTYPE* pSoldier = MercPtrs[i]; @@ -2823,7 +2823,7 @@ void PrepareMission(INT8 index) // confirmation popup std::vector mercs; - for (UINT8 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { SOLDIERTYPE* pSoldier = MercPtrs[i]; @@ -2988,7 +2988,7 @@ void PrepareMission(INT8 index) if (!evt.sentGenericRebelAgent) { - for (UINT8 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { SOLDIERTYPE* pSoldier = MercPtrs[i]; if (pSoldier->ubProfile == evt.mercProfileId) @@ -4907,7 +4907,7 @@ void HandleStrategicEvent(const UINT32 eventParam) // make sure the merc's still on our team BOOLEAN foundMerc = FALSE; - for (UINT8 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { const SOLDIERTYPE* pSoldier = MercPtrs[i]; @@ -4978,7 +4978,7 @@ void HandleStrategicEvent(const UINT32 eventParam) if (!evt1.sentGenericRebelAgent) { - for (UINT8 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { SOLDIERTYPE* pSoldier = MercPtrs[i]; if (pSoldier->ubProfile == evt1.mercProfileId) @@ -5005,7 +5005,7 @@ void HandleStrategicEvent(const UINT32 eventParam) { if (!evt1.sentGenericRebelAgent && foundMerc) { - for (UINT8 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { SOLDIERTYPE* pSoldier = MercPtrs[i]; if (pSoldier->ubProfile == evt1.mercProfileId) @@ -5027,7 +5027,7 @@ void HandleStrategicEvent(const UINT32 eventParam) if (!evt1.sentGenericRebelAgent && foundMerc) { - for (UINT8 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { SOLDIERTYPE* pSoldier = MercPtrs[i]; if (pSoldier->ubProfile == evt1.mercProfileId) diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 25cebecf..2a7de9cb 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -2075,7 +2075,7 @@ bool AStarPathfinder::IsSomeoneInTheWay() if (fPathAroundPeople && ( (CurrentNode != DestNode) || fCopyReachable) ) { // ATE: ONLY cancel if they are moving..... - UINT8 ubMerc = WhoIsThere2( CurrentNode, pSoldier->pathing.bLevel); + UINT16 ubMerc = WhoIsThere2( CurrentNode, pSoldier->pathing.bLevel); if ( ubMerc < NOBODY && ubMerc != pSoldier->ubID ) { // Check for movement.... From 57cc888cd7291d56662a3e6e15aa39bac7ae0b8b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 27 Jul 2023 21:30:03 +0300 Subject: [PATCH 004/571] Allow more creatures, civs and rebels --- Tactical/Overhead Types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 3a86994b..2ca0d5db 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -285,11 +285,11 @@ extern UINT16 giMAXIMUM_NUMBER_OF_PLAYER_VEHICLES; extern UINT16 giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; #define CODE_MAXIMUM_NUMBER_OF_ENEMIES 256 extern UINT16 giMAXIMUM_NUMBER_OF_ENEMIES; -#define CODE_MAXIMUM_NUMBER_OF_CREATURES 40 +#define CODE_MAXIMUM_NUMBER_OF_CREATURES 256 extern UINT16 giMAXIMUM_NUMBER_OF_CREATURES; -#define CODE_MAXIMUM_NUMBER_OF_REBELS 64 +#define CODE_MAXIMUM_NUMBER_OF_REBELS 256 extern UINT16 giMAXIMUM_NUMBER_OF_REBELS; -#define CODE_MAXIMUM_NUMBER_OF_CIVS 40 +#define CODE_MAXIMUM_NUMBER_OF_CIVS 256 extern UINT16 giMAXIMUM_NUMBER_OF_CIVS; // The following should be the largest from the above set of constants. From 06918d75853f66e4a7549134b534c601774467be Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 29 Jul 2023 14:43:57 +0300 Subject: [PATCH 005/571] Update Item Types.h uint8 -> uint16 --- Tactical/Item Types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index fb78fe59..c43c6fc2 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -247,7 +247,7 @@ public: UINT32 lbeClass; UINT16 lbeIndex; - UINT8 ubID; + UINT16 ubID; BOOLEAN ZipperFlag; int uniqueID; UINT32 uiNodeChecksum; From 0962319a433e61dcf2857ad88a6a0bacde961fbc Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Thu, 31 Aug 2023 02:55:51 +0200 Subject: [PATCH 006/571] Fix skill checks for backgrounds during IMP creation fixed checks for major and minor traits determining available IMP backgrounds edited disability trait case HEAT INTOLERANT added case DEAF at disability traits --- Laptop/IMP Background.cpp | 137 +++++++++++++++++++++++++++++++++++++- 1 file changed, 135 insertions(+), 2 deletions(-) diff --git a/Laptop/IMP Background.cpp b/Laptop/IMP Background.cpp index ec269423..1ab6cd75 100644 --- a/Laptop/IMP Background.cpp +++ b/Laptop/IMP Background.cpp @@ -17,6 +17,7 @@ #include "IMP Compile Character.h" #include "IMP Disability Trait.h" #include "IMP Character Trait.h" + #include "IMP Minor Trait.h" #include "GameSettings.h" #include "Interface.h" @@ -602,6 +603,11 @@ void ResetDisplaySkills() extern INT32 SkillsList[ ATTITUDE_LIST_SIZE ]; +extern BOOLEAN gfSkillTraitQuestions[20]; +extern BOOLEAN gfSkillTraitQuestions2[20]; + +extern BOOLEAN gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS]; + BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) { if ( !ubNumber ) @@ -613,6 +619,122 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) else if ( !fCharacterIsMale && zBackground[ ubNumber ].uiFlags & BACKGROUND_NO_FEMALE ) return FALSE; + /* kitty: fixed following skillcheck + * the previous used "SkillList" and the after-remap naming convention (i.e. DOCTOR_NT) didn't work in this place/point of character creation + * left the out-commented previous code for reference and potential rollback + * used distinctive single and dual trait for major traits to allow for possible future finetuning by trait level + * 2023/08/30 + */ + + // major traits (single-trait and dual-trait) + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS]) + { + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS]) + { + if (zBackground[ubNumber].value[BG_ARTILLERY] > 0) //dual trait (expert) + return FALSE; + } + else + { + if (zBackground[ubNumber].value[BG_ARTILLERY] > 0) //single trait + return FALSE; + } + } + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_PROF_SNIPER] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_PROF_SNIPER]) + { + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_PROF_SNIPER] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_PROF_SNIPER]) + { + if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0) //dual trait (expert) + return FALSE; + } + else + { + if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0) //single trait + return FALSE; + } + } + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS]) + { + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS]) + { + if (zBackground[ubNumber].value[BG_PERC_DAMAGE_MELEE] < 0) //dual trait (expert) + return FALSE; + } + else + { + if (zBackground[ubNumber].value[BG_PERC_DAMAGE_MELEE] < 0) //single trait + return FALSE; + } + } + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_TECHNICIAN] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_TECHNICIAN]) + { + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_TECHNICIAN] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_TECHNICIAN]) + { + if (zBackground[ubNumber].value[BG_MECHANICAL] < 0) //dual trait (expert) + return FALSE; + } + else + { + if (zBackground[ubNumber].value[BG_MECHANICAL] < 0) //single trait + return FALSE; + } + } + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_DOCTOR] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_DOCTOR]) + { + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_DOCTOR] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_DOCTOR]) + { + if (zBackground[ubNumber].value[BG_MEDICAL] < 0) //dual trait (expert) + return FALSE; + } + else + { + if (zBackground[ubNumber].value[BG_MEDICAL] < 0) //single trait + return FALSE; + } + } + + // minor traits (single trait only) + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_MELEE]) + { + if (zBackground[ubNumber].value[BG_PERC_CTH_BLADE] < 0) //single trait + return FALSE; + } + + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_STEALTHY]) + { + if (zBackground[ubNumber].value[BG_PERC_STEALTH] < 0) + return FALSE; + } + + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_ATHLETICS]) + { + if (zBackground[ubNumber].value[BG_PERC_SPEED_RUNNING] < 0) + return FALSE; + } + + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_DEMOLITIONS]) + { + if (zBackground[ubNumber].value[BG_EXPLOSIVE_ASSIGN] < 0) + return FALSE; + } + + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_SURVIVAL]) + { + if (zBackground[ubNumber].value[BG_PERC_CAMO] < 0) + return FALSE; + } + + /* previous code for reference + * if ( SkillsList[0] == HEAVY_WEAPONS_NT || SkillsList[1] == HEAVY_WEAPONS_NT || SkillsList[2] == HEAVY_WEAPONS_NT ) { if ( zBackground[ ubNumber ].value[BG_ARTILLERY] > 0 ) @@ -672,11 +794,18 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) if ( zBackground[ ubNumber ].value[BG_EXPLOSIVE_ASSIGN] < 0 ) return FALSE; } + */ + + /*kitty: + * added BG_TROPICAL to case HEAT_INTOLERANT - since tropical sector also is part of "MercIsHot"+HEAT_INTOLERANT (SoldierProfile.cpp), like desert + * added case DEAF - if merc is deaf, granting any bonus to hearing seems implausible + * 2023/08/30 + */ switch ( iChosenDisabilityTrait() ) { case HEAT_INTOLERANT: - if ( zBackground[ ubNumber ].value[BG_DESERT] > 0 ) + if ( zBackground[ ubNumber ].value[BG_DESERT] > 0 || zBackground[ ubNumber ].value[BG_TROPICAL] > 0 ) return FALSE; break; case NERVOUS: @@ -701,8 +830,12 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 ) return FALSE; break; + case DEAF: + if (zBackground[ ubNumber ].value[BG_PERC_HEARING_NIGHT] > 0 || zBackground[ ubNumber ].value[BG_PERC_HEARING_DAY] > 0) + return FALSE; + break; case AFRAID_OF_HEIGHTS: - if ( zBackground[ubNumber].value[BG_HEIGHT] > 0 ) + if ( zBackground[ ubNumber ].value[BG_HEIGHT] > 0 ) return FALSE; break; default: From 9dfbc7d39491b65089f1633bfaa9399937fc2d15 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 13 Mar 2024 19:29:28 +0200 Subject: [PATCH 007/571] Use correct gridno for XY conversion (#289) --- Tactical/Weapons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index cdc60e02..4aea8f81 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -5692,7 +5692,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN if ( pBullet->fFragment == false) { INT16 sX, sY; - ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY); + ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY); if ( Item[usWeaponIndex].singleshotrocketlauncher ) { From bf01f87cb4a48f4e4c5df92516039a91ba68cb64 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Mar 2024 13:00:04 +0200 Subject: [PATCH 008/571] Revert "Cache result of evaluating strategicmap.lua (#32)" (#293) This reverts commit 8f22d13fd9d28c7a2a5b65ec1d10239615e9fa80. --- Strategic/LuaInitNPCs.cpp | 57 +++++++++++++++------------------------ 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index be83d757..519dc005 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -13603,58 +13603,43 @@ static int l_GetNumHostilesInSector( lua_State *L ) void LuaGetIntelAndQuestMapData( INT32 aLevel ) { - static LuaScopeState _LS(true); - static bool isInitialized = false; + const char* filename = "scripts\\strategicmap.lua"; - // Initialize only once during lifetime of program - if (!isInitialized) - { - isInitialized = true; - IniFunction(_LS.L(), TRUE); - IniGlobalGameSetting(_LS.L()); - const char* filename = "scripts\\strategicmap.lua"; - SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget); - } + LuaScopeState _LS( true ); + + IniFunction( _LS.L(), TRUE ); + IniGlobalGameSetting( _LS.L() ); + + SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget ); - IniGlobalGameSetting(_LS.L()); LuaFunction( _LS.L, "GetIntelAndQuestMapData" ).Param( aLevel ).Call( 1 ); } void SetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, INT32 sProgressLeft ) { - static LuaScopeState _LS(true); - static bool isInitialized = false; + const char* filename = "scripts\\strategicmap.lua"; - // Initialize only once during lifetime of program - if (!isInitialized) - { - isInitialized = true; - IniFunction(_LS.L(), TRUE); - IniGlobalGameSetting(_LS.L()); - const char* filename = "scripts\\strategicmap.lua"; - SGP_THROW_IFFALSE(_LS.L.EvalFile(filename), _BS("Cannot open file: ") << filename << _BS::cget); - } + LuaScopeState _LS( true ); + + IniFunction( _LS.L(), TRUE ); + IniGlobalGameSetting( _LS.L() ); + + SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget ); - IniGlobalGameSetting(_LS.L()); LuaFunction( _LS.L, "SetFactoryLeftoverProgress" ).Param( sSectorX ).Param( sSectorY ).Param( bSectorZ ).Param( usFacilityType ).Param( usProductionNumber ).Param( sProgressLeft ).Call( 6 ); } INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber ) { - static LuaScopeState _LS( true ); - static bool isInitialized = false; + const char* filename = "scripts\\strategicmap.lua"; - // Initialize only once during lifetime of program - if (!isInitialized) - { - isInitialized = true; - IniFunction( _LS.L(), TRUE ); - IniGlobalGameSetting(_LS.L()); - const char* filename = "scripts\\strategicmap.lua"; - SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget ); - } + LuaScopeState _LS( true ); + + IniFunction( _LS.L(), TRUE ); + IniGlobalGameSetting( _LS.L() ); + + SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget ); - IniGlobalGameSetting(_LS.L()); LuaFunction( _LS.L, "GetFactoryLeftoverProgress" ).Param( sSectorX ).Param( sSectorY ).Param( bSectorZ ).Param( usFacilityType ).Param( usProductionNumber ).Call( 5 ); if ( lua_gettop( _LS.L() ) >= 0 ) From e6c5f95d733c0dd3cc005ffe66d097bf869fdfce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Fa=C5=82kowski?= Date: Sat, 16 Mar 2024 15:48:22 +0100 Subject: [PATCH 009/571] Fixed drugtypes and drugitems background tags causing subsequent tags in the same background to be skipped --- Tactical/XML_Background.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Tactical/XML_Background.cpp b/Tactical/XML_Background.cpp index 5caac1cd..26fa67b8 100644 --- a/Tactical/XML_Background.cpp +++ b/Tactical/XML_Background.cpp @@ -168,7 +168,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha else if (strcmp(name, "drugitems") == 0 && pData->curElement == ELEMENT) { pData->curElement = ELEMENT_VECTOR_OF_NUMBERS; - pData->curBackground.valueVectors[BackgroundVectorTypes::BG_DRUGUSE_TYPES].clear(); + pData->curBackground.valueVectors[BackgroundVectorTypes::BG_DRUGUSE_ITEMS].clear(); pData->maxReadDepth++; //we are not skipping this element } @@ -693,6 +693,14 @@ backgroundEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_CIVGROUPLOYAL : 0; } + else if (strcmp(name, "drugtypes") == 0) + { + pData->curElement = ELEMENT; + } + else if (strcmp(name, "drugitems") == 0) + { + pData->curElement = ELEMENT; + } else if (strcmp(name, "drugtype") == 0) { pData->curElement = ELEMENT_VECTOR_OF_NUMBERS; From 682dbaa8fcca3e5fda196028c4a22aeae4862608 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Tue, 19 Mar 2024 19:37:16 +0100 Subject: [PATCH 010/571] Alternative IMP Background Selection - two new options in ja2options.ini ALTERNATIVE IMP CREATION - adds new additional backgrounds, exclusive to this option - which IMP backgrounds will be available at selection is determined by previously made choices for skills, character traits and disablities - if a tag in background is contradicting to content of skill/character/disability, it won't be shown at selection - what's considered contradicting is based on what's been found in code for conntent of skill/character/disability - i.e. HeatIntolerant adds a penalty for desert and tropical sectors, so don't show backgrounds that add bonus for those sectortypes instead - a new tag has been added to backgrounds.xml + + if (!gGameExternalOptions.fAltIMPCreation) + + { + if (zBackground[ubNumber].uiFlags & BACKGROUND_ALT_IMP_CREATION) // don't show BG with tag if Alt_Imp_Creation isn't true in ja2options.ini + { + return FALSE; + } + else + { + return TRUE; + } + } + + // show BG with tag , + // but don't show BG whose tags would contradict with a main bonus/penalty gained by skill/char-trait/disability + + if (gGameExternalOptions.fAltIMPCreation) + + // define which tags are considered contradicting for major traits, minor traits, disablities and character traits // major traits (single-trait and dual-trait) if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS]) { if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_HEAVY_WEAPONS]) - { - if (zBackground[ubNumber].value[BG_ARTILLERY] > 0) //dual trait (expert) + { + if (zBackground[ubNumber].value[BG_ARTILLERY] > 0) //dual trait (expert) return FALSE; } else { - if (zBackground[ubNumber].value[BG_ARTILLERY] > 0) //single trait + if (zBackground[ubNumber].value[BG_ARTILLERY] > 10) //single trait return FALSE; } } @@ -647,12 +664,12 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_PROF_SNIPER] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_PROF_SNIPER]) { - if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0) //dual trait (expert) + if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0 || zBackground[ubNumber].value[BG_MARKSMANSHIP] < 0 ) return FALSE; } else { - if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0) //single trait + if (zBackground[ubNumber].value[BG_PERC_CTH_MAX] < 0 ) return FALSE; } } @@ -662,12 +679,13 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_MARTIAL_ARTS]) { - if (zBackground[ubNumber].value[BG_PERC_DAMAGE_MELEE] < 0) //dual trait (expert) + + if (zBackground[ubNumber].value[BG_RESI_PHYSICAL] < 0 ) return FALSE; } else { - if (zBackground[ubNumber].value[BG_PERC_DAMAGE_MELEE] < 0) //single trait + if (zBackground[ubNumber].value[BG_RESI_PHYSICAL] < 0 ) return FALSE; } } @@ -677,12 +695,12 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_TECHNICIAN] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_TECHNICIAN]) { - if (zBackground[ubNumber].value[BG_MECHANICAL] < 0) //dual trait (expert) + if (zBackground[ubNumber].value[BG_MECHANICAL] < 0) return FALSE; } else { - if (zBackground[ubNumber].value[BG_MECHANICAL] < 0) //single trait + if (zBackground[ubNumber].value[BG_MECHANICAL] < 0) return FALSE; } } @@ -692,20 +710,35 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_DOCTOR] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_DOCTOR]) { - if (zBackground[ubNumber].value[BG_MEDICAL] < 0) //dual trait (expert) + if (zBackground[ubNumber].value[BG_PERC_BANDAGING] < 0 || zBackground[ubNumber].value[BG_MEDICAL] < 0 ) return FALSE; } else { - if (zBackground[ubNumber].value[BG_MEDICAL] < 0) //single trait + if (zBackground[ubNumber].value[BG_PERC_BANDAGING] < 0) return FALSE; } } - // minor traits (single trait only) + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_SQUADLEADER] || gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_SQUADLEADER]) + { + + if (gfSkillTraitQuestions[IMP_SKILL_TRAITS_NEW_SQUADLEADER] && gfSkillTraitQuestions2[IMP_SKILL_TRAITS_NEW_SQUADLEADER]) + { + if (zBackground[ubNumber].value[BG_RESI_SUPPRESSION] < 0 || zBackground[ubNumber].value[BG_RESI_FEAR] < 0 ) + return FALSE; + } + else + { + if (zBackground[ubNumber].value[BG_RESI_SUPPRESSION] < 0) + return FALSE; + } + } + + // Minor Traits (single trait only) if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_MELEE]) { - if (zBackground[ubNumber].value[BG_PERC_CTH_BLADE] < 0) //single trait + if (zBackground[ubNumber].value[BG_PERC_CTH_BLADE] < 0 || zBackground[ubNumber].value[BG_PERC_DAMAGE_MELEE] < 0 ) return FALSE; } @@ -715,97 +748,42 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) return FALSE; } - if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_ATHLETICS]) + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_DEMOLITIONS]) { - if (zBackground[ubNumber].value[BG_PERC_SPEED_RUNNING] < 0) + if (zBackground[ubNumber].value[BG_BONUS_BREACHINGCHARGE] < 0 || zBackground[ubNumber].value[BG_EXPLOSIVE_ASSIGN] < 0 ) return FALSE; } - if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_DEMOLITIONS]) + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_SURVIVAL]) { - if (zBackground[ubNumber].value[BG_EXPLOSIVE_ASSIGN] < 0) + if (zBackground[ubNumber].value[BG_TRAVEL_FOOT] < 0 || zBackground[ubNumber].value[BG_TRAVEL_CAR] <0 || zBackground[ubNumber].value[BG_TRAVEL_AIR] <0 || + zBackground[ubNumber].value[BG_RESI_DISEASE] < 0 || zBackground[ubNumber].value[BG_SNAKEDEFENSE] < 0 ) return FALSE; } - if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_SURVIVAL]) + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_BODYBUILDING]) { - if (zBackground[ubNumber].value[BG_PERC_CAMO] < 0) + if (zBackground[ubNumber].value[BG_PERC_CARRYSTRENGTH] < 0) return FALSE; } - /* previous code for reference - * - if ( SkillsList[0] == HEAVY_WEAPONS_NT || SkillsList[1] == HEAVY_WEAPONS_NT || SkillsList[2] == HEAVY_WEAPONS_NT ) + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_AMBIDEXTROUS]) { - if ( zBackground[ ubNumber ].value[BG_ARTILLERY] > 0 ) + if (zBackground[ubNumber].value[BG_INVENTORY] > 0) return FALSE; } - if ( SkillsList[0] == SNIPER_NT || SkillsList[1] == SNIPER_NT || SkillsList[2] == SNIPER_NT ) + if (gfMinorTraitQuestions[IMP_SKILL_TRAITS_NEW_NIGHT_OPS]) { - if ( zBackground[ ubNumber ].value[BG_PERC_CTH_MAX] < 0 ) + if (zBackground[ubNumber].value[BG_PERC_SLEEP] > 0 || zBackground[ubNumber].value[BG_PERC_HEARING_NIGHT] < 0 ) return FALSE; } - if ( SkillsList[0] == SURVIVAL_NT || SkillsList[1] == SURVIVAL_NT || SkillsList[2] == SURVIVAL_NT ) - { - if ( zBackground[ ubNumber ].value[BG_PERC_CAMO] < 0 ) - return FALSE; - } - - if ( SkillsList[0] == MARTIAL_ARTS_NT || SkillsList[1] == MARTIAL_ARTS_NT || SkillsList[2] == MARTIAL_ARTS_NT ) - { - if ( zBackground[ ubNumber ].value[BG_PERC_DAMAGE_MELEE] < 0 ) - return FALSE; - } - - if ( SkillsList[0] == TECHNICIAN_NT || SkillsList[1] == TECHNICIAN_NT || SkillsList[2] == TECHNICIAN_NT ) - { - if ( zBackground[ ubNumber ].value[BG_MECHANICAL] < 0 ) - return FALSE; - } - - if ( SkillsList[0] == DOCTOR_NT || SkillsList[1] == DOCTOR_NT || SkillsList[2] == DOCTOR_NT ) - { - if ( zBackground[ ubNumber ].value[BG_MEDICAL] < 0 ) - return FALSE; - } - - if ( SkillsList[0] == MELEE_NT || SkillsList[1] == MELEE_NT || SkillsList[2] == MELEE_NT ) - { - if ( zBackground[ ubNumber ].value[BG_PERC_CTH_BLADE] < 0 ) - return FALSE; - } - - if ( SkillsList[0] == STEALTHY_NT || SkillsList[1] == STEALTHY_NT || SkillsList[2] == STEALTHY_NT ) - { - if ( zBackground[ ubNumber ].value[BG_PERC_STEALTH] < 0 ) - return FALSE; - } - - if ( SkillsList[0] == ATHLETICS_NT || SkillsList[1] == ATHLETICS_NT || SkillsList[2] == ATHLETICS_NT ) - { - if ( zBackground[ ubNumber ].value[BG_PERC_SPEED_RUNNING] < 0 ) - return FALSE; - } - - if ( SkillsList[0] == DEMOLITIONS_NT || SkillsList[1] == DEMOLITIONS_NT || SkillsList[2] == DEMOLITIONS_NT ) - { - if ( zBackground[ ubNumber ].value[BG_EXPLOSIVE_ASSIGN] < 0 ) - return FALSE; - } - */ - - /*kitty: - * added BG_TROPICAL to case HEAT_INTOLERANT - since tropical sector also is part of "MercIsHot"+HEAT_INTOLERANT (SoldierProfile.cpp), like desert - * added case DEAF - if merc is deaf, granting any bonus to hearing seems implausible - * 2023/08/30 - */ - - switch ( iChosenDisabilityTrait() ) + // Disabiliies + switch (iChosenDisabilityTrait()) { case HEAT_INTOLERANT: - if ( zBackground[ ubNumber ].value[BG_DESERT] > 0 || zBackground[ ubNumber ].value[BG_TROPICAL] > 0 ) + if (zBackground[ubNumber].value[BG_DESERT] > 0 || zBackground[ubNumber].value[BG_TROPICAL] > 0) return FALSE; break; case NERVOUS: @@ -815,7 +793,7 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) return FALSE; break; case NONSWIMMER: - if ( zBackground[ ubNumber ].value[BG_RIVER] > 0 || zBackground[ ubNumber ].value[BG_COASTAL] > 0 || zBackground[ ubNumber ].value[BG_SWIMMING] > 0 ) + if ( zBackground[ ubNumber ].value[BG_RIVER] > 0 || zBackground[ ubNumber ].value[BG_COASTAL] > 0 ) return FALSE; break; case FEAR_OF_INSECTS: @@ -823,39 +801,109 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber ) return FALSE; break; case FORGETFUL: - if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 ) + if (zBackground[ubNumber].value[BG_INVENTORY] < 0 || zBackground[ubNumber].value[BG_ASSAULT] < 0 ) return FALSE; break; case PSYCHO: - if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 ) + if (zBackground[ubNumber].value[BG_LEADERSHIP] > 5) return FALSE; break; case DEAF: if (zBackground[ ubNumber ].value[BG_PERC_HEARING_NIGHT] > 0 || zBackground[ ubNumber ].value[BG_PERC_HEARING_DAY] > 0) return FALSE; break; + case SHORTSIGHTED: + if (zBackground[ ubNumber ].value[BG_PERC_CTH_MAX] > 0 || zBackground[ubNumber].value[BG_PERC_SPOTTER] > 0 ) + return FALSE; + break; + case HEMOPHILIAC: + if (zBackground[ubNumber].value[BG_RESI_DISEASE] > 0) + return FALSE; + break; case AFRAID_OF_HEIGHTS: - if ( zBackground[ ubNumber ].value[BG_HEIGHT] > 0 ) + if ( zBackground[ ubNumber ].value[BG_HEIGHT] > 0 || zBackground[ubNumber].value[BG_AIRDROP] > 0 ) + return FALSE; + break; + case SELF_HARM: + if (zBackground[ubNumber].value[BG_RESI_DISEASE] > 0) return FALSE; break; default: break; } - switch ( iChosenCharacterTrait() ) + // Character Traits + switch (iChosenCharacterTrait()) { case CHAR_TRAIT_SOCIABLE: - if ( zBackground[ ubNumber ].uiFlags & BACKGROUND_XENOPHOBIC ) + if (zBackground[ubNumber].uiFlags & BACKGROUND_XENOPHOBIC || zBackground[ubNumber].value[BG_PERC_SPOTTER] < 0) return FALSE; break; case CHAR_TRAIT_LONER: - if ( zBackground[ ubNumber ].value[BG_LEADERSHIP] > 0 ) + if (zBackground[ubNumber].value[BG_LEADERSHIP] > 0 || zBackground[ubNumber].value[BG_PERC_SPOTTER] > 0) + return FALSE; + break; + case CHAR_TRAIT_OPTIMIST: + if (zBackground[ubNumber].uiFlags & BACKGROUND_TRAPLEVEL) + return FALSE; + break; + case CHAR_TRAIT_ASSERTIVE: + if (zBackground[ubNumber].value[BG_PERC_INTERROGATION] < 0 || zBackground[ubNumber].value[BG_PERC_APPROACH_THREATEN] < 0) + return FALSE; + break; + case CHAR_TRAIT_INTELLECTUAL: + if (zBackground[ubNumber].value[BG_ADMINISTRATION_ASSIGNMENT] < 0) + return FALSE; + break; + case CHAR_TRAIT_PRIMITIVE: + if (zBackground[ubNumber].value[BG_ADMINISTRATION_ASSIGNMENT] > 0) + return FALSE; + break; + case CHAR_TRAIT_AGGRESSIVE: + if (zBackground[ubNumber].uiFlags & BACKGROUND_TRAPLEVEL || zBackground[ubNumber].value[BG_PERC_DISARM] > 0 ) + return FALSE; + break; + case CHAR_TRAIT_PHLEGMATIC: + if (zBackground[ubNumber].value[BG_ASSAULT] > 0 ) + return FALSE; + break; + case CHAR_TRAIT_DAUNTLESS: + if (zBackground[ubNumber].value[BG_CROUCHEDDEFENSE] < 0 ) + return FALSE; + break; + case CHAR_TRAIT_PACIFIST: + break; + case CHAR_TRAIT_MALICIOUS: + if (zBackground[ubNumber].value[BG_PERC_APPROACH_FRIENDLY] > 0) + return FALSE; + break; + case CHAR_TRAIT_SHOWOFF: + break; + case CHAR_TRAIT_COWARD: + if (zBackground[ubNumber].value[BG_PERC_CAPITULATION] > 0) return FALSE; break; default: break; } + // show exclusivly the BG's with tag if Reduced_Imp_Creation is true in ja2options.ini + // requires Alt_Imp_Creation to be true in ja2options.ini (otherwise BG's with tag won't be shown) + + if (gGameExternalOptions.fReducedIMPCreation) + + { + + if (zBackground[ubNumber].uiFlags & BACKGROUND_ALT_IMP_CREATION) + { + return TRUE; + } + else + { + return FALSE; + } + } + return TRUE; } diff --git a/Laptop/IMP Disability Trait.h b/Laptop/IMP Disability Trait.h index ce728d73..58ffd66a 100644 --- a/Laptop/IMP Disability Trait.h +++ b/Laptop/IMP Disability Trait.h @@ -8,7 +8,7 @@ void RenderIMPDisabilityTrait( void ); void ExitIMPDisabilityTrait( void ); void HandleIMPDisabilityTrait( void ); -INT8 iChosenDisabilityTrait(); +INT8 iChosenDisabilityTrait(); INT8 iPlayersAttributePointsBonusForDisabilitySelected(); #endif diff --git a/Laptop/IMP Minor Trait.cpp b/Laptop/IMP Minor Trait.cpp index 51286ca9..848b4c49 100644 --- a/Laptop/IMP Minor Trait.cpp +++ b/Laptop/IMP Minor Trait.cpp @@ -80,7 +80,7 @@ UINT8 gusNewMinorTraitRemap[IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS] = BOOLEAN gfIMT_Redraw=FALSE; -BOOLEAN gfMinorTraitQuestions[ IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS ]; +BOOLEAN gfMinorTraitQuestions[ IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS ]; // these are the buttons for the questions INT32 giIMPMinorTraitAnswerButton[ IMP_SKILL_TRAITS_NEW_NUMBER_MINOR_SKILLS ]; diff --git a/Laptop/IMP Skill Trait.cpp b/Laptop/IMP Skill Trait.cpp index eb1e18df..93fab856 100644 --- a/Laptop/IMP Skill Trait.cpp +++ b/Laptop/IMP Skill Trait.cpp @@ -98,8 +98,8 @@ UINT8 gusOldMajorTraitRemap[IMP_SKILL_TRAITS__NUMBER_SKILLS] = // Global Variables // //******************************************************************* -BOOLEAN gfSkillTraitQuestions[ 20 ]; -BOOLEAN gfSkillTraitQuestions2[ 20 ]; +BOOLEAN gfSkillTraitQuestions[ 20 ]; +BOOLEAN gfSkillTraitQuestions2[ 20 ]; BOOLEAN gfIST_Redraw=FALSE; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index f461f30d..74c08462 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -466,12 +466,13 @@ enum #define BACKGROUND_ANIMALFRIEND 0x0000000000000200 //512 // refuses to attack animals #define BACKGROUND_CIVGROUPLOYAL 0x0000000000000400 //1024 // refuses to attack members of the same civgroup +#define BACKGROUND_ALT_IMP_CREATION 0x0000000000000800 //2048 // BG can only be used when ALT_IMP_CREATION is TRUE in ja2options.ini (IMP creation) -#define BACKGROUND_FLAG_MAX 11 // number of flagged backgrounds - keep this updated, or properties will get lost! +#define BACKGROUND_FLAG_MAX 12 // number of flagged backgrounds - keep this updated, or properties will get lost! // some properties are hidden (forbid background in MP creation) // corruption property is not relevant in 1.13 -#define BACKGROUND_HIDDEN_FLAGS (BACKGROUND_NO_MALE|BACKGROUND_NO_FEMALE|BACKGROUND_CORRUPTIONSPREAD) +#define BACKGROUND_HIDDEN_FLAGS (BACKGROUND_NO_MALE|BACKGROUND_NO_FEMALE|BACKGROUND_CORRUPTIONSPREAD|BACKGROUND_ALT_IMP_CREATION) // anv: externalised taunts // taunt properties diff --git a/Tactical/XML_Background.cpp b/Tactical/XML_Background.cpp index 26fa67b8..829f8669 100644 --- a/Tactical/XML_Background.cpp +++ b/Tactical/XML_Background.cpp @@ -152,7 +152,8 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha strcmp(name, "no_female") == 0 || strcmp(name, "loyalitylossondeath" ) == 0 || strcmp(name, "animal_friend") == 0 || - strcmp(name, "civgroup_loyal") == 0 )) + strcmp(name, "civgroup_loyal") == 0 || + strcmp(name, "alt_impcreation") == 0 )) { pData->curElement = ELEMENT_PROPERTY; @@ -693,6 +694,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_CIVGROUPLOYAL : 0; } + else if (strcmp(name, "alt_impcreation") == 0) + { + pData->curElement = ELEMENT; + pData->curBackground.uiFlags |= (UINT16)atol(pData->szCharData) ? BACKGROUND_ALT_IMP_CREATION : 0; + } else if (strcmp(name, "drugtypes") == 0) { pData->curElement = ELEMENT; From d670383f3a6f6f4c2a55bcff65e4e51bf67de18e Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Fri, 29 Mar 2024 16:21:39 -0300 Subject: [PATCH 011/571] add const accessor to Inventory --- Tactical/Soldier Control.cpp | 4 ++++ Tactical/Soldier Control.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index dacb8dfc..46a09d69 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -378,6 +378,10 @@ unsigned int Inventory::size( ) const { return inv.size( ); } +auto Inventory::get() const -> const std::vector& { + return inv; +} + // Assignment operator Inventory& Inventory::operator=(const Inventory& src) { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 74c08462..7545ce6b 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -772,6 +772,9 @@ public: // How any slots are there in this inventory? unsigned int size() const; + // const-only accessor + auto get() const -> const std::vector&; + //temporarily? public std::vector bNewItemCount; std::vector bNewItemCycleCount; From 049ec472194effdcf3cf0c7cf25acff648fd0a5a Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Fri, 29 Mar 2024 16:23:59 -0300 Subject: [PATCH 012/571] make OBJECTTYPE::Exists() const --- Tactical/Item Types.cpp | 2 +- Tactical/Item Types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index de7478ad..e8a7c848 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -592,7 +592,7 @@ LBENODE* OBJECTTYPE::GetLBEPointer(unsigned int index) } -bool OBJECTTYPE::exists() +bool OBJECTTYPE::exists() const { return(this && ubNumberOfObjects && usItem); } diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index cdd3d2a1..4fbfb650 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -546,7 +546,7 @@ public: bool operator==(OBJECTTYPE& compare); bool operator==(const OBJECTTYPE& compare)const; - bool exists(); + bool exists() const; bool IsActiveLBE(unsigned int index); bool HasAnyActiveLBEs(SOLDIERTYPE * pSoldier = NULL, UINT8 iter = 0); LBENODE* GetLBEPointer(unsigned int index); From dee2415d4ae88ed64b1ce96ae6b6e7755b0d059d Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Fri, 29 Mar 2024 16:42:25 -0300 Subject: [PATCH 013/571] simplify SOLDIERTYPE::GetDiseaseContactProtection( ) --- Tactical/Soldier Control.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 46a09d69..7ff39702 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -19938,22 +19938,19 @@ FLOAT SOLDIERTYPE::GetDiseaseContactProtection( ) // if we wear special equipment, lower our chances of being infected FLOAT bestfacegear = 0.0f; FLOAT bestprotectivegear = 0.0f; - INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly - for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) + for ( const auto &item : inv.get() ) { - if ( inv[bLoop].exists( ) ) + if ( item.exists( ) ) { - OBJECTTYPE* pObj = &(inv[bLoop]); - - if ( pObj && (*pObj)[0]->data.objectStatus >= USABLE ) + if ( item[0]->data.objectStatus >= USABLE ) { - if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_1 ) ) + if ( HasItemFlag( item.usItem, DISEASEPROTECTION_1 ) ) { - bestfacegear = max( bestfacegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) ); + bestfacegear = max( bestfacegear, (FLOAT)(item[0]->data.objectStatus / 100) ); } - if ( HasItemFlag( pObj->usItem, DISEASEPROTECTION_2 ) ) + if ( HasItemFlag( item.usItem, DISEASEPROTECTION_2 ) ) { - bestprotectivegear = max( bestprotectivegear, (FLOAT)((*pObj)[0]->data.objectStatus / 100) ); + bestprotectivegear = max( bestprotectivegear, (FLOAT)(item[0]->data.objectStatus / 100) ); } } } From 72f01b53790197d8d21d92f3ba3a188a46a52bfa Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Wed, 10 Apr 2024 09:22:01 +0200 Subject: [PATCH 014/571] Fix Attachable Launchers Slot Tooltips fix: launchables made valid by attached launchers are now again shown as tooltip and can be attached to slot with click fixes https://github.com/1dot13/source/issues/298 --- Tactical/Interface Items.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index b021c47a..2a897d88 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -5769,14 +5769,6 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) //search primary item launchables.xml usAttachment = Launchable[usLoop][0]; } - - if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) - { - if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) - { - attachList.push_back(usAttachment); - } - } else { //search for launchables made valid by other attachments @@ -5785,11 +5777,22 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) while (cnt) { if (Launchable[usLoop][1] == *p && AttachmentSlots[usLoopSlotID].nasAttachmentClass & Item[Launchable[usLoop][0]].nasAttachmentClass) + { usAttachment = Launchable[usLoop][0]; + break; + } cnt--, p++; } } + + if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) + { + if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) + { + attachList.push_back(usAttachment); + } + } } // check all attachments From 6650f70c934333e8a171cf51adaf0adc2d8b2f03 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Mon, 15 Apr 2024 01:08:41 +0200 Subject: [PATCH 015/571] Update AimMembers.cpp reworking r9343 - this resulted in player being forced to choose features to allways see all possible merc gear sets - loosing whole gearsets to avoid a few items is too much - in some item-mods that even could result in some mercs not having any - therefore deleted --- Laptop/AimMembers.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index d0f0561f..aa045033 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -5633,28 +5633,15 @@ void EnableWeaponKitSelectionButtons() { if ( !(gMercProfiles[gbCurrentSoldier].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) || gGameExternalOptions.fGearKitsAlwaysAvailable ) { - bool bShow; - INT16 usItem; for(int i=0; i Date: Mon, 15 Apr 2024 01:17:18 +0200 Subject: [PATCH 016/571] Update ShopKeeper Interface.cpp reworking r9343 - already decided in IsItemlegal - if it ain't legal, it won't be shown in ShopKeeperInventory, no need to bother with it again --- Tactical/ShopKeeper Interface.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 427a0fc5..505ce377 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -2896,13 +2896,6 @@ BOOLEAN DetermineArmsDealersSellingInventory( ) continue; } - //shadooow: do not sell any item that is limited to specific system and this system isn't enabled - if (((Item[iter->object.usItem].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[iter->object.usItem].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease)) - { - ++iter; - continue; - } - bool increment = true; if (ItemIsSpecial(*iter) == false) { StoreObjectsInNextFreeDealerInvSlot( &(*iter), gpTempDealersInventory, gbSelectedArmsDealerID ); From e386a66f0318107263c90449951b5ca547469174 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Mon, 15 Apr 2024 01:22:26 +0200 Subject: [PATCH 017/571] Update Item Types.h reworking r9343 - no need for Foodsystem flag, restricting food items to food system was already part of the code prior to r9343 (in IsItemLegal by silversurfer) - for disease system changed flag to boolean --- Tactical/Item Types.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 4fbfb650..3d82e35e 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -947,9 +947,6 @@ extern OBJECTTYPE gTempObject; // autofiretohitbonus, // bursttohitbonus -// bitflags for usLimitedToSystem -#define FOOD_SYSTEM_FLAG 1 -#define DISEASE_SYSTEM_FLAG 2 typedef struct { @@ -1218,8 +1215,9 @@ typedef struct BOOLEAN fProvidesRobotCamo; BOOLEAN fProvidesRobotNightVision; BOOLEAN fProvidesRobotLaserBonus; - //shadooow: bitflag controlling what system needs to be in play for item to appear - UINT8 usLimitedToSystem; + + // kitty: item exclusively available with disease feature + BOOLEAN DiseaseSystemExclusive; // rftr: the progress bounds that allow a transport group to drop an item INT8 iTransportGroupMinProgress; From 71667aba27fdb205582f9088d4c6d6a2bacb3545 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Mon, 15 Apr 2024 01:26:50 +0200 Subject: [PATCH 018/571] Update XML_Items.cpp reworking r9343 - part about food system was obsolete, that was already a thing prior to r9343 (see IsItemLegal) - disease changed because instead of flag now boolean is used --- Utils/XML_Items.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 5c1c37ae..b15fbc1b 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -1515,17 +1515,10 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.fProvidesRobotLaserBonus = (BOOLEAN)atol(pData->szCharData); } - else if (strcmp(name, "FoodSystemExclusive") == 0) - { - pData->curElement = ELEMENT; - if (atol(pData->szCharData)) - pData->curItem.usLimitedToSystem|= FOOD_SYSTEM_FLAG; - } else if (strcmp(name, "DiseaseSystemExclusive") == 0) { - pData->curElement = ELEMENT; - if (atol(pData->szCharData)) - pData->curItem.usLimitedToSystem|= DISEASE_SYSTEM_FLAG; + pData->curElement = ELEMENT; + pData->curItem.DiseaseSystemExclusive = (BOOLEAN)atol(pData->szCharData); } else if (strcmp(name, "TransportGroupMinProgress") == 0) { @@ -2194,6 +2187,8 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotNightVision ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotLaserBonus ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].DiseaseSystemExclusive); + FilePrintf(hFile,"\t\r\n"); } FilePrintf(hFile,"\r\n"); From b13bcaac7153b99c9157ee4891d18b518ddee679 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Mon, 15 Apr 2024 01:33:47 +0200 Subject: [PATCH 019/571] Update Items.cpp reworking r9343 - the part about Food System is obsolete, already was happening in code prior to r9343 - the flags got removed and a boolean is used instead, allowing a simpler function for the remaining disease - wether an item is considered exclusive to disease feature or not is decided by usage of tag in items.xml --- Tactical/Items.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 6e353552..6e154a04 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1279,8 +1279,9 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) return FALSE; } - //shadooow: exclude also any item that is limited to specific system and this system isn't enabled - if (((Item[usItemIndex].usLimitedToSystem & FOOD_SYSTEM_FLAG) && !UsingFoodSystem()) || ((Item[usItemIndex].usLimitedToSystem & DISEASE_SYSTEM_FLAG) && !gGameExternalOptions.fDisease)) + // kitty: no disease items if the disease system is off + // whether the item is exclusive is defined by tag + if (!gGameExternalOptions.fDisease && Item[usItemIndex].DiseaseSystemExclusive) { return FALSE; } From 3bab6ef3b7b6c785ad030145a3249a028aa792e0 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Mon, 15 Apr 2024 02:28:49 +0200 Subject: [PATCH 020/571] Update XML_Items.cpp reworking r9343 - some leftover cleanup and formating --- Utils/XML_Items.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index b15fbc1b..76652ae4 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -306,7 +306,6 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "ProvidesRobotCamo") == 0 || strcmp(name, "ProvidesRobotNightVision") == 0 || strcmp(name, "ProvidesRobotLaserBonus") == 0 || - strcmp(name, "FoodSystemExclusive") == 0 || strcmp(name, "DiseaseSystemExclusive") == 0 || strcmp(name, "TransportGroupMinProgress") == 0 || strcmp(name, "TransportGroupMaxProgress") == 0 @@ -1517,8 +1516,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) } else if (strcmp(name, "DiseaseSystemExclusive") == 0) { - pData->curElement = ELEMENT; - pData->curItem.DiseaseSystemExclusive = (BOOLEAN)atol(pData->szCharData); + pData->curElement = ELEMENT; + pData->curItem.DiseaseSystemExclusive = (BOOLEAN)atol(pData->szCharData); } else if (strcmp(name, "TransportGroupMinProgress") == 0) { From f7f214f347d9a814b09fb4a7a501125e7947fb47 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 25 May 2024 20:59:00 +0300 Subject: [PATCH 021/571] Fix CTD (#304) Fix illegal array access when creating an IMP and the help texts are referenced. With the missing comma, the array length was 5 and it's supposed to be 6. --- Utils/_Ja25GermanText.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utils/_Ja25GermanText.cpp b/Utils/_Ja25GermanText.cpp index a19fa526..b402f410 100644 --- a/Utils/_Ja25GermanText.cpp +++ b/Utils/_Ja25GermanText.cpp @@ -263,7 +263,7 @@ STR16 gzIMPMajorTraitsHelpTextsRadioOperator[]= L"Kann Artillerieunterstützung von Verbündeten in Nachbarsektoren anfordern\n", L"Kann Funkfrequenzen abhören und feindliche Truppen aufspüren\n", L"Kann den Funkverkehr im ganzen Sektor stören\n", - L"Kann nach feindlichen Störsendern suchen, wenn solche aktiv sind\n" + L"Kann nach feindlichen Störsendern suchen, wenn solche aktiv sind\n", L"Kann Unterstützung durch Milizen aus Nachbarsektoren anfordern\n", }; From a26845b608d5fce3e0dd3780d91abd497f9ae820 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 10 Aug 2024 20:14:15 +0300 Subject: [PATCH 022/571] Check that a dropped backpack belongs to a controllable merc (#320) Fixes handle BP pickup behavior if a merc drops a backpack and then leaves the sector. --- Tactical/Turn Based Input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index abc77380..4cb81bcc 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -8318,7 +8318,7 @@ void HandleTBBackpacks(void) { pTeamSoldier = MercPtrs[ubLoop]; - if (pTeamSoldier->flags.DropPackFlag) + if (OK_CONTROLLABLE_MERC(pTeamSoldier) && pTeamSoldier->flags.DropPackFlag) { backpackDropped = true; break; From 2307508a85ed33d9701e856929df20d8ad897a36 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:56:35 +0300 Subject: [PATCH 023/571] Use auto & to prevent an unnecessary copy (#321) --- Tactical/Tactical Save.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index b723dad9..e1b843ab 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -3176,7 +3176,7 @@ void SaveWorldItemsToTempFiles() const auto y = gAllWorldItems.sectors[i].y; const auto z = gAllWorldItems.sectors[i].z; const auto nItems = gAllWorldItems.NumItems[i]; - auto Items = gAllWorldItems.Items[i]; + auto &Items = gAllWorldItems.Items[i]; SaveWorldItemsToTempItemFile(x, y, (INT8)z, nItems, Items); } From 3391c6d7773fe3bb9f6bf18934b221d0f36b8466 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 11 Aug 2024 13:30:49 +0300 Subject: [PATCH 024/571] Ignore mercs away on minievents for food status updates (#322) --- Tactical/Food.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 968c8132..0b656d49 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -364,7 +364,9 @@ void ReduceBPRegenForHunger( SOLDIERTYPE *pSoldier, INT32 *psPoints ) void HourlyFoodSituationUpdate( SOLDIERTYPE *pSoldier ) { - if ( !pSoldier ) + // A merc away on a minievent assignment is ignored since we cannot control their food or water intake. + // Without this they would end up losing stats and/or dying during long event assignments, which would lead to the game crashing when death occurs. + if ( !pSoldier || pSoldier->bAssignment == ASSIGNMENT_MINIEVENT) return; // determine our current activity level From caa02cd6b7e65254888602bded5a664077ed88c5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 13 Aug 2024 00:29:48 +0300 Subject: [PATCH 025/571] Read new MercOpinions.xml format (#323) Requires accompanying gameDir change. MercOpinions.xml now only contains opinions that are not 0. A new tag with fields "id" and "modifier" are used instead of old ones that had 255 $value$ tags for all profiles. Loading time of MercOpinions.xml went down from ~4.047 s to 0.011 s due to this change with default 1.13 VFS config. A small cmd utility tool for converting existing MercOpinions.xml data into the new format is available at https://github.com/Asdow/JA2-ConvertXMLData/tree/master --- Tactical/CMakeLists.txt | 1 + Tactical/XML.cpp | 9 +++++++ Tactical/XML.h | 3 +++ Tactical/XML_Opinions.cpp | 51 ++++++++++++++------------------------- 4 files changed, 31 insertions(+), 33 deletions(-) create mode 100644 Tactical/XML.cpp diff --git a/Tactical/CMakeLists.txt b/Tactical/CMakeLists.txt index ebecb65d..86810e0d 100644 --- a/Tactical/CMakeLists.txt +++ b/Tactical/CMakeLists.txt @@ -93,6 +93,7 @@ set(TacticalSrc "${CMAKE_CURRENT_SOURCE_DIR}/VehicleMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Weapons.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/World Items.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/XML.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_AmmoTypes.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Armour.cpp" diff --git a/Tactical/XML.cpp b/Tactical/XML.cpp new file mode 100644 index 00000000..4cb460be --- /dev/null +++ b/Tactical/XML.cpp @@ -0,0 +1,9 @@ +#include "XML.h" + +const XML_Char* GetAttribute(const XML_Char* name, const XML_Char** atts) { + for (const XML_Char** pIter = atts; *pIter != NULL; pIter++) { + const XML_Char* key = *pIter++; + if (strcmp(key, name) == 0) return *pIter; + } + return NULL; +} diff --git a/Tactical/XML.h b/Tactical/XML.h index efa28c25..963417ef 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -1,6 +1,7 @@ #ifndef __XML_H #define __XML_H +#include "expat.h" #include "armsdealerinvinit.h" #include "EnemyItemDrops.h" #include "Loading Screen.h" @@ -581,4 +582,6 @@ extern BOOLEAN ReadInAimOldArchive(STR fileName, BOOLEAN localizedVersion); extern BOOLEAN ReadInHistorys(STR fileName, BOOLEAN localizedVersion ); extern BOOLEAN ReadInDifficultySettings(STR fileName, BOOLEAN localizedVersion); +extern const XML_Char* GetAttribute(const XML_Char* name, const XML_Char** atts); + #endif diff --git a/Tactical/XML_Opinions.cpp b/Tactical/XML_Opinions.cpp index 5c808441..a82c5fda 100644 --- a/Tactical/XML_Opinions.cpp +++ b/Tactical/XML_Opinions.cpp @@ -70,21 +70,21 @@ opinionStartElementHandle(void *userData, const XML_Char *name, const XML_Char * pData->maxReadDepth++; //we are not skipping this element } - else if(pData->curElement == ELEMENT) + else if (pData->curElement == ELEMENT && strcmp(name, "AnOpinion") == 0) { - for(UINT8 i = 0; i < NUMBER_OF_OPINIONS; ++i) + pData->curElement = ELEMENT; + pData->maxReadDepth++; //we are not skipping this element + + XML_Char const* anID = GetAttribute("id", atts); + XML_Char const* modifier = GetAttribute("modifier", atts); + + INT32 id, value; + id = atoi(anID); + value = atoi(modifier); + + if (id >= 0 && id < NUMBER_OF_OPINIONS) { - XML_Char bla[12]; - sprintf(bla, "Opinion%d", i); - - if(strcmp(name, bla) == 0) - { - pData->curElement = ELEMENT_PROPERTY; - - pData->maxReadDepth++; //we are not skipping this element - - break; - } + pData->curProfile.bMercOpinion[id] = value; } } @@ -92,9 +92,9 @@ opinionStartElementHandle(void *userData, const XML_Char *name, const XML_Char * } pData->currentDepth++; - } + static void XMLCALL opinionCharacterDataHandle(void *userData, const XML_Char *str, int len) { @@ -149,24 +149,6 @@ opinionEndElementHandle(void *userData, const XML_Char *name) pData->curIndex = (UINT32) strtoul(pData->szCharData, NULL, 0); } - else - { - for(UINT8 i = 0; i < NUMBER_OF_OPINIONS; ++i) - { - XML_Char bla[12]; - sprintf(bla, "Opinion%d", i); - - if(strcmp(name, bla) == 0) - { - pData->curElement = ELEMENT; - - pData->curProfile.bMercOpinion[i] = (INT8) atol(pData->szCharData); - - break; - } - } - } - pData->maxReadDepth--; } @@ -315,7 +297,10 @@ BOOLEAN WriteMercOpinions() UINT8 cnt_b = 0; for (cnt_b = 0; cnt_b < NUMBER_OF_OPINIONS; ++cnt_b) { - FilePrintf(hFile,"\t\t%d\r\n", cnt_b, gMercProfiles[ cnt ].bMercOpinion[cnt_b], cnt_b); + if (gMercProfiles[cnt].bMercOpinion[cnt_b] != 0) + { + FilePrintf(hFile, "\t\t\r\n", cnt_b, gMercProfiles[cnt].bMercOpinion[cnt_b]); + } } From ce02a488f0bd1980c725d97335477a4c96fda075 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 15 Aug 2024 00:50:13 +0300 Subject: [PATCH 026/571] Remove sleep() (#324) Near instantaneous program exit when we let the CPU do its thing :) --- sgp/soundman.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/sgp/soundman.cpp b/sgp/soundman.cpp index 743dd087..02d33d3e 100644 --- a/sgp/soundman.cpp +++ b/sgp/soundman.cpp @@ -261,7 +261,6 @@ void ShutdownSoundManager(void) SoundStopAll(); SoundShutdownCache(); - Sleep(1000); SoundShutdownHardware(); fSoundSystemInit=FALSE; SoundLog("JA2 sound manager shutdown"); From 49a119e6b94e869d32fddf8e5ca2621864a980e9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 22 Aug 2024 08:48:29 +0300 Subject: [PATCH 027/571] Convert INVTYPE boolean fields to flagmask (#325) Rearranged fields from largest to smallest to remove alignment padding --- Editor/EditorItems.cpp | 4 +- Laptop/BobbyRGuns.cpp | 22 +- Laptop/IMP Confirm.cpp | 10 +- Laptop/IMP Gear.cpp | 2 +- Strategic/ASD.cpp | 4 +- Strategic/Assignments.cpp | 22 +- Strategic/Auto Resolve.cpp | 4 +- Strategic/Hourly Update.cpp | 2 +- .../Map Screen Interface Map Inventory.cpp | 6 +- Strategic/Rebel Command.cpp | 12 +- Strategic/Strategic Event Handler.cpp | 2 +- Strategic/Strategic Movement.cpp | 2 +- Strategic/Strategic Transport Groups.cpp | 24 +- Strategic/mapscreen.cpp | 12 +- Tactical/Animation Control.cpp | 10 +- Tactical/Arms Dealer Init.cpp | 69 +-- Tactical/ArmsDealerInvInit.cpp | 8 +- Tactical/DisplayCover.cpp | 6 +- Tactical/Drugs And Alcohol.cpp | 2 +- Tactical/Faces.cpp | 6 +- Tactical/Food.cpp | 26 +- Tactical/Handle Items.cpp | 67 ++- Tactical/Handle UI.cpp | 19 +- Tactical/Interface Enhanced.cpp | 284 +++++------ Tactical/Interface Items.cpp | 86 ++-- Tactical/Interface Panels.cpp | 17 +- Tactical/Interface.cpp | 8 +- Tactical/Inventory Choosing.cpp | 14 +- Tactical/Item Types.cpp | 2 +- Tactical/Item Types.h | 463 ++++++++---------- Tactical/Items.cpp | 392 ++++++++------- Tactical/Items.h | 78 ++- Tactical/LOS.cpp | 32 +- Tactical/LogicalBodyTypes/Filter.cpp | 4 +- Tactical/Overhead.cpp | 8 +- Tactical/Points.cpp | 36 +- Tactical/RandomMerc.cpp | 9 +- Tactical/Rotting Corpses.cpp | 4 +- Tactical/ShopKeeper Interface.cpp | 15 +- Tactical/Soldier Ani.cpp | 14 +- Tactical/Soldier Control.cpp | 165 ++++--- Tactical/Soldier Create.cpp | 43 +- Tactical/Soldier Profile.cpp | 2 +- Tactical/SoldierTooltips.cpp | 4 +- Tactical/Tactical Save.cpp | 2 +- Tactical/Turn Based Input.cpp | 8 +- Tactical/UI Cursors.cpp | 10 +- Tactical/Weapons.cpp | 108 ++-- Tactical/World Items.cpp | 4 +- TacticalAI/AIMain.cpp | 37 +- TacticalAI/AIUtils.cpp | 2 +- TacticalAI/Attacks.cpp | 69 +-- TacticalAI/DecideAction.cpp | 31 +- TacticalAI/FindLocations.cpp | 6 +- TacticalAI/NPC.cpp | 2 +- TacticalAI/PanicButtons.cpp | 1 + TileEngine/Explosion Control.cpp | 38 +- TileEngine/physics.cpp | 26 +- Utils/XML_Items.cpp | 408 ++++++++------- 59 files changed, 1437 insertions(+), 1336 deletions(-) diff --git a/Editor/EditorItems.cpp b/Editor/EditorItems.cpp index b6c96847..7c0b3364 100644 --- a/Editor/EditorItems.cpp +++ b/Editor/EditorItems.cpp @@ -152,7 +152,7 @@ void EntryInitEditorItemsInfo() item = &Item[i]; //if( Item[i].fFlags & ITEM_NOT_EDITOR ) // continue; - if(item->notineditor) + if(ItemIsNotInEditor(i)) continue; if( i == SWITCH || i == ACTION_ITEM ) { @@ -331,7 +331,7 @@ void InitEditorItemsInfo(UINT32 uiItemType) continue; } item = &Item[usCounter]; - if(item->notineditor) + if(ItemIsNotInEditor(usCounter)) { usCounter++; continue; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 01136a57..d336e436 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -1765,11 +1765,11 @@ BOOLEAN DisplayItemInfo(UINT32 uiItemClass, INT32 iFilter, INT32 iSubFilter) { if ( iSubFilter > -1 ) // Madd: new BR filters { - if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & iSubFilter ) + if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & iSubFilter ) bAddItem = TRUE; - else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) + else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex)) bAddItem = TRUE; - else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment) + else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex)) bAddItem = TRUE; } else @@ -2653,11 +2653,11 @@ void SetFirstLastPagesForNew( UINT32 uiClassMask, INT32 iFilter, INT32 iSubFilte { if (iSubFilter > -1 ) { - if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & iSubFilter) + if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & iSubFilter) bCntNumItems = TRUE; - else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) + else if (iSubFilter == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex)) bCntNumItems = TRUE; - else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment ) + else if (iSubFilter == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex)) bCntNumItems = TRUE; } else @@ -3641,11 +3641,11 @@ void CalcFirstIndexForPage( STORE_INVENTORY *pInv, UINT32 uiItemClass ) { if (guiCurrentMiscSubFilterMode > -1) // Madd: new BR filter options { - if (Item[usItemIndex].attachment && Item[usItemIndex].attachmentclass & guiCurrentMiscSubFilterMode) + if (ItemIsAttachment(usItemIndex) && Item[usItemIndex].attachmentclass & guiCurrentMiscSubFilterMode) bCntItem = TRUE; - else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && Item[usItemIndex].attachment) + else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_OTHER_ATTACHMENTS && !(Item[usItemIndex].attachmentclass & BR_MISC_FILTER_STD_ATTACHMENTS) && ItemIsAttachment(usItemIndex)) bCntItem = TRUE; - else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_NO_ATTACHMENTS && !Item[usItemIndex].attachment) + else if (guiCurrentMiscSubFilterMode == BR_MISC_FILTER_NO_ATTACHMENTS && !ItemIsAttachment(usItemIndex)) bCntItem = TRUE; } else @@ -4181,7 +4181,7 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber ) for (it = range.first; it != range.second; it++) { UINT16 attachmentId = it->second.attachmentIndex; - if (!Item[attachmentId].hiddenaddon && !Item[attachmentId].hiddenattachment && ItemIsLegal(attachmentId, TRUE)) + if (!ItemIsHiddenAddon(attachmentId) && !ItemIsHiddenAttachment(attachmentId) && ItemIsLegal(attachmentId, TRUE)) { fAttachmentsFound = TRUE; if (DecorateAppendString(attachStr3, ATTACHMENTS_STRBUF_SIZE, Item[attachmentId].szItemName) == FALSE) @@ -4194,7 +4194,7 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber ) for (UINT32 itemId = 1; itemId < gMAXITEMS_READ; itemId++) { // If the attachment is not hidden and attachable to the gun (usItemNumber) - if (!Item[itemId].hiddenaddon && !Item[itemId].hiddenattachment && + if (!ItemIsHiddenAddon(itemId) && !ItemIsHiddenAttachment(itemId) && ItemIsLegal(itemId, TRUE) && IsAttachmentPointAvailable(Item[usItemNumber].uiIndex, itemId)) { fAttachmentsFound = TRUE; diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index fd74d9f2..b5a0ac1a 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -526,7 +526,7 @@ void DistributeInitialGear(MERCPROFILESTRUCT *pProfile) if(iOrder[i]!=-1) { // skip if this item is an attachment - if(Item[tInv[iOrder[i]].inv].attachment) + if(ItemIsAttachment(tInv[iOrder[i]].inv)) continue; iSet = FALSE; number = tInv[iOrder[i]].iNumber; @@ -1103,7 +1103,7 @@ INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHow return HELMETPOS; if ( pProfile->inv[VESTPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_VEST ) return VESTPOS; - if ( pProfile->inv[LEGPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS && !(Item[usItem].attachment)) + if ( pProfile->inv[LEGPOS] == NONE && Armour[Item[usItem].ubClassIndex].ubArmourClass == ARMOURCLASS_LEGGINGS && !ItemIsAttachment(usItem) ) return LEGPOS; break; case IC_BLADE: @@ -1132,7 +1132,7 @@ INT32 SpecificFreePocket(MERCPROFILESTRUCT *pProfile, UINT16 usItem, UINT8 ubHow case IC_GUN: if ( pProfile->inv[HANDPOS] == NONE ) return HANDPOS; - if ( pProfile->inv[SECONDHANDPOS] == NONE && !(Item[pProfile->inv[HANDPOS]].twohanded)) + if ( pProfile->inv[SECONDHANDPOS] == NONE && !(ItemIsTwoHanded(pProfile->inv[HANDPOS]))) return SECONDHANDPOS; if((UsingNewInventorySystem() == true)) if ( pProfile->inv[GUNSLINGPOCKPOS] == NONE && pProfile->inv[BPACKPOCKPOS] == NONE && LBEPocketType[1].ItemCapacityPerSize[Item[usItem].ItemSize]!=0) @@ -1681,7 +1681,7 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) // give ammo for guns Assert( usItem < gMAXITEMS_READ ); - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { usItem = DefaultMagazine(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: give ammo typeIndex = %d, usItem = %d ",typeIndex, usItem )); @@ -1726,7 +1726,7 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd MakeProfileInvItemAnySlot(pProfile,usItem,100,1); // give ammo for guns - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { usItem = DefaultMagazine(usItem); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem )); diff --git a/Laptop/IMP Gear.cpp b/Laptop/IMP Gear.cpp index e8da0ada..0d84fb2f 100644 --- a/Laptop/IMP Gear.cpp +++ b/Laptop/IMP Gear.cpp @@ -1285,7 +1285,7 @@ void DistributePossibleItemsToVectors(void) { gIMPPossibleItems[HANDPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName)); - if (Item[usItem].twohanded) { + if (ItemIsTwoHanded(usItem)) { gIMPPossibleItems[GUNSLINGPOCKPOS].push_back(std::make_pair(usItem, Item[usItem].szItemName)); } else { diff --git a/Strategic/ASD.cpp b/Strategic/ASD.cpp index 8c23a678..41bad719 100644 --- a/Strategic/ASD.cpp +++ b/Strategic/ASD.cpp @@ -1198,7 +1198,7 @@ void EnemyHeliMANPADSCheck( INT16 id ) if ( pObj ) { // abort if this is a launcher without ammo - if ( Item[pObj->usItem].rocketlauncher && !Item[pObj->usItem].singleshotrocketlauncher ) + if (ItemIsRocketLauncher(pObj->usItem) && !ItemIsSingleShotRocketLauncher(pObj->usItem)) { OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE ); if ( !pAttachment->exists( ) ) @@ -1227,7 +1227,7 @@ void EnemyHeliMANPADSCheck( INT16 id ) MapScreenMessage( FONT_MCOLOR_LTRED, MSG_INTERFACE, szEnemyHeliText[7], pSoldier->GetName( ), Item[pObj->usItem].szItemName, pStrSectorName ); // 'fire' (remove shot) - if ( Item[pObj->usItem].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(pObj->usItem)) { CreateItem( Item[pObj->usItem].discardedlauncheritem, (*pObj)[0]->data.objectStatus, pObj ); diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 1a1da072..eea73652 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -3349,7 +3349,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts } // can't repair at all without a toolkit - if (!Item[pSoldier->inv[HANDPOS].usItem].toolkit ) + if (!ItemIsToolkit(pSoldier->inv[HANDPOS].usItem)) { *pusMaxPts = 0; return(0); @@ -4063,7 +4063,7 @@ UINT16 ToolKitPoints(SOLDIERTYPE *pSoldier) // CHRISL: Changed to dynamically determine max inventory locations. for (int ubPocket=HANDPOS; ubPocket < NUM_INV_SLOTS; ++ubPocket) { - if( Item[pSoldier->inv[ ubPocket ].usItem].toolkit ) + if(ItemIsToolkit(pSoldier->inv[ ubPocket ].usItem)) { usKitpts += TotalPoints( &( pSoldier->inv[ ubPocket ] ) ); } @@ -5138,7 +5138,7 @@ void DoActualRepair( SOLDIERTYPE * pSoldier, UINT16 usItem, INT16 * pbStatus, IN // repairs on electronic items take twice as long if the guy doesn't have the skill // Technician/Electronic traits - repairing electronic items - SANDRO - if ( Item[ usItem ].electronic ) + if (ItemIsElectronic(usItem)) { if (gGameOptions.fNewTraitSystem) { @@ -5745,7 +5745,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) BOOLEAN IsItemRepairable(SOLDIERTYPE* pSoldier, UINT16 usItem, INT16 bStatus, INT16 bThreshold ) { // check to see if item can/needs to be repaired - if ( ( bStatus < 100) && ( Item[ usItem ].repairable ) ) + if ( ( bStatus < 100) && ItemIsRepairable(usItem) ) { if ( gGameExternalOptions.fAdvRepairSystem ) { @@ -10459,7 +10459,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier ) INT8 bPocket = 0, bonus = -101, bToolkitPocket = NO_SLOT; // if there isn't a toolkit in his hand - if( Item[pSoldier->inv[ HANDPOS].usItem].toolkit ) + if(ItemIsToolkit(pSoldier->inv[ HANDPOS].usItem)) { bonus = Item[pSoldier->inv[ HANDPOS].usItem].RepairModifier; bToolkitPocket = HANDPOS; @@ -10469,7 +10469,7 @@ BOOLEAN MakeSureToolKitIsInHand( SOLDIERTYPE *pSoldier ) // CHRISL: Changed to dynamically determine max inventory locations. for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) { - if( Item[pSoldier->inv[ bPocket ].usItem].toolkit && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus) + if(ItemIsToolkit(pSoldier->inv[ bPocket ].usItem) && Item[pSoldier->inv[ bPocket ].usItem].RepairModifier > bonus) { bonus = Item[pSoldier->inv[ bPocket ].usItem].RepairModifier; bToolkitPocket = bPocket; @@ -10503,7 +10503,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) fTeamPanelDirty = TRUE; // if there is a MEDICAL BAG in his hand, we're set - if ( Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit ) + if (ItemIsMedicalKit(pSoldier->inv[ HANDPOS ].usItem)) { return(TRUE); } @@ -10511,7 +10511,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) // run through rest of inventory looking 1st for MEDICAL BAGS, swap the first one into hand if found for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) { - if ( Item[pSoldier->inv[ bPocket ].usItem].medicalkit ) + if (ItemIsMedicalKit(pSoldier->inv[ bPocket ].usItem)) { medkit_found = true; can_swap = true; @@ -10579,7 +10579,7 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) return FALSE; // we didn't find a medical bag, so settle for a FIRST AID KIT - if ( Item[pSoldier->inv[ HANDPOS ].usItem].firstaidkit ) + if (ItemIsFirstAidKit(pSoldier->inv[ HANDPOS ].usItem)) { return(TRUE); } @@ -10588,10 +10588,10 @@ BOOLEAN MakeSureMedKitIsInHand( SOLDIERTYPE *pSoldier , bool bAllow1stAidKit) // CHRISL: Changed to dynamically determine max inventory locations. for (bPocket = SECONDHANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket) { - if ( Item[pSoldier->inv[ bPocket ].usItem].firstaidkit ) + if (ItemIsFirstAidKit(pSoldier->inv[ bPocket ].usItem)) { // CHRISL: This needs to start with the first "non-big" pocket. - if( ( Item[ pSoldier -> inv[ HANDPOS ].usItem ].twohanded ) && ( bPocket >= SMALLPOCKSTART ) ) + if( (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && (bPocket >= SMALLPOCKSTART))) { // first move from hand to second hand SwapObjs( pSoldier, HANDPOS, SECONDHANDPOS, TRUE ); diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 2029541e..3820ddf4 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -4257,7 +4257,7 @@ BOOLEAN FireTankCannon( SOLDIERCELL *pAttacker ) { pItem = &pSoldier->inv[i]; - if ( Item[pItem->usItem].cannon ) + if (ItemIsCannon(pItem->usItem)) { PlayAutoResolveSample( Weapon[pItem->usItem].sSound, RATE_11025, 50, 1, MIDDLEPAN ); @@ -4291,7 +4291,7 @@ BOOLEAN FireAntiTankWeapon( SOLDIERCELL *pAttacker ) { pItem = &pSoldier->inv[i]; - if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || Item[pItem->usItem].cannon ) + if ( Item[pItem->usItem].usItemClass == IC_LAUNCHER || ItemIsCannon(pItem->usItem)) { pAttacker->bWeaponSlot = (INT8)i; if ( gpAR->fUnlimitedAmmo ) diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index 4cd628c2..f6e3386e 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -627,7 +627,7 @@ void HourlySmokerUpdate( ) INT8 invsize = (INT8)pSoldier->inv.size( ); // remember inventorysize, so we don't call size() repeatedly for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) // ... for all items in our inventory ... { - if ( pSoldier->inv[bLoop].exists( ) && Item[pSoldier->inv[bLoop].usItem].cigarette ) + if ( pSoldier->inv[bLoop].exists( ) && ItemIsCigarette(pSoldier->inv[bLoop].usItem) ) { pObj = &(pSoldier->inv[bLoop]); diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 826e4c7b..9f2b21a4 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -1481,7 +1481,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) } else { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !(Item[twItem->object.usItem].singleshotrocketlauncher)) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !ItemIsSingleShotRocketLauncher(twItem->object.usItem)) { EmptyWeaponMagazine( &twItem->object, &gItemPointer ); InternalMAPBeginItemPointer( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] ); @@ -6009,7 +6009,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO //original code by flugente, renamed variables to fit here, removed "min (OVERHEATING_MAX_TEMPERATURE, newValue)" for dirt to allow to go beyond maximum and deduct later the same amount if neccessary. // ... if we use overheating and item is a gun, a launcher or a barrel ... - if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[itemStack->usItem].barrel == TRUE ) ) + if ( gGameExternalOptions.fWeaponOverheating && ( Item[itemStack->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) || ItemIsBarrel(itemStack->usItem) ) ) { for(INT16 i = 0; i < itemStack->ubNumberOfObjects; ++i) // ... there might be multiple items here (item stack), so for each one ... { @@ -6017,7 +6017,7 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO FLOAT cooldownfactor = GetItemCooldownFactor(itemStack); // ... get item cooldown factor provided of attachments ... - if ( Item[itemStack->usItem].barrel == TRUE ) // ... a barrel lying around cools down a bit faster ... + if (ItemIsBarrel(itemStack->usItem)) // ... a barrel lying around cools down a bit faster ... cooldownfactor *= gGameExternalOptions.iCooldownModificatorLonelyBarrel; FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ... diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index 84f6f69f..2f8a05c2 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -4417,16 +4417,16 @@ void SetupInfo() // (Item[i].usItemClass & IC_AMMO) && (Magazine[ Item[i].ubClassIndex ].ubMagType == AMMO_BOX or AMMO_CRATE?) for (UINT16 i = 0; i < MAXITEMS; ++i) { - if (Item[i].gascan) ItemIdCache::gasCans.push_back(i); - else if (Item[i].firstaidkit) ItemIdCache::firstAidKits.push_back(i); - else if (Item[i].medicalkit) ItemIdCache::medKits.push_back(i); - else if (Item[i].toolkit) ItemIdCache::toolKits.push_back(i); + if (ItemIsGascan(i)) ItemIdCache::gasCans.push_back(i); + else if (ItemIsFirstAidKit(i)) ItemIdCache::firstAidKits.push_back(i); + else if (ItemIsMedicalKit(i)) ItemIdCache::medKits.push_back(i); + else if (ItemIsToolkit(i)) ItemIdCache::toolKits.push_back(i); else if (Item[i].usItemClass & IC_AMMO) { if (Magazine[Item[i].ubClassIndex].ubMagType == AMMO_BOX) { - if ((gGameOptions.fGunNut || !Item[i].biggunlist) - && (gGameOptions.ubGameStyle == STYLE_SCIFI || !Item[i].scifi)) + if ((gGameOptions.fGunNut || !ItemIsOnlyInTonsOfGuns(i)) + && (gGameOptions.ubGameStyle == STYLE_SCIFI || !ItemIsOnlyInScifi(i))) { // coolness runs from 1-10, so apply offset const UINT8 coolness = min(max(1, Item[i].ubCoolness), 10); diff --git a/Strategic/Strategic Event Handler.cpp b/Strategic/Strategic Event Handler.cpp index 4358c0a1..37147e6b 100644 --- a/Strategic/Strategic Event Handler.cpp +++ b/Strategic/Strategic Event Handler.cpp @@ -1334,7 +1334,7 @@ void CheckForMissingHospitalSupplies( void ) } } #endif//obsoleteCode - if ( Item[pObj->usItem].firstaidkit || Item[pObj->usItem].medicalkit || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER ) + if (ItemIsFirstAidKit(pObj->usItem) || ItemIsMedicalKit(pObj->usItem) || pObj->usItem == REGEN_BOOSTER || pObj->usItem == ADRENALINE_BOOSTER ) { for (StackedObjects::iterator iter = pObj->objectStack.begin(); iter != pObj->objectStack.end(); ++iter) { if ( iter->data.objectStatus > 60 ) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index e8969d4f..e1c24384 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -5137,7 +5137,7 @@ void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ) OBJECTTYPE *pItem; INT16 sFuelNeeded, sFuelAvailable, sFuelAdded; pItem = &pSoldier->inv[ HANDPOS ]; - if( !Item[pItem->usItem].gascan ) + if( !ItemIsGascan(pItem->usItem)) { #ifdef JA2BETAVERSION CHAR16 str[ 100 ]; diff --git a/Strategic/Strategic Transport Groups.cpp b/Strategic/Strategic Transport Groups.cpp index f8e19dab..16916e3f 100644 --- a/Strategic/Strategic Transport Groups.cpp +++ b/Strategic/Strategic Transport Groups.cpp @@ -500,18 +500,18 @@ void UpdateTransportGroupInventory() if (!ItemIsLegal(i, TRUE)) continue; if ((Item[i].usItemClass & IC_AMMO) == 0 && (Item[i].iTransportGroupMaxProgress == 0 || Item[i].iTransportGroupMinProgress > progress || progress > Item[i].iTransportGroupMaxProgress)) continue; - if (Item[i].medical) + if (ItemIsMedical(i)) { - if (Item[i].firstaidkit) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i); - else if (Item[i].medicalkit) itemMap[MEDICAL_MEDKITS].push_back(i); + if (ItemIsFirstAidKit(i)) itemMap[MEDICAL_FIRSTAIDKITS].push_back(i); + else if (ItemIsMedicalKit(i)) itemMap[MEDICAL_MEDKITS].push_back(i); else itemMap[MEDICAL_OTHER].push_back(i); } - else if (Item[i].gascan) itemMap[GAS_CANS].push_back(i); - else if (Item[i].toolkit) itemMap[TOOL_KITS].push_back(i); + else if (ItemIsGascan(i)) itemMap[GAS_CANS].push_back(i); + else if (ItemIsToolkit(i)) itemMap[TOOL_KITS].push_back(i); else if (HasItemFlag(i, RADIO_SET)) itemMap[RADIOS].push_back(i); else if (Item[i].usItemClass & IC_GRENADE) { - if (Item[i].glgrenade == 0 + if (!ItemIsGLgrenade(i) && Item[i].attachmentclass != AC_GRENADE // not for a grenade launcher && Item[i].attachmentclass != AC_ROCKET) // not for a rocket launcher itemMap[GRENADE_THROWN].push_back(i); @@ -523,7 +523,7 @@ void UpdateTransportGroupInventory() itemMap[BACKPACKS].push_back(i); } } - else if (Item[i].camouflagekit) itemMap[CAMO_KITS].push_back(i); + else if (ItemIsCamoKit(i)) itemMap[CAMO_KITS].push_back(i); else if (Item[i].usItemClass & IC_MISC) { switch (Item[i].attachmentclass) @@ -555,11 +555,11 @@ void UpdateTransportGroupInventory() { itemMap[GUNS].push_back(i); } - else if (Item[i].grenadelauncher) + else if (ItemIsGrenadeLauncher(i)) { itemMap[GRENADELAUNCHERS].push_back(i); } - else if (Item[i].rocketlauncher) + else if (ItemIsRocketLauncher(i)) { itemMap[ROCKETLAUNCHERS].push_back(i); } @@ -713,7 +713,7 @@ void UpdateTransportGroupInventory() case ROCKETLAUNCHERS: { - addItemToInventory(pSoldier, id, Item[id].singleshotrocketlauncher ? 3 : 1); + addItemToInventory(pSoldier, id, ItemIsSingleShotRocketLauncher(id) ? 3 : 1); const UINT16 launchableId = PickARandomLaunchable(id); if (launchableId == 0) continue; // no launchable matches, skip @@ -773,7 +773,7 @@ void UpdateTransportGroupInventory() for (int i = 0; i < pSoldier->inv.size(); ++i) { OBJECTTYPE* item = &pSoldier->inv[i]; - if (item->exists() && Item[item->usItem].defaultundroppable == FALSE) + if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE) { item->fFlags &= ~OBJECT_UNDROPPABLE; } @@ -861,7 +861,7 @@ void UpdateTransportGroupInventory() for (int i = 0; i < pSoldier->inv.size(); ++i) { OBJECTTYPE* item = &pSoldier->inv[i]; - if (item->exists() && Item[item->usItem].defaultundroppable == FALSE) + if (item->exists() && ItemIsUndroppableByDefault(item->usItem) == FALSE) { item->fFlags &= ~OBJECT_UNDROPPABLE; } diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 655d6b50..bdf89983 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9797,12 +9797,12 @@ void BltCharInvPanel() UINT32 fontColour = FONT_MCOLOR_RED; // robot targeting bonus - if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { swprintf(text, szRobotText[ROBOT_TEXT_LASER]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision) + else if (ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { swprintf(text, szRobotText[ROBOT_TEXT_NIGHT_VISION]); fontColour = FONT_MCOLOR_LTGREEN; @@ -9825,7 +9825,7 @@ void BltCharInvPanel() swprintf(text, szRobotText[ROBOT_TEXT_STAT_BONUSES]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + else if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { swprintf(text, szRobotText[ROBOT_TEXT_CAMO]); fontColour = FONT_MCOLOR_LTGREEN; @@ -9858,12 +9858,12 @@ void BltCharInvPanel() swprintf(text, L"%s", szRobotText[ROBOT_TEXT_RADIO]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].metaldetector == 1) + else if (ItemIsMetalDetector(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem)) { swprintf(text, L"%s", szRobotText[ROBOT_TEXT_METAL_DETECTOR]); fontColour = FONT_MCOLOR_LTGREEN; } - else if (Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].xray == 1) + else if (ItemHasXRay(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem)) { swprintf(text, L"%s", szRobotText[ROBOT_TEXT_XRAY]); fontColour = FONT_MCOLOR_LTGREEN; @@ -10442,7 +10442,7 @@ void MAPInvClickCallback( MOUSE_REGION *pRegion, INT32 iReason ) { if ( !InItemDescriptionBox( ) ) { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[pSoldier->inv[ uiHandPos ].usItem].singleshotrocketlauncher) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[pSoldier->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (pSoldier->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(pSoldier->inv[ uiHandPos ].usItem) ) { EmptyWeaponMagazine( &(pSoldier->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); InternalMAPBeginItemPointer( pSoldier ); diff --git a/Tactical/Animation Control.cpp b/Tactical/Animation Control.cpp index d24eb88d..fb2d9275 100644 --- a/Tactical/Animation Control.cpp +++ b/Tactical/Animation Control.cpp @@ -4297,10 +4297,10 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // ADJUST BASED ON ITEM IN HAND.... usItem = pSoldier->inv[ HANDPOS ].usItem; - if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !Item[usItem].rocketlauncher) + if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !ItemIsRocketLauncher(usItem) ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[ usItem ].twohanded ) ) + if (ItemIsTwoHanded(usItem)) { ubWaterHandIndex = 0; } @@ -4321,7 +4321,7 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta // ADJUST BASED ON ITEM IN HAND.... usItem = pSoldier->inv[ HANDPOS ].usItem; - if ( !(Item[ usItem ].usItemClass == IC_GUN ) && !(Item[ usItem ].usItemClass == IC_LAUNCHER ) || Item[usItem].rocketlauncher ) + if ( !(Item[ usItem ].usItemClass == IC_GUN ) && !(Item[ usItem ].usItemClass == IC_LAUNCHER ) || ItemIsRocketLauncher(usItem) ) { if ( usAnimState == STANDING ) { @@ -4342,10 +4342,10 @@ UINT16 DetermineSoldierAnimationSurface( SOLDIERTYPE *pSoldier, UINT16 usAnimSta else { // CHECK FOR HANDGUN - if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !Item[usItem].rocketlauncher ) + if ( ( Item[ usItem ].usItemClass == IC_GUN || Item[ usItem ].usItemClass == IC_LAUNCHER ) && !ItemIsRocketLauncher(usItem) ) { // if ( !(Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( !(Item[ usItem ].twohanded ) ) + if ( !ItemIsTwoHanded(usItem) ) { // SANDRO - new anim for running with pistol by PasHancock if ( usAnimState == RUNNING ) diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index b7573fce..59b64a9a 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -71,7 +71,6 @@ void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemIndex, UIN void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ); void ArmsDealerGetsFreshStock( UINT8 ubArmsDealer, UINT16 usItemIndex, UINT8 ubNumItems ); -BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ); UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ); BOOLEAN DoesItemAppearInDealerInventoryList( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); @@ -85,8 +84,6 @@ BOOLEAN CanThisItemBeSoldToSimulatedCustomer( UINT8 ubArmsDealerID, UINT16 usIte void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ); -BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ); - BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime ); ARMS_DEALER_STATUS& ARMS_DEALER_STATUS::operator=(const OLD_ARMS_DEALER_STATUS_101& status) @@ -961,7 +958,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) return( ARMS_DEALER_HANDGUNCLASS ); break; case RIFLECLASS: - if ( ItemIsARocketRifle( usItem ) ) + if (ItemHasFingerPrintID( usItem ) ) return( ARMS_DEALER_ROCKET_RIFLE ); else return( ARMS_DEALER_RIFLECLASS ); @@ -1010,15 +1007,15 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) { if ( Item [usItem].alcohol > 0.0f ) return( ARMS_DEALER_ALCOHOL ); - else if ( Item [usItem].electronic ) + else if (ItemIsElectronic(usItem)) return( ARMS_DEALER_ELECTRONICS ); - else if ( Item [usItem].hardware ) + else if (ItemIsHardware(usItem)) return( ARMS_DEALER_HARDWARE ); - else if ( Item [usItem].medical ) + else if (ItemIsMedical(usItem)) return( ARMS_DEALER_MEDICAL ); - else if ( Item [usItem].attachment ) + else if (ItemIsAttachment(usItem)) return( ARMS_DEALER_ATTACHMENTS ); - else if ( Item [usItem].detonator || Item [usItem].remotedetonator || Item [usItem].remotetrigger ) + else if (ItemIsDetonator(usItem) || ItemIsRemoteDetonator(usItem) || ItemIsRemoteTrigger(usItem)) return( ARMS_DEALER_DETONATORS ); else return( ARMS_DEALER_MISC ); @@ -1076,7 +1073,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) return( ARMS_DEALER_AMMO ); break; case IC_FACE: - if (Item[usItem].electronic ) + if (ItemIsElectronic(usItem)) return ARMS_DEALER_ELECTRONICS; else return ARMS_DEALER_FACE; @@ -1278,8 +1275,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) // uiFlags = Item[ usItemIndex ].fFlags; // can't repair anything that's not repairable! -// if ( !( uiFlags & ITEM_REPAIRABLE ) ) - if ( !( Item[ usItemIndex ].repairable ) ) + if ( !ItemIsRepairable(usItemIndex) ) { return(FALSE); } @@ -1297,8 +1293,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) case ARMS_DEALER_PERKO: #endif // repairs ANYTHING non-electronic -// if ( !( uiFlags & ITEM_ELECTRONIC ) ) - if ( !( Item[ usItemIndex ].electronic ) ) + if ( !ItemIsElectronic(usItemIndex) ) { return(TRUE); } @@ -1306,8 +1301,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) case ARMS_DEALER_FREDO: // repairs ONLY electronics -// if ( uiFlags & ITEM_ELECTRONIC ) - if ( Item[ usItemIndex ].electronic ) + if (ItemIsElectronic(usItemIndex)) { return(TRUE); } @@ -1318,7 +1312,7 @@ BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ) // Flugente: if we set this guy to be a repairguy, and this item is NOT electronic, well, we can if ( armsDealerInfo[ubArmsDealer].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) { - if ( !( Item[ usItemIndex ].electronic ) ) + if ( !ItemIsElectronic(usItemIndex) ) return(TRUE); else return(FALSE); @@ -1369,7 +1363,7 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ) // if it's a damagable item, and not a liquid (those are always sold full) // if ( ( Item[ usItemIndex ].fFlags & ITEM_DAMAGEABLE ) && !ItemContainsLiquid( usItemIndex ) ) - if ( ( Item[ usItemIndex ].damageable ) && !ItemContainsLiquid( usItemIndex ) ) + if (ItemIsDamageable(usItemIndex) && !ItemContainsLiquid(usItemIndex)) { // if he ONLY has used items, or 50% of the time if he carries both used & new items if ( ( armsDealerInfo[ ubArmsDealer ].uiFlags & ARMS_DEALER_ONLY_USED_ITEMS ) || @@ -1383,25 +1377,6 @@ UINT8 DetermineDealerItemCondition( UINT8 ubArmsDealer, UINT16 usItemIndex ) return( ubCondition); } -BOOLEAN ItemContainsLiquid( UINT16 usItemIndex ) -{ - return Item[usItemIndex].containsliquid; - - //switch ( usItemIndex ) - //{ - // case CANTEEN: - // case BEER: - // case ALCOHOL: - // case JAR_HUMAN_BLOOD: - // case JAR_CREATURE_BLOOD: - // case JAR_QUEEN_CREATURE_BLOOD: - // case JAR_ELIXIR: - // case GAS_CAN: - // return( TRUE ); - //} - - //return( FALSE ); -} bool ItemIsSpecial(DEALER_SPECIAL_ITEM& item) { @@ -1839,7 +1814,7 @@ void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE // they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this // ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets. //CHRISL: If we're working with a SingleShotRocketLauncher, we need ubGunShotsLeft to equal 1 - if(Item[pObject->usItem].singleshotrocketlauncher == TRUE) + if(ItemIsSingleShotRocketLauncher(pObject->usItem)) (*pObject)[subObject]->data.gun.ubGunShotsLeft = 1; else (*pObject)[subObject]->data.gun.ubGunShotsLeft = 0; @@ -1863,7 +1838,7 @@ void GiveObjectToArmsDealerForRepair( UINT8 ubArmsDealer, OBJECTTYPE *pObject, U Assert( CanDealerRepairItem( ubArmsDealer, pObject->usItem ) ); // c) Actually damaged, or a rocket rifle (being reset) - Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); + Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemHasFingerPrintID( pObject->usItem ) ); /* ARM: Can now repair with removeable attachments still attached... // d) Already stripped of all *detachable* attachments @@ -1898,7 +1873,7 @@ void GiveItemToArmsDealerforRepair( UINT8 ubArmsDealer, OBJECTTYPE* pObject, UIN Assert( DoesDealerDoRepairs( ubArmsDealer ) ); Assert( (*pObject)[0]->data.objectStatus > 0 ); - Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemIsARocketRifle( pObject->usItem ) ); + Assert( ( (*pObject)[0]->data.objectStatus < 100 ) || ItemHasFingerPrintID( pObject->usItem ) ); // figure out the earliest the repairman will be free to start repairing this item uiTimeWhenFreeToStartIt = WhenWillRepairmanBeAllDoneRepairing( ubArmsDealer ); @@ -1995,8 +1970,7 @@ UINT32 CalculateSimpleItemRepairTime( UINT8 ubArmsDealer, UINT16 usItemIndex, IN // repairs on electronic items take twice as long if the guy doesn't have the skill // for dealers, this means anyone but Fredo the Electronics guy takes twice as long (but doesn't charge double) // (Mind you, current he's the ONLY one who CAN repair Electronics at all! Oh well.) -// if( ( Item[ usItemIndex ].fFlags & ITEM_ELECTRONIC ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) - if( ( Item[ usItemIndex ].electronic ) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) + if( ItemIsElectronic(usItemIndex) && ( ubArmsDealer != ARMS_DEALER_FREDO ) ) { uiTimeToRepair *= 2; } @@ -2065,7 +2039,7 @@ UINT32 CalculateSimpleItemRepairCost( UINT8 ubArmsDealer, UINT16 usItemIndex, IN } */ - if ( ItemIsARocketRifle( usItemIndex ) ) + if (ItemHasFingerPrintID( usItemIndex ) ) { // resetting imprinting for a rocket rifle costs something extra even if rifle is at 100% uiRepairCost += 100; @@ -2167,7 +2141,7 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN // the rest of this function applies only to the "general" dealers ( Jake, Keith, and Franz ) // Micky & Gabby specialize in creature parts & such, the others don't buy these at all (exception: jars) - if ( ( !Item[usItemIndex].jar ) && + if ( ( !ItemIsJar(usItemIndex)) && ( DoesItemAppearInDealerInventoryList( ARMS_DEALER_MICKY, usItemIndex, TRUE ) || DoesItemAppearInDealerInventoryList( ARMS_DEALER_GABBY, usItemIndex, TRUE ) ) ) { @@ -2214,7 +2188,7 @@ UINT16 CalcValueOfItemToDealer( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN { // exception: Gas (Jake's) // if ( usItemIndex != GAS_CAN ) - if ( !Item[usItemIndex].gascan ) + if ( !ItemIsGascan(usItemIndex)) { // they pay only 1/3 of true value! usValueToThisDealer /= 3; @@ -2244,11 +2218,6 @@ void GuaranteeMinimumAlcohol( UINT8 ubArmsDealer ) GuaranteeAtLeastXItemsOfIndex( ubArmsDealer, ALCOHOL, ( UINT8 ) ( GetDealersMaxItemAmount( ubArmsDealer, ALCOHOL ) / 3 ) ); } -BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ) -{ - return( Item[sItemIndex].fingerprintid ); -} - BOOLEAN GetArmsDealerShopHours( UINT8 ubArmsDealer, UINT32 *puiOpeningTime, UINT32 *puiClosingTime ) { SOLDIERTYPE *pSoldier; diff --git a/Tactical/ArmsDealerInvInit.cpp b/Tactical/ArmsDealerInvInit.cpp index 951f556a..c8376592 100644 --- a/Tactical/ArmsDealerInvInit.cpp +++ b/Tactical/ArmsDealerInvInit.cpp @@ -944,8 +944,7 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA } // items normally not sold at shops are unsuitable -// if ( Item[ usItemIndex ].fFlags & ITEM_NOT_BUYABLE ) - if ( Item[ usItemIndex ].notbuyable ) + if (ItemIsNotBuyable(usItemIndex)) { return(ITEM_SUITABILITY_NONE); } @@ -971,7 +970,7 @@ UINT8 GetCurrentSuitabilityForItem( INT8 bArmsDealer, UINT16 usItemIndex, BOOLEA // case JAR: // case JAR_ELIXIR: // case JAR_CREATURE_BLOOD: - if ( Item[usItemIndex].medical || Item[usItemIndex].canteen || Item[usItemIndex].medicalkit || Item[usItemIndex].locksmithkit || Item[usItemIndex].toolkit || Item[usItemIndex].crowbar || Item[usItemIndex].jar ) + if (ItemIsMedical(usItemIndex) || ItemIsCanteen(usItemIndex) || ItemIsMedicalKit(usItemIndex) || ItemIsLocksmithKit(usItemIndex) || ItemIsToolkit(usItemIndex) || ItemIsCrowbar(usItemIndex) || ItemIsJar(usItemIndex) ) return(ITEM_SUITABILITY_ALWAYS); //} @@ -1455,8 +1454,7 @@ UINT8 GetDealerItemCategoryNumber( UINT16 usItemIndex ) BOOLEAN CanDealerItemBeSoldUsed( UINT16 usItemIndex ) { -// if ( !( Item[ usItemIndex ].fFlags & ITEM_DAMAGEABLE ) ) - if ( !( Item[ usItemIndex ].damageable ) ) + if ( !ItemIsDamageable(usItemIndex) ) return(FALSE); // certain items, although they're damagable, shouldn't be sold in a used condition diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index f89863a9..b4324511 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -1274,7 +1274,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType, { case MINES_DRAW_PLAYERTEAM_NETWORKS: { - if ( Item[pObj->usItem].tripwire == 1 ) + if (ItemIsTripwire(pObj->usItem)) { // if we're already marked as MINE_BOMB, switch to MINE_BOMB_AND_WIRE if ( bOverlayType == MINE_BOMB ) @@ -1314,7 +1314,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType, case MINES_DRAW_NETWORKCOLOURING: { - if ( Item[pObj->usItem].tripwire == 1 ) + if (ItemIsTripwire(pObj->usItem)) { // determine if wire is of the network we're searching for // determine this tripwire's flag @@ -1342,7 +1342,7 @@ void DetermineMineDisplayInTile( INT32 sGridNo, INT8 bLevel, INT8& bOverlayType, case MINES_DRAW_NET_C: case MINES_DRAW_NET_D: { - if ( Item[pObj->usItem].tripwire == 1 ) + if (ItemIsTripwire(pObj->usItem)) { UINT32 specificnet = 0; switch ( gubDrawMode ) diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index cec2974c..0c7c281c 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -205,7 +205,7 @@ BOOLEAN ApplyDrugs_New( SOLDIERTYPE *pSoldier, UINT16 usItem, UINT16 uStatusUsed gMercProfiles[pSoldier->ubProfile].ubNumTimesDrugUseInLifetime++; } - if ( Item[usItem].cigarette ) + if (ItemIsCigarette(usItem)) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_MERC_TOOK_CIGARETTE], pSoldier->GetName( ), ShortItemNames[usItem] ); } diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 4759b4ac..6eaa12e8 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -1950,7 +1950,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // check first face slot if (uiFaceItemOne != NONE) { - if (Item[uiFaceItemOne].gasmask) + if (ItemIsGasmask(uiFaceItemOne)) uiFaceItemOne = 1; else if (Item[uiFaceItemOne].nightvisionrangebonus > 0) uiFaceItemOne = 2; @@ -1965,7 +1965,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // check second face slot if (uiFaceItemTwo != NONE) { - if (Item[uiFaceItemTwo].gasmask) + if (ItemIsGasmask(uiFaceItemTwo)) uiFaceItemTwo = 21; else if (Item[uiFaceItemTwo].nightvisionrangebonus > 0) uiFaceItemTwo = 42; @@ -2250,7 +2250,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sIconIndex_Assignment = 0; fDoIcon_Assignment = TRUE; // Show repair points if merc has a toolkit in his hand. Otherwise show cleaning points. - if (Item[pSoldier->inv[HANDPOS].usItem].toolkit) + if (ItemIsToolkit(pSoldier->inv[HANDPOS].usItem)) sPtsAvailable = CalculateRepairPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts, FALSE); else sPtsAvailable = CalculateCleaningPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts); diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 0b656d49..872a4958 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -174,7 +174,7 @@ BOOLEAN ApplyFood( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObject, UINT16 usPointsTo return( FALSE); // workaround: canteens with 1% status are treated as 'empty'. They cannot be consumed, but refilled - if ( Item[pObject->usItem].canteen == TRUE && (*pObject)[0]->data.objectStatus == 1 ) + if (ItemIsCanteen(pObject->usItem) && (*pObject)[0]->data.objectStatus == 1 ) return( FALSE); // do we eat or drink this stuff? @@ -693,7 +693,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) // if fcanteensonly is TRUE, omit everything that is not a canteen if ( fcanteensonly ) { - if ( Item[pObj->usItem].canteen == FALSE ) + if ( !ItemIsCanteen(pObj->usItem)) continue; } else @@ -707,7 +707,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) if ( foodcondition < FOOD_BAD_THRESHOLD ) continue; - if ( Item[pObj->usItem].canteen == TRUE ) + if (ItemIsCanteen(pObj->usItem)) continue; } @@ -741,7 +741,7 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) // if fcanteensonly is TRUE, omit everything that is not a canteen if ( fcanteensonly ) { - if ( Item[pObj->usItem].canteen == FALSE ) + if (!ItemIsCanteen(pObj->usItem)) continue; } @@ -846,7 +846,7 @@ void SectorFillCanteens( void ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen (that can have drink points) ... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -878,7 +878,7 @@ void SectorFillCanteens( void ) if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... { // ... if Item exists and is a canteen (only those are refillable) ... - if ( Item[gWorldItems[ uiCount ].object.usItem].canteen && Food[Item[gWorldItems[ uiCount ].object.usItem].foodtype].bDrinkPoints > 0) + if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem) && Food[Item[gWorldItems[ uiCount ].object.usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... @@ -920,7 +920,7 @@ void SectorFillCanteens( void ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen and is NOT a water drum... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && (Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) && !HasItemFlag(pSoldier->inv[bLoop].usItem, (WATER_DRUM))) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && (Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) && !HasItemFlag(pSoldier->inv[bLoop].usItem, (WATER_DRUM))) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -973,7 +973,7 @@ void SectorFillCanteens( void ) if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... { // ... if Item exists and is a canteen (only those are refillable) ... - if ( Item[gWorldItems[ uiCount ].object.usItem].canteen ) + if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem)) { OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... @@ -1031,7 +1031,7 @@ OBJECTTYPE* GetUsableWaterDrumInSector( void ) if( gWorldItems[ uiCount ].fExists ) // ... if item exists ... { // ... if Item exists and is a canteen (only those are refillable) ... - if ( Item[gWorldItems[ uiCount ].object.usItem].canteen ) + if (ItemIsCanteen(gWorldItems[ uiCount ].object.usItem)) { OBJECTTYPE* pObj = &(gWorldItems[ uiCount ].object); // ... get pointer for this item ... @@ -1077,7 +1077,7 @@ void SoldierAutoFillCanteens(SOLDIERTYPE *pSoldier) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen (that can have drink points) ... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -1118,7 +1118,7 @@ BOOLEAN HasFoodInInventory( SOLDIERTYPE *pSoldier, BOOLEAN fCheckFood, BOOLEAN f if ( fCheckDrink && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints ) { - if ( Item[pSoldier->inv[bLoop].usItem].canteen ) + if (ItemIsCanteen(pSoldier->inv[bLoop].usItem)) { // empty canteens retain 1% status, so check ether something is in them if ( pSoldier->inv[bLoop][0]->data.objectStatus > 1 ) @@ -1170,7 +1170,7 @@ void DrinkFromWaterTap( SOLDIERTYPE* pSoldier ) for (INT8 bLoop = 0; bLoop < invsize; ++bLoop) // ... for all items in our inventory ... { // ... if Item exists and is canteen (that can have drink points) ... - if (pSoldier->inv[bLoop].exists() == true && Item[pSoldier->inv[bLoop].usItem].canteen && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) + if (pSoldier->inv[bLoop].exists() == true && ItemIsCanteen(pSoldier->inv[bLoop].usItem) && Food[Item[pSoldier->inv[bLoop].usItem].foodtype].bDrinkPoints > 0) { OBJECTTYPE* pObj = &(pSoldier->inv[bLoop]); // ... get pointer for this item ... @@ -1197,4 +1197,4 @@ void DrinkFromWaterTap( SOLDIERTYPE* pSoldier ) } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szInteractiveActionText[8], pSoldier->GetName( ) ); -} \ No newline at end of file +} diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 7e9c6476..b7d9414b 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -319,7 +319,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa pSoldier->ubProfile != NO_PROFILE && pTargetSoldier && Item[usHandItem].usItemClass != IC_MEDKIT && - !Item[usHandItem].gascan && + !ItemIsGascan(usHandItem) && !ItemCanBeAppliedToOthers(usHandItem) && !HasItemFlag(usHandItem, EMPTY_BLOOD_BAG) && !HasItemFlag( usHandItem, MEDICAL_SPLINT ) ) @@ -473,8 +473,8 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].usItemClass == IC_GUN || Item[ usHandItem ].usItemClass == IC_THROWING_KNIFE ) { // WEAPONS - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem,Item[usHandItem].fingerprintid,pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID,pSoldier->ubProfile)); - if ( Item[usHandItem].fingerprintid ) + DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleItem: checking for fingerprintID, item id = %d,id required = %d, imprint id = %d, soldier id = %d",usHandItem, ItemHasFingerPrintID(usHandItem), pSoldier->inv[ pSoldier->ubAttackingHand ][0]->data.ubImprintID,pSoldier->ubProfile)); + if (ItemHasFingerPrintID(usHandItem)) { // check imprint ID // NB not-imprinted value is NO_PROFILE @@ -807,7 +807,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } // ATE: Here to make cursor go back to move after LAW shot... - if ( fFromUI && Item[usHandItem].singleshotrocketlauncher) + if ( fFromUI && ItemIsSingleShotRocketLauncher(usHandItem) ) { guiPendingOverrideEvent = A_CHANGE_TO_MOVE; } @@ -969,7 +969,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa BOOLEAN fCorpse = FALSE; if(pCorpse != NULL) fCorpse = IsValidDecapitationCorpse( pCorpse ); - if ( Item[usHandItem].wirecutters && pTargetSoldier == NULL && !pCorpse ) // Madd: quick fix to allow wirecutter/knives + if (ItemIsWirecutters(usHandItem) && pTargetSoldier == NULL && !pCorpse ) // Madd: quick fix to allow wirecutter/knives { // See if we can get there to stab sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); @@ -1025,7 +1025,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - if ( Item[usHandItem].toolkit ) + if (ItemIsToolkit(usHandItem)) { UINT8 ubMercID; BOOLEAN fVehicle = FALSE; @@ -1098,7 +1098,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - if ( Item[usHandItem].gascan ) + if (ItemIsGascan(usHandItem)) { UINT8 ubMercID; INT32 sVehicleGridNo=-1; @@ -1170,7 +1170,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } - if ( Item[usHandItem].jar ) + if (ItemIsJar(usHandItem)) { sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); @@ -1614,7 +1614,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - if ( Item[usHandItem].canandstring ) + if (ItemIsCanAndString(usHandItem)) { STRUCTURE *pStructure; LEVELNODE *pIntTile; @@ -1686,7 +1686,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) ) { DeductPoints( pSoldier, sAPCost, 0 ); - if ( Item[usHandItem].xray ) + if (ItemHasXRay(usHandItem)) { PlayJA2Sample( USE_X_RAY_MACHINE, RATE_11025, SoundVolume( HIGHVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); @@ -1867,7 +1867,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa sAPCost = MinAPsToAttack( pSoldier, sTargetGridNo, TRUE, pSoldier->aiData.bAimTime, 0 ); // Check if these is room to place mortar! - if ( Item[usHandItem].mortar ) + if (ItemIsMortar(usHandItem)) { ubDirection = (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ); @@ -1881,7 +1881,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa //pSoldier->flags.fDontChargeAPsForStanceChange = TRUE;//dnl ch72 270913 no reason why not charge for stance change } - else if ( Item[usHandItem].grenadelauncher )//usHandItem == GLAUNCHER || usHandItem == UNDER_GLAUNCHER ) + else if (ItemIsGrenadeLauncher(usHandItem))//usHandItem == GLAUNCHER || usHandItem == UNDER_GLAUNCHER ) { GetAPChargeForShootOrStabWRTGunRaises( pSoldier, sTargetGridNo, TRUE, &fAddingTurningCost, &fAddingRaiseGunCost, pSoldier->aiData.bAimTime ); usTurningCost = CalculateTurningCost(pSoldier, usHandItem, fAddingTurningCost); @@ -1960,7 +1960,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa if ( Item[ usHandItem ].ubCursor == INVALIDCURS ) { // Found detonator... - if ( HasAttachmentOfClass( &(pSoldier->inv[pSoldier->ubAttackingHand]), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || Item[usHandItem].tripwire ) + if ( HasAttachmentOfClass( &(pSoldier->inv[pSoldier->ubAttackingHand]), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || ItemIsTripwire(usHandItem)) { StartBombMessageBox( pSoldier, sGridNo ); @@ -1980,7 +1980,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) { // Does this have detonator that needs info? - if ( HasAttachmentOfClass( &(pSoldier->inv[ HANDPOS ] ), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || Item[ (&(pSoldier->inv[ HANDPOS ] ))->usItem ].tripwire == 1) + if ( HasAttachmentOfClass( &(pSoldier->inv[ HANDPOS ] ), (AC_DETONATOR | AC_REMOTEDET | AC_DEFUSE) ) || ItemIsTripwire((&(pSoldier->inv[ HANDPOS ] ))->usItem) ) { StartBombMessageBox( pSoldier, sGridNo ); } @@ -2003,7 +2003,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) if ( iResult >= 0 ) { // Less explosives gain for placing tripwire - if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire ) + if (ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem)) StatChange( pSoldier, EXPLODEAMT, 1, FALSE ); else if ( HasItemFlag( (pSoldier->inv[HANDPOS]).usItem, BEARTRAP ) ) StatChange( pSoldier, MECHANAMT, 10, FALSE ); @@ -2027,7 +2027,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) pSoldier->inv[ HANDPOS ][0]->data.bTrap++; // anv: additional tile properties - modify trap level depending on its placement - if(gGameExternalOptions.fAdditionalTileProperties && Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) + if(gGameExternalOptions.fAdditionalTileProperties && !ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem)) { ADDITIONAL_TILE_PROPERTIES_VALUES zAllTileValues = GetAllAdditonalTilePropertiesForGrid( sGridNo, pSoldier->pathing.bLevel ); pSoldier->inv[ HANDPOS ][0]->data.bTrap += zAllTileValues.bTrapBonus; @@ -2072,7 +2072,7 @@ void HandleSoldierDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) StatChange( pSoldier, EXPLODEAMT, 10, FROM_FAILURE ); // oops! How badly did we screw up? - if ( iResult < -20 && Item[ pSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) + if ( iResult < -20 && !ItemIsTripwire(pSoldier->inv[ HANDPOS ].usItem) ) { // OOPS! ... BOOM! IgniteExplosion( NOBODY, pSoldier->sX, pSoldier->sY, (INT16) (gpWorldLevelData[pSoldier->sGridNo].sHeight), pSoldier->sGridNo, pSoldier->inv[ HANDPOS ].usItem, pSoldier->pathing.bLevel, pSoldier->ubDirection, &pSoldier->inv[ HANDPOS ] ); @@ -2576,7 +2576,7 @@ void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGr if ( ItemExistsAtLocation( sGridNo, iItemIndex, pSoldier->pathing.bLevel ) ) { // Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the items' existence already... - if ( gWorldItems[ iItemIndex ].object.exists() && gWorldItems[ iItemIndex ].object.fFlags & OBJECT_ARMED_BOMB && Item[gWorldItems[ iItemIndex ].object.usItem].tripwireactivation == 1 ) + if ( gWorldItems[ iItemIndex ].object.exists() && gWorldItems[ iItemIndex ].object.fFlags & OBJECT_ARMED_BOMB && ItemHasTripwireActivation(gWorldItems[ iItemIndex ].object.usItem) ) { gpBoobyTrapItemPool = GetItemPoolForIndex( sGridNo, iItemIndex, pSoldier->pathing.bLevel ); gpBoobyTrapSoldier = pSoldier; @@ -2998,8 +2998,7 @@ OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bV if ( TERRAIN_IS_WATER( bTerrainID) ) { - // if ( Item[ pObject->usItem ].fFlags & ITEM_SINKS ) - if ( Item[ pObject->usItem ].sinks ) + if (ItemSinks(pObject->usItem)) { return( NULL ); } @@ -3340,7 +3339,7 @@ BOOLEAN MarblesExistAtLocation( INT32 sGridNo, UINT8 ubLevel, INT32 * piItemInde pItemPoolTemp = pItemPool; while( pItemPoolTemp != NULL ) { - if ( Item[gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem].marbles ) + if (ItemIsMarbles(gWorldItems[ pItemPoolTemp->iItemIndex ].object.usItem)) { if ( piItemIndex ) { @@ -5154,7 +5153,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo ) gpTempSoldier = pSoldier; gsTempGridNo = sGridNo; - if (Item[ pSoldier->inv[HANDPOS].usItem].remotetrigger ) + if (ItemIsRemoteTrigger(pSoldier->inv[HANDPOS].usItem)) { wcscpy( gzUserDefinedButton[0], L"1" ); wcscpy( gzUserDefinedButton[1], L"2" ); @@ -5249,7 +5248,7 @@ void StartBombMessageBox( SOLDIERTYPE * pSoldier, INT32 sGridNo ) { DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ CHOOSE_REMOTE_FREQUENCY_STR ], GAME_SCREEN, MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, BombMessageBoxCallBack, NULL ); } - else if ( Item[ (&(pSoldier->inv[HANDPOS]))->usItem ].tripwire == 1 ) + else if (ItemIsTripwire((&(pSoldier->inv[HANDPOS]))->usItem)) { wcscpy( gzUserDefinedButton[0], L"1-A" ); wcscpy( gzUserDefinedButton[1], L"1-B" ); @@ -5573,10 +5572,10 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) if (gpTempSoldier) { // sevenfm: remember last tripwire network settings - if(Item[ gpTempSoldier->inv[HANDPOS].usItem ].tripwire ) + if(ItemIsTripwire(gpTempSoldier->inv[HANDPOS].usItem)) gubLastTripwire = ubExitValue; - if (Item[ gpTempSoldier->inv[HANDPOS].usItem ].remotetrigger ) + if (ItemIsRemoteTrigger(gpTempSoldier->inv[HANDPOS].usItem)) { // Flugente: jamming can prevent bomb activation if ( !gSkillTraitValues.fVOJammingBlocksRemoteBombs || !SectorJammed() ) @@ -5602,7 +5601,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) if ( iResult >= 0 ) { // Less explosives gain for placing tripwire - if ( Item[ gpTempSoldier->inv[ HANDPOS ].usItem ].tripwire == 1 ) + if (ItemIsTripwire(gpTempSoldier->inv[ HANDPOS ].usItem)) StatChange( gpTempSoldier, EXPLODEAMT, 5, FALSE ); else if ( HasItemFlag( (gpTempSoldier->inv[HANDPOS]).usItem, BEARTRAP ) ) StatChange( gpTempSoldier, MECHANAMT, 10, FALSE ); @@ -5643,7 +5642,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) else { // we can't blow up tripwire, no matter how bad we fail - if ( Item[ gpTempSoldier->inv[ HANDPOS ].usItem ].tripwire != 1 ) + if ( !ItemIsTripwire(gpTempSoldier->inv[ HANDPOS ].usItem)) { // OOPS! ... BOOM! IgniteExplosion( NOBODY, gpTempSoldier->sX, gpTempSoldier->sY, (INT16) (gpWorldLevelData[gpTempSoldier->sGridNo].sHeight), gpTempSoldier->sGridNo, gpTempSoldier->inv[ HANDPOS ].usItem, gpTempSoldier->pathing.bLevel, gpTempSoldier->ubDirection, &gpTempSoldier->inv[ HANDPOS ] ); @@ -5699,7 +5698,7 @@ void BombMessageBoxCallBack( UINT8 ubExitValue ) gTempObject[0]->data.ubDirection = gpTempSoldier->ubDirection; // Flugente: direction of bomb is direction of soldier // Flugente: tripwire was called through a messagebox, but has to be buried nevertheless - if ( Item[ (&gTempObject)->usItem ].tripwire == 1 ) + if (ItemIsTripwire((&gTempObject)->usItem)) { AddItemToPool( gsTempGridNo, &gTempObject, BURIED, gpTempSoldier->pathing.bLevel, WORLD_ITEM_ARMED_BOMB, 0 ); // sevenfm: set flag only if planting tripwire @@ -5839,7 +5838,7 @@ BOOLEAN HandItemWorks( SOLDIERTYPE *pSoldier, INT8 bSlot ) // shape to be usable, and doesn't break during use. // Exception: land mines. You can bury them broken, they just won't blow! // if ( (Item[ pObj->usItem ].fFlags & ITEM_DAMAGEABLE) && (pObj->usItem != MINE) && (Item[ pObj->usItem ].usItemClass != IC_MEDKIT) && pObj->usItem != GAS_CAN ) - if ( Item[pObj->usItem].damageable && !Item[pObj->usItem].mine && (Item[pObj->usItem].usItemClass != IC_MEDKIT) && !Item[pObj->usItem].gascan && !IsStructureConstructItem( pObj->usItem, pSoldier->sGridNo, NULL ) ) + if (ItemIsDamageable(pObj->usItem) && !ItemIsMine(pObj->usItem) && (Item[pObj->usItem].usItemClass != IC_MEDKIT) && !ItemIsGascan(pObj->usItem) && !IsStructureConstructItem( pObj->usItem, pSoldier->sGridNo, NULL ) ) { // if it's still usable, check whether it breaks if ( (*pObj)[0]->data.objectStatus >= USABLE) @@ -6103,7 +6102,7 @@ void BoobyTrapMessageBoxCallBack( UINT8 ubExitValue ) CreateItem(gTempObject[0]->data.misc.usBombItem, gTempObject[0]->data.misc.bBombStatus, &TempObject); // also spawn attached guns/explosives - if (gTempObject.usItem != ACTION_ITEM && (Item[gTempObject.usItem].tripwire || Item[gTempObject.usItem].usItemClass & IC_EXPLOSV)) + if (gTempObject.usItem != ACTION_ITEM && (ItemIsTripwire(gTempObject.usItem) || Item[gTempObject.usItem].usItemClass & IC_EXPLOSV)) { // search for attached items OBJECTTYPE* pAttItem = NULL; @@ -6990,7 +6989,7 @@ INT32 FindNearestAvailableGridNoForItem( INT32 sSweetGridNo, INT8 ubRadius ) BOOLEAN CanPlayerUseRocketRifle( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay ) { - if ( Item[pSoldier->inv[ pSoldier->ubAttackingHand ].usItem].fingerprintid ) + if (ItemHasFingerPrintID(pSoldier->inv[ pSoldier->ubAttackingHand ].usItem)) { // check imprint ID // NB not-imprinted value is NO_PROFILE @@ -7042,7 +7041,7 @@ UINT8 StealItems(SOLDIERTYPE* pSoldier,SOLDIERTYPE* pOpponent, UINT8* ubIndexRet fStealItem = FALSE; pObject=&pOpponent->inv[i]; - if ((pObject->exists() == true) && !(Item[pObject->usItem].defaultundroppable )) // CHECK! Undroppable items cannot be stolen - SANDRO + if ((pObject->exists() == true) && !ItemIsUndroppableByDefault(pObject->usItem)) // CHECK! Undroppable items cannot be stolen - SANDRO { // Is the enemy collapsed if ( pOpponent->stats.bLife < OKLIFE || pOpponent->bCollapsed ) @@ -9855,7 +9854,7 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name ) } } // if we want to equip a two-handed item in our first hand, also drop whatever we have in the second hand - else if ( node.slot == HANDPOS && Item[node.item].twohanded && pSoldier->inv[SECONDHANDPOS].exists( ) ) + else if ( node.slot == HANDPOS && ItemIsTwoHanded(node.item) && pSoldier->inv[SECONDHANDPOS].exists( ) ) { AutoPlaceObjectInInventoryStash( &pSoldier->inv[SECONDHANDPOS], pSoldier->sGridNo, pSoldier->pathing.bLevel ); DeleteObj( &pSoldier->inv[SECONDHANDPOS] ); @@ -10268,7 +10267,7 @@ void ReadEquipmentTable( SOLDIERTYPE* pSoldier, std::string name ) } // if there is water in this sector, refill canteens - if ( refillwaterfromsector && Item[(pSoldier->inv[slot]).usItem].canteen && Food[Item[(pSoldier->inv[slot]).usItem].foodtype].bDrinkPoints > 0 ) + if ( refillwaterfromsector && ItemIsCanteen(pSoldier->inv[slot].usItem) && Food[Item[(pSoldier->inv[slot]).usItem].foodtype].bDrinkPoints > 0 ) { OBJECTTYPE* pObj = &(pSoldier->inv[slot]); diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index e4243381..75733b2b 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -2988,11 +2988,12 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) if ( pTSoldier != NULL ) { // If this is one of our own guys.....pop up requiester... + UINT16 usItem = pSoldier->inv[HANDPOS].usItem; if ( ( pTSoldier->bTeam == gbPlayerNum || pTSoldier->bTeam == MILITIA_TEAM ) - && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass != IC_MEDKIT - && !Item[pSoldier->inv[ HANDPOS ].usItem].gascan - && !Item[pSoldier->inv[HANDPOS].usItem].toolkit - && !ItemCanBeAppliedToOthers( pSoldier->inv[ HANDPOS ].usItem ) + && Item[ usItem ].usItemClass != IC_MEDKIT + && !ItemIsGascan(usItem) + && !ItemIsToolkit(usItem) + && !ItemCanBeAppliedToOthers( usItem ) && gTacticalStatus.ubLastRequesterTargetID != pTSoldier->ubProfile && ( pTSoldier->ubID != pSoldier->ubID ) ) { @@ -3010,7 +3011,7 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) } //////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - Should we ask if we really want to do the surgery? - else if (Item[ pSoldier->inv[ HANDPOS ].usItem ].medicalkit && (NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) + else if (ItemIsMedicalKit(usItem) && (NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && (pTSoldier->bTeam == OUR_TEAM || pTSoldier->bTeam == MILITIA_TEAM) && (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier )) && gGameOptions.fNewTraitSystem && pTSoldier->iHealableInjury >= 100 @@ -3894,7 +3895,7 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) gGameExternalOptions.ubAllowAlternativeWeaponHolding && pSoldier->inv[HANDPOS].exists() && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && - Item[pSoldier->inv[HANDPOS].usItem].twohanded && + ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && bNewStance == ANIM_STAND) { ChangeScopeMode(pSoldier, NOWHERE); @@ -3937,7 +3938,7 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) gGameExternalOptions.ubAllowAlternativeWeaponHolding && pSoldier->inv[HANDPOS].exists() && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && - Item[pSoldier->inv[HANDPOS].usItem].twohanded && + ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && bNewStance == ANIM_STAND) { ChangeScopeMode(pSoldier, NOWHERE); @@ -4628,7 +4629,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags ) } else if ( uiFlags == MOVEUI_TARGET_BOMB ) { - if(Item[pSoldier->inv[HANDPOS].usItem].mine == 1) + if(ItemIsMine(pSoldier->inv[HANDPOS].usItem)) sAPCost += GetAPsToPlantMine( pSoldier ); else sAPCost += GetAPsToDropBomb( pSoldier ); @@ -5014,7 +5015,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) } // SANDRO - doctor with medical bag trying to do the surgery - if ((NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && Item[pSoldier->inv[ HANDPOS ].usItem].medicalkit && gGameOptions.fNewTraitSystem + if ((NUM_SKILL_TRAITS( pSoldier, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && ItemIsMedicalKit(pSoldier->inv[ HANDPOS ].usItem) && gGameOptions.fNewTraitSystem && (pTSoldier->stats.bLife != pTSoldier->stats.bLifeMax) && (pTSoldier->iHealableInjury >= 100)) { // should come a question first if you really want to do the surgery diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index 91f052d3..c6eee82c 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -1555,7 +1555,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// DAMAGE - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_BLADE|IC_PUNCH|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_BLADE|IC_PUNCH|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { ubRegionOffset = 1; MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + ubRegionOffset ] ); @@ -1698,7 +1698,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// AP TO DRAW - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER|IC_PUNCH) && !Item[ gpItemDescObject->usItem].rocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER|IC_PUNCH) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 13 ] ); } @@ -1709,25 +1709,25 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// AP TO BURST - if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[gpItemDescObject->usItem].rocketlauncher ) + if ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 15 ] ); } /////////////////// AP TO AUTOFIRE - if ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher ) + if ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 16 ] ); } /////////////////// AP TO RELOAD - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 17 ] ); } /////////////////// AP TO RELOAD MANUALLY - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 18 ] ); } @@ -1735,7 +1735,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr /////////////////// RECOIL X/Y if( UsingNewCTHSystem() == true ) { - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher && (GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 || GetShotsPerBurst(gpItemDescObject)> 0 ) ) + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && (GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 || GetShotsPerBurst(gpItemDescObject)> 0 ) ) { // HEADROCK HAM 5: One value to rule them all. // MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 18 ] ); @@ -1751,7 +1751,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } /////////////////// BULLETS PER 5 AP - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) { MSYS_EnableRegion( &gUDBFasthelpRegions[ iFirstDataRegion + 21 ] ); } @@ -2333,7 +2333,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr if (Item[ gpItemDescObject->usItem ].usItemClass & IC_ARMOUR) { //////////////////// EXPLOSIVE RESISTANCE - if (Item[ gpItemDescObject->usItem ].flakjacket) + if (ItemIsFlakJacket(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 5 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 5 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2432,7 +2432,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr if (Item[ gpItemDescObject->usItem ].usItemClass & IC_EXPLOSV) { ////////////////// LOCK BOMB - if (Item[ gpItemDescObject->usItem ].lockbomb) + if (ItemIsLockBomb(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 25 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 25 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2445,7 +2445,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr // Draw stats that can be had by any item. //////////////////// WATERPROOF - if (!Item[ gpItemDescObject->usItem ].waterdamages) + if (!ItemIsDamagedByWater(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 6 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 6 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2454,7 +2454,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// ELECTRONIC - if (Item[ gpItemDescObject->usItem ].electronic) + if (ItemIsElectronic(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 7 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 7 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2463,7 +2463,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// GAS MASK - if (Item[ gpItemDescObject->usItem ].gasmask) + if (ItemIsGasmask(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 8 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 8 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2472,7 +2472,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// NEEDS BATTERIES - if (Item[ gpItemDescObject->usItem ].needsbatteries) + if (ItemNeedsBatteries(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 9 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 9 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2481,7 +2481,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// LOCKSMITH'S KIT - if (Item[ gpItemDescObject->usItem ].locksmithkit) + if (ItemIsLocksmithKit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 10 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 10 ], (Item[ gpItemDescObject->usItem ].LockPickModifier > 0 ? ( Item[ gpItemDescObject->usItem ].LockPickModifier * (*gpItemDescObject)[0]->data.objectStatus / 100 ) : Item[ gpItemDescObject->usItem ].LockPickModifier ) ); @@ -2491,7 +2491,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// WIRE CUTTERS - if (Item[ gpItemDescObject->usItem ].wirecutters) + if (ItemIsWirecutters(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 11 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 11 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2500,7 +2500,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// CROWBAR - if (Item[ gpItemDescObject->usItem ].crowbar) + if (ItemIsCrowbar(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 12 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 12 ], Item[ gpItemDescObject->usItem ].CrowbarModifier ); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2509,7 +2509,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// METAL DETECTOR - if (Item[ gpItemDescObject->usItem ].metaldetector) + if (ItemIsMetalDetector(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 13 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 13 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2518,7 +2518,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// REMOTE TRIGGER - if (Item[ gpItemDescObject->usItem ].remotetrigger) + if (ItemIsRemoteTrigger(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 14 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 14 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2527,7 +2527,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// REMOTE DETONATOR - if (Item[ gpItemDescObject->usItem ].remotedetonator) + if (ItemIsRemoteDetonator(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 15 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 15 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2536,7 +2536,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TIMER DETONATOR - if (Item[ gpItemDescObject->usItem ].detonator) + if (ItemIsDetonator(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 16 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 16 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2545,7 +2545,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// GAS CAN - if (Item[ gpItemDescObject->usItem ].gascan) + if (ItemIsGascan(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 17 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 17 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2554,7 +2554,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TOOLKIT - if (Item[ gpItemDescObject->usItem ].toolkit) + if (ItemIsToolkit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s%d", szUDBGenSecondaryStatsTooltipText[ 18 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 18 ], Item[ gpItemDescObject->usItem ].RepairModifier ); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2563,7 +2563,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// THERMAL OPTICS - if (Item[ gpItemDescObject->usItem ].thermaloptics) + if (ItemIsThermalOptics(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 19 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 19 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2572,7 +2572,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// X-RAY DEVICE - if (Item[ gpItemDescObject->usItem ].xray) + if (ItemHasXRay(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 20 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 20 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2581,7 +2581,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// CANTEEN - if (Item[ gpItemDescObject->usItem ].canteen) + if (ItemIsCanteen(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 21 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 21 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2599,7 +2599,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// FIRST-AID KIT - if (Item[ gpItemDescObject->usItem ].firstaidkit) + if (ItemIsFirstAidKit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 23 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 23 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2608,7 +2608,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// MEDICAL KIT - if (Item[ gpItemDescObject->usItem ].medicalkit) + if (ItemIsMedicalKit(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 24 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 24 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2681,7 +2681,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// NOT DAMAGEABLE - if ( Item[gpItemDescObject->usItem].damageable == 0 ) + if (!ItemIsDamageable(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 32 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 32 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2690,7 +2690,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// METAL - if ( Item[gpItemDescObject->usItem].metal > 0 ) + if (ItemIsMetal(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 33 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 33 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2699,7 +2699,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// SINKS - if ( Item[gpItemDescObject->usItem].sinks > 0 ) + if (ItemSinks(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 34 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 34 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2708,7 +2708,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TWO HANDED - if ( Item[gpItemDescObject->usItem].twohanded > 0 ) + if (ItemIsTwoHanded(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 35 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 35 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2717,7 +2717,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// BLOCKS IRON SIGHTS - if ( Item[gpItemDescObject->usItem].blockironsight > 0 ) + if (ItemBlocksIronsight(gpItemDescObject->usItem)) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 36 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 36 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -4070,7 +4070,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } cnt++; } - else if ( Item[gpItemDescObject->usItem].barrel == TRUE ) // for barrel items + else if (ItemIsBarrel(gpItemDescObject->usItem)) // for barrel items { if (!fDrawGenIndexes) fDrawGenIndexes = ++cnt; // new index line here? ///////////////////// COOLDOWN FACTOR @@ -4366,8 +4366,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// DAMAGE - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) ) + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 1; BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 5, gItemDescGenRegions[ubNumLine][0].sLeft+sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -4525,8 +4525,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) ubNumLine = 11; } - if ( !Item[gpItemDescObject->usItem].repairable || - ( fComparisonMode && !Item[gpComparedItemDescObject->usItem].repairable ) ) + if ( !ItemIsRepairable(gpItemDescObject->usItem) || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[ubNumLine][0].sLeft + sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -4542,16 +4542,16 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// DRAW COST - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem].rocketlauncher ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 13; BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 1, gItemDescGenRegions[ubNumLine][0].sLeft+sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } //////////////////// SINGLE SHOT COST - GUN - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 14; // "NO SINGLE-SHOT" ICON @@ -4565,8 +4565,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } /////////////////// SINGLE SHOT COST - ROCKET - if ( ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && Item[gpItemDescObject->usItem].rocketlauncher && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && ItemIsRocketLauncher(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass & (IC_GUN|IC_LAUNCHER) && ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 14; // SINGLE ROCKET-LAUNCH AP ICON @@ -4574,9 +4574,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } /////////////////// SINGLE SHOT COST - GRENADE LAUNCHER - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpItemDescObject->usItem].rocketlauncher + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpItemDescObject->usItem) && !Weapon[gpItemDescObject->usItem].NoSemiAuto && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpComparedItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && !Weapon[gpComparedItemDescObject->usItem].NoSemiAuto ) ) { ubNumLine = 14; @@ -4608,8 +4608,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } /////////////////// BURST COST - GUN - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 15; // "NO BURST" ICON @@ -4625,9 +4625,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } } ////////////////// BURST COST - GRENADE LAUNCHER - else if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpItemDescObject->usItem].rocketlauncher + else if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetShotsPerBurst(gpItemDescObject)> 0 ) || - ( fComparisonMode && Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !Item[gpItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetShotsPerBurst(gpItemDescObject)> 0 ) ) { ubNumLine = 15; @@ -4635,8 +4635,8 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } ////////////////// AUTOFIRE COST - if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpItemDescObject->usItem].rocketlauncher ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !Item[gpComparedItemDescObject->usItem].rocketlauncher ) ) + if ( ( Item[gpItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[gpComparedItemDescObject->usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 16; // "NO-AUTO" ICON @@ -4654,17 +4654,17 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) ////////////////// RELOAD COST - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) ) + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) || + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 17; BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 2, gItemDescGenRegions[ubNumLine][0].sLeft+sOffsetX, gItemDescGenRegions[ubNumLine][0].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } ////////////////// MANUAL RELOAD COST - if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher + if ( ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) && Weapon[gpComparedItemDescObject->usItem].APsToReloadManually > 0 ) ) { ubNumLine = 18; @@ -4675,9 +4675,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) if( UsingNewCTHSystem() == true ) { ubNumLine = 20; - if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && ( GetShotsPerBurst(gpItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && ( GetShotsPerBurst(gpComparedItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) ) ) { // HEADROCK HAM 5: One value to rule them all! Line 19 left empty intentionally. @@ -4702,9 +4702,9 @@ void DrawWeaponStats( OBJECTTYPE * gpItemDescObject ) } ///////////////// AUTOFIRE SHOTS PER 5 AP ICON - if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) ) { ubNumLine = 21; @@ -4946,8 +4946,8 @@ void DrawExplosiveStats( OBJECTTYPE * gpItemDescObject ) } ////////////////// REPAIR EASE - if ( ( !Item[gpItemDescObject->usItem].repairable && !fComparisonMode ) || - ( fComparisonMode && !Item[ gpComparedItemDescObject->usItem ].repairable ) ) + if ( ( !ItemIsRepairable(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[11][0].sLeft + sOffsetX, gItemDescGenRegions[11][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -5036,8 +5036,8 @@ void DrawArmorStats( OBJECTTYPE * gpItemDescObject ) } ////////////////// REPAIR EASE - if ( ( !Item[gpItemDescObject->usItem].repairable && !fComparisonMode ) || - ( fComparisonMode && !Item[gpComparedItemDescObject->usItem].repairable ) ) + if ( ( !ItemIsRepairable(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[3][0].sLeft + sOffsetX, gItemDescGenRegions[3][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -5782,8 +5782,8 @@ void DrawAdvancedStats( OBJECTTYPE * gpItemDescObject ) cnt++; } - if( ( Item[gpItemDescObject->usItem].barrel == TRUE ) || // for barrel items - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].barrel == TRUE ) ) + if( (ItemIsBarrel(gpItemDescObject->usItem)) || // for barrel items + ( fComparisonMode && ItemIsBarrel(gpComparedItemDescObject->usItem) ) ) { if ( !fDrawGenIndexes ) fDrawGenIndexes = ++cnt; // new index line here? @@ -5988,8 +5988,8 @@ void DrawMiscStats( OBJECTTYPE * gpItemDescObject ) // not for weapons. They have this one their primary page if ( !(Item[ gpItemDescObject->usItem ].usItemClass & IC_WEAPON || Item[ gpItemDescObject->usItem ].usItemClass & IC_PUNCH) ) { - if ( !Item[gpItemDescObject->usItem].repairable && !fComparisonMode || - ( fComparisonMode && !Item[gpComparedItemDescObject->usItem].repairable ) ) + if ( !ItemIsRepairable(gpItemDescObject->usItem) && !fComparisonMode || + ( fComparisonMode && !ItemIsRepairable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoWeaponIcon, 35, gItemDescGenRegions[0][0].sLeft + sOffsetX, gItemDescGenRegions[0][0].sTop + sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); } @@ -6076,8 +6076,8 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) if (Item[ gpItemDescObject->usItem ].usItemClass & (IC_ARMOUR)) { ////////////////// FLAK JACKET - if ( ( Item[ gpItemDescObject->usItem ].flakjacket && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].flakjacket )) + if ( (ItemIsFlakJacket(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsFlakJacket(gpComparedItemDescObject->usItem) )) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 5, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6162,8 +6162,8 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) if (Item[ gpItemDescObject->usItem ].usItemClass & (IC_EXPLOSV)) { ////////////////// LOCK BOMB - if ( ( Item[ gpItemDescObject->usItem ].lockbomb && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].lockbomb ) ) + if (( ItemIsLockBomb(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsLockBomb(gpComparedItemDescObject->usItem) )) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 25, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6174,128 +6174,128 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) // Draw stats that can be had by any item. //////////////////// WATERPROOF - if ( ( !Item[ gpItemDescObject->usItem ].waterdamages && !fComparisonMode ) || - ( fComparisonMode && !Item[ gpComparedItemDescObject->usItem ].waterdamages ) ) + if ( ( !ItemIsDamagedByWater(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsDamagedByWater(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 6, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// ELECTRONIC - if ( ( Item[ gpItemDescObject->usItem ].electronic && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].electronic ) ) + if ( (ItemIsElectronic(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsElectronic(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 7, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// GAS MASK - if ( ( Item[ gpItemDescObject->usItem ].gasmask && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].gasmask ) ) + if ( (ItemIsGasmask(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsGasmask(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 8, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// NEEDS BATTERIES - if ( ( Item[ gpItemDescObject->usItem ].needsbatteries && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].needsbatteries ) ) + if ( (ItemNeedsBatteries(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemNeedsBatteries(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 9, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// LOCKSMITH'S KIT - if ( ( Item[ gpItemDescObject->usItem ].locksmithkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].locksmithkit ) ) + if ( (ItemIsLocksmithKit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsLocksmithKit(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 10, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// WIRE CUTTERS - if ( ( Item[ gpItemDescObject->usItem ].wirecutters && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].wirecutters ) ) + if ( (ItemIsWirecutters(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsWirecutters(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 11, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// CROWBAR - if ( ( Item[ gpItemDescObject->usItem ].crowbar && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].crowbar ) ) + if ( (ItemIsCrowbar(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsCrowbar(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 12, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// CROWBAR - if ( ( Item[ gpItemDescObject->usItem ].metaldetector && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].metaldetector ) ) + if ( (ItemIsMetalDetector(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsMetalDetector(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 13, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// REMOTE TRIGGER - if ( ( Item[ gpItemDescObject->usItem ].remotetrigger && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].remotetrigger ) ) + if ( (ItemIsRemoteTrigger(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsRemoteTrigger(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 14, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// REMOTE DETONATOR - if ( ( Item[ gpItemDescObject->usItem ].remotedetonator && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].remotedetonator ) ) + if ( (ItemIsRemoteDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsRemoteDetonator(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 15, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TIMER DETONATOR - if ( ( Item[ gpItemDescObject->usItem ].detonator && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].detonator ) ) + if ( (ItemIsDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsDetonator(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 16, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// GAS CAN - if ( ( Item[ gpItemDescObject->usItem ].gascan && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].gascan ) ) + if ( (ItemIsGascan(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsGascan(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 17, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TOOLKIT - if ( ( Item[ gpItemDescObject->usItem ].toolkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].toolkit ) ) + if ( (ItemIsToolkit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsToolkit(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 18, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// THERMAL OPTICS - if ( ( Item[ gpItemDescObject->usItem ].thermaloptics && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].thermaloptics ) ) + if ( (ItemIsThermalOptics(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsThermalOptics(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 19, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// X-RAY DEVICE - if ( ( Item[ gpItemDescObject->usItem ].xray && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].xray ) ) + if ( (ItemHasXRay(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemHasXRay(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 20, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// CANTEEN - if ( ( Item[ gpItemDescObject->usItem ].canteen && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].canteen ) ) + if ( (ItemIsCanteen(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsCanteen(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 21, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6310,16 +6310,16 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// FIRST-AID KIT - if ( ( Item[ gpItemDescObject->usItem ].firstaidkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].firstaidkit ) ) + if ( (ItemIsFirstAidKit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsFirstAidKit(gpComparedItemDescObject->usItem)) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 23, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// MEDICAL KIT - if ( ( Item[ gpItemDescObject->usItem ].medicalkit && !fComparisonMode ) || - ( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].medicalkit ) ) + if ( (ItemIsMedicalKit(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsMedicalKit(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 24, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6389,40 +6389,40 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// NOT DAMAGEABLE - if ( ( Item[gpItemDescObject->usItem].damageable == 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].damageable == 0 ) ) + if ( (!ItemIsDamageable(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && !ItemIsDamageable(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 31, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// METAL - if ( ( Item[gpItemDescObject->usItem].metal > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].metal > 0 ) ) + if ( (ItemIsMetal(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsMetal(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 32, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// SINKS - if ( ( Item[gpItemDescObject->usItem].sinks > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].sinks > 0 ) ) + if ( (ItemSinks(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemSinks(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 33, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TWO HANDED - if ( ( Item[gpItemDescObject->usItem].twohanded > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].twohanded > 0 ) ) + if ( (ItemIsTwoHanded(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemIsTwoHanded(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 34, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// BLOCKS IRON SIGHTS - if ( ( Item[gpItemDescObject->usItem].blockironsight > 0 && !fComparisonMode ) || - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].blockironsight > 0 ) ) + if ( (ItemBlocksIronsight(gpItemDescObject->usItem) && !fComparisonMode ) || + ( fComparisonMode && ItemBlocksIronsight(gpComparedItemDescObject->usItem) ) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 35, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; @@ -6822,7 +6822,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // ShotsPer4Turns -> ubAttackAPs, used later for all shot AP values // silversurfer: Knuckle Dusters count as bare hand attacks and use the AP_PUNCH constant. - if ( Item[gpItemDescObject->usItem].brassknuckles ) + if (ItemIsBrassKnuckles(gpItemDescObject->usItem)) { ubAttackAPs = APBPConstants[AP_PUNCH]; ubBasicAttackAPs = APBPConstants[AP_PUNCH]; @@ -7002,7 +7002,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyValueInColour( iFinalAccuracyValue, ubNumLine, 3, fComparisonMode, FALSE, TRUE, ITEMDESC_FONTPOSITIVE ); } /////////////// DAMAGE - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 1; @@ -7060,7 +7060,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyValueInColour( iComparedFinalDamageValue - iFinalDamageValue, ubNumLine, 3, fComparisonMode, FALSE, TRUE ); } } - else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) + else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 1; @@ -7840,7 +7840,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } // Does gun have flash suppression? - BOOLEAN iFlashValue = Item[ gpItemDescObject->usItem ].hidemuzzleflash; + BOOLEAN iFlashValue = ItemHasHiddenMuzzleFlash(gpItemDescObject->usItem); if( !fComparisonMode ) { @@ -7864,7 +7864,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } else if( IsFlashSuppressorAlt( gpComparedItemDescObject ) == TRUE ) { - BOOLEAN iComparedFlashValue = Item[ gpComparedItemDescObject->usItem ].hidemuzzleflash; + BOOLEAN iComparedFlashValue = ItemHasHiddenMuzzleFlash(gpComparedItemDescObject->usItem); if ( iFlashValue ) { if (iComparedFlashValue) @@ -7921,7 +7921,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) else ubNumLine = 8; // Does gun have flash suppression? - BOOLEAN iFlashValue = Item[ gpComparedItemDescObject->usItem ].hidemuzzleflash; + BOOLEAN iFlashValue = ItemHasHiddenMuzzleFlash(gpComparedItemDescObject->usItem); if ( iFlashValue ) { // Print base value @@ -8077,7 +8077,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } ///////////////////// DRAW AP - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem].rocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 13; @@ -8137,7 +8137,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyValueInColour( iComparedFinalDrawAPCost - iFinalDrawAPCost, ubNumLine, 3, fComparisonMode, FALSE, FALSE ); } } - else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem].rocketlauncher ) + else if( fComparisonMode && Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) ) { ubNumLine = 13; // Get final Draw Cost @@ -8376,7 +8376,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } ///////////////////// RELOAD AP - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { // Set line to draw into ubNumLine = 17; @@ -8423,7 +8423,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalReloadAPCost, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) { // Get final Reload Cost INT16 iComparedFinalReloadAPCost = GetAPsToReload( gpComparedItemDescObject ); @@ -8471,7 +8471,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyTextInColour( L"-", ubNumLine, 3, ITEMDESC_FONTPOSITIVE ); } } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) ) + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) ) { ubNumLine = 17; // Get final Reload Cost @@ -8515,7 +8515,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } ///////////////////// MANUAL RELOAD AP - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) && Weapon[gpItemDescObject->usItem].APsToReloadManually > 0 ) { // Set line to draw into @@ -8555,7 +8555,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalManualReloadAPCost, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) && Weapon[gpComparedItemDescObject->usItem].APsToReloadManually > 0 ) { // Get final Manual Reload Cost @@ -8597,7 +8597,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyTextInColour( L"-", ubNumLine, 3, ITEMDESC_FONTPOSITIVE ); } } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) && Weapon[gpComparedItemDescObject->usItem].APsToReloadManually > 0 ) ) { ubNumLine = 18; @@ -8637,7 +8637,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) ///////////////////// RECOIL X/Y if ( UsingNewCTHSystem() == true ) { - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetShotsPerBurst(gpItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpItemDescObject) ) { // HEADROCK HAM 5: One value to rule them all. @@ -8677,7 +8677,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColourFloat( dFinalRecoil, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE, 1.0f ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetShotsPerBurst(gpComparedItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) ) { FLOAT iComparedFinalRecoilX = 0; @@ -8775,7 +8775,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) SetFontForeground( 6 ); */ } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetShotsPerBurst(gpComparedItemDescObject)> 0 || GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) ) ) { @@ -8848,7 +8848,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalBurstValue, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !Item[ gpComparedItemDescObject->usItem ].singleshotrocketlauncher ) + else if( Item[ gpComparedItemDescObject->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) && !ItemIsSingleShotRocketLauncher(gpComparedItemDescObject->usItem) ) { // Get base Burst Penalty value INT16 iComparedBurstValue = Weapon[gpComparedItemDescObject->usItem].ubBurstPenalty * (gGameExternalOptions.bAimedBurstEnabled?gGameExternalOptions.uAimedBurstPenalty:1); @@ -8961,7 +8961,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) } /////////////////// AUTOFIRE BULLETS PER 5 AP - if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpItemDescObject->usItem].rocketlauncher + if ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpItemDescObject) > 0 ) { // Set line to draw into @@ -8982,7 +8982,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalB5AP, ubNumLine, 3, fComparisonMode, FALSE, TRUE, FONT_MCOLOR_WHITE ); } - else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) { // Get final B/5AP @@ -9003,7 +9003,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) DrawPropertyTextInColour( L"-", ubNumLine, 3, ITEMDESC_FONTNEGATIVE ); } } - else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if( fComparisonMode && ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) ) { ubNumLine = 21; @@ -9054,7 +9054,7 @@ void DrawWeaponValues( OBJECTTYPE * gpItemDescObject ) // Print final value DrawPropertyValueInColour( iFinalAutoValue, ubNumLine, 3, fComparisonMode, FALSE, FALSE, FONT_MCOLOR_WHITE ); } - else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !Item[ gpComparedItemDescObject->usItem].rocketlauncher + else if ( Item[ gpComparedItemDescObject->usItem ].usItemClass == IC_GUN && !ItemIsRocketLauncher(gpComparedItemDescObject->usItem) && GetAutofireShotsPerFiveAPs(gpComparedItemDescObject) > 0 ) { // Get base Auto Penalty value @@ -13805,8 +13805,8 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) cnt++; } - else if ( ( Item[gpItemDescObject->usItem].barrel == TRUE ) || // display for barrel items - ( fComparisonMode && Item[gpComparedItemDescObject->usItem].barrel == TRUE ) ) + else if ( (ItemIsBarrel(gpItemDescObject->usItem)) || // display for barrel items + ( fComparisonMode && ItemIsBarrel(gpComparedItemDescObject->usItem) ) ) { if (!fDrawGenIndexes) fDrawGenIndexes = ++cnt; // insert Indexes here? ///////////////////// COOLDOWN FACTOR diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 2a897d88..18f635db 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -168,7 +168,7 @@ INT16 ITEMDESC_DONE_Y; #define DOTDOTDOT L"..." #define COMMA_AND_SPACE L", " -#define ITEM_PROS_AND_CONS( usItem ) ( ( Item[ usItem ].usItemClass & IC_GUN && !Item[ usItem ].rocketlauncher ) ) +#define ITEM_PROS_AND_CONS( usItem ) ( ( Item[ usItem ].usItemClass & IC_GUN && !ItemIsRocketLauncher(usItem) ) ) #define ITEMDESC_ITEM_STATUS_WIDTH 2 #define ITEMDESC_ITEM_WIDTH 117 @@ -2666,7 +2666,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe } // IF it's the second hand and this hand cannot contain anything, remove the second hand position graphic - if (sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if (sPocket == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) { // CHRISL: Change coords for STI that covers 2nd hand location when carrying a 2handed weapon if( guiCurrentItemDescriptionScreen != MAP_SCREEN ) @@ -2710,7 +2710,7 @@ void INVRenderINVPanelItem( SOLDIERTYPE *pSoldier, INT16 sPocket, UINT8 fDirtyLe fHatchItOut = TRUE; } // CHRISL: Don't hatch second hand position if we're holding a two handed item - else if ( sPocket == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + else if ( sPocket == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) ) { fHatchItOut = FALSE; } @@ -2832,8 +2832,8 @@ BOOLEAN CompatibleItemForApplyingOnMerc(OBJECTTYPE *pTestObject) //Shadooow: rewritten to use new item flags and check canteen not empty - if (((HasItemFlag(usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving) || Item[usItem].camouflagekit || usItem == JAR_ELIXIR || - Item[usItem].clothestype || Item[usItem].drugtype || Item[usItem].foodtype) && (!Item[usItem].canteen || (*pTestObject)[0]->data.objectStatus > 1)) + if (((HasItemFlag(usItem, CAMO_REMOVAL) && gGameExternalOptions.fCamoRemoving) || ItemIsCamoKit(usItem) || usItem == JAR_ELIXIR || + Item[usItem].clothestype || Item[usItem].drugtype || Item[usItem].foodtype) && (!ItemIsCanteen(usItem) || (*pTestObject)[0]->data.objectStatus > 1)) { return( TRUE ); } @@ -3010,14 +3010,14 @@ BOOLEAN HandleCompatibleAmmoUIForMapScreen( SOLDIERTYPE *pSoldier, INT32 bInvPos UINT32 invsize = pSoldier->inv.size(); // First test attachments, which almost any type of item can have.... - if ( !(Item[ pTestObject->usItem ].hiddenaddon ) ) + if ( !(ItemIsHiddenAddon(pTestObject->usItem)) ) { for ( cnt = 0; cnt < invsize; ++cnt ) { pObject = &(pSoldier->inv[ cnt ]); - if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && - !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && + if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) && + !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) && !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) { // don't consider for UI purposes @@ -3116,14 +3116,14 @@ BOOLEAN HandleCompatibleAmmoUIForMapInventory(SOLDIERTYPE *pSoldier, INT32 bInvP } // First test attachments, which almost any type of item can have.... - if (!(Item[pTestObject->usItem].hiddenaddon)) + if (!(ItemIsHiddenAddon(pTestObject->usItem))) { for (cnt = 0; cnt < MAP_INVENTORY_POOL_SLOT_COUNT; ++cnt) { pObject = &(pInventoryPoolList[iStartSlotNumber + cnt].object); - if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && - !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && + if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) && + !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) && !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) { // don't consider for UI purposes @@ -3270,14 +3270,14 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest UINT32 invsize = pSoldier->inv.size(); // First test attachments, which almost any type of item can have.... - if (!(Item[pTestObject->usItem].hiddenaddon)) + if (!(ItemIsHiddenAddon(pTestObject->usItem))) { for (cnt = 0; cnt < invsize; ++cnt) { pObject = &(pSoldier->inv[cnt]); - if (pObject == pTestObject || Item[pObject->usItem].hiddenaddon || (!Item[pObject->usItem].attachment && - !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !Item[pTestObject->usItem].attachment && + if (pObject == pTestObject || ItemIsHiddenAddon(pObject->usItem) || (!ItemIsAttachment(pObject->usItem) && + !Item[pObject->usItem].attachmentclass && !Item[pObject->usItem].nasAttachmentClass && !ItemIsAttachment(pTestObject->usItem) && !Item[pTestObject->usItem].attachmentclass && !Item[pTestObject->usItem].nasAttachmentClass)) { // don't consider for UI purposes @@ -3302,7 +3302,7 @@ BOOLEAN InternalHandleCompatibleAmmoUI( SOLDIERTYPE *pSoldier, OBJECTTYPE *pTest } } //if the test object is hidden addon or attachment, it won't be ammunition or gun so skip this - if (!Item[pTestObject->usItem].hiddenaddon && !Item[pTestObject->usItem].attachment) + if (!ItemIsHiddenAddon(pTestObject->usItem) && !ItemIsAttachment(pTestObject->usItem)) { if( ( Item [ pTestObject->usItem ].usItemClass & IC_GUN ) ) { @@ -3816,7 +3816,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } } - if ( pItem->usItemClass == IC_GUN && !Item[pObject->usItem].rocketlauncher ) + if ( pItem->usItemClass == IC_GUN && !ItemIsRocketLauncher(pObject->usItem) ) { sNewY = sY + sHeight - 10; sNewX = sX + 1; @@ -3872,7 +3872,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } } - if ( pItemShown->usItemClass == IC_GUN && !Item[pObjShown->usItem].rocketlauncher ) + if ( pItemShown->usItemClass == IC_GUN && !ItemIsRocketLauncher(pObjShown->usItem) ) { SetRGBFontForeground( AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].red, AmmoTypes[( *pObjShown )[iter]->data.gun.ubGunAmmoType].green, @@ -3950,7 +3950,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } // Flugente: overheating - if ( gGameExternalOptions.fWeaponOverheating && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || Item[pObject->usItem].barrel ) ) + if ( gGameExternalOptions.fWeaponOverheating && ( pItem->usItemClass & (IC_GUN | IC_LAUNCHER) || ItemIsBarrel(pObject->usItem)) ) { OBJECTTYPE* pObjShown = pObject; @@ -4201,7 +4201,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec } if ( ( ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) || - ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) ) && + ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem)) ) && pSoldier->usGLDelayMode ) { wcscat( pStr, New113Message[MSG113_FIREMODE_GL_DELAYED] ); @@ -4231,7 +4231,7 @@ void INVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pObjec if ( pSoldier && pObject == &(pSoldier->inv[SECONDHANDPOS] ) && (pSoldier->bWeaponMode == WM_BURST || pSoldier->bWeaponMode == WM_AUTOFIRE) && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && - !(Item[ pSoldier->inv[HANDPOS ].usItem ].twohanded ) && + !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && pSoldier->IsValidSecondHandBurst() ) { sNewY = sY + 13; // rather arbitrary @@ -4565,7 +4565,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb } //////////////////// GUN DATA ////////////////// - if ( pItem->usItemClass & IC_GUN && !Item[pObject->usItem].rocketlauncher ) + if ( pItem->usItemClass & IC_GUN && !ItemIsRocketLauncher(pObject->usItem) ) { //////////////// AMMO REMAINING @@ -4804,7 +4804,7 @@ void MAPINVRenderItem( UINT32 uiBuffer, SOLDIERTYPE * pSoldier, OBJECTTYPE *pOb } iCurAsterisk = ATTACHMENT_GENERAL; - if (Item[iter->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(iter->usItem)) { //iCurAsterisk = ATTACHMENT_GL; uiNumAttachmentsGL++; @@ -5233,7 +5233,7 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, } // Add ammo eject button for GUN type objects. - if ( (Item[ pObject->usItem ].usItemClass & IC_GUN) && !Item[pObject->usItem].rocketlauncher ) + if ( (Item[ pObject->usItem ].usItemClass & IC_GUN) && !ItemIsRocketLauncher(pObject->usItem) ) { if ( GetMagSize(gpItemDescObject) <= 99 ) { @@ -5610,7 +5610,7 @@ BOOLEAN InternalInitItemDescriptionBox( OBJECTTYPE *pObject, INT16 sX, INT16 sY, } // if ( !(Item[ pObject->usItem ].fFlags & ITEM_HIDDEN_ADDON) && ( ValidAttachment( gpItemPointer->usItem, pObject->usItem ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) - if ( !(Item[ pObject->usItem ].hiddenaddon ) && ( ValidAttachment( gpItemPointer->usItem, pObject ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) + if ( !(ItemIsHiddenAddon(pObject->usItem)) && ( ValidAttachment( gpItemPointer->usItem, pObject ) || ValidLaunchable( gpItemPointer->usItem, pObject->usItem ) || ValidMerge( gpItemPointer->usItem, pObject->usItem ) ) ) { SetUpFastHelpListRegions( gItemDescHelpText.iXPosition, @@ -5750,7 +5750,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) if (Item[usLoop].nasAttachmentClass & AttachmentSlots[usLoopSlotID].nasAttachmentClass && IsAttachmentPointAvailable(point, usLoop, TRUE)) { usAttachment = usLoop; - if (!Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) + if (!ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment)) { if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) { @@ -5786,7 +5786,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) } } - if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) + if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment)) { if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) { @@ -5822,7 +5822,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) } } - if (usAttachment > 0 && !Item[usAttachment].hiddenaddon && !Item[usAttachment].hiddenattachment && ItemIsLegal(usAttachment)) + if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment) && ItemIsLegal(usAttachment)) { if (std::find(attachList.begin(), attachList.end(), usAttachment) == attachList.end()) { @@ -5895,7 +5895,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) for(UINT16 loop = 0; loop < attachList.size(); loop++){ usAttachment = attachList[loop]; // If the attachment is not hidden - if (usAttachment > 0 && !Item[ usAttachment ].hiddenaddon && !Item[ usAttachment ].hiddenattachment) + if (usAttachment > 0 && !ItemIsHiddenAddon(usAttachment) && !ItemIsHiddenAttachment(usAttachment)) { if (wcslen( attachStr3 ) + wcslen(Item[usAttachment].szItemName) > 3600) { @@ -7021,8 +7021,7 @@ void RenderItemDescriptionBox( ) //WarmSteel - This hatches out attachment slots one by one, instead of all of em. for(cnt = 0; cnt < (INT32)(*gpItemDescObject)[gubItemDescStatusIndex]->attachments.size(); cnt++) { - //if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || - if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) || + if (ItemIsHiddenAddon(gpItemPointer->usItem) || ( !ValidItemAttachmentSlot( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, cnt, FALSE, NULL, usAttachmentSlotIndexVector) && !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) @@ -7038,8 +7037,7 @@ void RenderItemDescriptionBox( ) } else { for(cnt = 0; cnt < OLD_MAX_ATTACHMENTS_101; cnt++) { - //if ( ( Item[ gpItemPointer->usItem ].fFlags & ITEM_HIDDEN_ADDON ) || - if ( ( Item[ gpItemPointer->usItem ].hiddenaddon ) || + if (ItemIsHiddenAddon(gpItemPointer->usItem) || ( !ValidItemAttachment( gpItemDescObject, gpItemPointer->usItem, FALSE, FALSE, gubItemDescStatusIndex, usAttachmentSlotIndexVector) && !ValidMerge( gpItemPointer->usItem, gpItemDescObject->usItem ) && !ValidLaunchable( gpItemPointer->usItem, gpItemDescObject->usItem ) ) ) @@ -7071,7 +7069,7 @@ void RenderItemDescriptionBox( ) DrawItemUIBarEx( gpItemDescObject, (UINT8)(DRAW_ITEM_STATUS_ATTACHMENT1 + cnt), sCenX, sCenY, ITEM_BAR_WIDTH, ITEM_BAR_HEIGHT, Get16BPPColor( STATUS_BAR ), Get16BPPColor( STATUS_BAR_SHADOW ), TRUE , guiSAVEBUFFER, gubItemDescStatusIndex ); // Flugente: overheating - if ( gGameExternalOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || Item[ (iter)->usItem ].barrel == TRUE) ) // Flugente + if ( gGameExternalOptions.fWeaponOverheating && ( Item[ (iter)->usItem ].usItemClass & (IC_GUN|IC_LAUNCHER) || ItemIsBarrel((iter)->usItem)) ) // Flugente { FLOAT overheatjampercentage = GetGunOverheatDisplayPercentage( &(*iter)); @@ -7219,7 +7217,7 @@ void RenderItemDescriptionBox( ) SetFontForeground( FONT_BLACK ); SetFontShadow( ITEMDESC_FONTSHADOW2 ); // Caliber - if ( (Item[gpItemDescObject->usItem].fingerprintid ) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE ) + if ( ItemHasFingerPrintID(gpItemDescObject->usItem) && (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID < NO_PROFILE ) { // Fingerprint ID swprintf( pStr, L"%s %s (%s)", AmmoCaliber[ Weapon[ gpItemDescObject->usItem ].ubCalibre ], WeaponType[ Weapon[ gpItemDescObject->usItem ].ubWeaponType ], gMercProfiles[ (*gpItemDescObject)[gubItemDescStatusIndex]->data.ubImprintID ].zNickname ); @@ -7284,7 +7282,7 @@ void RenderItemDescriptionBox( ) } // Flugente: display temperature string - if ( gGameExternalOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || Item[gpItemDescObject->usItem].barrel == TRUE ) ) + if ( gGameExternalOptions.fWeaponOverheating && ( Item[ gpItemDescObject->usItem ].usItemClass == IC_GUN || Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER || ItemIsBarrel(gpItemDescObject->usItem) ) ) { // UDB system displays a string with colored condition text. int regionindex = 8; @@ -7612,7 +7610,7 @@ void RenderItemDescriptionBox( ) FindFontRightCoordinates( gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sTop, gODBItemDescRegions[2][7].sRight - gODBItemDescRegions[2][7].sLeft, gODBItemDescRegions[2][7].sBottom - gODBItemDescRegions[2][7].sTop ,pStr, BLOCKFONT2, &usX, &usY); mprintf( usX, usY, pStr ); } - if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !Item[ gpItemDescObject->usItem ].singleshotrocketlauncher ) + if ( Item[ gpItemDescObject->usItem ].usItemClass & (IC_GUN|IC_PUNCH|IC_BLADE|IC_THROWING_KNIFE) && !ItemIsSingleShotRocketLauncher(gpItemDescObject->usItem) ) { // DAMAGE SetFontForeground( 6 ); @@ -8365,7 +8363,7 @@ void DeleteItemDescriptionBox( ) } if (Item[gpItemDescObject->usItem].usItemClass == IC_LAUNCHER && ValidLaunchable(newIter->usItem, gpItemDescObject->usItem) || - Item[gpItemDescObject->usItem].cannon) + ItemIsCannon(gpItemDescObject->usItem)) { //lalien: changed to charge AP's for reloading a GL/RL ubAPCost = GetAPsToReload(gpItemDescObject); @@ -10712,7 +10710,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpItemPopupObject->usItem].singleshotrocketlauncher) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpItemPopupObject->usItem) ) { EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos ); InternalMAPBeginItemPointer( gpItemPopupSoldier ); @@ -10723,7 +10721,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpItemPopupObject->usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpItemPopupObject->usItem].usItemClass == IC_GUN && (*gpItemPopupObject)[uiItemPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpItemPopupObject->usItem) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) { EmptyWeaponMagazine( gpItemPopupObject, &gItemPointer, uiItemPos ); gpItemPointer = &gItemPointer; @@ -12629,7 +12627,7 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier // Fingerprint ID (Soldier Name) - if ( ( Item[pObject->usItem].fingerprintid ) && (*pObject)[subObject]->data.ubImprintID < NO_PROFILE ) + if ( ItemHasFingerPrintID(pObject->usItem) && (*pObject)[subObject]->data.ubImprintID < NO_PROFILE ) { CHAR16 pStr2[20]; swprintf( pStr2, L" [%s]", gMercProfiles[ (*pObject)[subObject]->data.ubImprintID ].zNickname ); @@ -13816,7 +13814,7 @@ void BombInventoryMessageBoxCallBack( UINT8 ubExitValue ) if (gpItemDescSoldier) { // no planting tripwire in our inventory... - if ( Item[ gpItemDescObject->usItem ].tripwire == 1 ) + if (ItemIsTripwire(gpItemDescObject->usItem)) return; INT32 iResult; @@ -13965,14 +13963,14 @@ void BombInventoryDisArmMessageBoxCallBack( UINT8 ubExitValue ) if ( (*gpItemDescObject)[0]->data.misc.ubBombOwner > 1 && ( (INT32)(*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 >= gTacticalStatus.Team[ OUR_TEAM ].bFirstID && (*gpItemDescObject)[0]->data.misc.ubBombOwner - 2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ) ) { // Flugente: get a tripwire-related bonus if we have a wire cutter in our hands - if ( ( (&gpItemDescSoldier->inv[HANDPOS])->exists() && Item[ gpItemDescSoldier->inv[HANDPOS].usItem ].wirecutters == 1 ) || ( (&gpItemDescSoldier->inv[SECONDHANDPOS])->exists() && Item[ gpItemDescSoldier->inv[SECONDHANDPOS].usItem ].wirecutters == 1 ) ) + if ( ( (&gpItemDescSoldier->inv[HANDPOS])->exists() && ItemIsWirecutters(gpItemDescSoldier->inv[HANDPOS].usItem) ) || ( (&gpItemDescSoldier->inv[SECONDHANDPOS])->exists() && ItemIsWirecutters(gpItemDescSoldier->inv[SECONDHANDPOS].usItem) ) ) { // + 10 if item gets activated by tripwire - if ( Item[gpItemDescObject->usItem].tripwireactivation == 1 ) + if (ItemHasTripwireActivation(gpItemDescObject->usItem)) diff += 10; // + 10 if item is tripwire - if ( Item[gpItemDescObject->usItem].tripwire == 1 ) + if (ItemIsTripwire(gpItemDescObject->usItem)) diff += 10; } diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 4bbbeebd..13d9d2cb 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3373,7 +3373,7 @@ BOOLEAN HandleNailsVestFetish( SOLDIERTYPE *pSoldier, UINT32 uiHandPos, UINT16 u else { // Do we have nothing or the leather vest or kevlar leather vest? - if ( Item[usReplaceItem].leatherjacket || + if (ItemIsLeatherJacket(usReplaceItem) || usReplaceItem == COMPOUND18 || usReplaceItem == JAR_QUEEN_CREATURE_BLOOD ) { @@ -4044,7 +4044,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if ( !InItemDescriptionBox( ) ) { - if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !(Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].singleshotrocketlauncher) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) + if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[gpSMCurrentMerc->inv[ uiHandPos ].usItem].usItemClass == IC_GUN && (gpSMCurrentMerc->inv[ uiHandPos ])[uiHandPos]->data.gun.ubGunShotsLeft > 0 && !ItemIsSingleShotRocketLauncher(gpSMCurrentMerc->inv[ uiHandPos ].usItem) && !( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE ) ) { EmptyWeaponMagazine( &(gpSMCurrentMerc->inv[ uiHandPos ]), &gItemPointer, uiHandPos ); gpItemPointer = &gItemPointer; @@ -7096,22 +7096,23 @@ void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ) void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) { INT16 bMaxPoints; + UINT16 usItem = pObj->usItem; - if ( !(Item[pObj->usItem].usItemClass & IC_AMMO || Item[pObj->usItem].usItemClass & IC_KIT || Item[pObj->usItem].usItemClass & IC_MEDKIT || Item[pObj->usItem].canteen || Item[pObj->usItem].gascan || Item[pObj->usItem].alcohol > 0.0f) ) + if ( !(Item[usItem].usItemClass & IC_AMMO || Item[usItem].usItemClass & IC_KIT || Item[usItem].usItemClass & IC_MEDKIT || ItemIsCanteen(usItem) || ItemIsGascan(usItem) || Item[usItem].alcohol > 0.0f) ) { return; } - if ( Item[ pObj->usItem ].usItemClass & IC_AMMO ) + if ( Item[ usItem ].usItemClass & IC_AMMO ) { - bMaxPoints = Magazine[ Item[ pObj->usItem ].ubClassIndex ].ubMagSize; + bMaxPoints = Magazine[ Item[ usItem ].ubClassIndex ].ubMagSize; } else { bMaxPoints = 100; } - if ( pCursorObj && pCursorObj->usItem == pObj->usItem ) + if ( pCursorObj && pCursorObj->usItem == usItem ) { DistributeStatus(pCursorObj, pObj, bMaxPoints); } @@ -7120,13 +7121,13 @@ void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) // Flugente: one of the items on the stack might not be full. Make sure it is the first one, so the player can see what is missing at a glance if ( pObj->ubNumberOfObjects > 1 ) { - if ( Item[pObj->usItem].usItemClass & IC_AMMO ) + if ( Item[usItem].usItemClass & IC_AMMO ) { UINT16 shots_first = (*pObj)[0]->data.ubShotsLeft; (*pObj)[0]->data.ubShotsLeft = (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft; (*pObj)[pObj->ubNumberOfObjects - 1]->data.ubShotsLeft = shots_first; } - else if ( Item[pObj->usItem].usItemClass & IC_MAPFILTER_KIT ) + else if ( Item[usItem].usItemClass & IC_MAPFILTER_KIT ) { INT16 status_first = (*pObj)[0]->data.objectStatus; (*pObj)[0]->data.objectStatus = (*pObj)[pObj->ubNumberOfObjects - 1]->data.objectStatus; diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 5ab36750..cfa3098e 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -978,12 +978,12 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) } else { - if ( Item[pSoldier->inv[ HANDPOS ].usItem].toolkit ) + if (ItemIsToolkit(pSoldier->inv[ HANDPOS ].usItem)) { uiActionImages = TOOLKITACTIONC_IMAGES; swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] ); } - else if ( Item[pSoldier->inv[ HANDPOS ].usItem].wirecutters ) + else if (ItemIsWirecutters(pSoldier->inv[ HANDPOS ].usItem)) { uiActionImages = WIRECUTACTIONC_IMAGES; swprintf( zActionString, TacticalStr[ NOT_APPLICABLE_POPUPTEXT ] ); @@ -6043,7 +6043,7 @@ void GetEnemyInfoString( SOLDIERTYPE* pSelectedSoldier, SOLDIERTYPE* pTargetSold } else { // show general name - if( Item[pTargetSoldier->inv[HEAD1POS].usItem].gasmask ) + if(ItemIsGasmask(pTargetSoldier->inv[HEAD1POS].usItem)) wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] ); else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus ) wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] ); @@ -6059,7 +6059,7 @@ void GetEnemyInfoString( SOLDIERTYPE* pSelectedSoldier, SOLDIERTYPE* pTargetSold } else { // show general name - if( Item[pTargetSoldier->inv[HEAD1POS].usItem].gasmask ) + if(ItemIsGasmask(pTargetSoldier->inv[HEAD1POS].usItem)) wcscat( NameStr, TacticalStr[ GENERAL_INFO_MASK ] ); else if( Item[pTargetSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus || Item[pTargetSoldier->inv[HEAD1POS].usItem].cavevisionrangebonus ) wcscat( NameStr, TacticalStr[ GENERAL_INFO_NVG ] ); diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index cbac1179..72bfa796 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -738,7 +738,7 @@ void GenerateRandomEquipment( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass, INT8 switch( Item[ pItem->usItem ].usItemClass ) { case IC_GUN: - if ( !Item[pItem->usItem].rocketlauncher ) + if ( !ItemIsRocketLauncher(pItem->usItem) ) { bWeaponClass *= -1; } @@ -873,7 +873,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC pp->Inv[ i ][0]->data.gun.ubGunAmmoType = Magazine[Item[usAmmoIndex].ubClassIndex].ubAmmoType; pp->Inv[ i ][0]->data.gun.usGunAmmoItem = usAmmoIndex; - if ( Item[usGunIndex].fingerprintid ) + if (ItemHasFingerPrintID(usGunIndex)) { pp->Inv[ i ][0]->data.ubImprintID = (NO_PROFILE + 1); } @@ -951,7 +951,7 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC pp->Inv[ HANDPOS ].fFlags |= OBJECT_UNDROPPABLE; // Rocket Rifles must come pre-imprinted, in case carrier gets killed without getting a shot off - if ( Item[usGunIndex].fingerprintid ) + if (ItemHasFingerPrintID(usGunIndex)) { pp->Inv[ HANDPOS ][0]->data.ubImprintID = (NO_PROFILE + 1); } @@ -3144,7 +3144,7 @@ void ReplaceExtendedGuns( SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ) { usItem = pp->Inv[ uiLoop ].usItem; - if ( ( Item[ usItem ].usItemClass & IC_GUN ) && ExtendedGunListGun( usItem ) ) + if ( ( Item[ usItem ].usItemClass & IC_GUN ) && ItemIsOnlyInTonsOfGuns( usItem ) ) { if ( bSoldierClass == SOLDIER_CLASS_NONE ) { @@ -3528,7 +3528,7 @@ UINT32 ItemFitness( OBJECTTYPE* pObj, UINT8 idx ) } else if ( Item[ pObj->usItem ].usItemClass & IC_FACE ) { - if ( Item[ pObj->usItem ].gasmask ) + if (ItemIsGasmask(pObj->usItem)) value = (*pObj)[idx]->data.objectStatus; else if ( Item[ pObj->usItem ].hearingrangebonus ) { @@ -4186,7 +4186,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI else if ( Item[pWorldItem[ uiCount ].object.usItem].usItemClass & IC_FACE && (!si[SI_SIGHT].done || !si[SI_FACE2].done || !si[SI_FACE_SPARESIGHT].done || !si[SI_GASMASK].done) ) { // gasmasks are reserved for a special slot and will only be worn if we do not have 2 face items. items that increase our vision (NVGs adn sungooggles) get to slot 1, everything else in 2 - if ( Item[ pWorldItem[ uiCount ].object.usItem ].gasmask ) + if (ItemIsGasmask(pWorldItem[ uiCount ].object.usItem)) EvaluateObjForItem( pWorldItem, pObj, uiCount, &si[SI_GASMASK] ); else if ( Item[ pWorldItem[ uiCount ].object.usItem ].nightvisionrangebonus > 0 ) { @@ -4265,7 +4265,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI if ( fnd == launcherhelpmap.end() ) { LauncherHelpStruct tmp; - tmp.fNeedsAmmo = !Item[pWorldItem[ uiCount ].object.usItem].singleshotrocketlauncher; + tmp.fNeedsAmmo = !ItemIsSingleShotRocketLauncher(pWorldItem[ uiCount ].object.usItem); launcherhelpmap[ pWorldItem[ uiCount ].object.usItem ] = tmp; } } diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index e8a7c848..b80888d0 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -1595,7 +1595,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) } else if ( EXPLOSIVE_GUN( this->usItem ) ) { - if ( Item[this->usItem].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(this->usItem)) { (*this)[0]->data.gun.ubGunShotsLeft = 1; } diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 3d82e35e..78f1f5d5 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -779,6 +779,98 @@ extern OBJECTTYPE gTempObject; // extended flagmask to UINT64 #define EMPTY_BLOOD_BAG 0x0000000100000000 // this item is a empty blood bag #define MEDICAL_SPLINT 0x0000000200000000 // this item is a medical splint that can be applied to some diseases +#define ITEM_damageable 0x0000000400000000 +#define ITEM_repairable 0x0000000800000000 + +#define ITEM_waterdamages 0x0000001000000000 +#define ITEM_metal 0x0000002000000000 +#define ITEM_sinks 0x0000004000000000 +#define ITEM_showstatus 0x0000008000000000 + +#define ITEM_hiddenaddon 0x0000010000000000 +#define ITEM_twohanded 0x0000020000000000 +#define ITEM_notbuyable 0x0000040000000000 +#define ITEM_attachment 0x0000080000000000 + +#define ITEM_hiddenattachment 0x0000100000000000 +#define ITEM_biggunlist 0x0000200000000000 +#define ITEM_notineditor 0x0000400000000000 +#define ITEM_defaultundroppable 0x0000800000000000 + +#define ITEM_unaerodynamic 0x0001000000000000 +#define ITEM_electronic 0x0002000000000000 +#define ITEM_cannon 0x0004000000000000 +#define ITEM_rocketrifle 0x0008000000000000 + +#define ITEM_fingerprintid 0x0010000000000000 +#define ITEM_metaldetector 0x0020000000000000 +#define ITEM_gasmask 0x0040000000000000 +#define ITEM_lockbomb 0x0080000000000000 + +#define ITEM_flare 0x0100000000000000 +#define ITEM_grenadelauncher 0x0200000000000000 +#define ITEM_mortar 0x0400000000000000 +#define ITEM_duckbill 0x0800000000000000 + +#define ITEM_detonator 0x1000000000000000 +#define ITEM_remotedetonator 0x2000000000000000 +#define ITEM_hidemuzzleflash 0x4000000000000000 +#define ITEM_rocketlauncher 0x8000000000000000 + +// New UINT64 Item Flag => usItemFlag2 +#define ITEM_singleshotrocketlauncher 0x00000001 +#define ITEM_brassknuckles 0x00000002 +#define ITEM_crowbar 0x00000004 +#define ITEM_glgrenade 0x00000008 + +#define ITEM_flakjacket 0x00000010 +#define ITEM_leatherjacket 0x00000020 +#define ITEM_batteries 0x00000040 +#define ITEM_needsbatteries 0x00000080 + +#define ITEM_xray 0x00000100 +#define ITEM_wirecutters 0x00000200 +#define ITEM_toolkit 0x00000400 +#define ITEM_firstaidkit 0x00000800 + +#define ITEM_medicalkit 0x00001000 +#define ITEM_canteen 0x00002000 +#define ITEM_jar 0x00004000 +#define ITEM_canandstring 0x00008000 + +#define ITEM_marbles 0x00010000 +#define ITEM_walkman 0x00020000 +#define ITEM_remotetrigger 0x00040000 +#define ITEM_robotremotecontrol 0x00080000 + +#define ITEM_camouflagekit 0x00100000 +#define ITEM_locksmithkit 0x00200000 +#define ITEM_mine 0x00400000 +#define ITEM_antitankmine 0x00800000 + +#define ITEM_hardware 0x01000000 +#define ITEM_medical 0x02000000 +#define ITEM_gascan 0x04000000 +#define ITEM_containsliquid 0x08000000 + +#define ITEM_rock 0x10000000 +#define ITEM_thermaloptics 0x20000000 +#define ITEM_scifi 0x40000000 +#define ITEM_newinv 0x80000000 + +#define ITEM_DiseaseSystemExclusive 0x0000000100000000 // kitty: item exclusively available with disease feature +#define ITEM_barrel 0x0000000200000000 // item can be used on some guns as an exchange barrel +#define ITEM_tripwireactivation 0x0000000400000000 // item (mine) can be activated by nearby tripwire +#define ITEM_tripwire 0x0000000800000000 // item is tripwire + +#define ITEM_directional 0x0000001000000000 // item is a directional mine/bomb (actual direction is set upon planting) +#define ITEM_blockironsight 0x0000002000000000 // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight) +#define ITEM_fAllowClimbing 0x0000004000000000 // JMich: BackpackClimb does item allow climbing while wearing it +#define ITEM_cigarette 0x0000008000000000 // Flugente: this item can be smoked + +#define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments +#define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments +#define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments // ---------------------------------------------------------------- @@ -947,160 +1039,48 @@ extern OBJECTTYPE gTempObject; // autofiretohitbonus, // bursttohitbonus - typedef struct { - UINT32 usItemClass; - UINT64 nasAttachmentClass; //CHRISL: Identify the class of attachment - UINT64 nasLayoutClass; -//Madd: Common Attachment Framework: attach items based on matching connection points rather than using the old long attachmentinfo method - UINT64 ulAvailableAttachmentPoint; - UINT64 ulAttachmentPoint; - UINT8 ubAttachToPointAPCost; // cost to attach to any matching point - UINT16 ubClassIndex; - UINT8 ubCursor; - INT8 bSoundType; - UINT8 ubGraphicType; - UINT16 ubGraphicNum; - UINT16 ubWeight; //2 units per kilogram; roughly 1 unit per pound - UINT8 ubPerPocket; - UINT16 ItemSize; - UINT16 usPrice; - UINT8 ubCoolness; - INT8 bReliability; - INT8 bRepairEase; - UINT16 fFlags; - - UINT32 uiIndex; // added - CHAR16 szItemName[80]; //+1 for the null terminator //added - - BOOLEAN damageable; - BOOLEAN repairable; - BOOLEAN waterdamages; - BOOLEAN metal; - BOOLEAN sinks; - BOOLEAN showstatus; - BOOLEAN hiddenaddon; - BOOLEAN twohanded; - BOOLEAN notbuyable; - BOOLEAN attachment; - BOOLEAN hiddenattachment; - BOOLEAN biggunlist; - BOOLEAN notineditor; - BOOLEAN defaultundroppable; - BOOLEAN unaerodynamic; - BOOLEAN electronic; - UINT8 inseparable; //Madd:Normally, an inseparable attachment can never be removed. - //But now we will make it so that these items can be replaced, but still not removed directly. - //0 = removeable (as before) - //1 = inseparable (as before) - //2 = inseparable, but replaceable - - CHAR16 szLongItemName[80]; CHAR16 szItemDesc[400]; - CHAR16 szBRName[80]; CHAR16 szBRDesc[400]; - - //TODO: quest items, boosters, money - - // special item/attachment functions: - BOOLEAN cannon; - BOOLEAN rocketrifle; - BOOLEAN fingerprintid; - BOOLEAN metaldetector; - BOOLEAN gasmask; - BOOLEAN lockbomb; - BOOLEAN flare; - INT16 percentnoisereduction; - INT16 bipod; - INT16 tohitbonus; - INT16 bestlaserrange; - INT16 rangebonus; - INT16 percentrangebonus; - INT16 aimbonus; - INT16 minrangeforaimbonus; - INT16 percentapreduction; - INT16 percentstatusdrainreduction; - BOOLEAN grenadelauncher; - BOOLEAN mortar; - BOOLEAN duckbill; - BOOLEAN detonator; - BOOLEAN remotedetonator; - BOOLEAN hidemuzzleflash; - BOOLEAN rocketlauncher; - BOOLEAN singleshotrocketlauncher; - UINT16 discardedlauncheritem; - BOOLEAN brassknuckles; - //*** ddd UINT16 bloodieditem; - INT16 bloodieditem; - BOOLEAN crowbar; - BOOLEAN glgrenade; - BOOLEAN flakjacket; - INT16 hearingrangebonus; - INT16 visionrangebonus; - INT16 nightvisionrangebonus; - INT16 dayvisionrangebonus; - INT16 cavevisionrangebonus; - INT16 brightlightvisionrangebonus; - INT16 itemsizebonus; - BOOLEAN leatherjacket; - BOOLEAN batteries; - BOOLEAN needsbatteries; - BOOLEAN xray; - BOOLEAN wirecutters; - BOOLEAN toolkit; - BOOLEAN firstaidkit; - BOOLEAN medicalkit; - BOOLEAN canteen; - BOOLEAN jar; - BOOLEAN canandstring; - BOOLEAN marbles; - BOOLEAN walkman; - BOOLEAN remotetrigger; - BOOLEAN robotremotecontrol; - BOOLEAN camouflagekit; - BOOLEAN locksmithkit; - BOOLEAN mine; - BOOLEAN antitankmine; - FLOAT alcohol; - BOOLEAN hardware; - BOOLEAN medical; - BOOLEAN gascan; - BOOLEAN containsliquid; - BOOLEAN rock; - - INT16 damagebonus; - INT16 meleedamagebonus; - - INT16 magsizebonus; - INT16 percentautofireapreduction; - INT16 autofiretohitbonus; - INT16 APBonus; - INT16 rateoffirebonus; - INT16 burstsizebonus; - INT16 bursttohitbonus; - INT16 percentreadytimeapreduction; - INT16 bulletspeedbonus; - BOOLEAN thermaloptics; - UINT8 percenttunnelvision; - INT16 percentreloadtimeapreduction; - INT16 percentburstfireapreduction; - - INT16 camobonus; - INT16 stealthbonus; - INT16 urbanCamobonus; - INT16 desertCamobonus; - INT16 snowCamobonus; - - BOOLEAN scifi; // item only available in scifi mode - BOOLEAN newinv; // item only available in new inventory mode - UINT8 ubAttachmentSystem; //Item availability per attachment system: 0 = both, 1 = OAS, 2 = NAS - + CHAR16 szItemName[80]; //+1 for the null terminator //added + CHAR16 szLongItemName[80]; + CHAR16 szBRName[80]; UINT16 defaultattachments[MAX_DEFAULT_ATTACHMENTS]; //Need more default attachments, chose an array to do so. (no vector / list just to keep this all plain data) + UINT64 nasAttachmentClass; //CHRISL: Identify the class of attachment + UINT64 nasLayoutClass; + UINT64 ulAvailableAttachmentPoint; + UINT64 ulAttachmentPoint; + UINT64 usItemFlag; // bitflags to store various item properties (better than introducing 64 BOOLEAN values). If I only had thought of this earlier.... + UINT64 usItemFlag2; // bitflags to store various item properties + + UINT32 uiIndex; + UINT32 usItemClass; + UINT32 attachmentclass; // attachmentclass used + UINT32 drugtype; // this flagmask determines what different components are used in a drug, which results in different effects + UINT32 foodtype; + UINT32 usActionItemFlag; // Flugente: a flag that is necessary for transforming action items to objects with new abilities (for now, tripwire networks and directional explosives) + UINT32 clothestype; // Flugente: clothes type that 'links' to an entry in Clothes.xml + //zilpin: pellet spread patterns externalized in XML INT32 spreadPattern; + FLOAT alcohol; + // HEADROCK HAM 4: New modifiers that do not require a stance array, since they affect the gun objectively, not + // subjectively. + FLOAT RecoilModifierX; + FLOAT RecoilModifierY; + FLOAT scopemagfactor; + FLOAT projectionfactor; + FLOAT usOverheatingCooldownFactor; // every turn/5 seconds, a gun's temperature is lowered by this amount + FLOAT overheatTemperatureModificator; // percentage modifier of heat a shot generates (read from attachments) + FLOAT overheatCooldownModificator; // percentage modifier of cooldown amount (read from attachments, applies to guns & barrels) + FLOAT overheatJamThresholdModificator; // percentage modifier of a gun's jam threshold (read from attachments) + FLOAT overheatDamageThresholdModificator; // percentage modifier of a gun's damage threshold (read from attachments) + FLOAT dirtIncreaseFactor; // Flugente: advanced repair/dirt system. One shot causes this much dirt on a gun + FLOAT fRobotDamageReductionModifier; // rftr: robot attachments + // HEADROCK HAM 4: New variable arrays for the New CTH system. INT16 flatbasemodifier[3]; INT16 percentbasemodifier[3]; @@ -1113,115 +1093,98 @@ typedef struct INT16 counterforceaccuracymodifier[3]; INT16 targettrackingmodifier[3]; INT16 aimlevelsmodifier[3]; - // HEADROCK HAM 4: New modifiers that do not require a stance array, since they affect the gun objectively, not - // subjectively. - FLOAT RecoilModifierX; - FLOAT RecoilModifierY; + + //Madd: Common Attachment Framework: attach items based on matching connection points rather than using the old long attachmentinfo method + UINT16 ubClassIndex; + UINT16 ubGraphicNum; + UINT16 ubWeight; //2 units per kilogram; roughly 1 unit per pound + UINT16 ItemSize; + UINT16 usPrice; + UINT16 discardedlauncheritem; + UINT16 randomitem; // Flugente: a link to RandomItemsClass.xml. Out of such an item, a random object is created, depending on the entries in the xml + UINT16 usBuddyItem; // Flugente: item is connected to another item. Type of connection depends on item specifics + UINT16 usRiotShieldStrength; // Flugente: riot shields. strength of shield + UINT16 usRiotShieldGraphic; // Flugente: riot shields. graphic of shield (when deployed in tactical, taken from Tilecache/riotshield.sti) + + INT16 percentnoisereduction; + INT16 bipod; + INT16 tohitbonus; + INT16 bestlaserrange; + INT16 rangebonus; + INT16 percentrangebonus; + INT16 aimbonus; + INT16 minrangeforaimbonus; + INT16 percentapreduction; + INT16 percentstatusdrainreduction; + INT16 bloodieditem; + INT16 hearingrangebonus; + INT16 visionrangebonus; + INT16 nightvisionrangebonus; + INT16 dayvisionrangebonus; + INT16 cavevisionrangebonus; + INT16 brightlightvisionrangebonus; + INT16 itemsizebonus; + INT16 damagebonus; + INT16 meleedamagebonus; + INT16 magsizebonus; + INT16 percentautofireapreduction; + INT16 autofiretohitbonus; + INT16 APBonus; + INT16 rateoffirebonus; + INT16 burstsizebonus; + INT16 bursttohitbonus; + INT16 percentreadytimeapreduction; + INT16 bulletspeedbonus; + INT16 percentreloadtimeapreduction; + INT16 percentburstfireapreduction; + INT16 camobonus; + INT16 stealthbonus; + INT16 urbanCamobonus; + INT16 desertCamobonus; + INT16 snowCamobonus; INT16 PercentRecoilModifier; INT16 percentaccuracymodifier; - FLOAT scopemagfactor; - FLOAT projectionfactor; - BOOLEAN speeddot; + INT16 usSpotting; // Flugente: spotting effectiveness + INT16 sBackpackWeightModifier; // JMich: BackpackClimb modifier to weight calculation to climb. + INT16 sFireResistance; - // Flugente - BOOLEAN barrel; // item can be used on some guns as an exchange barrel - FLOAT usOverheatingCooldownFactor; // every turn/5 seconds, a gun's temperature is lowered by this amount - FLOAT overheatTemperatureModificator; // percentage modifier of heat a shot generates (read from attachments) - FLOAT overheatCooldownModificator; // percentage modifier of cooldown amount (read from attachments, applies to guns & barrels) - FLOAT overheatJamThresholdModificator; // percentage modifier of a gun's jam threshold (read from attachments) - FLOAT overheatDamageThresholdModificator; // percentage modifier of a gun's damage threshold (read from attachments) + UINT8 ubAttachToPointAPCost; // cost to attach to any matching point + UINT8 ubCursor; + UINT8 ubGraphicType; + UINT8 ubPerPocket; + UINT8 ubCoolness; + UINT8 percenttunnelvision; + UINT8 ubAttachmentSystem; //Item availability per attachment system: 0 = both, 1 = OAS, 2 = NAS + UINT8 CrowbarModifier; + UINT8 DisarmModifier; + UINT8 usHackingModifier; + UINT8 usBurialModifier; // Flugente: a modifier for burial effectiveness + UINT8 usDamageChance; // Flugente: advanced repair/dirt system. Chance that damage to the status will also damage the repair threshold + UINT8 usFlashLightRange; // Flugente: range of a flashlight (an item with usFlashLightRange > 0 is deemed a flashlight) + UINT8 usItemChoiceTimeSetting; // Flugente: determine wether the AI should pick this item for its choices only at certain times + UINT8 ubSleepModifier; // silversurfer: item provides breath regeneration bonus while resting + UINT8 usPortionSize; // Flugente: for consumables: how much of this item is consumed at once + UINT8 usAdministrationModifier; // Flugente: a modifier for administration effectiveness + UINT8 inseparable; //Madd:Normally, an inseparable attachment can never be removed. + //But now we will make it so that these items can be replaced, but still not removed directly. + //0 = removeable (as before) + //1 = inseparable (as before) + //2 = inseparable, but replaceable - UINT32 attachmentclass; // attachmentclass used - - BOOLEAN tripwireactivation; // item (mine) can be activated by nearby tripwire - BOOLEAN tripwire; // item is tripwire - BOOLEAN directional; // item is a directional mine/bomb (actual direction is set upon planting) - - UINT32 drugtype; // this flagmask determines what different components are used in a drug, which results in different effects - - BOOLEAN blockironsight; // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight) - - UINT64 usItemFlag; // bitflags to store various item properties (better than introducing 32 BOOLEAN values). If I only had thought of this earlier.... - - // Flugente: food type - UINT32 foodtype; - - //JMich_SkillModifiers: Adding new skill modifiers - INT8 LockPickModifier; - UINT8 CrowbarModifier; - UINT8 DisarmModifier; - INT8 RepairModifier; - - // Flugente: a modifier to hacking - UINT8 usHackingModifier; - - // Flugente: a modifier for burial effectiveness - UINT8 usBurialModifier; - - // Flugente: advanced repair/dirt system - UINT8 usDamageChance; // chance that damage to the status will also damage the repair threshold - FLOAT dirtIncreaseFactor; // one shot causes this much dirt on a gun - - // Flugente: a flag that is necessary for transforming action items to objects with new abilities (for now, tripwire networks and directional explosives) - UINT32 usActionItemFlag; - - // Flugente: clothes type that 'links' to an entry in Clothes.xml - UINT32 clothestype; - - // Flugente: a link to RandomItemsClass.xml. Out of such an item, a random object is created, depending on the entries in the xml - UINT16 randomitem; - INT8 randomitemcoolnessmodificator; // alters the allowed maximum coolness a random item can have - - // Flugente: range of a flashlight (an item with usFlashLightRange > 0 is deemed a flashlight) - UINT8 usFlashLightRange; - - // Flugente: determine wether the AI should pick this item for its choices only at certain times - UINT8 usItemChoiceTimeSetting; - - // Flugente: item is connected to another item. Type of connection depends on item specifics - UINT16 usBuddyItem; - - // silversurfer: item provides breath regeneration bonus while resting - UINT8 ubSleepModifier; - - // Flugente: spotting effectiveness - INT16 usSpotting; - - //JMich.BackpackClimb - INT16 sBackpackWeightModifier; //modifier to weight calculation to climb. - BOOLEAN fAllowClimbing; //does item allow climbing while wearing it - - BOOLEAN cigarette; // Flugente: this item can be smoked - UINT8 usPortionSize; // Flugente: for consumables: how much of this item is consumed at once - - // Flugente: riot shields - UINT16 usRiotShieldStrength; // strength of shield - UINT16 usRiotShieldGraphic; // graphic of shield (when deployed in tactical, taken from Tilecache/riotshield.sti) - - // Flugente: fire resistance - INT16 sFireResistance; - - // Flugente: a modifier for administration effectiveness - UINT8 usAdministrationModifier; - - // rftr: robot attachments - FLOAT fRobotDamageReductionModifier; - INT8 bRobotStrBonus; - INT8 bRobotAgiBonus; - INT8 bRobotDexBonus; - INT8 bRobotTargetingSkillGrant; - INT8 bRobotChassisSkillGrant; - INT8 bRobotUtilitySkillGrant; - BOOLEAN fProvidesRobotCamo; - BOOLEAN fProvidesRobotNightVision; - BOOLEAN fProvidesRobotLaserBonus; - - // kitty: item exclusively available with disease feature - BOOLEAN DiseaseSystemExclusive; - - // rftr: the progress bounds that allow a transport group to drop an item - INT8 iTransportGroupMinProgress; - INT8 iTransportGroupMaxProgress; + INT8 bSoundType; + INT8 bReliability; + INT8 bRepairEase; + INT8 LockPickModifier; + INT8 RepairModifier; + INT8 randomitemcoolnessmodificator; // Flugente: a link to RandomItemsClass.xml. alters the allowed maximum coolness a random item can have + INT8 bRobotStrBonus; // rftr: robot attachments + INT8 bRobotAgiBonus; // rftr: robot attachments + INT8 bRobotDexBonus; // rftr: robot attachments + INT8 bRobotTargetingSkillGrant; // rftr: robot attachments + INT8 bRobotChassisSkillGrant; // rftr: robot attachments + INT8 bRobotUtilitySkillGrant; // rftr: robot attachments + INT8 iTransportGroupMinProgress; // rftr: the progress bounds that allow a transport group to drop an item + INT8 iTransportGroupMaxProgress; // rftr: the progress bounds that allow a transport group to drop an item } INVTYPE; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 6e154a04..10ac4652 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1281,7 +1281,7 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) // kitty: no disease items if the disease system is off // whether the item is exclusive is defined by tag - if (!gGameExternalOptions.fDisease && Item[usItemIndex].DiseaseSystemExclusive) + if (!gGameExternalOptions.fDisease && ItemIsOnlyInDisease(usItemIndex)) { return FALSE; } @@ -1293,14 +1293,14 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) //if( (Item[ usItemIndex ].usItemClass == IC_GUN) || (Item[ usItemIndex ].usItemClass == IC_AMMO )) //Madd: restriction removed { // and the item is only available with the extended guns - if( Item[usItemIndex].biggunlist ) + if(ItemIsOnlyInTonsOfGuns(usItemIndex)) { return(FALSE); } } } - if ( gGameOptions.ubGameStyle != STYLE_SCIFI && Item[usItemIndex].scifi ) + if ( gGameOptions.ubGameStyle != STYLE_SCIFI && ItemIsOnlyInScifi(usItemIndex) ) { return FALSE; } @@ -1313,7 +1313,7 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) } else { - if(Item[usItemIndex].usItemClass == IC_LBEGEAR || Item[usItemIndex].newinv) + if(Item[usItemIndex].usItemClass == IC_LBEGEAR || ItemIsOnlyInNIV(usItemIndex)) return FALSE; } @@ -1325,18 +1325,11 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) return(TRUE); } -// also used for ammo -BOOLEAN ExtendedGunListGun( UINT16 usGun ) -{ -// return( (Item[ usGun ].fFlags & ITEM_BIGGUNLIST) != 0 ); - return( (Item[ usGun ].biggunlist ) != 0 ); -} - UINT16 StandardGunListReplacement( UINT16 usGun ) { UINT8 ubLoop; - if ( ExtendedGunListGun( usGun ) ) + if (ItemIsOnlyInTonsOfGuns( usGun ) ) { ubLoop = 0; while ( ReplacementGuns[ ubLoop ][ 0 ] != 0 ) @@ -1386,7 +1379,7 @@ BOOLEAN WeaponInHand( SOLDIERTYPE * pSoldier ) { if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_WEAPON | IC_THROWN) && pSoldier->inv[HANDPOS].exists() == true) { - if (Item[pSoldier->inv[HANDPOS].usItem].fingerprintid ) + if (ItemHasFingerPrintID(pSoldier->inv[HANDPOS].usItem)) { if (pSoldier->inv[HANDPOS][0]->data.ubImprintID != NO_PROFILE) { @@ -1637,18 +1630,18 @@ INT8 FindBestWeaponIfCurrentIsOutOfRange(SOLDIERTYPE * pSoldier, INT8 bCurrentWe INT8 FindMetalDetectorInHand( SOLDIERTYPE * pSoldier ) { - if ( (&(pSoldier->inv[HANDPOS] ))->exists() && Item[pSoldier->inv[HANDPOS].usItem].metaldetector ) + if ( (&(pSoldier->inv[HANDPOS] ))->exists() && ItemIsMetalDetector(pSoldier->inv[HANDPOS].usItem)) { return( HANDPOS ); } - if ( (&(pSoldier->inv[SECONDHANDPOS] ))->exists() && Item[pSoldier->inv[SECONDHANDPOS].usItem].metaldetector ) + if ( (&(pSoldier->inv[SECONDHANDPOS] ))->exists() && ItemIsMetalDetector(pSoldier->inv[SECONDHANDPOS].usItem)) { return( SECONDHANDPOS ); } // rftr: a metal detector can be installed into the robot - if ( pSoldier && AM_A_ROBOT(pSoldier) && (&(pSoldier->inv[ROBOT_UTILITY_SLOT]))->exists() && Item[pSoldier->inv[ROBOT_UTILITY_SLOT].usItem].metaldetector ) + if ( pSoldier && AM_A_ROBOT(pSoldier) && (&(pSoldier->inv[ROBOT_UTILITY_SLOT]))->exists() && ItemIsMetalDetector(pSoldier->inv[ROBOT_UTILITY_SLOT].usItem)) { return( ROBOT_UTILITY_SLOT ); } @@ -1661,7 +1654,7 @@ INT8 FindLockBomb( SOLDIERTYPE * pSoldier ) INT8 invsize = (INT8)pSoldier->inv.size(); for (INT8 bLoop = 0; bLoop < invsize; ++bLoop) { - if (Item[pSoldier->inv[bLoop].usItem].lockbomb && pSoldier->inv[bLoop].exists() == true) + if (ItemIsLockBomb(pSoldier->inv[bLoop].usItem) && pSoldier->inv[bLoop].exists() == true) { return( bLoop ); } @@ -1842,7 +1835,7 @@ INT8 FindEmptySlotWithin( SOLDIERTYPE * pSoldier, INT8 bLower, INT8 bUpper ) continue; if (pSoldier->inv[bLoop].exists() == false) { - if (bLoop == SECONDHANDPOS && Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if (bLoop == SECONDHANDPOS && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) ) { continue; } @@ -1858,7 +1851,7 @@ INT8 FindEmptySlotWithin( SOLDIERTYPE * pSoldier, INT8 bLower, INT8 bUpper ) BOOLEAN GLGrenadeInSlot(SOLDIERTYPE *pSoldier, INT8 bSlot ) { if (pSoldier->inv[bSlot].exists() == true) { - if (Item[pSoldier->inv[bSlot].usItem].glgrenade) + if (ItemIsGLgrenade(pSoldier->inv[bSlot].usItem)) return TRUE; } //switch (pSoldier->inv[bSlot].usItem) @@ -1922,12 +1915,12 @@ INT8 FindThrowableGrenade(SOLDIERTYPE * pSoldier, UINT8 ubGrenadeType, UINT8 ubM if ((Item[usItem].usItemClass & IC_GRENADE) && Item[usItem].ubCursor == TOSSCURS && GetLauncherFromLaunchable(usItem) == NOTHING && - (!Item[usItem].flare || NightLight()) && + (!ItemIsFlare(usItem) || NightLight()) && ubDamage >= ubMinDamage && (ubGrenadeType == EXPLOSV_ANY_TYPE || ubType == ubGrenadeType)) { // return if flare grenade has priority - if (fCheckForFlares && Item[usItem].flare) + if (fCheckForFlares && ItemIsFlare(usItem)) { return bLoop; } @@ -2175,7 +2168,7 @@ BOOLEAN ItemHasAttachments( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier, UINT8 ite { for(attachmentList::iterator att = (*pObj)[iter]->attachments.begin(); att != (*pObj)[iter]->attachments.end(); ++att) { - if ( att->usItem != 0 && !Item[att->usItem].hiddenattachment ) + if ( att->usItem != 0 && !ItemIsHiddenAttachment(att->usItem) ) { attachmentHidden = FALSE; break; @@ -2191,7 +2184,7 @@ BOOLEAN ItemHasAttachments( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier, UINT8 ite { for(attachmentList::iterator att = (*pObj)[iter]->attachments.begin(); att != (*pObj)[iter]->attachments.end(); ++att) { - if ( att->usItem != 0 && !Item[att->usItem].hiddenattachment ) + if ( att->usItem != 0 && !ItemIsHiddenAttachment(att->usItem) ) { attachmentHidden = FALSE; break; @@ -2260,7 +2253,7 @@ BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8 * pubAPCost ) } //Madd: all guns can be attached to tripwires - if ( Item[usItem].tripwire && Item[usAttachment].usItemClass & IC_GUN ) + if (ItemIsTripwire(usItem) && Item[usAttachment].usItemClass & IC_GUN ) return TRUE; //Madd: Common Attachment Framework @@ -2298,8 +2291,8 @@ BOOLEAN ValidAttachment( UINT16 usAttachment, OBJECTTYPE * pObj, UINT8 * pubAPCo return FALSE; // shadooow: efficiency check, we are passing all kinds of items into this function that are not necessary attachments at all - if (!Item[usAttachment].attachment && !Item[usAttachment].attachmentclass && !Item[usAttachment].nasAttachmentClass && - !Item[usAttachment].hiddenaddon && !((Item[usAttachment].usItemClass & IC_GUN) && Item[pObj->usItem].tripwire)) + if (!ItemIsAttachment(usAttachment) && !Item[usAttachment].attachmentclass && !Item[usAttachment].nasAttachmentClass && + !ItemIsHiddenAddon(usAttachment) && !((Item[usAttachment].usItemClass & IC_GUN) && ItemIsTripwire(pObj->usItem))) return FALSE; if( UsingNewAttachmentSystem() ) @@ -2451,7 +2444,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN { //Search for incompatible attachments //Madd: check for gun on tripwire first - if ( Item[pObj->usItem].tripwire && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) + if (ItemIsTripwire(pObj->usItem) && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) { fSimilarItems = TRUE; OBJECTTYPE * tmpObj = FindAttachmentByClass( pObj, IC_GUN, subObject ); @@ -2517,7 +2510,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN //Search for any valid attachments in this slot //CHRISL: Valid attachments are determined by the old "ValidItemAttachment" function and comparing the attachment class of the item and slot //Madd: gun on tripwire always allowed - if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && Item[pObj->usItem].tripwire)) && + if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && ItemIsTripwire(pObj->usItem))) && (ValidItemAttachment(pObj,usAttachment,fAttemptingAttachment,fDisplayMessage,subObject,usAttachmentSlotIndexVector) || ValidLaunchable(usAttachment, GetAttachedGrenadeLauncher(pObj)) || ValidLaunchable(usAttachment, pObj->usItem))) @@ -2553,7 +2546,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN //Search for any valid attachments in this slot //CHRISL: Valid attachments are determined by the old "ValidItemAttachment" function and comparing the attachment class of the item and slot //Madd: gun on tripwire always allowed - if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && Item[pObj->usItem].tripwire)) && + if((AttachmentSlots[ubSlotIndex].nasAttachmentClass & Item[usAttachment].nasAttachmentClass || (Item[usAttachment].usItemClass & IC_GUN && ItemIsTripwire(pObj->usItem))) && (ValidItemAttachment(pObj,usAttachment,FALSE,FALSE,subObject,usAttachmentSlotIndexVector) || ValidLaunchable(usAttachment, GetAttachedGrenadeLauncher(pObj)) || ValidLaunchable(usAttachment, pObj->usItem))) @@ -2620,7 +2613,7 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt UINT16 usSimilarItem = NOTHING; //Madd: check for gun on tripwire first - if ( Item[pObj->usItem].tripwire && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) + if (ItemIsTripwire(pObj->usItem) && Item[usAttachment].usItemClass & IC_GUN && FindAttachmentByClass( pObj, IC_GUN, subObject ) != 0 ) { fSimilarItems = TRUE; OBJECTTYPE * tmpObj = FindAttachmentByClass( pObj, IC_GUN, subObject ); @@ -2717,17 +2710,6 @@ BOOLEAN CompatibleFaceItem( UINT16 usItem1, UINT16 usItem2 ) } -//Determines if this item is a two handed item. -BOOLEAN TwoHandedItem( UINT16 usItem ) -{ -// if (Item[usItem].fFlags & ITEM_TWO_HANDED) - if (Item[usItem].twohanded ) - { - return( TRUE ); - } - return FALSE; -} - BOOLEAN ValidLaunchable( UINT16 usLaunchable, UINT16 usItem ) { // shadooow: efficiency check, we are passing all kinds of items into this function that are not neccessary attachments at all @@ -3149,7 +3131,7 @@ UINT16 OBJECTTYPE::GetWeightOfObjectInStack(unsigned int index) weight += Item[ (*this)[index]->data.gun.usGunAmmoItem ].ubWeight; } } - else if ( gGameExternalOptions.fAmmoDynamicWeight && ( pItem->camouflagekit || pItem->canteen || pItem->drugtype || pItem->foodtype || usItem == JAR_ELIXIR ) ) + else if ( gGameExternalOptions.fAmmoDynamicWeight && (ItemIsCamoKit(pItem->uiIndex) || ItemIsCanteen(pItem->uiIndex) || pItem->drugtype || pItem->foodtype || usItem == JAR_ELIXIR ) ) { weight *= (FLOAT)( ( *this )[index] )->data.objectStatus / 100.0f; } @@ -3407,7 +3389,7 @@ BOOLEAN ReloadGun( SOLDIERTYPE * pSoldier, OBJECTTYPE * pGun, OBJECTTYPE * pAmmo } } - if ( Item[ pGun->usItem ].usItemClass == IC_LAUNCHER || Item[pGun->usItem].cannon ) + if ( Item[ pGun->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(pGun->usItem)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("ReloadGun: Loading launcher - new ammo type = %d, weight = %d", pAmmo->usItem, CalculateObjectWeight(pAmmo) ) ); (*pGun)[subObject]->data.gun.usGunAmmoItem = pAmmo->usItem; @@ -3838,7 +3820,7 @@ INT8 FindAmmoToReload( SOLDIERTYPE * pSoldier, INT8 bWeaponIn, INT8 bExcludeSlot return bWeaponIn; // } - if ( Item[pObj->usItem].usItemClass == IC_GUN && !Item[pObj->usItem].cannon ) + if ( Item[pObj->usItem].usItemClass == IC_GUN && !ItemIsCannon(pObj->usItem) ) { //MM: make reload use crates/boxes if not in combat... if ( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) ) @@ -4149,7 +4131,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac return FALSE; } //CHRISL: If we're adding a loaded UGL, then we have to make sure there are actually 2 open attachment slots instead of 1 - if(Item[pAttachment->usItem].grenadelauncher && (*pAttachment)[0]->attachments.size() > 0) { + if(ItemIsGrenadeLauncher(pAttachment->usItem) && (*pAttachment)[0]->attachments.size() > 0) { if ((*this)[subObject]->attachments.size() >= (OLD_MAX_ATTACHMENTS_101-1)) return FALSE; } @@ -4181,7 +4163,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac // find an attachment position... // second half of this 'if' is for attaching GL grenades to a gun w/attached GL - if ( fValidLaunchable || (Item[pAttachment->usItem].glgrenade && FindAttachmentByClass(this, IC_LAUNCHER, subObject) != 0 ) ) + if ( fValidLaunchable || (ItemIsGLgrenade(pAttachment->usItem) && FindAttachmentByClass(this, IC_LAUNCHER, subObject) != 0 ) ) { canOnlyAttach1 = true; // try replacing if possible @@ -4216,7 +4198,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac return( FALSE ); } } - else if ( Item[this->usItem].tripwire && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire + else if (ItemIsTripwire(this->usItem) && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire { iCheckResult = SkillCheck( pSoldier, ATTACHING_DETONATOR_CHECK, 0 ); if (iCheckResult < 0) @@ -4238,7 +4220,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac if ( ValidItemAttachment( this, pAttachment->usItem, TRUE, TRUE, subObject ) && playSound ) // not launchable { // attachment sounds - if ( Item[ this->usItem ].usItemClass & IC_WEAPON || Item[this->usItem].tripwire ) //Madd: attaching items to tripwire makes gun attach sound + if ( Item[ this->usItem ].usItemClass & IC_WEAPON || ItemIsTripwire(this->usItem) ) //Madd: attaching items to tripwire makes gun attach sound { PlayJA2Sample( ATTACH_TO_GUN, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } @@ -4272,7 +4254,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac //if (pAttachmentPosition) { if(pAttachmentPosition || (pAttachmentPosition == NULL && (*this)[subObject]->attachments.size() < OLD_MAX_ATTACHMENTS_101)){ //we know we are replacing this attachment - if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || Item[this->usItem].cannon ) + if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(this->usItem) ) { if ( fValidLaunchable ) { @@ -4283,7 +4265,7 @@ BOOLEAN OBJECTTYPE::AttachObjectOAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac } //unfortunately must come before possible attachment swap - if (Item[pAttachment->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pAttachment->usItem)) { // transfer any attachments from the grenade launcher to the gun (*this)[subObject]->attachments.splice((*this)[subObject]->attachments.begin(), (*pAttachment)[0]->attachments, @@ -4847,7 +4829,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac return( FALSE ); } } - else if ( Item[this->usItem].tripwire && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire + else if (ItemIsTripwire(this->usItem) && Item[pAttachment->usItem].usItemClass & IC_GUN ) // Madd: gun on tripwire { iCheckResult = SkillCheck( pSoldier, ATTACHING_DETONATOR_CHECK, 0 ); if (iCheckResult < 0) @@ -4869,7 +4851,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac if (fValidItemAttachment && playSound ) // not launchable { // attachment sounds - if ( Item[ this->usItem ].usItemClass & IC_WEAPON || Item[this->usItem].tripwire ) //Madd: attaching items to tripwire makes gun attach sound + if ( Item[ this->usItem ].usItemClass & IC_WEAPON || ItemIsTripwire(this->usItem) ) //Madd: attaching items to tripwire makes gun attach sound { PlayJA2Sample( ATTACH_TO_GUN, RATE_11025, SoundVolume( MIDVOLUME, pSoldier->sGridNo ), 1, SoundDir( pSoldier->sGridNo ) ); } @@ -4903,7 +4885,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac // the AP costs for reloading GL/RL will be taken from weapons.xml ( wrong place!!! the AP's are deducted in DeleteItemDescriptionBox() ) //we know we are replacing this attachment - if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || Item[this->usItem].cannon ) + if ( Item[ this->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(this->usItem) ) { if ( fValidLaunchable ) { @@ -5404,7 +5386,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac case TEMPERATURE: { // check if this can work - if ( Item[ this->usItem ].usItemClass == IC_GUN && Item[pAttachment->usItem].barrel == TRUE ) + if ( Item[ this->usItem ].usItemClass == IC_GUN && ItemIsBarrel(pAttachment->usItem) ) { FLOAT guntemperature = (*this)[subObject]->data.bTemperature; FLOAT barreltemperature = (*pAttachment)[0]->data.bTemperature; @@ -5425,7 +5407,7 @@ BOOLEAN OBJECTTYPE::AttachObjectNAS( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttac case TRIPWIRE_ROLL: { // check if this can work - if ( Item[ this->usItem ].tripwire && Item[pAttachment->usItem].tripwire && HasItemFlag( this->usItem, TRIPWIREROLL ) ) + if (ItemIsTripwire(this->usItem) && ItemIsTripwire(pAttachment->usItem) && HasItemFlag( this->usItem, TRIPWIREROLL ) ) { if ( (*this)[subObject]->data.objectStatus < 100 ) (*this)[subObject]->data.objectStatus++; @@ -5722,7 +5704,7 @@ std::vector GetItemSlots(OBJECTTYPE* pObj, UINT8 subObject, BOOLEAN fAtt { fItemLayout = Item[pObj->usItem].nasLayoutClass; fIsLBE = (Item[pObj->usItem].usItemClass == IC_LBEGEAR); - if ( Item[pObj->usItem].grenadelauncher || Item[pObj->usItem].rocketlauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem) || ItemIsRocketLauncher(pObj->usItem) ) magSize = GetMagSize( pObj ); //We don't need to do anything if the item gets no slots @@ -5787,7 +5769,7 @@ std::vector GetItemSlots(OBJECTTYPE* pObj, UINT8 subObject, BOOLEAN fAtt //Madd: Only record these extra slots if the item has its attachment flag set! for(attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) { - if(iter->exists() && Item[iter->usItem].attachment && !(*iter)[0]->attachments.empty() ) + if(iter->exists() && ItemIsAttachment(iter->usItem) && !(*iter)[0]->attachments.empty() ) { OBJECTTYPE* pAttachment = &(*iter); tempSlots = GetItemSlots(pAttachment,0,TRUE); @@ -6246,10 +6228,10 @@ BOOLEAN CanItemFitInRobot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, INT8 bPos, BO (Magazine[Item[pObj->usItem].ubClassIndex].ubCalibre == Weapon[pSoldier->inv[HANDPOS].usItem].ubCalibre); case ROBOT_TARGETING_SLOT: - if (Item[pObj->usItem].fProvidesRobotLaserBonus) + if (ItemProvidesRobotLaserBonus(pObj->usItem)) return(TRUE); - if (Item[pObj->usItem].fProvidesRobotNightVision) + if (ItemProvidesRobotNightvision(pObj->usItem)) return(TRUE); if (Item[pObj->usItem].bRobotTargetingSkillGrant > 0) @@ -6261,7 +6243,7 @@ BOOLEAN CanItemFitInRobot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, INT8 bPos, BO if (Item[pObj->usItem].bRobotStrBonus > 0 || Item[pObj->usItem].bRobotAgiBonus > 0 || Item[pObj->usItem].bRobotDexBonus > 0) return(TRUE); - if (Item[pObj->usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pObj->usItem)) return(TRUE); if (Item[pObj->usItem].fRobotDamageReductionModifier > 0.0f && Item[pObj->usItem].fRobotDamageReductionModifier < 1.0f) @@ -6279,10 +6261,10 @@ BOOLEAN CanItemFitInRobot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, INT8 bPos, BO if (HasItemFlag( pObj->usItem, RADIO_SET )) return(TRUE); - if (Item[pObj->usItem].metaldetector == 1) + if (ItemIsMetalDetector(pObj->usItem)) return(TRUE); - if (Item[pObj->usItem].xray == 1) + if (ItemHasXRay(pObj->usItem)) return(TRUE); if (Item[pObj->usItem].bRobotUtilitySkillGrant > 0) @@ -6326,13 +6308,13 @@ BOOLEAN CanItemFitInPosition( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, INT8 bPos && pSoldier->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_ARMS ) ) return FALSE; - if (Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) { return( FALSE ); } break; case HANDPOS: - if (Item[ pObj->usItem ].twohanded ) + if (ItemIsTwoHanded(pObj->usItem)) { // Flugente: disease can stop us from using our arms normally if ( gGameExternalOptions.fDisease @@ -6669,7 +6651,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) OBJECTTYPE * pInSlot; BOOLEAN fObjectWasRobotRemote = FALSE; - if ( Item[pObj->usItem].robotremotecontrol ) + if (ItemIsRobotRemote(pObj->usItem)) { fObjectWasRobotRemote = TRUE; } @@ -6799,7 +6781,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) pSoldier->bDoBurst = TRUE; pSoldier->bDoAutofire = TRUE; } - if ( Item[pObj->usItem].twohanded && Weapon[pObj->usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pObj->usItem) && Weapon[pObj->usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -6820,7 +6802,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) if (pObj->exists() == false) { // dropped everything - if (bPos == HANDPOS && Item[pInSlot->usItem].twohanded ) + if (bPos == HANDPOS && ItemIsTwoHanded(pInSlot->usItem)) { // We just performed a successful drop of a two-handed object into the // main hand @@ -7016,7 +6998,7 @@ BOOLEAN PlaceObject( SOLDIERTYPE * pSoldier, INT8 bPos, OBJECTTYPE * pObj ) pInSlot->AddObjectsToStack( *pObj, ALL_OBJECTS, pSoldier, bPos ); } - else if ( (Item[pObj->usItem].twohanded ) && (bPos == HANDPOS) ) + else if (ItemIsTwoHanded(pObj->usItem) && (bPos == HANDPOS) ) { if (pSoldier->inv[SECONDHANDPOS].exists() == true) { // both pockets have something in them, so we can't swap @@ -7110,7 +7092,7 @@ bool TryToPlaceInSlot(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, bool fNewItem, in } if (bSlot == SECONDHANDPOS) { - if (pSoldier->inv[HANDPOS].exists() == true && Item[pSoldier->inv[ HANDPOS ].usItem].twohanded) { + if (pSoldier->inv[HANDPOS].exists() == true && ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem)) { return false; } } @@ -7447,7 +7429,7 @@ BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNew return( TRUE ); } } - else if ( !(Item[pSoldier->inv[HANDPOS].usItem].twohanded ) && pSoldier->inv[SECONDHANDPOS].exists() == false) + else if ( !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && pSoldier->inv[SECONDHANDPOS].exists() == false) { // put the one-handed weapon in the guy's 2nd hand... if( PlaceObject( pSoldier, SECONDHANDPOS, pObj, fNewItem ) ) @@ -7507,7 +7489,7 @@ BOOLEAN AutoPlaceObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, BOOLEAN fNew This is only an issue during merc hiring when leggings will often be placed after leg protectors. However, this isn't as big an issue at this point because of the redesigns in the profile item sorting functions.*/ - if(Item[pSoldier->inv[LEGPOS].usItem].attachment) + if(ItemIsAttachment(pSoldier->inv[LEGPOS].usItem)) { SwapObjs(pSoldier, LEGPOS, pObj, TRUE); pSoldier->inv[LEGPOS].AttachObject(pSoldier, pObj, FALSE); @@ -7832,17 +7814,17 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier ) (*pObj)[bLoop]->data.objectStatus -= (INT8)(usPoints * (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction) ) )/100); // Flugente: campaign stats - if ( Item[pObj->usItem].foodtype || Item[pObj->usItem].canteen) + if ( Item[pObj->usItem].foodtype || ItemIsCanteen(pObj->usItem)) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_FOOD, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].medical || Item[pObj->usItem].drugtype) + else if (ItemIsMedical(pObj->usItem) || Item[pObj->usItem].drugtype) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].toolkit || HasItemFlag(pObj->usItem, CLEANING_KIT) ) + else if (ItemIsToolkit(pObj->usItem) || HasItemFlag(pObj->usItem, CLEANING_KIT) ) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_REPAIR, (FLOAT)(usOriginalPoints * Item[pObj->usItem].ubWeight / 100.0) ); return( usOriginalPoints ); } // Flugente: we no longer destroy canteens upon emtptying them - as we can now refill them - else if ( Item[pObj->usItem].canteen == TRUE ) + else if (ItemIsCanteen(pObj->usItem) == TRUE ) { // consume this kit totally usPoints -= (((*pObj)[bLoop]->data.objectStatus - 1) / ((max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction))) /100)); @@ -7879,11 +7861,11 @@ UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier ) } // Flugente: campaign stats - if ( Item[pObj->usItem].foodtype || Item[pObj->usItem].canteen) + if ( Item[pObj->usItem].foodtype || ItemIsCanteen(pObj->usItem)) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_FOOD, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].medical || Item[pObj->usItem].drugtype) + else if (ItemIsMedical(pObj->usItem) || Item[pObj->usItem].drugtype) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_MEDICAL, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) ); - else if ( Item[pObj->usItem].toolkit || HasItemFlag(pObj->usItem, CLEANING_KIT) ) + else if (ItemIsToolkit(pObj->usItem) || HasItemFlag(pObj->usItem, CLEANING_KIT) ) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_REPAIR, (FLOAT)((usOriginalPoints - usPoints) * Item[pObj->usItem].ubWeight / 100.0) ); // check if pocket/hand emptied..update inventory, then update panel @@ -8245,7 +8227,7 @@ BOOLEAN CreateGun( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) } else if ( EXPLOSIVE_GUN( usItem ) ) { - if ( Item[usItem].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usItem)) { pStackedObject->data.gun.ubGunShotsLeft = 1; } @@ -8392,8 +8374,7 @@ BOOLEAN CreateItem( UINT16 usItem, INT16 bStatus, OBJECTTYPE * pObj ) } if (fRet) { -// if (Item[ usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) - if (Item[ usItem ].defaultundroppable ) + if (ItemIsUndroppableByDefault(usItem)) { (*pObj).fFlags |= OBJECT_UNDROPPABLE; } @@ -8471,7 +8452,7 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting ) { fRemote = TRUE; } - else if ( Item[pObj->usItem].mine || pObj->usItem == TRIP_FLARE || pObj->usItem == TRIP_KLAXON || pObj->usItem == ACTION_ITEM ) + else if (ItemIsMine(pObj->usItem) || pObj->usItem == TRIP_FLARE || pObj->usItem == TRIP_KLAXON || pObj->usItem == ACTION_ITEM ) { fPressure = TRUE; } @@ -8529,7 +8510,7 @@ BOOLEAN ArmBomb( OBJECTTYPE * pObj, INT8 bSetting ) // tripwires UINT32 ubWireNetworkFlag = 0; - if ( Item[pObj->usItem].tripwire == 1 && bSetting > 0 && bSetting < 17 ) // checks for safety + if (ItemIsTripwire(pObj->usItem) && bSetting > 0 && bSetting < 17 ) // checks for safety { // we are placing it, so it's ours ubWireNetworkFlag |= TRIPWIRE_NETWORK_OWNER_PLAYER; @@ -8710,7 +8691,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE * pAttachment, OBJECTTYPE * pNe pSoldier->bDoBurst = TRUE; pSoldier->bDoAutofire = 1; } - if ( Item[pSoldier->inv[ HANDPOS ].usItem].twohanded && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -8772,7 +8753,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE * pAttachment, OBJECTTYPE * pNe *pNewObj = removedAttachment; } - if (pNewObj->exists() && Item[pNewObj->usItem].grenadelauncher )//UNDER_GLAUNCHER) + if (pNewObj->exists() && ItemIsGrenadeLauncher(pNewObj->usItem))//UNDER_GLAUNCHER) { // look for any grenade; if it exists, we must make it an // attachment of the grenade launcher @@ -9019,7 +9000,7 @@ INT8 CheckItemForDamage( UINT16 usItem, INT32 iMaxDamage ) } // metal items are tough and will be damaged less // if (Item[usItem].fFlags & ITEM_METAL) - if (Item[usItem].metal ) + if (ItemIsMetal(usItem)) { iMaxDamage /= 2; } @@ -9110,7 +9091,7 @@ BOOLEAN DamageItem( OBJECTTYPE * pObject, INT32 iDamage, BOOLEAN fOnGround, INT3 INT8 bLoop; INT16 bDamage; - if ( pObject->exists() && (Item[pObject->usItem].damageable || Item[ pObject->usItem ].usItemClass == IC_AMMO) ) + if ( pObject->exists() && (ItemIsDamageable(pObject->usItem) || Item[ pObject->usItem ].usItemClass == IC_AMMO) ) { for (bLoop = 0; bLoop < pObject->ubNumberOfObjects; bLoop++) @@ -9365,7 +9346,7 @@ BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, IN INT8 IsMedicalKitItem( OBJECTTYPE *pObject ) { // check item id against current medical kits - if ( Item[pObject->usItem].medicalkit && pObject->exists() == true) + if (ItemIsMedicalKit(pObject->usItem) && pObject->exists() == true) return 1; //switch( pObject->usItem ) @@ -9402,7 +9383,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier ) } // if we somehow had an item in our second hand (which shouldn't be possible to begin with), drop it to inventory if twohanded - if ( TwoHandedItem( pSoldier->inv[SECONDHANDPOS].usItem ) ) + if ( ItemIsTwoHanded( pSoldier->inv[SECONDHANDPOS].usItem ) ) { // must move the item in the main hand elsewhere in the inventory fOk = AutoPlaceObject( pSoldier, &( pSoldier->inv[SECONDHANDPOS] ), FALSE, SECONDHANDPOS ); @@ -9425,7 +9406,7 @@ void SwapHandItems( SOLDIERTYPE * pSoldier ) } else { - if (TwoHandedItem( pSoldier->inv[SECONDHANDPOS].usItem ) ) + if (ItemIsTwoHanded( pSoldier->inv[SECONDHANDPOS].usItem ) ) { // must move the item in the main hand elsewhere in the inventory fOk = AutoPlaceObject( pSoldier, &(pSoldier->inv[HANDPOS]), FALSE, HANDPOS ); @@ -9490,8 +9471,7 @@ void WaterDamage( SOLDIERTYPE *pSoldier ) continue; } // if there's an item here that can get water damaged... -// if (pSoldier->inv[ bLoop ].usItem && Item[pSoldier->inv[ bLoop ].usItem].fFlags & ITEM_WATER_DAMAGES) - if (pSoldier->inv[ bLoop ].usItem && Item[pSoldier->inv[ bLoop ].usItem].waterdamages ) + if (pSoldier->inv[ bLoop ].usItem && ItemIsDamagedByWater(pSoldier->inv[bLoop].usItem) ) { // roll the 'ol 100-sided dice uiRoll = PreRandom(100); @@ -9715,7 +9695,7 @@ BOOLEAN ApplyCamo( SOLDIERTYPE * pSoldier, UINT16 usItem, UINT16& usrPointsToUse return( TRUE ); } - else if ( !Item[usItem].camouflagekit ) + else if ( !ItemIsCamoKit(usItem)) { return( FALSE ); } @@ -9962,7 +9942,7 @@ BOOLEAN ApplyCamo( SOLDIERTYPE * pSoldier, UINT16 usItem, UINT16& usrPointsToUse BOOLEAN ApplyCanteen( SOLDIERTYPE * pSoldier, UINT16 usItem, UINT16 usPointsToUse ) { - if ( !Item[usItem].canteen ) + if ( !ItemIsCanteen(usItem)) { return(FALSE); } @@ -10155,7 +10135,7 @@ void ActivateXRayDevice( SOLDIERTYPE * pSoldier ) SOLDIERTYPE * pSoldier2; UINT32 uiSlot; - if ( Item[pSoldier->inv[ HANDPOS ].usItem].needsbatteries && pSoldier->inv[ HANDPOS ].exists() == true && !AM_A_ROBOT(pSoldier) ) + if (ItemNeedsBatteries(pSoldier->inv[ HANDPOS ].usItem) && pSoldier->inv[ HANDPOS ].exists() == true && !AM_A_ROBOT(pSoldier) ) { // check for batteries OBJECTTYPE* pBatteries = FindAttachedBatteries( &(pSoldier->inv[HANDPOS]) ); @@ -10561,7 +10541,7 @@ INT16 GetRangeBonus( OBJECTTYPE * pObj ) bonus += Item[(*pObj)[0]->data.gun.usGunAmmoItem].rangebonus; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( !Item[iter->usItem].duckbill || ( Item[iter->usItem].duckbill && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT ) && iter->exists()) + if ( !ItemIsDuckbill(iter->usItem) || (ItemIsDuckbill(iter->usItem) && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT ) && iter->exists()) bonus += BonusReduce( Item[iter->usItem].rangebonus, (*iter)[0]->data.objectStatus ); } } @@ -11354,7 +11334,7 @@ INT16 GetNightVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) UINT16 usItem; INVTYPE *pItem; - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { return bonus += BonusReduceMore( NightBonusScale( Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].nightvisionrangebonus, bLightLevel ), @@ -11459,7 +11439,7 @@ INT16 GetCaveVisionRangeBonus( SOLDIERTYPE * pSoldier, UINT8 bLightLevel ) UINT16 usItem; INVTYPE *pItem; - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotNightVision) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotNightvision(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { return bonus += BonusReduceMore( NightBonusScale( Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].cavevisionrangebonus, bLightLevel ), @@ -11973,7 +11953,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier ) if (!IsWeapon(pSoldier->inv[i].usItem) || (IsWeapon(pSoldier->inv[i].usItem) && usingGunScope == true) ) { - if (Item[pSoldier->inv[i].usItem].thermaloptics) + if (ItemIsThermalOptics(pSoldier->inv[i].usItem)) { return TRUE; } @@ -11987,7 +11967,7 @@ BOOLEAN HasThermalOptics( SOLDIERTYPE * pSoldier ) OBJECTTYPE* pObj = &pSoldier->inv[HANDPOS]; if (pObj->exists() == true) { for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( Item[iter->usItem].thermaloptics && iter->exists() ) + if (ItemIsThermalOptics(iter->usItem) && iter->exists() ) return TRUE; } } @@ -12040,11 +12020,11 @@ INT16 GetHearingRangeBonus( SOLDIERTYPE * pSoldier ) BOOLEAN IsDuckbill( OBJECTTYPE * pObj ) { if (pObj->exists() == true) { - if (Item[pObj->usItem].duckbill || Item[(*pObj)[0]->data.gun.usGunAmmoItem].duckbill ) + if (ItemIsDuckbill(pObj->usItem) || ItemIsDuckbill((*pObj)[0]->data.gun.usGunAmmoItem)) return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].duckbill && iter->exists() ) + if (ItemIsDuckbill(iter->usItem) && iter->exists() ) { return( TRUE ); } @@ -12078,7 +12058,7 @@ INT8 FindGasMask( SOLDIERTYPE * pSoldier ) for (bLoop = 0; bLoop < NUM_INV_SLOTS; bLoop++)//dnl ch40 041009 { if (pSoldier->inv[bLoop].exists() == true) { - if ( Item[pSoldier->inv[bLoop].usItem].gasmask ) + if (ItemIsGasmask(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12095,7 +12075,7 @@ BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].detonator && iter->exists() ) + if (ItemIsDetonator(iter->usItem) && iter->exists() ) { return( TRUE ); } @@ -12111,7 +12091,7 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].remotedetonator && iter->exists() ) + if (ItemIsRemoteDetonator(iter->usItem) && iter->exists() ) { return( TRUE ); } @@ -12127,17 +12107,17 @@ BOOLEAN IsFlashSuppressor( OBJECTTYPE * pObj, SOLDIERTYPE * pSoldier ) if (Item[pObj->usItem].usItemClass == IC_GUN && AmmoTypes[(*pObj)[0]->data.gun.ubGunAmmoType].tracerEffect && pSoldier->bDoBurst ) return FALSE; - if (Item[pObj->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(pObj->usItem)) return TRUE; - if ( Item[(*pObj)[0]->data.gun.usGunAmmoItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash((*pObj)[0]->data.gun.usGunAmmoItem)) return TRUE; attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); for (; iter != iterend; ++iter) { - if (iter->exists() && Item[iter->usItem].hidemuzzleflash ) + if (iter->exists() && ItemHasHiddenMuzzleFlash(iter->usItem)) { return( TRUE ); } @@ -12150,12 +12130,12 @@ BOOLEAN IsGrenadeLauncherAttached( OBJECTTYPE * pObj, UINT8 subObject ) { if (pObj->exists() == true) { - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return TRUE; for (attachmentList::iterator iter = (*pObj)[subObject]->attachments.begin(); iter != (*pObj)[subObject]->attachments.end(); ++iter) { - if (iter->exists() && (Item[iter->usItem].grenadelauncher || IsAttachmentClass( iter->usItem, AC_RIFLEGRENADE ) ) ) + if (iter->exists() && (ItemIsGrenadeLauncher(iter->usItem) || IsAttachmentClass( iter->usItem, AC_RIFLEGRENADE ) ) ) { return TRUE; } @@ -12180,12 +12160,12 @@ OBJECTTYPE* FindAttachment_GrenadeLauncher( OBJECTTYPE * pObj ) } } - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return pObj; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (iter->exists() && Item[iter->usItem].grenadelauncher ) + if (iter->exists() && ItemIsGrenadeLauncher(iter->usItem)) { return( &(*iter) ); } @@ -12210,12 +12190,12 @@ INT16 GetGrenadeLauncherStatus( OBJECTTYPE * pObj ) } } - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return (*pObj)[0]->data.objectStatus; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (iter->exists() && Item[iter->usItem].grenadelauncher ) + if (iter->exists() && ItemIsGrenadeLauncher(iter->usItem)) { return( (*iter)[0]->data.objectStatus ); } @@ -12240,12 +12220,12 @@ UINT16 GetAttachedGrenadeLauncher( OBJECTTYPE * pObj ) } } - if (Item[pObj->usItem].grenadelauncher ) + if (ItemIsGrenadeLauncher(pObj->usItem)) return pObj->usItem; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (iter->exists() && Item[iter->usItem].grenadelauncher ) + if (iter->exists() && ItemIsGrenadeLauncher(iter->usItem)) { return( (UINT16) Item[iter->usItem].uiIndex ); } @@ -12322,7 +12302,7 @@ BOOLEAN EXPLOSIVE_GUN ( UINT16 x) { //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EXPLOSIVE_GUN x = %d",x)); - if ( Item[x].rocketlauncher || Item[x].cannon ) + if (ItemIsRocketLauncher(x) || ItemIsCannon(x) ) return TRUE; else return FALSE; @@ -12334,7 +12314,7 @@ INT8 FindRocketLauncherOrCannon( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].rocketlauncher || Item[pSoldier->inv[bLoop].usItem].cannon ) + if (ItemIsRocketLauncher(pSoldier->inv[bLoop].usItem) || ItemIsCannon(pSoldier->inv[bLoop].usItem) ) { return( bLoop ); } @@ -12349,7 +12329,7 @@ INT8 FindCannon( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if ( Item[pSoldier->inv[bLoop].usItem].cannon ) + if (ItemIsCannon(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12369,7 +12349,7 @@ INT8 FindUsableCrowbar( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if ( Item[pSoldier->inv[bLoop].usItem].crowbar && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE && Item[pSoldier->inv[bLoop].usItem].CrowbarModifier > bonus) + if (ItemIsCrowbar(pSoldier->inv[bLoop].usItem) && pSoldier->inv[bLoop][0]->data.objectStatus >= USABLE && Item[pSoldier->inv[bLoop].usItem].CrowbarModifier > bonus) { bonus = Item[pSoldier->inv[bLoop].usItem].CrowbarModifier; FoundCrowbar = bLoop; @@ -12383,7 +12363,7 @@ OBJECTTYPE* FindAttachedBatteries( OBJECTTYPE * pObj ) { if (pObj->exists() == true) { for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].batteries && iter->exists()) + if (ItemIsBatteries(iter->usItem) && iter->exists()) { return( &(*iter) ); } @@ -12398,7 +12378,7 @@ INT8 FindToolkit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].toolkit ) + if (ItemIsToolkit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12413,7 +12393,7 @@ INT8 FindMedKit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].medicalkit ) + if (ItemIsMedicalKit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12428,7 +12408,7 @@ INT8 FindFirstAidKit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].firstaidkit ) + if (ItemIsFirstAidKit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12443,7 +12423,7 @@ INT8 FindCamoKit( SOLDIERTYPE * pSoldier ) for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].camouflagekit ) + if (ItemIsCamoKit(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12485,7 +12465,7 @@ INT8 FindLocksmithKit( SOLDIERTYPE * pSoldier ) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].locksmithkit ) + if (ItemIsLocksmithKit(pSoldier->inv[bLoop].usItem)) { //JMich_SkillModifiers: If the locksmith kit has a bonus, reduce it based on the status, so we use the best bonus. if (Item[pSoldier->inv[bLoop].usItem].LockPickModifier > 0 ) @@ -12517,7 +12497,7 @@ INT8 FindWalkman(SOLDIERTYPE * pSoldier) // sevenfm: walkman only works from head slot for (INT8 bLoop = HEAD1POS; bLoop <= HEAD2POS; bLoop++) { - if (pSoldier->inv[bLoop].exists() && Item[pSoldier->inv[bLoop].usItem].walkman) + if (pSoldier->inv[bLoop].exists() && ItemIsWalkman(pSoldier->inv[bLoop].usItem)) { return(bLoop); } @@ -12532,7 +12512,7 @@ INT8 FindTrigger( SOLDIERTYPE * pSoldier ) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].remotetrigger ) + if (ItemIsRemoteTrigger(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12546,7 +12526,7 @@ INT8 FindRemoteControl( SOLDIERTYPE * pSoldier ) for (INT8 bLoop = BODYPOSSTART; bLoop < BODYPOSFINAL; ++bLoop) { if (pSoldier->inv[bLoop].exists() == true) { - if (Item[pSoldier->inv[bLoop].usItem].robotremotecontrol ) + if (ItemIsRobotRemote(pSoldier->inv[bLoop].usItem)) { return( bLoop ); } @@ -12615,7 +12595,7 @@ INT16 GetCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].camobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].camobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12628,7 +12608,7 @@ INT16 GetUrbanCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].urbanCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12641,7 +12621,7 @@ INT16 GetDesertCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].desertCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12654,7 +12634,7 @@ INT16 GetSnowCamoBonus( OBJECTTYPE * pObj ) bonus = (Item[pObj->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*pObj)[0]->data.objectStatus) / 100)) ; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (!Item[iter->usItem].camouflagekit && iter->exists()) + if (!ItemIsCamoKit(iter->usItem) && iter->exists()) bonus += (INT16) (Item[iter->usItem].snowCamobonus);// * (WEAPON_STATUS_MOD((*iter)[0]->data.objectStatus) / 100)); } } @@ -12667,7 +12647,7 @@ INT16 GetWornCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -12726,7 +12706,7 @@ INT16 GetWornUrbanCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetUrbanCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -12785,7 +12765,7 @@ INT16 GetWornDesertCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetDesertCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -12843,7 +12823,7 @@ INT16 GetWornSnowCamo( SOLDIERTYPE * pSoldier ) if (AM_A_ROBOT(pSoldier)) { - if (Item[pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem].fProvidesRobotCamo) + if (ItemProvidesRobotCamo(pSoldier->inv[ROBOT_CHASSIS_SLOT].usItem)) { ttl += GetSnowCamoBonus(&pSoldier->inv[ROBOT_CHASSIS_SLOT]); } @@ -13439,7 +13419,7 @@ UINT8 AllowedAimingLevelsNCTH( SOLDIERTYPE *pSoldier, INT32 sGridNo ) // Read from item aimLevels = Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubAimLevels; - fTwoHanded = Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded; + fTwoHanded = ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem); weaponRange = ( Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].usRange * GetPercentRangeBonus(&pSoldier->inv[pSoldier->ubAttackingHand]) ) / 10000; weaponRange += GetRangeBonus(&pSoldier->inv[pSoldier->ubAttackingHand]); weaponType = Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].ubWeaponType; @@ -13569,7 +13549,7 @@ UINT8 AllowedAimingLevels(SOLDIERTYPE * pSoldier, INT32 sGridNo) BOOLEAN fTwoHanded, fUsingBipod; // Read weapon data - fTwoHanded = Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded; + fTwoHanded = ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem); UINT16 usRange = GetModifiedGunRange(pSoldier->inv[pSoldier->ubAttackingHand].usItem); @@ -13861,7 +13841,7 @@ UINT8 GetAllowedAimingLevelsForItem( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, UI aimLevels = 0; // Read weapon data - fTwoHanded = Item[pObj->usItem].twohanded; + fTwoHanded = ItemIsTwoHanded(pObj->usItem); weaponRange = ( Weapon[Item[pObj->usItem].ubClassIndex].usRange * GetPercentRangeBonus(pObj) ) / 10000; weaponRange += GetRangeBonus(pObj); weaponType = Weapon[Item[pObj->usItem].ubClassIndex].ubWeaponType; @@ -14224,15 +14204,15 @@ BOOLEAN IsFlashSuppressorAlt( OBJECTTYPE * pObj ) if ( AmmoTypes[(*pObj)[0]->data.gun.ubGunAmmoType].tracerEffect ) return FALSE; - if ( Item[pObj->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(pObj->usItem)) return TRUE; - if ( Item[(*pObj)[0]->data.gun.usGunAmmoItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash((*pObj)[0]->data.gun.usGunAmmoItem)) return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( iter->exists( ) && Item[iter->usItem].hidemuzzleflash ) + if ( iter->exists( ) && ItemHasHiddenMuzzleFlash(iter->usItem)) { return( TRUE ); } @@ -14530,12 +14510,12 @@ BOOLEAN HasExtendedEarOn( SOLDIERTYPE * pSoldier ) { // optimistically assume, that anything electronic with hearing range bonus serves as extended ear as well if ( pSoldier->inv[HEAD1POS].exists() && (pSoldier->inv[HEAD1POS].usItem == EXTENDEDEAR || - (Item[pSoldier->inv[HEAD1POS].usItem].hearingrangebonus > 0 && Item[pSoldier->inv[HEAD1POS].usItem].electronic)) ) + (Item[pSoldier->inv[HEAD1POS].usItem].hearingrangebonus > 0 && ItemIsElectronic(pSoldier->inv[HEAD1POS].usItem))) ) { return( TRUE ); } else if ( pSoldier->inv[HEAD2POS].exists() && (pSoldier->inv[HEAD2POS].usItem == EXTENDEDEAR || - (Item[pSoldier->inv[HEAD2POS].usItem].hearingrangebonus > 0 && Item[pSoldier->inv[HEAD2POS].usItem].electronic)) ) + (Item[pSoldier->inv[HEAD2POS].usItem].hearingrangebonus > 0 && ItemIsElectronic(pSoldier->inv[HEAD2POS].usItem))) ) { return( TRUE ); } @@ -14654,19 +14634,19 @@ void GetScopeLists( SOLDIERTYPE * pSoldier, OBJECTTYPE * pObj, std::mapinv[HANDPOS].usItem].usItemClass & IC_GUN && !Item[pSoldier->inv[HANDPOS].usItem].twohanded) - && (Item[pSoldier->inv[SECONDHANDPOS].usItem].usItemClass & IC_GUN && !Item[pSoldier->inv[SECONDHANDPOS].usItem].twohanded) ) + if( (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) + && (Item[pSoldier->inv[SECONDHANDPOS].usItem].usItemClass & IC_GUN && !ItemIsTwoHanded(pSoldier->inv[SECONDHANDPOS].usItem)) ) bDualWielding = TRUE; // certain attachments prohibit the use of an iron sight once they are installed (flip-up built-in sights) - BOOLEAN noironsight = ( Item[pObj->usItem].blockironsight == TRUE ); + BOOLEAN noironsight = ItemBlocksIronsight(pObj->usItem); attachmentList::iterator iterend = (*pObj)[0]->attachments.end(); for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter) { if ( iter->exists() ) { - if ( Item[iter->usItem].blockironsight == TRUE ) + if (ItemBlocksIronsight(iter->usItem)) noironsight = TRUE; if ( IsAttachmentClass(iter->usItem, AC_SCOPE|AC_SIGHT|AC_IRONSIGHT ) ) @@ -15210,7 +15190,7 @@ bool IsAttachmentPointAvailable( OBJECTTYPE * pObject, UINT8 subObject, UINT32 a { if (pObject) { - if ( Item[pObject->usItem].ulAvailableAttachmentPoint > 0 && (Item[attachmentID].attachment || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & GetAvailableAttachmentPoint( pObject, subObject ) ) + if ( Item[pObject->usItem].ulAvailableAttachmentPoint > 0 && (ItemIsAttachment(attachmentID) || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & GetAvailableAttachmentPoint( pObject, subObject ) ) return true; } @@ -15220,7 +15200,7 @@ bool IsAttachmentPointAvailable( OBJECTTYPE * pObject, UINT8 subObject, UINT32 a //Madd: Common Attachment Framework - if we already know the point bool IsAttachmentPointAvailable( UINT64 point, UINT32 attachmentID, BOOLEAN onlyCheckAttachments ) { - if ( point > 0 && (!onlyCheckAttachments || (Item[attachmentID].attachment || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) )) && Item[attachmentID].ulAttachmentPoint & point ) + if ( point > 0 && (!onlyCheckAttachments || (ItemIsAttachment(attachmentID) || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) )) && Item[attachmentID].ulAttachmentPoint & point ) return true; return false; @@ -15229,7 +15209,7 @@ bool IsAttachmentPointAvailable( UINT64 point, UINT32 attachmentID, BOOLEAN only //Madd: Common Attachment Framework, doesn't look at attachments bool IsAttachmentPointAvailable( UINT32 itemID, UINT32 attachmentID ) { - if ( Item[itemID].ulAvailableAttachmentPoint > 0 && (Item[attachmentID].attachment || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & Item[itemID].ulAvailableAttachmentPoint ) + if ( Item[itemID].ulAvailableAttachmentPoint > 0 && (ItemIsAttachment(attachmentID) || Item[attachmentID].usItemClass & (IC_GRENADE | IC_BOMB) ) && Item[attachmentID].ulAttachmentPoint & Item[itemID].ulAvailableAttachmentPoint ) return true; return false; @@ -15244,7 +15224,7 @@ UINT64 GetAvailableAttachmentPoint (OBJECTTYPE * pObject, UINT8 subObject) point = Item[pObject->usItem].ulAvailableAttachmentPoint; for (attachmentList::iterator iter = (*pObject)[subObject]->attachments.begin(); iter != (*pObject)[subObject]->attachments.end(); ++iter) { - if(iter->exists() && Item[iter->usItem].ulAvailableAttachmentPoint && Item[iter->usItem].attachment ) + if(iter->exists() && Item[iter->usItem].ulAvailableAttachmentPoint && ItemIsAttachment(iter->usItem) ) point |= Item[iter->usItem].ulAvailableAttachmentPoint; } } @@ -15274,6 +15254,11 @@ BOOLEAN HasItemFlag( UINT16 usItem, UINT64 aFlag ) return( (Item[usItem].usItemFlag & aFlag) != 0 ); } +BOOLEAN HasItemFlag2(UINT16 usItem, UINT64 aFlag) +{ + return((Item[usItem].usItemFlag2 & aFlag) != 0); +} + // Flugente: get first item number that has this flag. Use with caution, as we search in all items BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag ) { @@ -15439,7 +15424,7 @@ INT8 GetNumberAltFireAimLevels( SOLDIERTYPE * pSoldier, INT32 iGridNo ) UINT16 usInHand = pSoldier->inv[ HANDPOS ].usItem; // If we are in water and having a pistol, don't allow alternative fire at all - if ( !Item[usInHand].twohanded && pSoldier->MercInWater() ) + if ( !ItemIsTwoHanded(usInHand) && pSoldier->MercInWater() ) { return -1; } @@ -15456,7 +15441,7 @@ INT8 GetNumberAltFireAimLevels( SOLDIERTYPE * pSoldier, INT32 iGridNo ) // with this mode, we always switch aaiming type manually return ubStandardAimLvls; } - else if ( Weapon[usInHand].HeavyGun && Item[usInHand].twohanded) + else if ( Weapon[usInHand].HeavyGun && ItemIsTwoHanded(usInHand)) { // if this gun is flagged as too heavy to shoulder, return the same as standard aim levels return ubStandardAimLvls; @@ -15718,7 +15703,7 @@ BOOL AddToRandomListFromItem( UINT16 usItem ) if ( Item[usItem].ubCoolness <= rditemmaxcoolness ) { // if item is food, not drug or canteen, and food system is off, don't add this - if ( !UsingFoodSystem() && Item[usItem].foodtype > 0 && Item[usItem].drugtype == 0 && Item[usItem].canteen == 0 ) + if ( !UsingFoodSystem() && Item[usItem].foodtype > 0 && Item[usItem].drugtype == 0 && !ItemIsCanteen(usItem)) ; else randomitemarray[itemcnt++] = usItem; @@ -15767,13 +15752,13 @@ BOOLEAN ItemCanBeAppliedToOthers( UINT16 usItem ) if ( Item[ usItem ].drugtype ) return TRUE; - if ( Item[ usItem ].gasmask ) + if (ItemIsGasmask(usItem)) return TRUE; - if ( Item[ usItem ].canteen ) + if (ItemIsCanteen(usItem)) return TRUE; - if ( Item[ usItem ].camouflagekit ) + if (ItemIsCamoKit(usItem)) return TRUE; if ( Item[ usItem ].clothestype ) @@ -15796,7 +15781,7 @@ INT32 GetPercentRangeBonus( OBJECTTYPE * pObj ) bonus = ( bonus * ( 100 + Item[(*pObj)[0]->data.gun.usGunAmmoItem].percentrangebonus ) ) / 100; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if ( !Item[iter->usItem].duckbill || ( Item[iter->usItem].duckbill && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT )) + if ( !ItemIsDuckbill(iter->usItem) || (ItemIsDuckbill(iter->usItem) && (*pObj)[0]->data.gun.ubGunAmmoType == AMMO_BUCKSHOT )) bonus = ( bonus * ( 100 + BonusReduce( Item[iter->usItem].percentrangebonus, (*iter)[0]->data.objectStatus ) ) ) / 100; } } @@ -15880,7 +15865,7 @@ FLOAT GetAttackAPTraitMultiplier( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, UINT8 { fMultiplier = (100 - gSkillTraitValues.ubMEBladesAPsReduction * NUM_SKILL_TRAITS( pSoldier, MELEE_NT ) ) / 100.0f; } - else if( Item[ pObj->usItem ].usItemClass == IC_PUNCH && Item[pObj->usItem].brassknuckles ) + else if( Item[ pObj->usItem ].usItemClass == IC_PUNCH && ItemIsBrassKnuckles(pObj->usItem) ) { fMultiplier = (100 - gSkillTraitValues.ubMAPunchAPsReduction * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ) ) / 100.0f; } @@ -15889,17 +15874,17 @@ FLOAT GetAttackAPTraitMultiplier( SOLDIERTYPE *pSoldier, OBJECTTYPE *pObj, UINT8 fMultiplier = (100 - gSkillTraitValues.ubTHBladesAPsReduction * NUM_SKILL_TRAITS( pSoldier, THROWING_NT ) ) / 100.0f; } // grenade launchers - else if( (Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || Item[ pObj->usItem ].grenadelauncher) && !(Item[ pObj->usItem ].rocketlauncher) && !(Item[ pObj->usItem ].mortar) ) + else if( (Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(pObj->usItem)) && !(ItemIsRocketLauncher(pObj->usItem)) && !ItemIsMortar(pObj->usItem) ) { fMultiplier = (100 - gSkillTraitValues.ubHWGrenadeLaunchersAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) ) / 100.0f; } // rocket launchers - else if( (Item[ pObj->usItem ].rocketlauncher || Item[ pObj->usItem ].singleshotrocketlauncher) && !(Item[ pObj->usItem ].mortar) ) + else if( (ItemIsRocketLauncher(pObj->usItem) || ItemIsSingleShotRocketLauncher(pObj->usItem)) && !ItemIsMortar(pObj->usItem) ) { fMultiplier = (100 - gSkillTraitValues.ubHWRocketLaunchersAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) ) / 100.0f; } // mortar - else if( Item[ pObj->usItem ].mortar ) + else if(ItemIsMortar(pObj->usItem)) { fMultiplier = (100 - gSkillTraitValues.ubHWMortarAPsReduction * NUM_SKILL_TRAITS( pSoldier, HEAVY_WEAPONS_NT ) + pSoldier->GetBackgroundValue(BG_ARTILLERY) ) / 100.0f; } @@ -16064,3 +16049,82 @@ BOOLEAN FindAttachmentRange(UINT16 usAttachment, UINT32* pStartIndex, UINT32* pE return result; } + +//////////////////////////////////// +// Item flagmask utility functions +// Just to improve readability +//////////////////////////////////// +// usItemFlag +BOOLEAN ItemIsDamageable(UINT16 usItem) { return HasItemFlag(usItem, ITEM_damageable); } +BOOLEAN ItemIsRepairable(UINT16 usItem) { return HasItemFlag(usItem, ITEM_repairable); } +BOOLEAN ItemIsDamagedByWater(UINT16 usItem) { return HasItemFlag(usItem, ITEM_waterdamages); } +BOOLEAN ItemIsMetal(UINT16 usItem) { return HasItemFlag(usItem, ITEM_metal); } +BOOLEAN ItemSinks(UINT16 usItem) { return HasItemFlag(usItem, ITEM_sinks); } +BOOLEAN ItemIsTwoHanded(UINT16 usItem) { return HasItemFlag(usItem, ITEM_twohanded); } +BOOLEAN ItemIsHiddenAddon(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hiddenaddon); } +BOOLEAN ItemIsNotBuyable(UINT16 usItem) { return HasItemFlag(usItem, ITEM_notbuyable); } +BOOLEAN ItemIsAttachment(UINT16 usItem) { return HasItemFlag(usItem, ITEM_attachment); } +BOOLEAN ItemIsHiddenAttachment(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hiddenattachment); } +BOOLEAN ItemIsOnlyInTonsOfGuns(UINT16 usItem) { return HasItemFlag(usItem, ITEM_biggunlist); } +BOOLEAN ItemIsNotInEditor(UINT16 usItem) { return HasItemFlag(usItem, ITEM_notineditor); } +BOOLEAN ItemIsUndroppableByDefault(UINT16 usItem) { return HasItemFlag(usItem, ITEM_defaultundroppable); } +BOOLEAN ItemIsUnaerodynamic(UINT16 usItem) { return HasItemFlag(usItem, ITEM_unaerodynamic); } +BOOLEAN ItemIsElectronic(UINT16 usItem) { return HasItemFlag(usItem, ITEM_electronic); } +BOOLEAN ItemIsCannon(UINT16 usItem) { return HasItemFlag(usItem, ITEM_cannon); } +BOOLEAN ItemIsRocketRifle(UINT16 usItem) { return HasItemFlag(usItem, ITEM_rocketrifle); } +BOOLEAN ItemHasFingerPrintID(UINT16 usItem) { return HasItemFlag(usItem, ITEM_fingerprintid); } +BOOLEAN ItemIsMetalDetector(UINT16 usItem) { return HasItemFlag(usItem, ITEM_metaldetector); } +BOOLEAN ItemIsGasmask(UINT16 usItem) { return HasItemFlag(usItem, ITEM_gasmask); } +BOOLEAN ItemIsLockBomb(UINT16 usItem) { return HasItemFlag(usItem, ITEM_lockbomb); } +BOOLEAN ItemIsFlare(UINT16 usItem) { return HasItemFlag(usItem, ITEM_flare); } +BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_grenadelauncher); } +BOOLEAN ItemIsMortar(UINT16 usItem) { return HasItemFlag(usItem, ITEM_mortar); } +BOOLEAN ItemIsDuckbill(UINT16 usItem) { return HasItemFlag(usItem, ITEM_duckbill); } +BOOLEAN ItemIsDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_detonator); } +BOOLEAN ItemIsRemoteDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_remotedetonator); } +BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hidemuzzleflash); } +BOOLEAN ItemIsRocketLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_rocketlauncher); } +// usItemFlag2 +BOOLEAN ItemIsSingleShotRocketLauncher(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_singleshotrocketlauncher); } +BOOLEAN ItemIsBrassKnuckles(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_brassknuckles); } +BOOLEAN ItemIsCrowbar(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_crowbar); } +BOOLEAN ItemIsGLgrenade(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_glgrenade); } +BOOLEAN ItemIsFlakJacket(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_flakjacket); } +BOOLEAN ItemIsLeatherJacket(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_leatherjacket); } +BOOLEAN ItemIsBatteries(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_batteries); } +BOOLEAN ItemNeedsBatteries(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_needsbatteries); } +BOOLEAN ItemHasXRay(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_xray); } +BOOLEAN ItemIsWirecutters(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_wirecutters); } +BOOLEAN ItemIsToolkit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_toolkit); } +BOOLEAN ItemIsFirstAidKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_firstaidkit); } +BOOLEAN ItemIsMedicalKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_medicalkit); } +BOOLEAN ItemIsCanteen(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_canteen); } +BOOLEAN ItemIsJar(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_jar); } +BOOLEAN ItemIsCanAndString(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_canandstring); } +BOOLEAN ItemIsMarbles(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_marbles); } +BOOLEAN ItemIsWalkman(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_walkman); } +BOOLEAN ItemIsRemoteTrigger(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_remotetrigger); } +BOOLEAN ItemIsRobotRemote(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_robotremotecontrol); } +BOOLEAN ItemIsCamoKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_camouflagekit); } +BOOLEAN ItemIsLocksmithKit(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_locksmithkit); } +BOOLEAN ItemIsMine(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_mine); } +BOOLEAN ItemIsATMine(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_antitankmine); } +BOOLEAN ItemIsHardware(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_hardware); } +BOOLEAN ItemIsMedical(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_medical); } +BOOLEAN ItemIsGascan(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_gascan); } +BOOLEAN ItemContainsLiquid(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_containsliquid); } +BOOLEAN ItemIsRock(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_rock); } +BOOLEAN ItemIsThermalOptics(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_thermaloptics); } +BOOLEAN ItemIsOnlyInScifi(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_scifi); } +BOOLEAN ItemIsOnlyInNIV(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_newinv); } +BOOLEAN ItemIsBarrel(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_barrel); } +BOOLEAN ItemHasTripwireActivation(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_tripwireactivation); } +BOOLEAN ItemIsTripwire(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_tripwire); } +BOOLEAN ItemIsDirectional(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_directional); } +BOOLEAN ItemBlocksIronsight(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_blockironsight); } +BOOLEAN ItemAllowsClimbing(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fAllowClimbing); } +BOOLEAN ItemIsCigarette(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_cigarette); } +BOOLEAN ItemIsOnlyInDisease(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_DiseaseSystemExclusive); } +BOOLEAN ItemProvidesRobotCamo(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotCamo); } +BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotNightVision); } +BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotLaserBonus); } diff --git a/Tactical/Items.h b/Tactical/Items.h index ce23180f..6aa26659 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -179,8 +179,78 @@ BOOLEAN ValidAttachmentClass( UINT16 usAttachment, UINT16 usItem ); //Determines if it is possible to equip this weapon with this ammo. BOOLEAN ValidAmmoType( UINT16 usItem, UINT16 usAmmoType ); -//Determines if this item is a two handed item. -BOOLEAN TwoHandedItem( UINT16 usItem ); +BOOLEAN ItemIsDamageable(UINT16 usItem); +BOOLEAN ItemIsRepairable(UINT16 usItem); +BOOLEAN ItemIsDamagedByWater(UINT16 usItem); +BOOLEAN ItemIsMetal(UINT16 usItem); +BOOLEAN ItemSinks(UINT16 usItem); +BOOLEAN ItemIsTwoHanded(UINT16 usItem); +BOOLEAN ItemIsHiddenAddon(UINT16 usItem); +BOOLEAN ItemIsNotBuyable(UINT16 usItem); +BOOLEAN ItemIsAttachment(UINT16 usItem); +BOOLEAN ItemIsHiddenAttachment(UINT16 usItem); +BOOLEAN ItemIsOnlyInTonsOfGuns(UINT16 usItem); +BOOLEAN ItemIsNotInEditor(UINT16 usItem); +BOOLEAN ItemIsUndroppableByDefault(UINT16 usItem); +BOOLEAN ItemIsUnaerodynamic(UINT16 usItem); +BOOLEAN ItemIsElectronic(UINT16 usItem); +BOOLEAN ItemIsCannon(UINT16 usItem); +BOOLEAN ItemIsRocketRifle(UINT16 usItem); +BOOLEAN ItemHasFingerPrintID(UINT16 usItem); +BOOLEAN ItemIsMetalDetector(UINT16 usItem); +BOOLEAN ItemIsGasmask(UINT16 usItem); +BOOLEAN ItemIsLockBomb(UINT16 usItem); +BOOLEAN ItemIsFlare(UINT16 usItem); +BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem); +BOOLEAN ItemIsMortar(UINT16 usItem); +BOOLEAN ItemIsDuckbill(UINT16 usItem); +BOOLEAN ItemIsDetonator(UINT16 usItem); +BOOLEAN ItemIsRemoteDetonator(UINT16 usItem); +BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem); +BOOLEAN ItemIsRocketLauncher(UINT16 usItem); +BOOLEAN ItemIsSingleShotRocketLauncher(UINT16 usItem); +BOOLEAN ItemIsBrassKnuckles(UINT16 usItem); +BOOLEAN ItemIsCrowbar(UINT16 usItem); +BOOLEAN ItemIsGLgrenade(UINT16 usItem); +BOOLEAN ItemIsFlakJacket(UINT16 usItem); +BOOLEAN ItemIsLeatherJacket(UINT16 usItem); +BOOLEAN ItemIsBatteries(UINT16 usItem); +BOOLEAN ItemNeedsBatteries(UINT16 usItem); +BOOLEAN ItemHasXRay(UINT16 usItem); +BOOLEAN ItemIsWirecutters(UINT16 usItem); +BOOLEAN ItemIsToolkit(UINT16 usItem); +BOOLEAN ItemIsFirstAidKit(UINT16 usItem); +BOOLEAN ItemIsMedicalKit(UINT16 usItem); +BOOLEAN ItemIsCanteen(UINT16 usItem); +BOOLEAN ItemIsJar(UINT16 usItem); +BOOLEAN ItemIsCanAndString(UINT16 usItem); +BOOLEAN ItemIsMarbles(UINT16 usItem); +BOOLEAN ItemIsWalkman(UINT16 usItem); +BOOLEAN ItemIsRemoteTrigger(UINT16 usItem); +BOOLEAN ItemIsRobotRemote(UINT16 usItem); +BOOLEAN ItemIsCamoKit(UINT16 usItem); +BOOLEAN ItemIsLocksmithKit(UINT16 usItem); +BOOLEAN ItemIsMine(UINT16 usItem); +BOOLEAN ItemIsATMine(UINT16 usItem); +BOOLEAN ItemIsHardware(UINT16 usItem); +BOOLEAN ItemIsMedical(UINT16 usItem); +BOOLEAN ItemIsGascan(UINT16 usItem); +BOOLEAN ItemContainsLiquid(UINT16 usItem); +BOOLEAN ItemIsRock(UINT16 usItem); +BOOLEAN ItemIsThermalOptics(UINT16 usItem); +BOOLEAN ItemIsOnlyInScifi(UINT16 usItem); +BOOLEAN ItemIsOnlyInNIV(UINT16 usItem); +BOOLEAN ItemIsBarrel(UINT16 usItem); +BOOLEAN ItemHasTripwireActivation(UINT16 usItem); +BOOLEAN ItemIsTripwire(UINT16 usItem); +BOOLEAN ItemIsDirectional(UINT16 usItem); +BOOLEAN ItemBlocksIronsight(UINT16 usItem); +BOOLEAN ItemAllowsClimbing(UINT16 usItem); +BOOLEAN ItemIsCigarette(UINT16 usItem); +BOOLEAN ItemIsOnlyInDisease(UINT16 usItem); +BOOLEAN ItemProvidesRobotCamo(UINT16 usItem); +BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem); +BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem); //Existing functions without header def's, added them here, just incase I'll need to call //them from the editor. @@ -222,7 +292,6 @@ UINT8 ConvertObjectTypeMoneyValueToProfileMoneyValue( UINT32 uiMoneyAmount ); BOOLEAN CheckForChainReaction( UINT16 usItem, INT16 bStatus, INT16 bDamage, BOOLEAN fOnGround ); BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness = FALSE ); -BOOLEAN ExtendedGunListGun( UINT16 usGun ); UINT16 StandardGunListReplacement( UINT16 usGun ); UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType); UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UINT16 usNewGun ); @@ -497,7 +566,8 @@ UINT64 GetAvailableAttachmentPoint ( OBJECTTYPE * pObject, UINT8 subObject ); void CheckBombSpecifics( OBJECTTYPE * pObj, INT8* detonatortype, INT8* setting, INT8* defusefrequency ); // Flugente: check for specific flags -BOOLEAN HasItemFlag( UINT16 usItem, UINT64 aFlag ); +BOOLEAN HasItemFlag(UINT16 usItem, UINT64 aFlag); +BOOLEAN HasItemFlag2(UINT16 usItem, UINT64 aFlag); // Flugente: get first item number that has this flag. Use with caution, as we search in all items BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag ); diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index ac2605a3..6d674b55 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -4840,15 +4840,15 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usHandItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usHandItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usHandItem].cannon ) + else if (ItemIsCannon(usHandItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usHandItem].rocketrifle ) + else if (ItemIsRocketRifle(usHandItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -5237,7 +5237,7 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) ) { // another shot fired - if ( Item[usHandItem].usItemClass == IC_LAUNCHER || Item[usHandItem].grenadelauncher || Item[usHandItem].rocketlauncher || Item[usHandItem].singleshotrocketlauncher || Item[usHandItem].mortar) + if ( Item[usHandItem].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usHandItem) || ItemIsRocketLauncher(usHandItem) || ItemIsSingleShotRocketLauncher(usHandItem) || ItemIsMortar(usHandItem)) gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++; else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE ) gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++; @@ -5335,15 +5335,15 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usHandItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usHandItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usHandItem].cannon ) + else if (ItemIsCannon(usHandItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usHandItem].rocketrifle ) + else if (ItemIsRocketRifle(usHandItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -5753,7 +5753,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA if( !fFake && ( pFirer->ubProfile != NO_PROFILE ) && ( pFirer->bTeam == gbPlayerNum ) ) { // another shot fired - if ( Item[usHandItem].usItemClass == IC_LAUNCHER || Item[usHandItem].grenadelauncher || Item[usHandItem].rocketlauncher || Item[usHandItem].singleshotrocketlauncher || Item[usHandItem].mortar) + if ( Item[usHandItem].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usHandItem) || ItemIsRocketLauncher(usHandItem) || ItemIsSingleShotRocketLauncher(usHandItem) || ItemIsMortar(usHandItem)) gMercProfiles[ pFirer->ubProfile ].records.usMissilesLaunched++; else if ( Item[usHandItem].usItemClass == IC_THROWING_KNIFE ) gMercProfiles[ pFirer->ubProfile ].records.usKnivesThrown++; @@ -6007,15 +6007,15 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usItem].cannon ) + else if (ItemIsCannon(usItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usItem].rocketrifle ) + else if (ItemIsRocketRifle(usItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -6594,15 +6594,15 @@ INT8 FireBulletGivenTarget_NoObjectNoSoldier( UINT16 usItem, UINT8 ammotype, UIN { usBulletFlags |= BULLET_FLAG_KNIFE; } - else if ( Item[usItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usItem)) { usBulletFlags |= BULLET_FLAG_MISSILE; } - else if ( Item[usItem].cannon ) + else if (ItemIsCannon(usItem)) { usBulletFlags |= BULLET_FLAG_TANK_CANNON; } - else if ( Item[usItem].rocketrifle ) + else if (ItemIsRocketRifle(usItem)) { usBulletFlags |= BULLET_FLAG_SMALL_MISSILE; } @@ -6923,7 +6923,7 @@ INT8 ChanceToGetThrough(SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dE // sevenfm: check that weapon exists! if (pObjHand->exists() && pObjHand->usItem == pFirer->usAttackingWeapon && - (Item[pFirer->usAttackingWeapon].usItemClass == IC_GUN || Item[pFirer->usAttackingWeapon].usItemClass == IC_THROWING_KNIFE || Item[pFirer->usAttackingWeapon].rocketlauncher)) + (Item[pFirer->usAttackingWeapon].usItemClass == IC_GUN || Item[pFirer->usAttackingWeapon].usItemClass == IC_THROWING_KNIFE || ItemIsRocketLauncher(pFirer->usAttackingWeapon))) { BOOLEAN fBuckShot = FALSE; @@ -8643,7 +8643,7 @@ void AdjustTargetCenterPoint( SOLDIERTYPE *pShooter, INT32 iTargetGridNo, FLOAT //INT32 iLaserRange = GetBestLaserRange(&(pShooter->inv[pSoldier->ubAttackingHand])); INT16 sLaserRange = GetBestLaserRange(pWeapon); - if (AM_A_ROBOT(pShooter) && Item[pShooter->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (AM_A_ROBOT(pShooter) && ItemProvidesRobotLaserBonus(pShooter->inv[ROBOT_TARGETING_SLOT].usItem)) { sLaserRange = max(sLaserRange, GetBestLaserRange(&pShooter->inv[ROBOT_TARGETING_SLOT])); } diff --git a/Tactical/LogicalBodyTypes/Filter.cpp b/Tactical/LogicalBodyTypes/Filter.cpp index 648105bf..d0a60a9e 100644 --- a/Tactical/LogicalBodyTypes/Filter.cpp +++ b/Tactical/LogicalBodyTypes/Filter.cpp @@ -214,10 +214,10 @@ bool Filter::Match(SOLDIERTYPE* pSoldier) { cmp_val = Weapon[pSoldier->inv[HANDPOS].usItem].ubCalibre; break; case REQ_WEAPON_TWOHANDED: - cmp_val = TwoHandedItem(pSoldier->inv[HANDPOS].usItem); + cmp_val = ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem); break; case REQ_LEFT_WEAPON_TWOHANDED: - cmp_val = TwoHandedItem(pSoldier->inv[SECONDHANDPOS].usItem); + cmp_val = ItemIsTwoHanded(pSoldier->inv[SECONDHANDPOS].usItem); break; case REQ_VEST_AMOR_PROTECTION: cmp_val = Armour[Item[pSoldier->inv[VESTPOS].usItem].ubClassIndex].ubProtection; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 3052c2bb..9ea83354 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -7287,7 +7287,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // Check if it's supposed to be dropped if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) || pTeamSoldier->bTeam == gbPlayerNum ) { - if ( !(Item[pObj->usItem].defaultundroppable) ) + if ( !ItemIsUndroppableByDefault(pObj->usItem) ) { //ReduceAmmoDroppedByNonPlayerSoldiers( pTeamSoldier, cnt ); @@ -7301,7 +7301,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; - if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives + if (ItemIsDamageable(pObj->usItem) && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives { // silversurfer: externalized this //(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random( 20 ); @@ -9320,7 +9320,7 @@ BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** pp if ( gTacticalStatus.bBoxingState == BOXING ) { // should have a check for "in boxing ring", no? - if ( ( pSoldier->usAttackingWeapon != NOTHING && !Item[pSoldier->usAttackingWeapon].brassknuckles ) || !( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) || pSoldier->IsRiotShieldEquipped() ) + if ( ( pSoldier->usAttackingWeapon != NOTHING && !ItemIsBrassKnuckles(pSoldier->usAttackingWeapon)) || !( pSoldier->flags.uiStatusFlags & SOLDIER_BOXER ) || pSoldier->IsRiotShieldEquipped() ) { // someone's cheating! if ( (Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_BLADE || Item[ pSoldier->usAttackingWeapon ].usItemClass == IC_PUNCH) && (pTarget->flags.uiStatusFlags & SOLDIER_BOXER) ) @@ -9921,7 +9921,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) pSoldier->bDoAutofire = 1; pSoldier->bDoBurst = TRUE; } - if ( Item[pSoldier->inv[ HANDPOS ].usItem].twohanded && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[pSoldier->inv[ HANDPOS ].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 81597a60..ee07e3f0 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -2375,9 +2375,9 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, // Do we need to stand up? bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND ); } - else if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too + else if(ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem))//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too { - if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) + if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) bAPCost += GetAPsToChangeStance(pSoldier, ANIM_CROUCH); else bAPCost += GetAPsToChangeStance(pSoldier, gAnimControl[pSoldier->usAnimState].ubEndHeight); @@ -2393,9 +2393,9 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, if (!TileIsOutOfBounds(sGridNo)) { { - if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 + if(ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem))//dnl ch72 260913 { - if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) + if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND) usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost, ANIM_CROUCH); else usTurningCost = CalculateTurningCost(pSoldier, usItem, fAddingTurningCost); @@ -2429,7 +2429,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, // if attacking a new target (or if the specific target is uncertain) // Added check if the weapon is throwing knife/melee weapons - otherwise it would add APs for change target on cursor but not actually deduct them afterwards - SANDRO - if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !Item[usUBItem].rocketlauncher && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE )/* && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE )*/ ) )//dnl ch69 140913 //dnl ch73 290913 + if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !ItemIsRocketLauncher(usUBItem) && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE )/* && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE )*/ ) )//dnl ch69 140913 //dnl ch73 290913 { if ( pSoldier->IsValidAlternativeFireMode( bAimTime, sGridNo ) ) bAPCost += (APBPConstants[AP_CHANGE_TARGET] / 2); @@ -2635,13 +2635,13 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( &(pSoldier->inv[bInvPos]) ); UINT16 usItemUsed = pSoldier->GetUsedWeaponNumber( &(pSoldier->inv[bInvPos]) ); - if ( Item[usItemUsed].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usItemUsed)) { // hack... they turn empty afterwards anyways return( TRUE ); } - if (Item[ usItemUsed ].usItemClass == IC_LAUNCHER || Item[usItemUsed].cannon ) + if (Item[ usItemUsed ].usItemClass == IC_LAUNCHER || ItemIsCannon(usItemUsed)) { if ( FindAttachmentByClass( pObjUsed, IC_GRENADE ) != 0 ) { @@ -2661,7 +2661,7 @@ BOOLEAN EnoughAmmo( SOLDIERTYPE *pSoldier, BOOLEAN fDisplay, INT8 bInvPos ) } // WANNE: If there is a tank, it always have ammo to shoot, no check! - if (Item[usItemUsed].cannon) + if (ItemIsCannon(usItemUsed)) { return ( TRUE ); } @@ -2715,13 +2715,13 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE* pObj ) { // tanks never run out of MG ammo! // unlimited cannon ammo is handled in AI - if ( (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && !Item[pObj->usItem].cannon ) + if ( (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && !ItemIsCannon(pObj->usItem) ) return; - if ( Item[pObj->usItem].cannon ) + if (ItemIsCannon(pObj->usItem)) { } - else if ( Item[ pObj->usItem ].usItemClass == IC_GUN && !Item[pObj->usItem].cannon && pSoldier->bWeaponMode != WM_ATTACHED_GL && pSoldier->bWeaponMode != WM_ATTACHED_GL_BURST && pSoldier->bWeaponMode != WM_ATTACHED_GL_AUTO ) + else if ( Item[ pObj->usItem ].usItemClass == IC_GUN && !ItemIsCannon(pObj->usItem) && pSoldier->bWeaponMode != WM_ATTACHED_GL && pSoldier->bWeaponMode != WM_ATTACHED_GL_BURST && pSoldier->bWeaponMode != WM_ATTACHED_GL_AUTO ) { // Flugente: check for underbarrel weapons and use that object if necessary OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( pObj ); @@ -2754,7 +2754,7 @@ void DeductAmmo( SOLDIERTYPE *pSoldier, OBJECTTYPE* pObj ) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_AMMO, (FLOAT)(Item[(*pObjUsed)[0]->data.gun.usGunAmmoItem].ubWeight) / (FLOAT)(Magazine[ Item[ (*pObjUsed)[0]->data.gun.usGunAmmoItem ].ubClassIndex ].ubMagSize ) ); } } - else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || Item[pObj->usItem].cannon || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) + else if ( Item[ pObj->usItem ].usItemClass == IC_LAUNCHER || ItemIsCannon(pObj->usItem) || pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO ) { OBJECTTYPE* pAttachment = FindAttachmentByClass( pObj, IC_GRENADE ); if ( !pAttachment->exists() ) @@ -3325,7 +3325,7 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // If we are told to go to the alt weapon holding mode if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) || (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && usAnimState == INVALID_ANIMATION) )//dnl ch71 180913 { - if ( Item[ usItem ].twohanded ) + if (ItemIsTwoHanded(usItem)) { // Raising only to hip, either charge no APs or a portion of them ubReadyAPs = ((ubReadyAPs * gGameExternalOptions.ubToAltWeaponHoldReadyAPsPerc) + 99) / 100 ; // round up for rifles @@ -3339,7 +3339,7 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) // If we are told to go from alternative to standard weapon holding else if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) ) { - if ( Item[ usItem ].twohanded ) + if (ItemIsTwoHanded(usItem)) { ubReadyAPs = ubReadyAPs * gGameExternalOptions.ubFromAltWeaponHoldReadyAPsPerc / 100; // round down for rifles } @@ -3703,7 +3703,7 @@ UINT16 GetTotalAPsToDropBomb( SOLDIERTYPE *pSoldier, INT32 sGridNo ) if ( sAPs > 0 ) { - if(Item[pSoldier->inv[HANDPOS].usItem].mine == 1) + if(ItemIsMine(pSoldier->inv[HANDPOS].usItem)) sAPs += GetAPsToPlantMine( pSoldier ); // changed by SANDRO else sAPs += GetAPsToDropBomb( pSoldier ); // changed by SANDRO @@ -4154,7 +4154,7 @@ INT32 GetBPCostPer10APsForGunHolding( SOLDIERTYPE * pSoldier, BOOLEAN fEstimate // Alternative weapon holding? if (( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) || (fEstimate && pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD) ) { - if ( Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) // firing from hip is not nearly ?n effort + if (ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem)) // firing from hip is not nearly ?n effort dModifier += 80; // only 20% cost if on hip else // holding pistol in one hand is worse in this case dModifier -= 25; // increased cost by 25% @@ -4265,7 +4265,7 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier ) iKickPower = iKickPower * (100 - sWeaponWeight) / 100; // If one-handed gun, reduce it a bit, since the whole thing is somewhat different. - if ( !Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) + if ( !ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem) ) iKickPower = iKickPower * 3 / 4; // -25% // ::: overview ::: @@ -4310,7 +4310,7 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier ) // Alternative weapon holding? if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_ALT_WEAPON_HOLDING ) { - if ( Item[pSoldier->inv[pSoldier->ubAttackingHand].usItem].twohanded ) // firing from hip makes the kicking rather diminishing + if (ItemIsTwoHanded(pSoldier->inv[pSoldier->ubAttackingHand].usItem)) // firing from hip makes the kicking rather diminishing dModifier += 80; // only 20% of the regular kick power else // holding pistol in one hand is worse in this case dModifier -= 33; // plus 33% power diff --git a/Tactical/RandomMerc.cpp b/Tactical/RandomMerc.cpp index bbb323f0..0e0a2413 100644 --- a/Tactical/RandomMerc.cpp +++ b/Tactical/RandomMerc.cpp @@ -460,7 +460,7 @@ INVTYPE* GearGetRandomFaceItem(INT8 min_coolness = -1, INT8 max_coolness = -1, U if (HasItemFlag((*it)->uiIndex, SCUBA_MASK)) continue; - if (item_type == FACEITEM_GAS_MASK && (*it)->gasmask < 1) continue; + if (item_type == FACEITEM_GAS_MASK && !ItemIsGasmask((*it)->uiIndex)) continue; if (item_type == FACEITEM_SPECTACLES && (*it)->brightlightvisionrangebonus < 1) continue; if (item_type == FACEITEM_NVG && (*it)->nightvisionrangebonus < 1) continue; if (item_type == FACEITEM_HEADSET && (*it)->hearingrangebonus < 1) continue; @@ -643,7 +643,8 @@ std::vector GearFindAttachmentsForWeapon(INVTYPE* weapon, BOOL attach_ { INVTYPE* item = *it; - if (item->attachment < 1) + //if (item->attachment < 1) + if (!ItemIsAttachment(item->uiIndex)) continue; if (!ValidAttachment(item->uiIndex, weapon->uiIndex)) @@ -680,7 +681,7 @@ std::vector GearFindItemsForRole(std::vector* roles, std::vecto INVTYPE* item = *it; INT8 chance = 0; - if (item->glgrenade > 0) + if (ItemIsGLgrenade(item->uiIndex)) continue; if (item->attachmentclass == AC_GRENADE || item->attachmentclass == AC_ROCKET) @@ -1061,4 +1062,4 @@ void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc, BOOL random_gear_k merc->usOptionalGearCost = kit_cost; } } -} \ No newline at end of file +} diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 2293bfa6..5083ecc9 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1014,7 +1014,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE { // and make sure that it really is a droppable item type // if ( !(Item[ pObj->usItem ].fFlags & ITEM_DEFAULT_UNDROPPABLE) ) - if ( !(Item[ pObj->usItem ].defaultundroppable ) ) + if ( !ItemIsUndroppableByDefault(pObj->usItem) ) { ReduceAmmoDroppedByNonPlayerSoldiers( pSoldier, cnt ); //if this soldier was an enemy @@ -1027,7 +1027,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; - if ( Item[pObj->usItem].damageable && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives + if (ItemIsDamageable(pObj->usItem) && Item[pObj->usItem].usItemClass != IC_THROWING_KNIFE ) // Madd: drop crappier items from enemies on higher difficulty levels - note the quick fix for throwing knives { // silversurfer: externalized this //(*pObj)[0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 505ce377..b58d61bb 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -607,8 +607,6 @@ void EnableAllDealersOfferSlots( void ); void HatchOutInvSlot( UINT16 usPosX, UINT16 usPosY ); -extern BOOLEAN ItemIsARocketRifle( INT16 sItemIndex ); - #ifdef JA2TESTVERSION BOOLEAN gfTestDisplayDealerCash = FALSE; void DisplayAllDealersCash(); @@ -3392,8 +3390,7 @@ FLOAT ItemConditionModifier(UINT16 usItemIndex, INT16 bStatus) // an item at 100% is worth full price... -// if ( Item[ usItemIndex ].fFlags & ITEM_REPAIRABLE ) - if ( Item[ usItemIndex ].repairable ) + if (ItemIsRepairable(usItemIndex)) { // a REPAIRABLE item at 0% is still worth 50% of its full price, not 0% dConditionModifier = 0.5f + ( bStatus / (FLOAT)200 ); @@ -5007,8 +5004,7 @@ BOOLEAN IsGunOrAmmoOfSameTypeSelected( OBJECTTYPE *pItemObject ) } //if the highlighted object is an attachment -// if( Item[ pItemObject->usItem ].fFlags & ITEM_ATTACHMENT ) - if( Item[ pItemObject->usItem ].attachment ) + if(ItemIsAttachment(pItemObject->usItem)) { if( ValidAttachment( pItemObject->usItem, gpHighLightedItemObject ) ) return( TRUE ); @@ -5646,7 +5642,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) } //if the item is a rocket rifle - if( ItemIsARocketRifle( PlayersOfferArea[ bSlotID ].sItemIndex ) ) + if(ItemHasFingerPrintID( PlayersOfferArea[ bSlotID ].sItemIndex ) ) { fRocketRifleWasEvaluated = TRUE; } @@ -5716,8 +5712,7 @@ void EvaluateItemAddedToPlayersOfferArea( INT8 bSlotID, BOOLEAN fFirstOne ) if( armsDealerInfo[ gbSelectedArmsDealerID ].ubTypeOfArmsDealer == ARMS_DEALER_REPAIRS ) { // only otherwise repairable items count as actual rejections -// if ( Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].fFlags & ITEM_REPAIRABLE ) - if ( Item[ PlayersOfferArea[ bSlotID ].sItemIndex ].repairable ) + if (ItemIsRepairable(PlayersOfferArea[bSlotID].sItemIndex)) { uiEvalResult = EVAL_RESULT_DONT_HANDLE; } @@ -6356,7 +6351,7 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject ) // strip off any loaded ammo/payload // Exception: don't do this with rocket launchers, their "shots left" are fake and this screws 'em up! - if ( !Item[usItem].singleshotrocketlauncher ) // Madd rpg - still do this + if ( !ItemIsSingleShotRocketLauncher(usItem)) // Madd rpg - still do this { pData->data.gun.usGunAmmoItem = NONE; pData->data.gun.ubGunShotsLeft = 0; diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index eda237d2..662bc460 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -375,8 +375,8 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { // sevenfm: breaking window with crowbar code if (pSoldier->inv[HANDPOS].exists() && - (Item[pSoldier->inv[HANDPOS].usItem].crowbar && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || - Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[pSoldier->inv[HANDPOS].usItem].twohanded && Item[pSoldier->inv[HANDPOS].usItem].metal)) + (ItemIsCrowbar(pSoldier->inv[HANDPOS].usItem) && Item[pSoldier->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || + Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && ItemIsMetal(pSoldier->inv[HANDPOS].usItem))) { INT32 sWindowGridNo = pSoldier->sTargetGridNo; if (pSoldier->ubDirection == NORTH || pSoldier->ubDirection == WEST) @@ -1135,10 +1135,10 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) UINT16 usItem = pSoldier->pTempObject->usItem; UINT16 usBuddyItem = Item[usItem].usBuddyItem; if (pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM && - (Item[usItem].flare || + (ItemIsFlare(usItem) || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_BURNABLEGAS || - usBuddyItem && (Item[usBuddyItem].usItemClass & IC_EXPLOSV) && (Item[usBuddyItem].flare || Explosive[Item[usBuddyItem].ubClassIndex].ubType == EXPLOSV_FLARE))) + usBuddyItem && (Item[usBuddyItem].usItemClass & IC_EXPLOSV) && (ItemIsFlare(usBuddyItem) || Explosive[Item[usBuddyItem].ubClassIndex].ubType == EXPLOSV_FLARE))) { if ((pSoldier->iMuzFlash = LightSpriteCreate("L-R03.LHT", 0)) != -1) { @@ -1805,7 +1805,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( Item[ usItem ].usItemClass == IC_GUN ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[ usItem ].twohanded ) ) + if (ItemIsTwoHanded(usItem)) { // Set to rifle ubRandomHandIndex = RANDOM_ANIM_RIFLEINHAND; @@ -2714,7 +2714,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) case BIGBUY_STRECH: case FEM_KICKSN: case FEM_WIPE: - if ( pSoldier->inv[ HANDPOS ].exists() == true && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded ) + if ( pSoldier->inv[ HANDPOS ].exists() == true && Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN && ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) ) { pSoldier->EVENT_InitNewSoldierAnim( RAISE_RIFLE, 0 , FALSE ); return( TRUE ); @@ -4457,7 +4457,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) // SANDRO - if Martial Artist took someone down, always fall back if possible (for the fun) if ( pSoldier->ubAttackerID != NOBODY && gGameOptions.fNewTraitSystem ) { - if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || Item[MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem].brassknuckles ) ) + if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || ItemIsBrassKnuckles(MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem)) ) { fAlwaysFallBack = TRUE; } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 7ff39702..b80c9585 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -3017,7 +3017,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart } else { - if (Item[usItem].flare || + if (ItemIsFlare(usItem) || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_SIGNAL_SMOKE || Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLARE) { @@ -3159,7 +3159,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // Going from shoulder stance to hip stance else if ( usNewState == READY_ALTERNATIVE_STAND && (gAnimControl[this->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) ) { - if ( Item[this->inv[HANDPOS].usItem].twohanded ) + if (ItemIsTwoHanded(this->inv[HANDPOS].usItem)) usStartingAniCode = 1; else usStartingAniCode = 2; @@ -3278,7 +3278,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // 1) We have a rifle in hand... //usItem = this->inv[ HANDPOS ].usItem; - if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) ) { // Switch on height! switch ( gAnimControl[this->usAnimState].ubEndHeight ) @@ -3301,7 +3301,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // 1) We have a rifle in hand... //usItem = this->inv[ HANDPOS ].usItem; - if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) ) { // Switch on height! switch ( gAnimControl[this->usAnimState].ubEndHeight ) @@ -3429,10 +3429,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( this->inv[HANDPOS].exists( ) == true ) { - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[usItem].twohanded) ) + if (ItemIsTwoHanded(usItem)) { usNewState = BIGMERC_CROUCH_TRANS_INTO; } @@ -3449,10 +3449,10 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( this->inv[HANDPOS].exists( ) == true ) { - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { // if ( (Item[ usItem ].fFlags & ITEM_TWO_HANDED) ) - if ( (Item[usItem].twohanded) ) + if (ItemIsTwoHanded(usItem)) { usNewState = BIGMERC_CROUCH_TRANS_OUTOF; } @@ -3477,7 +3477,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart if ( ((gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) || (gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE)) && gGameExternalOptions.fAllowWalkingWithWeaponRaised ) { - if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) { @@ -3524,7 +3524,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_CROUCH ) { - if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && Item[usItem].twohanded && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && ItemIsTwoHanded(usItem) && !ItemIsRocketLauncher(usItem) ) usNewState = SWAT_BACKWARDS; else usNewState = SWAT_BACKWARDS_NOTHING; @@ -3595,7 +3595,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart // SANDRO - check if we are gonna move with weapon raised else if ( gGameExternalOptions.fAllowWalkingWithWeaponRaised && ( (gAnimControl[this->usAnimState].uiFlags & ANIM_FIREREADY) || (gAnimControl[this->usAnimState].uiFlags & ANIM_FIRE) ) ) { - if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + if ( this->inv[HANDPOS].exists( ) == true && Item[usItem].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItem) ) { if ( usNewState == WALKING ) { @@ -3618,7 +3618,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart { usNewState = CROUCHEDMOVE_DUAL_READY; } - else if ( !Item[this->inv[HANDPOS].usItem].twohanded ) + else if (!ItemIsTwoHanded(this->inv[HANDPOS].usItem)) { usNewState = CROUCHEDMOVE_PISTOL_READY; } @@ -3991,7 +3991,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart case PLANT_BOMB: - if ( Item[this->inv[HANDPOS].usItem].mine == 1 ) // bury a mine + if (ItemIsMine(this->inv[HANDPOS].usItem)) // bury a mine DeductPoints( this, GetAPsToPlantMine( this ), APBPConstants[BP_BURY_MINE] ); // changed by SANDRO else DeductPoints( this, GetAPsToDropBomb( this ), APBPConstants[BP_DROP_BOMB] ); // changed by SANDRO @@ -4960,9 +4960,9 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo ) usItem = GetAttachedGrenadeLauncher( &this->inv[HANDPOS] ); else usItem = this->inv[HANDPOS].usItem; - if ( Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar ) + if (ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem) ) { - if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) + if ( gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE || ItemIsMortar(usItem) && gAnimControl[this->usAnimState].ubEndHeight == ANIM_STAND ) SendChangeSoldierStanceEvent( this, ANIM_CROUCH ); fDoFireRightAway = TRUE; } @@ -5118,7 +5118,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) } // Check for rocket laucncher.... - if ( Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) + if (ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem)) { //***ddd if shoot crouched if ( ubHeight == ANIM_STAND ) @@ -5128,14 +5128,14 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ) } // Check for mortar.... - if ( Item[pSoldier->inv[HANDPOS].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[HANDPOS].usItem)) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "SelectFireAnimation: shoot_mortar" ); return(SHOOT_MORTAR); } // Check for tank cannon - if ( Item[pSoldier->inv[HANDPOS].usItem].cannon ) + if (ItemIsCannon(pSoldier->inv[HANDPOS].usItem)) { return(TANK_SHOOT); } @@ -5447,7 +5447,7 @@ BOOLEAN SOLDIERTYPE::InternalSoldierReadyWeapon( UINT8 sFacingDir, BOOLEAN fEndR } //dnl ch72 270913 ugly but fast fix for not charging turning APs as there is no fire ready animation for mortars and rocket launchers UINT16 usItem = this->inv[HANDPOS].usItem; - if ( Item[usItem].rocketlauncher || Item[usItem].mortar ) + if (ItemIsRocketLauncher(usItem) || ItemIsMortar(usItem) ) usForceAnimState = this->usAnimState; EVENT_InternalSetSoldierDesiredDirection( this, sFacingDir, FALSE, usAnimState ); usForceAnimState = INVALID_ANIMATION; @@ -5535,12 +5535,12 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL } // Check if we have a gun..... - if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass != IC_GUN && !Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) + if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass != IC_GUN && !ItemIsGrenadeLauncher(pSoldier->inv[HANDPOS].usItem) ) { return(INVALID_ANIMATION); } - if ( Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) + if (ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem)) { return(INVALID_ANIMATION); } @@ -5621,7 +5621,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL // this is a specific situation when we have a gun in standard holding (shouldered rifle/two-hand pistol) and was told to go to alternative holding else if ( (gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_FIREREADY | ANIM_FIRE)) && !(gAnimControl[pSoldier->usAnimState].uiFlags & (ANIM_ALT_WEAPON_HOLDING)) && fAltWeaponHolding && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 && pSoldier->bScopeMode == -1 && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND - && ((!Item[pSoldier->inv[HANDPOS].usItem].twohanded && !pSoldier->IsValidSecondHandShot( ) && !pSoldier->MercInWater( )) || Item[pSoldier->inv[HANDPOS].usItem].twohanded) ) + && ((!ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && !pSoldier->IsValidSecondHandShot( ) && !pSoldier->MercInWater( )) || ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) ) { return(READY_ALTERNATIVE_STAND); } @@ -5641,7 +5641,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL { if ( gGameExternalOptions.ubAllowAlternativeWeaponHolding ) { - if ( fAltWeaponHolding || (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].HeavyGun && Item[pSoldier->inv[HANDPOS].usItem].twohanded) ) + if ( fAltWeaponHolding || (Weapon[pSoldier->inv[pSoldier->ubAttackingHand].usItem].HeavyGun && ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem)) ) { return(READY_ALTERNATIVE_STAND); } @@ -5877,7 +5877,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 { if ( ubAttackerID != NOBODY ) { - if ( !(MercPtrs[ubAttackerID]->inv[HANDPOS].exists( )) || Item[MercPtrs[ubAttackerID]->inv[HANDPOS].usItem].brassknuckles ) + if ( !(MercPtrs[ubAttackerID]->inv[HANDPOS].exists( )) || ItemIsBrassKnuckles(MercPtrs[ubAttackerID]->inv[HANDPOS].usItem) ) { // with enhanced CCS, make the lost breath harder to regenerate, which makes CQC more usable if ( gGameExternalOptions.fEnhancedCloseCombatSystem ) @@ -5944,7 +5944,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 if ( HasItemFlag( usWeaponIndex, TASER ) ) { // tasers need batteries, because I say so - if ( Item[usWeaponIndex].needsbatteries ) + if (ItemNeedsBatteries(usWeaponIndex)) { // check for batteries OBJECTTYPE* pBatteries = FindAttachedBatteries( &(MercPtrs[ubAttackerID]->inv[HANDPOS]) ); @@ -9734,7 +9734,7 @@ BOOLEAN SOLDIERTYPE::CanClimbWithCurrentBackpack() // only apply backpack climbing limitations to player mercs if (UsingNewInventorySystem() == true && this->inv[BPACKPOCKPOS].exists() == true && this->bTeam == OUR_TEAM && ((gGameExternalOptions.sBackpackWeightToClimb == -1) || (INT16)this->inv[BPACKPOCKPOS].GetWeightOfObjectInStack() + Item[this->inv[BPACKPOCKPOS].usItem].sBackpackWeightModifier > gGameExternalOptions.sBackpackWeightToClimb) - && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || (Item[this->inv[BPACKPOCKPOS].usItem].fAllowClimbing == FALSE))) + && ((gGameExternalOptions.fUseGlobalBackpackSettings == TRUE) || !ItemAllowsClimbing(this->inv[BPACKPOCKPOS].usItem))) return FALSE; return TRUE; @@ -10439,7 +10439,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr && this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_ARMS ) ) { // drop item in main hand if twohanded - if ( this->inv[HANDPOS].exists() == true && TwoHandedItem( this->inv[HANDPOS].usItem ) ) + if ( this->inv[HANDPOS].exists() == true && ItemIsTwoHanded( this->inv[HANDPOS].usItem ) ) dropiteminmainhand = true; // we can only use one hand, so drop items in second hand @@ -12763,9 +12763,9 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio //Ja25 No meanwhiles #ifdef JA2UB - if ( fMartialArtist && !Item[usItem].crowbar && this->ubBodyType == REGMALE ) + if ( fMartialArtist && !ItemIsCrowbar(usItem) && this->ubBodyType == REGMALE ) #else - if ( fMartialArtist && !AreInMeanwhile( ) && !Item[usItem].crowbar && this->ubBodyType == REGMALE && !IsZombie( ) + if ( fMartialArtist && !AreInMeanwhile( ) && !ItemIsCrowbar(usItem) && this->ubBodyType == REGMALE && !IsZombie( ) && !( gGameExternalOptions.fDiseaseSevereLimitations && this->HasDiseaseWithFlag( DISEASE_PROPERTY_LIMITED_USE_LEGS )) ) // SANDRO - added check for body type #endif { @@ -12871,7 +12871,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio case ANIM_STAND: case ANIM_CROUCH: - if ( !Item[usItem].crowbar ) + if ( !ItemIsCrowbar(usItem) ) { BOOLEAN fCannotKick = (ubDirection & 1); // SANDRO - we will determine here what type of punch we are gonna use @@ -13095,7 +13095,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginDropBomb( ) void SOLDIERTYPE::EVENT_SoldierDefuseTripwire( INT32 sGridNo, INT32 sItem ) { // Flugente: if item is tripwireactivated and is a planted bomb, call the defuse dialogue. We obviously know about the item's existence already... - if ( gWorldItems[sItem].object.exists( ) && gWorldItems[sItem].object.fFlags & OBJECT_ARMED_BOMB && Item[gWorldItems[sItem].object.usItem].tripwire == 1 ) + if ( gWorldItems[sItem].object.exists( ) && gWorldItems[sItem].object.fFlags & OBJECT_ARMED_BOMB && ItemIsTripwire(gWorldItems[sItem].object.usItem) ) { // Increment the number of people busy doing stuff because of an attack switch ( gAnimControl[this->usAnimState].ubHeight ) @@ -13148,7 +13148,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection ) //SANDRO - hack! Find out if we are a doctor with medical bag trying to make a surgery this->fDoingSurgery = FALSE; - if ( (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && Item[this->inv[HANDPOS].usItem].medicalkit && gGameOptions.fNewTraitSystem ) + if ( (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) && ItemIsMedicalKit(this->inv[HANDPOS].usItem) && gGameOptions.fNewTraitSystem ) { if ( ((pTSoldier->bTeam == OUR_TEAM) || (pTSoldier->bTeam == MILITIA_TEAM)) && (IS_MERC_BODY_TYPE( pTSoldier ) || IS_CIV_BODY_TYPE( pTSoldier )) @@ -13320,7 +13320,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 // Flugente: AI medics are allowed to perform surgery without first aid kits, and can do this on themselves if ( pVictim->iHealableInjury > 0 && this->fDoingSurgery && (this->ubID != pVictim->ubID || (gGameExternalOptions.fEnemyMedicsHealSelf && this->bTeam == ENEMY_TEAM)) && gGameOptions.fNewTraitSystem && (NUM_SKILL_TRAITS( this, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) - && (Item[this->inv[HANDPOS].usItem].medicalkit || this->bTeam == ENEMY_TEAM) ) + && (ItemIsMedicalKit(this->inv[HANDPOS].usItem) || this->bTeam == ENEMY_TEAM) ) { fOnSurgery = TRUE; } @@ -13359,7 +13359,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 return(0); // using the GOOD medic stuff - if ( Item[this->inv[HANDPOS].usItem].medicalkit && !(fOnSurgery) ) // added check + if (ItemIsMedicalKit(this->inv[HANDPOS].usItem) && !(fOnSurgery) ) // added check { uiPossible += (uiPossible / 2); // add extra 50 % } @@ -13417,7 +13417,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 } // now make sure we HAVE that much - if ( Item[this->inv[HANDPOS].usItem].medicalkit ) + if (ItemIsMedicalKit(this->inv[HANDPOS].usItem)) { if ( fOnSurgery ) uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot @@ -13665,7 +13665,7 @@ UINT32 SOLDIERTYPE::SoldierDressWound( SOLDIERTYPE *pVictim, INT16 sKitPts, INT1 // usedAPs equals (actionPts) * (%of possible points actually used) uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible; - if ( Item[this->inv[HANDPOS].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff + if (ItemIsMedicalKit(this->inv[HANDPOS].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff { uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds } @@ -14071,7 +14071,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U this->bWeaponMode = WM_ATTACHED_GL; } - if ( Item[usNewItem].twohanded && Weapon[usNewItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(usNewItem) && Weapon[usNewItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) this->bScopeMode = USE_ALT_WEAPON_HOLD; else this->bScopeMode = USE_BEST_SCOPE; @@ -14094,8 +14094,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U { if ( Item[usOldItem].usItemClass == IC_GUN ) { - // if ( (Item[ usOldItem ].fFlags & ITEM_TWO_HANDED) && usOldItem != ROCKET_LAUNCHER ) - if ( (Item[usOldItem].twohanded) && !Item[usOldItem].rocketlauncher ) + if (ItemIsTwoHanded(usOldItem) && !ItemIsRocketLauncher(usOldItem)) { fOldRifle = TRUE; } @@ -14106,8 +14105,7 @@ void SOLDIERTYPE::ReLoadSoldierAnimationDueToHandItemChange( UINT16 usOldItem, U { if ( Item[usNewItem].usItemClass == IC_GUN ) { - // if ( (Item[ usNewItem ].fFlags & ITEM_TWO_HANDED) && usNewItem != ROCKET_LAUNCHER ) - if ( (Item[usNewItem].twohanded) && !Item[usNewItem].rocketlauncher ) + if (ItemIsTwoHanded(usNewItem) && !ItemIsRocketLauncher(usNewItem)) { fNewRifle = TRUE; } @@ -14632,7 +14630,7 @@ BOOLEAN SOLDIERTYPE::SoldierCarriesTwoHandedWeapon( void ) usItem = this->inv[HANDPOS].usItem; - if ( this->inv[HANDPOS].exists( ) == true && (Item[usItem].twohanded) ) + if ( this->inv[HANDPOS].exists( ) == true && ItemIsTwoHanded(usItem) ) { return(TRUE); } @@ -15529,7 +15527,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void ) { // if that item is a gun, explosives, military armour or facewear, we're screwed if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) || - ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !Item[this->inv[bLoop].usItem].leatherjacket && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || + ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !ItemIsLeatherJacket(this->inv[bLoop].usItem) && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || (Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0) ) { @@ -15551,7 +15549,7 @@ BOOLEAN SOLDIERTYPE::LooksLikeACivilian( void ) { // if that item is a gun, explosives, military armour or facewear, we're screwed if ( (Item[this->inv[bLoop].usItem].usItemClass & (IC_WEAPON | IC_GRENADE | IC_BOMB)) || - ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !Item[this->inv[bLoop].usItem].leatherjacket && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || + ((Item[this->inv[bLoop].usItem].usItemClass & (IC_ARMOUR)) && !ItemIsLeatherJacket(this->inv[bLoop].usItem) && Armour[Item[this->inv[bLoop].usItem].ubClassIndex].ubProtection > 10) || (Item[this->inv[bLoop].usItem].nightvisionrangebonus > 0 || Item[this->inv[bLoop].usItem].hearingrangebonus > 0) ) { @@ -16848,7 +16846,7 @@ void SOLDIERTYPE::DropSectorEquipment( ) if ( pObj->exists( ) ) { // Check if it's supposed to be dropped - if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !(Item[pObj->usItem].defaultundroppable) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) + if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !ItemIsUndroppableByDefault(pObj->usItem) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) { (*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA; @@ -16874,7 +16872,7 @@ void SOLDIERTYPE::DropSectorEquipment( ) if ( pObj->exists( ) ) { // Check if it's supposed to be dropped - if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !(Item[pObj->usItem].defaultundroppable) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) + if ( !((*pObj).fFlags & OBJECT_UNDROPPABLE) && !ItemIsUndroppableByDefault(pObj->usItem) && (*pObj)[0]->data.sObjectFlag & TAKEN_BY_MILITIA ) { (*pObj)[0]->data.sObjectFlag &= ~TAKEN_BY_MILITIA; @@ -16944,12 +16942,13 @@ void SOLDIERTYPE::TakeNewBombFromInventory( UINT16 usItem ) // take tripwire-activated item only if used item is tripwire activated for ( i = 0; i < invsize; i++ ) { + UINT16 usItem = this->inv[i].usItem; if ( this->inv[i].exists( ) == true && - Item[this->inv[i].usItem].usItemClass == IC_BOMB && - Item[this->inv[i].usItem].ubCursor == BOMBCURS && - !Item[this->inv[i].usItem].tripwire && - ((Item[this->inv[i].usItem].tripwireactivation && Item[usItem].tripwireactivation) || - (!Item[this->inv[i].usItem].tripwireactivation && !Item[usItem].tripwireactivation)) ) + Item[usItem].usItemClass == IC_BOMB && + Item[usItem].ubCursor == BOMBCURS && + !ItemIsTripwire(usItem) && + ((ItemHasTripwireActivation(usItem) && ItemHasTripwireActivation(usItem)) || + (!ItemHasTripwireActivation(usItem) && !ItemHasTripwireActivation(usItem))) ) { this->inv[i].MoveThisObjectTo( this->inv[HANDPOS], 1, this ); return; @@ -17072,7 +17071,7 @@ void SOLDIERTYPE::SwitchWeapons( BOOLEAN fKnife, BOOLEAN fSideArm ) else handCanMove = (CanItemFitInPosition( this, &this->inv[HANDPOS], handobjstorageslot, FALSE ) || (this->inv[HANDPOS].exists( ) == false && this->inv[SECONDHANDPOS].exists( ) == false)); - if ( Item[this->inv[retrieveslot].usItem].twohanded && this->inv[SECONDHANDPOS].exists( ) == true ) + if ( ItemIsTwoHanded(this->inv[retrieveslot].usItem) && this->inv[SECONDHANDPOS].exists( ) == true ) searchitemCanMove = FALSE; else searchitemCanMove = (CanItemFitInPosition( this, &this->inv[retrieveslot], HANDPOS, FALSE ) || this->inv[retrieveslot].exists( ) == false); @@ -17171,7 +17170,7 @@ INT8 SOLDIERTYPE::GetTraitCTHModifier( UINT16 usItem, INT16 ubAimTime, UINT8 ubT { // Bonus for heavy weapons moved here from above to get instant CtH bonus and not marksmanship bonus, // which is supressed by weapon condition - if ( Item[usItem].rocketlauncher || Item[usItem].singleshotrocketlauncher ) + if (ItemIsRocketLauncher(usItem) || ItemIsSingleShotRocketLauncher(usItem)) { modifier += gSkillTraitValues.bCtHModifierRocketLaunchers; // -25% for untrained mercs !!! @@ -17867,7 +17866,7 @@ void SOLDIERTYPE::SoldierPropertyUpkeep( ) if ( this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT] ) this->usSkillCooldown[SOLDIER_COOLDOWN_DRUGUSER_COMBAT]--; - if (AM_A_ROBOT(this) && Item[this->inv[ROBOT_UTILITY_SLOT].usItem].xray == 1) + if (AM_A_ROBOT(this) && ItemHasXRay(this->inv[ROBOT_UTILITY_SLOT].usItem)) { if (this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY]) this->usSkillCooldown[SOLDIER_COOLDOWN_ROBOT_XRAY]--; @@ -18555,7 +18554,7 @@ BOOLEAN SOLDIERTYPE::HasMortar( ) INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) { - if ( inv[bLoop].exists( ) == true && Item[inv[bLoop].usItem].mortar ) + if ( inv[bLoop].exists( ) == true && ItemIsMortar(inv[bLoop].usItem) ) { return TRUE; } @@ -18571,7 +18570,7 @@ BOOLEAN SOLDIERTYPE::GetSlotOfSignalShellIfMortar( UINT8* pbLoop ) INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop ) { - if ( inv[bLoop].exists( ) == true && Item[inv[bLoop].usItem].mortar ) + if ( inv[bLoop].exists( ) == true && ItemIsMortar(inv[bLoop].usItem) ) { mortaritem = inv[bLoop].usItem; break; @@ -18590,7 +18589,7 @@ BOOLEAN SOLDIERTYPE::GetSlotOfSignalShellIfMortar( UINT8* pbLoop ) return TRUE; } - if ( Item[inv[bLoop].usItem].mortar ) + if (ItemIsMortar(inv[bLoop].usItem)) { OBJECTTYPE* pAttObj = FindAttachmentByClass( &(inv[bLoop]), IC_BOMB ); @@ -18878,7 +18877,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN for ( INT8 bLoop = 0; (bLoop < invsize) && (mortaritemcnt < maxFiringMortarsAmount); ++bLoop ) { - if ( pSoldier->inv[bLoop].exists( ) == true && Item[pSoldier->inv[bLoop].usItem].mortar ) + if ( pSoldier->inv[bLoop].exists( ) == true && ItemIsMortar(pSoldier->inv[bLoop].usItem)) { // if not already in list, remember this mortar bool alreadyInList = false; @@ -18923,7 +18922,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN { if ( pSoldier->inv[bLoop].exists( ) == true ) { - if ( Item[pSoldier->inv[bLoop].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[bLoop].usItem)) { OBJECTTYPE* pAttObj = FindAttachmentByClass( &(pSoldier->inv[bLoop]), IC_BOMB ); @@ -22429,7 +22428,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginAttachCan( INT32 sGridNo, UINT8 ubDirection // OK, find door, attach to door, do animation...., remove item.... // First make sure we still have item in hand.... - if ( !Item[this->inv[HANDPOS].usItem].canandstring ) + if ( !ItemIsCanAndString(this->inv[HANDPOS].usItem)) { return; } @@ -22741,7 +22740,7 @@ void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirecti if ( success ) { - if ( Item[usItem].gasmask ) + if (ItemIsGasmask(usItem)) { // put this item into a (at best empty) faceslot if no gasmask is been worn INT8 bSlot = FindGasMask( pSoldier ); @@ -23362,11 +23361,11 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid BOOLEAN SOLDIERTYPE::IsValidSecondHandShot( void ) { if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[SECONDHANDPOS].usItem].twohanded) && + !ItemIsTwoHanded(this->inv[SECONDHANDPOS].usItem) && (!this->bDoBurst || this->IsValidSecondHandBurst( )) && - !Item[this->inv[HANDPOS].usItem].grenadelauncher && + !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[HANDPOS].usItem].twohanded) && + !ItemIsTwoHanded(this->inv[HANDPOS].usItem) && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 ) { @@ -23380,11 +23379,11 @@ BOOLEAN SOLDIERTYPE::IsValidSecondHandBurst( void ) { // SANDRO - a function to determine if we can autofire with both weapons if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[SECONDHANDPOS].usItem].twohanded) && - !Item[this->inv[HANDPOS].usItem].grenadelauncher && + !ItemIsTwoHanded(this->inv[SECONDHANDPOS].usItem) && + !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) && this->bDoBurst && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && - !(Item[this->inv[HANDPOS].usItem].twohanded) && + !ItemIsTwoHanded(this->inv[HANDPOS].usItem) && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE && this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 ) { @@ -23416,7 +23415,7 @@ BOOLEAN SOLDIERTYPE::IsValidSecondHandShotForReloadingPurposes( void ) // about ammo taken out! if ( Item[this->inv[SECONDHANDPOS].usItem].usItemClass == IC_GUN && //!this->bDoBurst && - !Item[this->inv[HANDPOS].usItem].grenadelauncher && + !ItemIsGrenadeLauncher(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass == IC_GUN && this->inv[SECONDHANDPOS][0]->data.gun.bGunStatus >= USABLE //&& // this->inv[SECONDHANDPOS][0]->data.gun.ubGunShotsLeft > 0 && @@ -23452,7 +23451,7 @@ BOOLEAN SOLDIERTYPE::IsValidShotFromHip( INT16 bAimTime, INT32 iTrgGridNo ) return(FALSE); } // must be two handed for this - if ( !Item[this->inv[HANDPOS].usItem].twohanded ) + if ( !ItemIsTwoHanded(this->inv[HANDPOS].usItem) ) { return(FALSE); } @@ -23509,7 +23508,7 @@ BOOLEAN SOLDIERTYPE::IsValidPistolFastShot( INT16 bAimTime, INT32 iTrgGridNo ) return(FALSE); } // must be one handed for this - if ( Item[this->inv[HANDPOS].usItem].twohanded ) + if (ItemIsTwoHanded(this->inv[HANDPOS].usItem)) { return(FALSE); } @@ -24178,8 +24177,8 @@ void SOLDIERTYPE::BreakWindow(void) { if (this->inv[HANDPOS].exists() && this->inv[HANDPOS][0]->data.objectStatus >= USABLE && - (Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || - Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal)) + (ItemIsCrowbar(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || + Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(this->inv[HANDPOS].usItem) && ItemIsMetal(this->inv[HANDPOS].usItem) )) { this->usAttackingWeapon = this->inv[HANDPOS].usItem; this->aiData.bAction = AI_ACTION_KNIFE_STAB; @@ -24203,8 +24202,8 @@ BOOLEAN SOLDIERTYPE::CanBreakWindow(void) IS_MERC_BODY_TYPE(this) && this->inv[HANDPOS].exists() && this->inv[HANDPOS][0]->data.objectStatus >= USABLE && - (Item[this->inv[HANDPOS].usItem].crowbar && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || - Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && Item[this->inv[HANDPOS].usItem].twohanded && Item[this->inv[HANDPOS].usItem].metal)) + (ItemIsCrowbar(this->inv[HANDPOS].usItem) && Item[this->inv[HANDPOS].usItem].usItemClass & (IC_PUNCH) || + Item[this->inv[HANDPOS].usItem].usItemClass & IC_GUN && ItemIsTwoHanded(this->inv[HANDPOS].usItem) && ItemIsMetal(this->inv[HANDPOS].usItem) )) { //INT32 sWindowGridNo = this->sTargetGridNo; INT32 sWindowGridNo = this->sGridNo; @@ -25063,7 +25062,7 @@ BOOLEAN AIDecideHipOrShoulderStance( SOLDIERTYPE * pSoldier, INT32 iGridNo ) UINT16 usInHand = pSoldier->usAttackingWeapon; // not 2-handed or not standing - if ( gAnimControl[pSoldier->usAnimState].ubEndHeight != ANIM_STAND || !Item[pSoldier->inv[HANDPOS].usItem].twohanded ) + if ( gAnimControl[pSoldier->usAnimState].ubEndHeight != ANIM_STAND || !ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) ) { return FALSE; } @@ -25596,7 +25595,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB if ( !uiPossible ) return 0; - if ( Item[pSoldier->inv[0].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff + if (ItemIsMedicalKit(pSoldier->inv[0].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff uiPossible += (uiPossible / 2); // add extra 50 % // Doctor trait improves basic bandaging ability @@ -25632,7 +25631,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB uiActual = uiDeficiency; // reduce actual not to waste anything // now make sure we HAVE that much - if ( Item[pKit->usItem].medicalkit ) + if (ItemIsMedicalKit(pKit->usItem)) { if ( fOnSurgery ) uiMedcost = (uiActual * gSkillTraitValues.usDOSurgeryMedBagConsumption) / 100; // surgery drains the kit a lot @@ -25851,7 +25850,7 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB // usedAPs equals (actionPts) * (%of possible points actually used) uiUsedAPs = (uiActual * uiAvailAPs) / uiPossible; - if ( Item[pSoldier->inv[0].usItem].medicalkit && !(fOnSurgery) ) // using the GOOD medic stuff + if (ItemIsMedicalKit(pSoldier->inv[0].usItem) && !(fOnSurgery) ) // using the GOOD medic stuff uiUsedAPs = (uiUsedAPs * 2) / 3; // reverse 50% bonus by taking 2/3rds // surgery is harder so cost more BPs @@ -25983,7 +25982,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, // how much of this item do we use up UINT16 statusused = min(portionsize, (*pObj)[0]->data.objectStatus); - if (!statusused || (statusused == 1 && Item[pObj->usItem].canteen)) + if (!statusused || (statusused == 1 && ItemIsCanteen(pObj->usItem))) return FALSE; INT16 apcost = 0; @@ -26000,12 +25999,12 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, apcost = max( apcost, (APBPConstants[AP_CAMOFLAGE] / 2) ); } - if ( Item[pObj->usItem].camouflagekit ) + if (ItemIsCamoKit(pObj->usItem)) { apcost = max( apcost, APBPConstants[AP_CAMOFLAGE] ); } - if ( Item[pObj->usItem].canteen ) + if (ItemIsCanteen(pObj->usItem)) { apcost = max( apcost, APBPConstants[AP_DRINK] ); } @@ -26052,7 +26051,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, } // some mercs will refuse to smoke - if ( Item[pObj->usItem].cigarette && pSoldier->GetBackgroundValue( BG_SMOKERTYPE ) == 2 ) + if (ItemIsCigarette(pObj->usItem) && pSoldier->GetBackgroundValue( BG_SMOKERTYPE ) == 2 ) { // merc gets slightly pissed by the player even suggesting this TacticalCharacterDialogue( pSoldier, QUOTE_REFUSE_TO_SMOKE ); @@ -26108,7 +26107,7 @@ BOOLEAN ApplyConsumable(SOLDIERTYPE* pSoldier, OBJECTTYPE *pObj, BOOLEAN fForce, fSuccess = TRUE; // no sound on consuming cigarettes, as that is very annoying - if ( !Item[pObj->usItem].cigarette ) + if ( !ItemIsCigarette(pObj->usItem) ) { fDoSound = TRUE; } diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index b5769d55..445fcfc6 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -4163,7 +4163,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc UINT32 invsize = pProfile->inv.size(); for ( cnt = 0; cnt < pProfile->inv.size(); ++cnt ) { - if ( pProfile->inv[ cnt ] == NOTHING || Item[pProfile->inv[cnt]].attachment) { + if ( pProfile->inv[ cnt ] == NOTHING || ItemIsAttachment(pProfile->inv[cnt]) ) { continue; } fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); @@ -4188,7 +4188,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc if ( pProfile->inv[ cnt ] == NOTHING) { continue; } - if (!Item[pProfile->inv[cnt]].attachment) { + if (!ItemIsAttachment(pProfile->inv[cnt])) { continue; } fRet = CreateItems( pProfile->inv[ cnt ], pProfile->bInvStatus[ cnt ], pProfile->bInvNumber[ cnt ], &gTempObject ); @@ -4293,7 +4293,7 @@ void CopyProfileItems( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruc if(fRet) { pSoldier->inv[cnt] = gTempObject; - if ( Item[gTempObject.usItem].fingerprintid ) + if (ItemHasFingerPrintID(gTempObject.usItem)) { for (int x = 0; x < pProfile->bInvNumber[ cnt ]; ++x) { gTempObject[x]->data.ubImprintID = pSoldier->ubProfile; @@ -5090,7 +5090,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre } } // Chance to gain second weapon - if ( Chance( iChance / 4 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) // 1/4 of chance + if ( Chance( iChance / 4 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) ) // 1/4 of chance { (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); @@ -5178,7 +5178,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre BTraitAssigned = TRUE; // elites can have third skill trait - if ( Chance( iChance / 3 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && + if ( Chance( iChance / 3 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) && (ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) ) { pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT; @@ -5188,7 +5188,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre } // Chance to gain second weapon and ambidextrous trait - else if ( Chance( iChance / 2 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && !BTraitAssigned ) // 1/2 of chance + else if ( Chance( iChance / 2 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) && !BTraitAssigned ) // 1/2 of chance { if ( pCreateStruct->bTeam == MILITIA_TEAM && gGameExternalOptions.fMilitiaUseSectorInventory && gGameExternalOptions.fMilitiaUseSectorInventory_Gun ) ; @@ -5206,7 +5206,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre BTraitAssigned = TRUE; // elites can have third skill trait - if ( Chance( iChance / 3 ) && !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded && + if ( Chance( iChance / 3 ) && !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) && (ubSolClass == SOLDIER_CLASS_ELITE || ubSolClass == SOLDIER_CLASS_ELITE_MILITIA) ) { pSoldier->stats.ubSkillTraits[2] = AMBIDEXTROUS_NT; @@ -5222,7 +5222,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre pSoldier->stats.ubSkillTraits[0] = AMBIDEXT_OT; ATraitAssigned = TRUE; // Ambidextrous trait gives us second weapon automatically - if ( !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) + if ( !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) ) { (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); } @@ -5232,7 +5232,7 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre pSoldier->stats.ubSkillTraits[1] = AMBIDEXT_OT; BTraitAssigned = TRUE; // Ambidextrous trait gives us second weapon automatically - if ( !Item[pCreateStruct->Inv[HANDPOS].usItem].twohanded ) + if ( !ItemIsTwoHanded(pCreateStruct->Inv[HANDPOS].usItem) ) { (pCreateStruct->Inv[SECONDHANDPOS]) = (pCreateStruct->Inv[HANDPOS]); } @@ -5267,28 +5267,29 @@ BOOLEAN AssignTraitsToSoldier( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCre { if ( pCreateStruct->Inv[bLoop].exists( ) == true ) { - if ( Item[pCreateStruct->Inv[bLoop].usItem].mortar ) + UINT16 usItem = pCreateStruct->Inv[bLoop].usItem; + if (ItemIsMortar(usItem)) foundMortar = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usItem)) foundRocketlauncher = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].grenadelauncher ) + else if (ItemIsGrenadeLauncher(usItem)) foundGrenadelauncher = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_BLADE ) + else if ( Item[usItem].usItemClass == IC_BLADE ) foundKnife = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_THROWING_KNIFE ) + else if ( Item[usItem].usItemClass == IC_THROWING_KNIFE ) foundThrowing = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == IC_GRENADE ) + else if ( Item[usItem].usItemClass == IC_GRENADE ) foundGrenades = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].brassknuckles ) + else if (ItemIsBrassKnuckles(usItem)) foundHtH = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].usItemClass == 128 && // 128 is an identifier of blunt melee weapons - Item[pCreateStruct->Inv[bLoop].usItem].uiIndex != 0 ) + else if ( Item[usItem].usItemClass == 128 && // 128 is an identifier of blunt melee weapons + Item[usItem].uiIndex != 0 ) foundMelee = TRUE; - else if ( HasItemFlag( pCreateStruct->Inv[bLoop].usItem, RADIO_SET ) ) + else if ( HasItemFlag( usItem, RADIO_SET ) ) fRadioSetFound = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].firstaidkit ) + else if (ItemIsFirstAidKit(usItem)) fFirstAidKitFound = TRUE; - else if ( Item[pCreateStruct->Inv[bLoop].usItem].medicalkit ) + else if (ItemIsMedicalKit(usItem)) { // Flugente: for enemy medic purposes, med kits also count as first aid kits fFirstAidKitFound = TRUE; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 37052fb0..ee38c12c 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1845,7 +1845,7 @@ BOOLEAN RecruitRPC( UINT8 ubCharNum ) if ( bSlot != NO_SLOT ) { // if ( Item[ pNewSoldier->inv[ bSlot ].usItem ].fFlags & ITEM_TWO_HANDED ) - if ( Item[ pNewSoldier->inv[ bSlot ].usItem ].twohanded ) + if (ItemIsTwoHanded(pNewSoldier->inv[ bSlot ].usItem)) { if ( bSlot != SECONDHANDPOS && pNewSoldier->inv[ SECONDHANDPOS ].exists() == true ) { diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index b1b08ccf..731bb636 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -598,7 +598,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) break; } - if ( Item[ pSoldier->inv[ BigSlot ].usItem ].rocketlauncher ) + if (ItemIsRocketLauncher(pSoldier->inv[ BigSlot ].usItem)) iCarriedRL = pSoldier->inv[ BigSlot ].usItem; // remember that enemy is carrying a rocket launcher when check for rocket ammo is made later on if ( ( Item[ pSoldier->inv[ BigSlot ].usItem ].usItemClass == IC_LAUNCHER ) || @@ -712,7 +712,7 @@ void DisplayWeaponInfo( SOLDIERTYPE* pSoldier, CHAR16* pStrInfo, UINT8 ubSlot, U if ( ubTooltipDetailLevel == DL_Basic || ubTooltipDetailLevel == DL_Full ) // Madd: also hidden attachments should be hidden at the full level as well... unless the mercs have x-ray vision to see that rod&spring inside the gun!! :p { // display only externally-visible weapon attachments - if ( Item[iter->usItem].hiddenattachment ) + if (ItemIsHiddenAttachment(iter->usItem)) fDisplayAttachment = FALSE; else fDisplayAttachment = TRUE; diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index e1b843ab..7352422f 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -2678,7 +2678,7 @@ BOOLEAN AddDeadSoldierToUnLoadedSector( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, S pWorldItems[ bCount ].bVisible = TRUE; pWorldItems[ bCount ].bRenderZHeightAboveLevel = 0; - if ( Item[pSoldier->inv[i].usItem].damageable ) // Madd: drop crappier items on higher difficulty levels + if (ItemIsDamageable(pSoldier->inv[i].usItem)) // Madd: drop crappier items on higher difficulty levels { // silversurfer: externalized this //pSoldier->inv[i][0]->data.objectStatus -= (gGameOptions.ubDifficultyLevel - 1) * Random(20); diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 4cb81bcc..13f5666f 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -8969,7 +8969,7 @@ void HandleTacticalTakeInvItem( INT32 iType ) for(UINT8 i = GUNSLINGPOCKPOS; i < NUM_INV_SLOTS; ++i) { if ( pSoldier->inv[i].exists() && - !Item[ pSoldier->inv[i].usItem ].twohanded && + !ItemIsTwoHanded(pSoldier->inv[i].usItem) && ( iType > 0 ? ( pSoldier->inv[i].usItem == iType ) : ( InvItemType( pSoldier->inv[i].usItem ) == iType ) ) ) { ubItemSlot = i; @@ -9019,7 +9019,7 @@ INT32 InvItemType( UINT16 usItem ) { if( usItem == XRAY_DEVICE ) return INV_ITEM_TYPE_XRAY; - if( Item[ usItem ].firstaidkit ) + if(ItemIsFirstAidKit(usItem)) return INV_ITEM_TYPE_FIRSTAID; if( Item[ usItem ].usItemClass == IC_BLADE ) return INV_ITEM_TYPE_MELEE; @@ -9033,9 +9033,9 @@ INT32 InvItemType( UINT16 usItem ) return INV_ITEM_TYPE_BINOCULARS; if( HasItemFlag( usItem, TASER ) ) return INV_ITEM_TYPE_TASER; - if( Item[ usItem ].usItemClass == IC_GUN && !Item[ usItem ].twohanded && Weapon[Item[ usItem ].ubClassIndex].ubWeaponType <= GUN_SMG ) + if( Item[ usItem ].usItemClass == IC_GUN && !ItemIsTwoHanded(usItem) && Weapon[Item[ usItem ].ubClassIndex].ubWeaponType <= GUN_SMG ) return INV_ITEM_TYPE_SIDEARM; - if( Item[ usItem ].usItemClass == IC_MISC && Item[ usItem ].metaldetector ) + if( Item[ usItem ].usItemClass == IC_MISC && ItemIsMetalDetector(usItem) ) return INV_ITEM_TYPE_METALDETECTOR; return INV_ITEM_TYPE_UNKNOWN; diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 241eb810..142aff02 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -180,7 +180,7 @@ UINT8 GetProperItemCursor( UINT8 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos //Madd: quick hack to make wirecutter cursor appear when using a knife that can cut through wire // sevenfm: check that not using bayonet attached to the gun //if ( Item[ubItemIndex].wirecutters && IsCuttableWireFenceAtGridNo( sTargetGridNo ) && pSoldier->pathing.bLevel == 0 ) - if ( Item[ubItemIndex].wirecutters && + if (ItemIsWirecutters(ubItemIndex) && IsCuttableWireFenceAtGridNo( sTargetGridNo ) && pSoldier->pathing.bLevel == 0 && pSoldier->bWeaponMode != WM_ATTACHED_BAYONET) @@ -1281,7 +1281,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos , BO //CHRISL: We need to only check the second hand if the weapon in the second hand is onehanded // Check for enough ammo... - if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) || (pSoldier->IsValidSecondHandShotForReloadingPurposes( ) && !Item[pSoldier->inv[SECONDHANDPOS].usItem].twohanded && !EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) + if ( !EnoughAmmo( pSoldier, FALSE, HANDPOS ) || (pSoldier->IsValidSecondHandShotForReloadingPurposes( ) && !ItemIsTwoHanded(pSoldier->inv[SECONDHANDPOS].usItem) && !EnoughAmmo( pSoldier, FALSE, SECONDHANDPOS) ) ) { // Check if ANY ammo exists..... if ( FindAmmoToReload( pSoldier, HANDPOS, NO_SLOT ) == NO_SLOT ) @@ -2937,14 +2937,14 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) return( TRAJECTORYCURS ); } - if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || ( pSoldier->bWeaponMode == WM_BURST && Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) ) + if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || ( pSoldier->bWeaponMode == WM_BURST && ItemIsGrenadeLauncher(pSoldier->inv[HANDPOS].usItem) ) ) { if ( gGameSettings.fOptions [ TOPTION_GL_BURST_CURSOR ] ) return( TARGETCURS ); else return ( TRAJECTORYCURS ); } - else if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO || ( pSoldier->bWeaponMode == WM_AUTOFIRE && Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher ) ) + else if ( pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO || ( pSoldier->bWeaponMode == WM_AUTOFIRE && ItemIsGrenadeLauncher(pSoldier->inv[HANDPOS].usItem) ) ) { if ( gGameSettings.fOptions [ TOPTION_GL_BURST_CURSOR ] ) return( TARGETCURS ); @@ -2976,7 +2976,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) // Flugente: cursor for constructing/deconstructing // at the moment the gridno is not required in these functions, thus 1 suffices - if (!Item[usInHand].wirecutters && (IsStructureConstructItem(usInHand, 1, pSoldier) || IsStructureDeconstructItem(usInHand, 1, pSoldier))) + if (!ItemIsWirecutters(usInHand) && (IsStructureConstructItem(usInHand, 1, pSoldier) || IsStructureDeconstructItem(usInHand, 1, pSoldier))) { ubCursor = FORTICURS; } diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 4aea8f81..9649faa0 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -1210,7 +1210,7 @@ INT32 ExplosiveEffectiveArmour( OBJECTTYPE * pObj ) } iValue = Armour[ Item[pObj->usItem].ubClassIndex ].ubProtection; iValue = iValue * (*pObj)[0]->data.objectStatus * Armour[ Item[pObj->usItem].ubClassIndex ].ubCoverage / 10000; - if ( Item[pObj->usItem].flakjacket ) + if (ItemIsFlakJacket(pObj->usItem)) { // increase value for flak jackets! iValue *= 3; @@ -1654,7 +1654,7 @@ BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) break; case IC_LAUNCHER: - if ( Item[pSoldier->usAttackingWeapon].rocketlauncher ){ + if (ItemIsRocketLauncher(pSoldier->usAttackingWeapon)){ UseGunWrapper( pSoldier, sTargetGridNo ); } else { // ATE: PAtch up - bookkeeping for spreading done out of whak @@ -2563,7 +2563,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) { for (attachmentList::iterator iter = (*pObjAttHand)[0]->attachments.begin(); iter != (*pObjAttHand)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(iter->usItem)) { OBJECTTYPE* pA= &(*iter); if ( (*pA)[0]->data.objectStatus >=USABLE) @@ -2704,7 +2704,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // ATE: Check if we should say quote... if ( (*pObjHand)[0]->data.gun.ubGunShotsLeft == 0 && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && pSoldier->bTeam == gbPlayerNum && (Chance(gGameExternalOptions.iChanceSayAnnoyingPhrase) || GetMagSize(pObjHand) > 4)) { @@ -2719,14 +2719,14 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // Deduct knife from inv! (not here, later?) } - if ( Item[usUBItem].rocketlauncher ) + if (ItemIsRocketLauncher(usUBItem)) { if ( WillExplosiveWeaponFail( pSoldier, pObjHand ) ) { INT16 sX, sY; ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY); - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usItemNum].discardedlauncheritem , (*pObjHand)[0]->data.objectStatus, pObjHand ); @@ -2889,7 +2889,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) if (IS_MERC_BODY_TYPE(pSoldier) && pSoldier->bVisible == TRUE && Item[usUBItem].usItemClass == IC_GUN && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && strlen(AmmoTypes[Magazine[Item[(*pObjAttHand)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType].shotAnimation) > 0) { ANITILE_PARAMS AniParams; @@ -2943,9 +2943,9 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) } DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } - else if ( Item[usUBItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usUBItem)) { - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usUBItem].discardedlauncheritem, (*pObjHand)[0]->data.objectStatus, pObjHand ); @@ -3349,7 +3349,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) { for (attachmentList::iterator iter = (*pObjUsed)[0]->attachments.begin(); iter != (*pObjUsed)[0]->attachments.end(); ++iter) { - if (Item[iter->usItem].hidemuzzleflash ) + if (ItemHasHiddenMuzzleFlash(iter->usItem)) { OBJECTTYPE* pA= &(*iter); if ( (*pA)[0]->data.objectStatus >=USABLE) @@ -3527,7 +3527,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // ATE: Check if we should say quote... if ( (*pObjUsed)[0]->data.gun.ubGunShotsLeft == 0 && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && pSoldier->bTeam == gbPlayerNum && (Chance(gGameExternalOptions.iChanceSayAnnoyingPhrase) || GetMagSize(pObjUsed) > 4)) { @@ -3648,14 +3648,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) } } - if ( Item[usUBItem].rocketlauncher ) + if (ItemIsRocketLauncher(usUBItem)) { if ( WillExplosiveWeaponFail( pSoldier, pObjUsed ) ) { INT16 sX, sY; ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY); - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usUBItem].discardedlauncheritem , (*pObjUsed)[0]->data.objectStatus, pObjUsed ); @@ -3708,7 +3708,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) if (IS_MERC_BODY_TYPE(pSoldier) && pSoldier->bVisible == TRUE && Item[usUBItem].usItemClass == IC_GUN && - !Item[usUBItem].rocketlauncher && + !ItemIsRocketLauncher(usUBItem) && strlen(AmmoTypes[Magazine[Item[(*pObjAttHand)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType].shotAnimation) > 0) { ANITILE_PARAMS AniParams; @@ -3761,9 +3761,9 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) } DirtyMercPanelInterface( pSoldier, DIRTYLEVEL2 ); } - else if ( Item[usUBItem].rocketlauncher ) + else if (ItemIsRocketLauncher(usUBItem)) { - if ( Item[usUBItem].singleshotrocketlauncher ) + if ( ItemIsSingleShotRocketLauncher(usUBItem) ) { CreateItem( Item[usUBItem].discardedlauncheritem, (*pObjUsed)[0]->data.objectStatus, pObjUsed ); @@ -4424,7 +4424,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea } } // if twohanded item, place the secondhand item if any to temp space - if (pSoldier->inv[SECONDHANDPOS].exists() == true && Item[pTargetSoldier->inv[HANDPOS].usItem].twohanded) + if (pSoldier->inv[SECONDHANDPOS].exists() == true && ItemIsTwoHanded(pTargetSoldier->inv[HANDPOS].usItem)) { if( pSoldier->bTeam != gbPlayerNum ) // for enemies, ignore rules and place it anywhere { @@ -5266,8 +5266,8 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) ///////////////////////////////////////////////////////////////////////////////////// // SANDRO - new mercs' records - if ( Item[ usItemNum ].usItemClass == IC_LAUNCHER || Item[usItemNum].grenadelauncher || - Item[usItemNum].rocketlauncher || Item[usItemNum].singleshotrocketlauncher || Item[usItemNum].mortar ) + if ( Item[ usItemNum ].usItemClass == IC_LAUNCHER || ItemIsGrenadeLauncher(usItemNum) || + ItemIsRocketLauncher(usItemNum) || ItemIsSingleShotRocketLauncher(usItemNum) || ItemIsMortar(usItemNum) ) { gMercProfiles[ pSoldier->ubProfile ].records.usMissilesLaunched++; } @@ -5519,9 +5519,9 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s //TODO: Madd --- I don't think this code will ever get called for the HE ammo -- the EXPLOSIVE_GUN check filters out regular guns // marke test mag ammo type: pSoldier->inv[pSoldier->ubAttackingHand ][0]->data.gun.ubGunAmmoType // 2cond 'or' added - if ( Item[usWeaponIndex].rocketlauncher || AmmoTypes[ubAmmoType].explosionSize > 1 ) + if (ItemIsRocketLauncher(usWeaponIndex) || AmmoTypes[ubAmmoType].explosionSize > 1 ) { - if ( Item[usWeaponIndex].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usWeaponIndex)) { if ( Item[usWeaponIndex].usBuddyItem != 0 && Item[Item[usWeaponIndex].usBuddyItem].usItemClass & IC_EXPLOSV ) { @@ -5533,7 +5533,7 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s } } // changed rpg type to work only with two flags matching - else if ( pSoldier && !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) + else if ( pSoldier && !ItemIsSingleShotRocketLauncher(usWeaponIndex) && ItemIsRocketLauncher(usWeaponIndex)) //we shouldn't be able to have an underbarrel firing mode in this step, so we keep the original code :JMich { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("WeaponHit: RPG7 item: %d, Ammo: %d",pSoldier->inv[HANDPOS].usItem , pSoldier->inv[HANDPOS][0]->data.gun.usGunAmmoItem ) ); @@ -5683,7 +5683,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN usDirection = (UINT8)GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, sGridNo ); // marke added one 'or' to get this working with HE ammo - if ( Item[usWeaponIndex].rocketlauncher || (pObj && AmmoTypes[ (*pObj)[0]->data.gun.ubGunAmmoType].explosionSize > 1 )) + if (ItemIsRocketLauncher(usWeaponIndex) || (pObj && AmmoTypes[ (*pObj)[0]->data.gun.ubGunAmmoType].explosionSize > 1 )) { // Reduce attacker count! DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of LAW fire") ); @@ -5694,7 +5694,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN INT16 sX, sY; ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY); - if ( Item[usWeaponIndex].singleshotrocketlauncher ) + if (ItemIsSingleShotRocketLauncher(usWeaponIndex)) { if ( Item[usWeaponIndex].usBuddyItem != 0 && Item[Item[usWeaponIndex].usBuddyItem].usItemClass & IC_EXPLOSV ) { @@ -5706,7 +5706,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN } } // changed too to use 2 flag to determine - else if ( ubAttackerID != NOBODY && !Item[usWeaponIndex].singleshotrocketlauncher && Item[usWeaponIndex].rocketlauncher) + else if ( ubAttackerID != NOBODY && !ItemIsSingleShotRocketLauncher(usWeaponIndex) && ItemIsRocketLauncher(usWeaponIndex) ) //there shouldn't be a way to enter here with an UnderBarrel weapon, so retaining original code :JMich { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("StructureHit: RPG7 item: %d, Ammo: %d",pAttacker->inv[HANDPOS].usItem , pAttacker->inv[HANDPOS][0]->data.gun.usGunAmmoItem ) ); @@ -5737,7 +5737,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN return; } - if ( Item[usWeaponIndex].cannon ) + if (ItemIsCannon(usWeaponIndex)) { // Reduce attacker count! //DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - end of TANK fire") ); @@ -6763,7 +6763,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, ///////////////////////////////////////////////////////////////////////////////////// // Determine iMarksmanship and Base CTH - if (Item[usItemUsed].rocketlauncher ){ + if (ItemIsRocketLauncher(usItemUsed)){ // use the same calculation as for mechanical thrown weapons iMarksmanship = ( EffectiveDexterity( pSoldier, FALSE ) + EffectiveMarksmanship( pSoldier ) + EffectiveWisdom( pSoldier ) + (10 * EffectiveExpLevel( pSoldier ) )) / 4; // heavy weapons trait helps out @@ -7164,7 +7164,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, ///////////////////////////////////////////////////////////////////////////////////// // Modify for using one hand - if ( !(Item[ usInHand ].twohanded ) ) + if ( !ItemIsTwoHanded(usInHand) ) //check for 2weapon, retaining original code :JMich { if (pSoldier->inv[SECONDHANDPOS].exists() == false) @@ -7496,7 +7496,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, // Equipment Modifiers iChance += GetGearToHitBonus ( pSoldier ); - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { iChance += GetToHitBonus(&(pSoldier->inv[ROBOT_TARGETING_SLOT]), iRange, bLightLevel, FALSE); } @@ -7995,7 +7995,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i { INT32 protection = ArmourProtection( pTarget, Item[iter->usItem].ubClassIndex, &((*iter)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); - if ( fConsiderFlak && Item[iter->usItem].flakjacket ) + if ( fConsiderFlak && ItemIsFlakJacket(iter->usItem) ) { // increase value for flak jackets! protection *= 3; @@ -8028,7 +8028,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i // bullet got through jacket; apply ceramic plate armour INT32 protection = ArmourProtection( pTarget, Item[iter->usItem].ubClassIndex, &((*iter)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); - if ( fConsiderFlak && Item[iter->usItem].flakjacket ) + if ( fConsiderFlak && ItemIsFlakJacket(iter->usItem) ) { // increase value for flak jackets! protection *= 3; @@ -8057,7 +8057,7 @@ INT32 TotalArmourProtection( SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 i { INT32 protection = ArmourProtection( pTarget, Item[pArmour->usItem].ubClassIndex, &((*pArmour)[0]->data.objectStatus), iImpact, ubAmmoType, &plateHit ); - if ( fConsiderFlak && Item[pArmour->usItem].flakjacket ) + if ( fConsiderFlak && ItemIsFlakJacket(pArmour->usItem) ) { // increase value for flak jackets! protection *= 3; @@ -8860,7 +8860,7 @@ INT32 HTHImpact( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget, INT32 iHitBy, BO { if ( gGameOptions.fNewTraitSystem ) { - if (!pSoldier->usAttackingWeapon || Item[pSoldier->inv[HANDPOS].usItem].brassknuckles) + if (!pSoldier->usAttackingWeapon || ItemIsBrassKnuckles(pSoldier->inv[HANDPOS].usItem)) { if ( gGameExternalOptions.fEnhancedCloseCombatSystem ) { @@ -9372,7 +9372,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, INT16 ubAi iAttRating += gSkillTraitValues.ubMABonusCtHBareHands * NUM_SKILL_TRAITS( pAttacker, MARTIAL_ARTS_NT ); } // brass knuckles - bonus for Martial Arts (but a little lesser) - else if (Item[pAttacker->inv[HANDPOS].usItem].brassknuckles && HAS_SKILL_TRAIT( pAttacker, MARTIAL_ARTS_NT )) + else if (ItemIsBrassKnuckles(pAttacker->inv[HANDPOS].usItem) && HAS_SKILL_TRAIT( pAttacker, MARTIAL_ARTS_NT )) { iAttRating += gSkillTraitValues.ubMABonusCtHBrassKnuckles * NUM_SKILL_TRAITS( pAttacker, MARTIAL_ARTS_NT ); } @@ -9586,7 +9586,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, INT16 ubAi { iDefRating += gSkillTraitValues.bModifierDodgeHtHChance; // Make HtH dodging a little more problematic for untrained mercs - if ( !pAttacker->usAttackingWeapon || Item[pAttacker->inv[HANDPOS].usItem].brassknuckles ) + if ( !pAttacker->usAttackingWeapon || ItemIsBrassKnuckles(pAttacker->inv[HANDPOS].usItem) ) { if (HAS_SKILL_TRAIT( pDefender, MARTIAL_ARTS_NT )) { @@ -9599,7 +9599,7 @@ UINT32 CalcChanceHTH( SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, INT16 ubAi { iDefRating += ( gSkillTraitValues.ubMAOnTopCTDHtHBareHanded * NUM_SKILL_TRAITS( pDefender, MARTIAL_ARTS_NT ) ); } - else if ( Item[pDefender->inv[HANDPOS].usItem].brassknuckles ) + else if (ItemIsBrassKnuckles(pDefender->inv[HANDPOS].usItem)) { iDefRating += ( gSkillTraitValues.ubMAOnTopCTDHtHBrassKnuckles * NUM_SKILL_TRAITS( pDefender, MARTIAL_ARTS_NT ) ); } @@ -9869,17 +9869,17 @@ BOOLEAN IsGunWeaponModeCapable( OBJECTTYPE* pObject, WeaponMode bWpnMode, SOLDIE case WM_AUTOFIRE: //return ((IsGunAutofireCapable(pSoldier, ubHandPos) || Weapon[ pSoldier->inv[ ubHandPos ].usItem ].NoSemiAuto )&& !Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher ); - return ((IsGunAutofireCapable(pObject) || Weapon[ pObject->usItem ].NoSemiAuto )&& !Item[pObject->usItem].grenadelauncher ); + return ((IsGunAutofireCapable(pObject) || Weapon[ pObject->usItem ].NoSemiAuto )&& !ItemIsGrenadeLauncher(pObject->usItem)); case WM_ATTACHED_GL: // return (FindAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != 0 && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), UNDER_GLAUNCHER ) != 0 ); //return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]) )) != 0 ); - return ( (!Item[pObject->usItem].grenadelauncher && !IsAttachmentClass(pObject->usItem, AC_RIFLEGRENADE) ) && IsGrenadeLauncherAttached( pObject ) && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject )) != 0 ); + return ( (!ItemIsGrenadeLauncher(pObject->usItem) && !IsAttachmentClass(pObject->usItem, AC_RIFLEGRENADE) ) && IsGrenadeLauncherAttached( pObject ) && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject )) != 0 ); case WM_ATTACHED_GL_BURST: //return (!Item[pSoldier->inv[ubHandPos].usItem].grenadelauncher && IsGrenadeLauncherAttached( &(pSoldier->inv[ubHandPos]) ) && Weapon[GetAttachedGrenadeLauncher(&pSoldier->inv[ubHandPos])].ubShotsPerBurst > 0 && FindLaunchableAttachment( &(pSoldier->inv[ubHandPos]), GetAttachedGrenadeLauncher( &(pSoldier->inv[ubHandPos]))) != 0 ); - return ( (!Item[pObject->usItem].grenadelauncher && !HasAttachmentOfClass( pObject, AC_RIFLEGRENADE ) ) && IsGrenadeLauncherAttached( pObject ) && Weapon[GetAttachedGrenadeLauncher(pObject)].ubShotsPerBurst > 0 && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject)) != 0 ); + return ( (!ItemIsGrenadeLauncher(pObject->usItem) && !HasAttachmentOfClass( pObject, AC_RIFLEGRENADE ) ) && IsGrenadeLauncherAttached( pObject ) && Weapon[GetAttachedGrenadeLauncher(pObject)].ubShotsPerBurst > 0 && FindLaunchableAttachment( pObject, GetAttachedGrenadeLauncher( pObject)) != 0 ); case WM_ATTACHED_GL_AUTO: return FALSE; @@ -9997,7 +9997,7 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv pSoldier->bDoBurst = TRUE; pSoldier->bDoAutofire = 1; } - if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -10038,7 +10038,7 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv pSoldier->bDoAutofire = 1; pSoldier->bDoBurst = TRUE; } - if ( Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) && Weapon[ pSoldier->inv[ HANDPOS ].usItem ].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; else pSoldier->bScopeMode = USE_BEST_SCOPE; @@ -10156,7 +10156,7 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, O else itemWeight=Item[usItem].ubWeight; - if ( Item[ usItem ].unaerodynamic ) + if (ItemIsUnaerodynamic(usItem)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcmaxtossrange: not aerodynamic"); iRange = 1; @@ -10180,7 +10180,7 @@ INT32 CalcMaxTossRange( SOLDIERTYPE * pSoldier, UINT16 usItem, BOOLEAN fArmed, O } // sevenfm: for grenades and aerodynamic items - apply modifier - if ( ! Item[ usItem ].unaerodynamic ) + if ( !ItemIsUnaerodynamic(usItem)) iRange = (INT32)( iRange * gItemSettings.fRangeModifierGrenade ); // adjust for thrower's remaining breath (lose up to 1/2 of range) @@ -10310,7 +10310,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi // SANDRO - old/new traits if (gGameOptions.fNewTraitSystem) { - if (Item[usHandItem].mortar) + if (ItemIsMortar(usHandItem)) { if (HAS_SKILL_TRAIT(pSoldier, HEAVY_WEAPONS_NT)) iChance += gSkillTraitValues.sCtHModifierMortar * max(0, 100 - gSkillTraitValues.ubHWMortarCtHPenaltyReduction * NUM_SKILL_TRAITS(pSoldier, HEAVY_WEAPONS_NT)) / 100; @@ -10330,7 +10330,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi // This feature is available only if not having new traits on - SANDRO // Also.. this was moved here before the Heavy Weapons bonus // HEADROCK HAM 3.2: External divisor for CTH with mortars, now that they are more prevalent in the battlefield. - if (Item[usHandItem].mortar) + if (ItemIsMortar(usHandItem)) { iChance = iChance / gGameExternalOptions.ubMortarCTHDivisor; } @@ -10436,7 +10436,7 @@ UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi // ADJUST FOR RANGE - if ( Item[usHandItem].mortar && iRange < MIN_MORTAR_RANGE) + if (ItemIsMortar(usHandItem) && iRange < MIN_MORTAR_RANGE) { return(0); } @@ -10552,7 +10552,7 @@ void ChangeWeaponMode( SOLDIERTYPE * pSoldier ) // Flugente: if we are in a GL fire mode, switch between impact/delayed mode if (((pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO) || - (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher)) && + (Item[pSoldier->inv[HANDPOS].usItem].usItemClass & IC_LAUNCHER && !ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem))) && !pSoldier->usGLDelayMode && !gGameExternalOptions.fDelayedGrenadeExplosion) { @@ -10646,7 +10646,7 @@ void ChangeScopeMode( SOLDIERTYPE * pSoldier, INT32 iTrgGridNo ) INT8 bOldAimTime = pSoldier->aiData.bShownAimTime; // SANDRO - if the gun is flagged as HeavyGun, then we can only fire it from hip, thus no scopes to use at all, not even iron sights - if ( Item[pSoldier->inv[HANDPOS].usItem].twohanded && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) + if (ItemIsTwoHanded(pSoldier->inv[HANDPOS].usItem) && Weapon[pSoldier->inv[HANDPOS].usItem].HeavyGun && gGameExternalOptions.ubAllowAlternativeWeaponHolding == 3 ) { pSoldier->bScopeMode = USE_ALT_WEAPON_HOLD; } @@ -10667,7 +10667,7 @@ void ChangeScopeMode( SOLDIERTYPE * pSoldier, INT32 iTrgGridNo ) while( ObjList[pSoldier->bScopeMode] == NULL && pSoldier->bScopeMode != USE_ALT_WEAPON_HOLD); //USE_BEST_SCOPE); // If this mode is not allowed, or we are not standing, or holding something weird, skip it - if ( pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && ( gGameExternalOptions.ubAllowAlternativeWeaponHolding != 3 || gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND || AM_A_ROBOT(pSoldier) || Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher || Item[pSoldier->inv[HANDPOS].usItem].singleshotrocketlauncher ) ) + if ( pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && ( gGameExternalOptions.ubAllowAlternativeWeaponHolding != 3 || gAnimControl[ pSoldier->usAnimState ].ubEndHeight != ANIM_STAND || AM_A_ROBOT(pSoldier) || ItemIsRocketLauncher(pSoldier->inv[HANDPOS].usItem) || ItemIsSingleShotRocketLauncher(pSoldier->inv[HANDPOS].usItem)) ) pSoldier->bScopeMode = USE_BEST_SCOPE; } // changing scope mode can change number of aiming levels, we should reset the aiming variable here @@ -11228,7 +11228,7 @@ void CalcMagFactorSimple( SOLDIERTYPE *pSoldier, FLOAT d2DDistance, INT16 bAimTi iHighestMagFactor = 1.0; } - if (AM_A_ROBOT(pSoldier) && Item[pSoldier->inv[ROBOT_TARGETING_SLOT].usItem].fProvidesRobotLaserBonus) + if (AM_A_ROBOT(pSoldier) && ItemProvidesRobotLaserBonus(pSoldier->inv[ROBOT_TARGETING_SLOT].usItem)) { gCTHDisplay.iBestLaserRange = max(gCTHDisplay.iBestLaserRange, GetBestLaserRange(&pSoldier->inv[ROBOT_TARGETING_SLOT])); } @@ -11514,7 +11514,7 @@ FLOAT CalcNewChanceToHitBaseWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, IN } // FIRING 1-HANDED WEAPONS - if ( !(Item[ usInHand ].twohanded ) ) //JMich todo: underbarrel + if ( !ItemIsTwoHanded(usInHand) ) //JMich todo: underbarrel { if (pSoldier->inv[SECONDHANDPOS].exists() != false) { @@ -11553,7 +11553,7 @@ FLOAT CalcNewChanceToHitBaseWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, IN } // HEAVY WEAPON in OLD trait system - if (Item[usInHand].rocketlauncher && !(gGameOptions.fNewTraitSystem) ) + if (ItemIsRocketLauncher(usInHand) && !(gGameOptions.fNewTraitSystem) ) { // Penalty for shooting heavy weapons (launchers). Heavy Weapons skill halves this, once per skill level. FLOAT fTempPenalty = (gGameCTHConstants.BASE_HEAVY_WEAPON * fGunBaseDifficulty) - fGunBaseDifficulty; @@ -11883,7 +11883,7 @@ FLOAT CalcNewChanceToHitAimWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT } // FIRING 1-HANDED WEAPONS - if ( !(Item[ usInHand ].twohanded ) ) //JMich Todo: fix for UnderBarrel firing + if ( !ItemIsTwoHanded(usInHand) ) //JMich Todo: fix for UnderBarrel firing { if (pSoldier->inv[SECONDHANDPOS].exists() != false) { @@ -11922,7 +11922,7 @@ FLOAT CalcNewChanceToHitAimWeaponBonus(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT } // HEAVY WEAPON in OLD trait system - if (Item[usInHand].rocketlauncher && !(gGameOptions.fNewTraitSystem) ) + if (ItemIsRocketLauncher(usInHand) && !(gGameOptions.fNewTraitSystem) ) { // Penalty for shooting heavy weapons (launchers). Heavy Weapons skill halves this, once per skill level. FLOAT fTempPenalty = (gGameCTHConstants.AIM_HEAVY_WEAPON * fGunAimDifficulty) - fGunAimDifficulty; diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index 218b0c15..d6eb1c8f 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -457,7 +457,7 @@ INT32 FindWorldItemForTripwireInGridNo( INT32 sGridNo, INT8 bLevel, BOOLEAN fKno { pObj = &( gWorldItems[ gWorldBombs[ uiBombIndex ].iItemIndex ].object ); - if ( pObj && Item[pObj->usItem].tripwire ) + if ( pObj && ItemIsTripwire(pObj->usItem) ) { if ( !fKnown ) return( gWorldBombs[ uiBombIndex ].iItemIndex ); @@ -867,7 +867,7 @@ void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorM } } - else if ( dummyItem.bVisible == HIDDEN_ITEM && dummyItem.object[0]->data.bTrap > 0 && ( Item[dummyItem.object.usItem].mine || dummyItem.object.usItem == TRIP_FLARE || dummyItem.object.usItem == TRIP_KLAXON) ) + else if ( dummyItem.bVisible == HIDDEN_ITEM && dummyItem.object[0]->data.bTrap > 0 && (ItemIsMine(dummyItem.object.usItem) || dummyItem.object.usItem == TRIP_FLARE || dummyItem.object.usItem == TRIP_KLAXON) ) { ArmBomb( &dummyItem.object, BOMB_PRESSURE ); dummyItem.usFlags |= WORLD_ITEM_ARMED_BOMB; diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index 00bf2902..ce032d07 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -1888,7 +1888,7 @@ UINT32 GetTankCannonIndex() { for ( UINT32 i = 0; i < gMAXITEMS_READ; ++i ) { - if (Item[i].cannon) + if (ItemIsCannon(i)) { return Item[i].uiIndex; } @@ -2239,23 +2239,24 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) // fall through case AI_ACTION_FIRE_GUN: // shoot at nearby opponent - case AI_ACTION_THROW_KNIFE: // throw knife at nearby opponent - // randomly decide whether to say civ quote - - if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_FIRE_GUN, pSoldier->ubOppNum ); - else if (Item[pSoldier->inv[HANDPOS].usItem].grenadelauncher || Item[pSoldier->inv[HANDPOS].usItem].mortar || Item[pSoldier->inv[HANDPOS].usItem].rocketlauncher ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_FIRE_LAUNCHER, pSoldier->ubOppNum ); - else if (pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE && Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_THROWN && !Item[pSoldier->inv[HANDPOS].usItem].flare ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_THROW_KNIFE, pSoldier->ubOppNum ); - else if (pSoldier->aiData.bAction == AI_ACTION_KNIFE_MOVE ) - { - if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_BLADE ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_CHARGE_BLADE ); - else if (Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_PUNCH ) - PossiblyStartEnemyTaunt( pSoldier, TAUNT_CHARGE_HTH ); - } - + case AI_ACTION_THROW_KNIFE: // throw knife at nearby opponent + // randomly decide whether to say civ quote + { + UINT16 usItem = pSoldier->inv[HANDPOS].usItem; + if (Item[usItem].usItemClass == IC_GUN) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_FIRE_GUN, pSoldier->ubOppNum); + else if (ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem) || ItemIsRocketLauncher(usItem)) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_FIRE_LAUNCHER, pSoldier->ubOppNum); + else if (pSoldier->aiData.bAction == AI_ACTION_TOSS_PROJECTILE && Item[usItem].usItemClass == IC_THROWN && !ItemIsFlare(usItem)) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_THROW_KNIFE, pSoldier->ubOppNum); + else if (pSoldier->aiData.bAction == AI_ACTION_KNIFE_MOVE) + { + if (Item[usItem].usItemClass == IC_BLADE) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_CHARGE_BLADE); + else if (Item[usItem].usItemClass == IC_PUNCH) + PossiblyStartEnemyTaunt(pSoldier, TAUNT_CHARGE_HTH); + } + } // CC, ATE here - I put in some TEMP randomness... if (!is_networked) { diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 8b42fb29..b6b5bf43 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -102,7 +102,7 @@ INT8 OKToAttack(SOLDIERTYPE * pSoldier, int target) if ( Item[pSoldier->inv[HANDPOS].usItem].usItemClass == IC_GUN) { - if ( Item[pSoldier->inv[HANDPOS].usItem].cannon ) + if (ItemIsCannon(pSoldier->inv[HANDPOS].usItem)) { // look for another tank shell ELSEWHERE IN INVENTORY if ( FindLaunchable( pSoldier, pSoldier->inv[HANDPOS].usItem ) == NO_SLOT ) diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index b3e9f183..cfea4a61 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -63,7 +63,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) usInHand = GetAttachedGrenadeLauncher(&pSoldier->inv[HANDPOS]); // if he's got a MORTAR in his hand, make sure he has a MORTARSHELL avail. - if (Item[usInHand].mortar ) + if (ItemIsMortar(usInHand)) { // bPayloadPocket = FindObj( pSoldier, MORTAR_SHELL ); bPayloadPocket = FindLaunchable( pSoldier, usInHand ); @@ -76,7 +76,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) } } // if he's got a GL in his hand, make sure he has some type of GRENADE avail. - else if (Item[usInHand].grenadelauncher ) + else if (ItemIsGrenadeLauncher(usInHand)) { bPayloadPocket = FindGLGrenade( pSoldier ); if (bPayloadPocket == NO_SLOT || FindNonSmokeLaunchableAttachment( &pSoldier->inv[HANDPOS],usInHand ) != 0 ) @@ -88,7 +88,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) } } // if he's got a RPG7 in his hand, make sure he has some type of RPG avail. - else if (Item[usInHand].rocketlauncher && !Item[usInHand].singleshotrocketlauncher ) + else if (ItemIsRocketLauncher(usInHand) && !ItemIsSingleShotRocketLauncher(usInHand)) { bPayloadPocket = FindLaunchable (pSoldier, usInHand ); if (bPayloadPocket == NO_SLOT) @@ -96,7 +96,7 @@ void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier) return; // no grenades, can't fire } } - else if (Item[usInHand].cannon ) + else if (ItemIsCannon(usInHand)) { bPayloadPocket = FindLaunchable( pSoldier, usInHand ); if (bPayloadPocket == NO_SLOT) @@ -444,7 +444,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot) // sevenfm: take into account direction when checking stance // sevenfm: shoot heavy guns in standing stance only when using hip fire if (pSoldier->InternalIsValidStance(AIDirection(pSoldier->sGridNo, sTarget), ubStance) && - (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || !Weapon[pSoldier->usAttackingWeapon].HeavyGun || !Item[pSoldier->usAttackingWeapon].twohanded || !gGameExternalOptions.ubAllowAlternativeWeaponHolding)) + (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || !Weapon[pSoldier->usAttackingWeapon].HeavyGun || !ItemIsTwoHanded(pSoldier->usAttackingWeapon) || !gGameExternalOptions.ubAllowAlternativeWeaponHolding)) { sStanceAPcost = GetAPsToChangeStance(pSoldier, ubStance); if(sStanceAPcost) @@ -887,7 +887,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } // if he's got a MORTAR in his hand, make sure he has a MORTARSHELL avail. - if (Item[usInHand].mortar ) + if (ItemIsMortar(usInHand)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a mortar"); bPayloadPocket = FindNonSmokeLaunchable(pSoldier, usInHand); @@ -911,7 +911,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) fMortar = TRUE; } // if he's got a GL in his hand, make sure he has some type of GRENADE avail. - else if (Item[usInHand].grenadelauncher ) + else if (ItemIsGrenadeLauncher(usInHand)) { // use up pocket 2 first, they get left as drop items DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a GL"); @@ -943,7 +943,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } fGrenadeLauncher = TRUE; } - else if ( Item[usInHand].rocketlauncher ) + else if (ItemIsRocketLauncher(usInHand)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a rocket launcher"); @@ -952,7 +952,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // put in hand bPayloadPocket = HANDPOS;//dnl ch63 240813 - if (Item[usInHand].singleshotrocketlauncher) + if (ItemIsSingleShotRocketLauncher(usInHand)) { // sevenfm: for single shot rocket launchers, use buddy item instead if (Item[usInHand].usBuddyItem && Item[Item[usInHand].usBuddyItem].usItemClass & IC_EXPLOSV) @@ -983,7 +983,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } fRocketLauncher = TRUE; } - else if (Item[usInHand].cannon ) + else if (ItemIsCannon(usInHand)) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"calcbestthrow: buddy's got a tank"); bPayloadPocket = FindNonSmokeLaunchable(pSoldier, usInHand); @@ -1008,7 +1008,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) usGrenade = pSoldier->inv[bPayloadPocket].usItem; ubSafetyMargin = (UINT8)(1 + max(Explosive[Item[usGrenade].ubClassIndex].ubRadius, min((UINT8)TACTICAL_RANGE / 4, Explosive[Item[usGrenade].ubClassIndex].ubFragRange / CELL_X_SIZE))); - if ( Item[usGrenade].flare ) + if (ItemIsFlare(usGrenade)) { // JA2Gold: light isn't as nasty as explosives ubSafetyMargin /= 2; @@ -1032,7 +1032,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // use flares only at night if (usGrenade != NOTHING && - Item[usGrenade].flare && + ItemIsFlare(usGrenade) && !NightLight()) { return; @@ -1121,7 +1121,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // limit explosives type when attacking zombies if (usGrenade != NOTHING && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_NORMAL && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_CREATUREGAS && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_BURNABLEGAS && @@ -1143,7 +1143,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // limit explosives type when attacking robots, vehicles and tanks if (usGrenade != NOTHING && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_NORMAL && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_CREATUREGAS && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_BURNABLEGAS && @@ -1161,7 +1161,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // limit explosives type when attacking collapsed enemies if (usGrenade != NOTHING && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_NORMAL && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_CREATUREGAS && Explosive[Item[usGrenade].ubClassIndex].ubType != EXPLOSV_BURNABLEGAS && @@ -1173,7 +1173,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // don't use flare if soldier is in light if (usGrenade != NOTHING && - Item[usGrenade].flare && + ItemIsFlare(usGrenade) && InLightAtNight(pOpponent->sGridNo, pOpponent->pathing.bLevel)) { continue; @@ -1181,13 +1181,13 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // don't use flares against opponents on roof if (usGrenade != NOTHING && - Item[usGrenade].flare && + ItemIsFlare(usGrenade) && pOpponent->pathing.bLevel > 0) { continue; } - if (Item[usInHand].mortar) + if (ItemIsMortar(usInHand)) { // active KNOWN opponent, remember where he is so that we DO blow him up! if (bPersonalKnowledge == SEEN_CURRENTLY || @@ -1209,7 +1209,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) continue; // next soldier } } - else if (Item[usInHand].rocketlauncher) + else if (ItemIsRocketLauncher(usInHand)) { if (bPersonalKnowledge == SEEN_CURRENTLY || bPublicKnowledge == SEEN_CURRENTLY) { @@ -1231,7 +1231,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) continue; } } - else if( Item[usInHand].grenadelauncher ) + else if(ItemIsGrenadeLauncher(usInHand)) { if (bPersonalKnowledge == SEEN_CURRENTLY || bPublicKnowledge == SEEN_CURRENTLY) { @@ -1262,7 +1262,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) else if ((bKnowledge == SEEN_THIS_TURN || bKnowledge == SEEN_LAST_TURN || bKnowledge == HEARD_THIS_TURN || bKnowledge == HEARD_LAST_TURN) && !TileIsOutOfBounds(KnownLocation(pSoldier, pOpponent->ubID)) && CloseEnoughForGrenadeToss(pOpponent->sGridNo, KnownLocation(pSoldier, pOpponent->ubID)) && - (usGrenade != NOTHING && Item[usGrenade].flare || pSoldier->aiData.bUnderFire || pSoldier->aiData.bShock)) + (usGrenade != NOTHING && ItemIsFlare(usGrenade) || pSoldier->aiData.bUnderFire || pSoldier->aiData.bShock)) { sOpponentTile[ubOpponentCnt] = KnownLocation(pSoldier, pOpponent->ubID); bOpponentLevel[ubOpponentCnt] = KnownLevel(pSoldier, pOpponent->ubID); @@ -1299,7 +1299,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // don't spare non lethal grenades if (usGrenade != NOTHING && - (Item[usGrenade].flare || + (ItemIsFlare(usGrenade) || Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_STUN || Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_SMOKE || Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_TEARGAS || @@ -1328,7 +1328,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // militia always try to spare grenades unless under attack or using flares if (pSoldier->bTeam == MILITIA_TEAM && !pSoldier->aiData.bUnderFire && - !Item[usGrenade].flare && + !ItemIsFlare(usGrenade) && !fRocketLauncher) { fSpare = TRUE; @@ -1563,7 +1563,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) ubChanceToGetThrough = 100 - (UINT8) uiPenalty; } } - else if (Item[usInHand].mortar && + else if (ItemIsMortar(usInHand) && usGrenade != NOTHING && Explosive[Item[usGrenade].ubClassIndex].ubType == EXPLOSV_NORMAL && bOpponentLevel[ubLoop] == 0 && @@ -1589,7 +1589,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // this is try to minimize enemies wasting their (few) mortar shells or LAWs // they won't use them on less than 2 targets as long as half life left - if ((Item[usInHand].mortar || Item[usInHand].rocketlauncher) && (ubOppsInRange < 2) && + if ((ItemIsMortar(usInHand) || ItemIsRocketLauncher(usInHand)) && (ubOppsInRange < 2) && (!gGameExternalOptions.fEnemyTanksDontSpareShells || !ARMED_VEHICLE(pSoldier)) && !gGameExternalOptions.fEnemiesDontSpareLaunchables) { @@ -1597,7 +1597,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) } // limit RPG use, unless can hit several enemies, shooting at tank or opponent is in a room - if (Item[usInHand].rocketlauncher && + if (ItemIsRocketLauncher(usInHand) && ubOppsInRange < 2 && !ARMED_VEHICLE(MercPtrs[ubOpponentID[ubLoop]]) && (!InARoom(sOpponentTile[ubLoop], NULL) || pSoldier->bTeam != ENEMY_TEAM)) @@ -1687,7 +1687,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // this is try to minimize enemies wasting their (limited) toss attacks: UINT8 ubMinChanceToReallyHit; - if( usGrenade != NOTHING && Item[usGrenade].flare ) + if( usGrenade != NOTHING && ItemIsFlare(usGrenade) ) { ubMinChanceToReallyHit = 30; } @@ -2305,11 +2305,12 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * // ubExplosiveIndex = Item[ C1 ].ubClassIndex; // break; //default: - if ( Item[pSoldier->inv[ ubItemPos ].usItem].singleshotrocketlauncher ) + UINT16 usItem = pSoldier->inv[ubItemPos].usItem; + if (ItemIsSingleShotRocketLauncher(usItem)) ubExplosiveIndex = Item[ C1 ].ubClassIndex; - else if ( Item[pSoldier->inv[ ubItemPos ].usItem].rocketlauncher || Item[pSoldier->inv[ ubItemPos ].usItem].grenadelauncher || Item[pSoldier->inv[ ubItemPos ].usItem].mortar ) + else if (ItemIsRocketLauncher(usItem) || ItemIsGrenadeLauncher(usItem) || ItemIsMortar(usItem) ) { - OBJECTTYPE* pAttachment = FindLaunchableAttachment(&pSoldier->inv[ ubItemPos ],pSoldier->inv[ ubItemPos ].usItem ) ; + OBJECTTYPE* pAttachment = FindLaunchableAttachment(&pSoldier->inv[ ubItemPos ],usItem ) ; if ( pAttachment->exists() ) ubExplosiveIndex = Item[pAttachment->usItem].ubClassIndex; else @@ -2331,7 +2332,7 @@ INT32 EstimateThrowDamage( SOLDIERTYPE *pSoldier, UINT8 ubItemPos, SOLDIERTYPE * // break; //} // JA2Gold: added - if ( Item[pSoldier->inv[ubItemPos].usItem].flare ) + if (ItemIsFlare(pSoldier->inv[ubItemPos].usItem)) { return( 5 * ( LightTrueLevel( pOpponent->sGridNo, pOpponent->pathing.bLevel ) - NORMAL_LIGHTLEVEL_DAY ) ); } @@ -2496,7 +2497,7 @@ INT32 EstimateStabDamage( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 u { if (gGameOptions.fNewTraitSystem) { - if (!pSoldier->usAttackingWeapon || Item[usItem].brassknuckles) + if (!pSoldier->usAttackingWeapon || ItemIsBrassKnuckles(usItem)) { // add bonus for martial arts if (HAS_SKILL_TRAIT(pSoldier, MARTIAL_ARTS_NT)) @@ -2765,13 +2766,13 @@ INT8 CanNPCAttack(SOLDIERTYPE *pSoldier) RearrangePocket( pSoldier, HANDPOS, bWeaponIn, FOREVER ); // look for another weapon if this one is 1-handed // if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ HANDPOS ].usItem ].fFlags & ITEM_TWO_HANDED ) ) - if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ HANDPOS ].usItem ].twohanded ) ) + if ( (Item[ pSoldier->inv[ HANDPOS ].usItem ].usItemClass == IC_GUN) && !ItemIsTwoHanded(pSoldier->inv[ HANDPOS ].usItem) ) { // look for another pistol/SMG if available // CHRISL: Change final parameter to use dynamic pocket definition bWeaponIn = FindAIUsableObjClassWithin( pSoldier, IC_WEAPON, BIGPOCKSTART, NUM_INV_SLOTS ); // if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ bWeaponIn ].usItem ].fFlags & ITEM_TWO_HANDED ) ) - if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !(Item[ pSoldier->inv[ bWeaponIn ].usItem ].twohanded ) ) + if (bWeaponIn != NO_SLOT && (Item[ pSoldier->inv[ bWeaponIn ].usItem ].usItemClass == IC_GUN) && !ItemIsTwoHanded(pSoldier->inv[ bWeaponIn ].usItem) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"cannpcattack: swapping weapon into holster"); RearrangePocket( pSoldier, SECONDHANDPOS, bWeaponIn, FOREVER ); diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index e4a1e0ad..af862c89 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -2735,15 +2735,16 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) if (BestThrow.ubPossible) { // sevenfm: allow using mortars, grenade launchers, flares and grenades in RED state - if (Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar || - //Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].cannon || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].rocketlauncher || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].grenadelauncher || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].flare || - Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].usItemClass & IC_GRENADE) + UINT16 usItem = pSoldier->inv[BestThrow.bWeaponIn].usItem; + if (ItemIsMortar(usItem) || + //Item[usItem].cannon || + ItemIsRocketLauncher(usItem) || + ItemIsGrenadeLauncher(usItem) || + ItemIsFlare(usItem) || + Item[usItem].usItemClass & IC_GRENADE) { // if firing mortar make sure we have room - if (Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar) + if (ItemIsMortar(usItem)) { DebugAI(AI_MSG_INFO, pSoldier, String("using mortar, check room to deploy")); ubOpponentDir = AIDirection(pSoldier->sGridNo, BestThrow.sTarget); @@ -5503,7 +5504,7 @@ INT16 ubMinAPCost; if (BestThrow.ubPossible) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"good throw possible"); - if ( Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[ BestThrow.bWeaponIn ].usItem)) { ubOpponentDir = AIDirection(pSoldier->sGridNo, BestThrow.sTarget); @@ -6323,7 +6324,7 @@ INT16 ubMinAPCost; } // SANDRO: more likely to burst when firing from hip - if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && Item[pSoldier->inv[BestAttack.bWeaponIn].usItem].twohanded ) + if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && ItemIsTwoHanded(pSoldier->inv[BestAttack.bWeaponIn].usItem) ) iChance += 40; // CHRISL: Changed from a simple flag to two externalized values for more modder control over AI suppression @@ -6440,7 +6441,7 @@ L_NEWAIM: } // SANDRO: more likely to burst when firing from hip - if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && Item[pSoldier->inv[BestAttack.bWeaponIn].usItem].twohanded ) + if ( BestAttack.bScopeMode == USE_ALT_WEAPON_HOLD && ItemIsTwoHanded(pSoldier->inv[BestAttack.bWeaponIn].usItem) ) iChance += 40; // CHRISL: Changed from a simple flag to two externalized values for more modder control over AI suppression @@ -8403,10 +8404,10 @@ INT8 ArmedVehicleDecideActionRed( SOLDIERTYPE *pSoldier) if ( BestThrow.ubPossible ) { // if firing mortar make sure we have room - //if ( Item[pSoldier->inv[ BestThrow.bWeaponIn ].usItem].mortar ) //comm by ddd - if ( Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar - || Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].grenadelauncher - || Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].flare ) + UINT16 usItem = pSoldier->inv[BestThrow.bWeaponIn].usItem; + if (ItemIsMortar(usItem) + || ItemIsGrenadeLauncher(usItem) + || ItemIsFlare(usItem) ) { ubOpponentDir = GetDirectionFromGridNo( BestThrow.sTarget, pSoldier ); @@ -9799,7 +9800,7 @@ INT8 ArmedVehicleDecideActionBlack( SOLDIERTYPE *pSoldier ) if ( BestThrow.ubPossible ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "good throw possible" ); - if ( Item[pSoldier->inv[BestThrow.bWeaponIn].usItem].mortar ) + if (ItemIsMortar(pSoldier->inv[BestThrow.bWeaponIn].usItem)) { ubOpponentDir = (UINT8)GetDirectionFromGridNo( BestThrow.sTarget, pSoldier ); diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 37fcd984..3c9ab556 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -1987,7 +1987,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if ( pItem->usItemClass == IC_GUN && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { // maybe this gun has ammo (adjust for whether it is better than ours!) - if ( (*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (Item[pObj->usItem].fingerprintid && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) + if ( (*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) { iTempValue = 0; } @@ -2028,7 +2028,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if (pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { DebugAI(AI_MSG_INFO, pSoldier, String("weapon has good status")); - if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) { // jammed or out of ammo, skip it! DebugAI(AI_MSG_INFO, pSoldier, String("jammed or out of ammo, skip it!")); @@ -2079,7 +2079,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if ( pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { DebugAI(AI_MSG_INFO, pSoldier, String("gun has good status")); - if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (( Item[pObj->usItem].fingerprintid ) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) { // jammed or out of ammo, skip it! DebugAI(AI_MSG_INFO, pSoldier, String("jammed or out of ammo, skip it!")); diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 55606e27..84702a01 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -1149,7 +1149,7 @@ UINT8 NPCConsiderReceivingItemFromMerc( UINT8 ubNPC, UINT8 ubMerc, OBJECTTYPE * ubLastQuoteRecord = NUM_NPC_QUOTE_RECORDS - 1; usItemToConsider = pObj->usItem; - if ( Item[ usItemToConsider ].usItemClass == IC_GUN && !Item[usItemToConsider].rocketlauncher ) + if ( Item[ usItemToConsider ].usItemClass == IC_GUN && !ItemIsRocketLauncher(usItemToConsider) ) { UINT8 ubWeaponClass; diff --git a/TacticalAI/PanicButtons.cpp b/TacticalAI/PanicButtons.cpp index b673c8d4..03c54f3f 100644 --- a/TacticalAI/PanicButtons.cpp +++ b/TacticalAI/PanicButtons.cpp @@ -10,6 +10,7 @@ #include "Queen Command.h" + void MakeClosestEnemyChosenOne() { UINT32 cnt; diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index fac8bc3e..d1281de3 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -1614,7 +1614,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo // Demolitions damage bonus with bombs and mines if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], DEMOLITIONS_NT ) && Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL && Item[usItem].usItemClass == IC_BOMB && - (!Item[usItem].attachment || Item[usItem].mine )) + (!ItemIsAttachment(usItem) || ItemIsMine(usItem))) { sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubDEDamageOfBombsAndMines) / 100.0f + 0.5f); } @@ -1627,9 +1627,9 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo // Heavy Weapons trait bonus damage with rocket, grenade launchers and mortar else if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT ) && Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL && - ((Item[usItem].usItemClass == IC_BOMB && Item[usItem].attachment && !Item[usItem].mine ) || // mortar shells - (Item[usItem].usItemClass == IC_GRENADE && (Item[usItem].glgrenade || Item[usItem].electronic) ) || // rockets for rocketlaunchers (I haven't found any other way) - (Item[usItem].usItemClass == IC_LAUNCHER ) || Item[usItem].rocketlauncher || Item[usItem].singleshotrocketlauncher ) ) + ((Item[usItem].usItemClass == IC_BOMB && ItemIsAttachment(usItem) && !ItemIsMine(usItem) ) || // mortar shells + (Item[usItem].usItemClass == IC_GRENADE && (ItemIsGLgrenade(usItem) || ItemIsElectronic(usItem)) ) || // rockets for rocketlaunchers (I haven't found any other way) + (Item[usItem].usItemClass == IC_LAUNCHER ) || ItemIsRocketLauncher(usItem) || ItemIsSingleShotRocketLauncher(usItem) ) ) { sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubHWDamageBonusPercentForHW * NUM_SKILL_TRAITS( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT )) / 100.0f + 0.5f); // +15% } @@ -1640,7 +1640,7 @@ BOOLEAN DamageSoldierFromBlast( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo { sNewWoundAmt = (INT16)(sNewWoundAmt * (100 - gSkillTraitValues.bTanksDamageResistanceModifier) / 100); // another half of this for ordinary grenades - if ( (( Item[usItem].usItemClass == IC_GRENADE ) || Item[usItem].glgrenade ) && !Item[usItem].electronic ) + if ( (( Item[usItem].usItemClass == IC_GRENADE ) || ItemIsGLgrenade(usItem) ) && !ItemIsElectronic(usItem)) sNewWoundAmt = (INT16)(sNewWoundAmt * (100 - (gSkillTraitValues.bTanksDamageResistanceModifier / 2)) / 100); } @@ -3858,10 +3858,10 @@ BOOLEAN ActivateSurroundingTripwire( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UIN usBombItem = (*pObj)[0]->data.misc.usBombItem; // if item can be activated by tripwire, detonate it - if ( Item[usBombItem].tripwireactivation == 1 ) + if (ItemHasTripwireActivation(usBombItem)) { // tripwire just gets activated - if ( Item[usBombItem].tripwire == 1 ) + if (ItemIsTripwire(usBombItem)) { // this is important - we have to check wether the wire has already been activated if ( ( (*pObj)[0]->data.sObjectFlag & TRIPWIRE_ACTIVATED ) == 0 ) @@ -4029,7 +4029,7 @@ void HandleExplosionQueue( void ) CallAvailableEnemiesTo( sGridNo ); //RemoveItemFromPool( sGridNo, gWorldBombs[ uiWorldBombIndex ].iItemIndex, 0 ); } - else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_FLARE || Item[pObj->usItem].flare) + else if ( (*pObj)[0]->data.misc.usBombItem == TRIP_FLARE || ItemIsFlare(pObj->usItem)) { // sevenfm: changed pObj->usItem to Item[pObj->usItem].ubClassIndex as it should be correct explosives index // NewLightEffect( sGridNo, (UINT8)Explosive[pObj->usItem].ubDuration, (UINT8)Explosive[pObj->usItem].ubStartRadius ); @@ -4128,7 +4128,7 @@ void HandleExplosionQueue( void ) } // Flugente: handle tripwire gun traps here... // tripwire gets called and activated in ActivateSurroundingTripwire - else if ( Item[pObj->usItem].tripwire == 1 ) + else if (ItemIsTripwire(pObj->usItem)) { OBJECTTYPE newtripwireObject; CreateItem( pObj->usItem, (*pObj)[0]->data.objectStatus, &newtripwireObject ); @@ -4189,7 +4189,7 @@ void HandleExplosionQueue( void ) // Flugente: handle tripwire gun traps here... // tripwire gets called and activated in ActivateSurroundingTripwire // now for action item tripwire - else if ( pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 ) + else if ( pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && ItemIsTripwire((*pObj)[0]->data.misc.usBombItem) ) { OBJECTTYPE newtripwireObject; CreateItem( (*pObj)[0]->data.misc.usBombItem, (*pObj)[0]->data.objectStatus, &newtripwireObject ); @@ -4910,7 +4910,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 if (fAllBombs || (*pObj)[0]->data.misc.bDetonatorType == BOMB_PRESSURE) { // Flugente: if this is a anti-tank mine, only detonate it if the person triggering it is (in) a vehicle, or if we detonate everything unconditional - if ( !fAllBombs && ubID != NOBODY && Item[pObj->usItem].antitankmine ) + if ( !fAllBombs && ubID != NOBODY && ItemIsATMine(pObj->usItem)) { // if this is not a vehicle, not a robot and not a tank, don't activate if ( !(MercPtrs[ubID]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ubID] ) && !ARMED_VEHICLE( MercPtrs[ubID] ) && !ENEMYROBOT( MercPtrs[ubID] ) ) @@ -4942,7 +4942,7 @@ BOOLEAN SetOffBombsInGridNo( UINT8 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 SetOffBombsByFrequency( ubID, (*pObj)[0]->data.misc.bFrequency ); } // Flugente: a tripwire activates all other tripwires in connection, and detonates all bombs in connection that are tripwire-activated - else if ( Item[pObj->usItem].tripwire == 1 || (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && Item[(*pObj)[0]->data.misc.usBombItem].tripwire == 1 ) ) + else if (ItemIsTripwire(pObj->usItem) || (pObj->usItem == ACTION_ITEM && (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP && ItemIsTripwire((*pObj)[0]->data.misc.usBombItem) ) ) { gubPersonToSetOffExplosions = ubID; @@ -5449,7 +5449,7 @@ void FireFragments( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, FLOAT dRandomZ = 0; // if explosive is directional, calculation of frags is different - if ( Item[usItem].directional == TRUE ) + if (ItemIsDirectional(usItem)) { // Flugente: if item is a directional explosive, determine in what direction the frags should fly INT16 degree = (45 + ubDirection * 45) % 360; // modulo 360 to prevent nonsense from nonsensical input @@ -5891,7 +5891,7 @@ void HandleBuddyExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sG // Flugente: Items can have secondary explosions if ( Item[usItem].usBuddyItem ) { - if ( Item[Item[usItem].usBuddyItem].flare ) + if (ItemIsFlare(Item[usItem].usBuddyItem)) { if( !sZ || !FindBuilding(sGridNo) ) { @@ -5929,10 +5929,10 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN if ( iter->exists() && Item[iter->usItem].usItemClass & (IC_GRENADE|IC_BOMB) ) { // no need for binder if both item and attachment are tripwire-activated - if( ( Item[pObj->usItem].tripwireactivation && Item[iter->usItem].tripwireactivation ) || + if( (ItemHasTripwireActivation(pObj->usItem) && ItemHasTripwireActivation(iter->usItem)) || ( binderFound && detonator && Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) ) { - if(Item[iter->usItem].directional && ubDirection == DIRECTION_IRRELEVANT) + if(ItemIsDirectional(iter->usItem) && ubDirection == DIRECTION_IRRELEVANT) direction=Random(8); else direction=ubDirection; @@ -5953,7 +5953,7 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN } if ( binderFound && detonator && gGameExternalOptions.bAllowSpecialExplosiveAttachments && iter->exists() && Item[iter->usItem].usItemClass & IC_MISC ) { - if(Item[iter->usItem].gascan) + if(ItemIsGascan(iter->usItem)) { IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, GAS_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); fAttFound = TRUE; @@ -5963,7 +5963,7 @@ BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, IN IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, MOLOTOV_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); fAttFound = TRUE; } - if(Item[iter->usItem].marbles) + if(ItemIsMarbles(iter->usItem)) { IgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, FRAG_EXPLOSION, bLevel, DIRECTION_IRRELEVANT , NULL ); fAttFound = TRUE; @@ -6017,7 +6017,7 @@ UINT16 CalcTotalVolatility(OBJECTTYPE * pObj) if ( iter->exists() && Item[iter->usItem].usItemClass & (IC_GRENADE|IC_BOMB) ) { // no need for binder if both item and attachment are tripwire-activated - if( ( Item[usItem].tripwireactivation && Item[iter->usItem].tripwireactivation ) || + if( (ItemHasTripwireActivation(usItem) && ItemHasTripwireActivation(iter->usItem)) || ( binderFound && detonator && Explosive[Item[iter->usItem].ubClassIndex].ubVolatility > 0 ) ) { totalVolatility += Explosive[Item[iter->usItem].ubClassIndex].ubVolatility; diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 68c55586..138e4b09 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -531,8 +531,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) else { // If we are in water, and we are a sinkable item... - // if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].fFlags & ITEM_SINKS ) ) - if ( !pObject->fInWater || !( Item[ pObject->Obj.usItem ].sinks ) ) + if ( !pObject->fInWater || !ItemSinks(pObject->Obj.usItem) ) { if ( pObject->fDropItem ) { @@ -562,7 +561,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) } // Make impact noise.... - if ( Item[pObject->Obj.usItem].rock ) + if (ItemIsRock(pObject->Obj.usItem)) { MakeNoise( pObject->ubOwner, pObject->sGridNo, 0, gpWorldLevelData[ pObject->sGridNo ].ubTerrainID, (UINT8) (9 + PreRandom( 9 ) ), NOISE_ROCK_IMPACT ); } @@ -1013,10 +1012,11 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) if ( iCollisionCode == COLLISION_WINDOW_NORTHWEST || iCollisionCode == COLLISION_WINDOW_NORTHEAST || iCollisionCode == COLLISION_WINDOW_SOUTHWEST || iCollisionCode == COLLISION_WINDOW_SOUTHEAST ) { // sevenfm: added requirements for object to break window - if (Item[pObject->Obj.usItem].ubWeight >= 4 && - Item[pObject->Obj.usItem].sinks && - !Item[pObject->Obj.usItem].unaerodynamic && - (Item[pObject->Obj.usItem].metal || Item[pObject->Obj.usItem].rock)) + UINT16 usItem = pObject->Obj.usItem; + if (Item[usItem].ubWeight >= 4 && + ItemSinks(usItem) && + !ItemIsUnaerodynamic(usItem) && + (ItemIsMetal(usItem) || ItemIsRock(usItem))) { if (!pObject->fTestObject) { @@ -1927,7 +1927,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1741")); - if ( fArmed && ( Item[usLauncher].mortar || Item[pItem->usItem].mortar ) ) + if ( fArmed && (ItemIsMortar(usLauncher) || ItemIsMortar(pItem->usItem)) ) { // Start at 0.... sStartZ = ( pSoldier->pathing.bLevel * 256 ); @@ -1937,7 +1937,7 @@ void CalculateLaunchItemBasicParams( SOLDIERTYPE *pSoldier, OBJECTTYPE *pItem, I } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 1750")); - if ( fArmed && ( Item[usLauncher].grenadelauncher || Item[pItem->usItem].grenadelauncher ) ) + if ( fArmed && (ItemIsGrenadeLauncher(usLauncher) || ItemIsGrenadeLauncher(pItem->usItem)) ) { // OK, look at target level and decide angle to use... if ( ubLevel == 1 ) @@ -2327,7 +2327,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI } // set the max miss radius - if ( Item[usItemNum].mortar ) + if (ItemIsMortar(usItemNum)) { bMaxRadius = gItemSettings.usMissMaxRadiusMortar; } @@ -2413,7 +2413,7 @@ void CalculateLaunchItemParamsForThrow( SOLDIERTYPE *pSoldier, INT32 sGridNo, UI DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("physics.cpp line 2103")); - if ( fArmed && Item[usLauncher].mortar ) + if ( fArmed && ItemIsMortar(usLauncher)) { // Start at 0.... sStartZ = ( pSoldier->pathing.bLevel * 256 ) + 50; @@ -2665,7 +2665,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) { fCheckForDuds = TRUE; - if (CanDelayGrenadeExplosion(pObj->usItem) && (Item[pObj->usItem].ubCursor == TOSSCURS || Item[pObj->usItem].glgrenade)) + if (CanDelayGrenadeExplosion(pObj->usItem) && (Item[pObj->usItem].ubCursor == TOSSCURS || ItemIsGLgrenade(pObj->usItem))) { fCanDelayExplosion = TRUE; } @@ -2780,7 +2780,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) if ( fDoImpact ) { - if ( Item[pObject->Obj.usItem].flare ) + if (ItemIsFlare(pObject->Obj.usItem)) { //if the light object will be created OFF the ground if( pObject->Position.z > 0 && FindBuilding(pObject->sGridNo) ) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 76652ae4..412a96fa 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -561,90 +561,101 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.bRepairEase = (INT8) atol(pData->szCharData); } - //else if(strcmp(name, "fFlags") == 0) - //{ - // pData->curElement = ELEMENT; - // pData->curItem.fFlags = (BOOLEAN) atol(pData->szCharData); - //} else if(strcmp(name, "Damageable") == 0) { pData->curElement = ELEMENT; - pData->curItem.damageable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_damageable; } else if(strcmp(name, "Repairable") == 0) { pData->curElement = ELEMENT; - pData->curItem.repairable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_repairable; } else if(strcmp(name, "WaterDamages") == 0) { pData->curElement = ELEMENT; - pData->curItem.waterdamages = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_waterdamages; } else if(strcmp(name, "Metal") == 0) { pData->curElement = ELEMENT; - pData->curItem.metal = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_metal; } else if(strcmp(name, "Sinks") == 0) { pData->curElement = ELEMENT; - pData->curItem.sinks = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_sinks; } else if(strcmp(name, "ShowStatus") == 0) { pData->curElement = ELEMENT; - pData->curItem.showstatus = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_showstatus; } else if(strcmp(name, "HiddenAddon") == 0) { pData->curElement = ELEMENT; - pData->curItem.hiddenaddon = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_hiddenaddon; } else if(strcmp(name, "TwoHanded") == 0) { pData->curElement = ELEMENT; - pData->curItem.twohanded = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_twohanded; } else if(strcmp(name, "NotBuyable") == 0) { pData->curElement = ELEMENT; - pData->curItem.notbuyable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_notbuyable; } else if(strcmp(name, "Attachment") == 0) { pData->curElement = ELEMENT; - pData->curItem.attachment = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_attachment; } else if(strcmp(name, "HiddenAttachment") == 0) { pData->curElement = ELEMENT; - pData->curItem.hiddenattachment = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_hiddenattachment; } else if(strcmp(name, "BigGunList") == 0) { pData->curElement = ELEMENT; - pData->curItem.biggunlist = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_biggunlist; } else if(strcmp(name, "NotInEditor") == 0) { pData->curElement = ELEMENT; - pData->curItem.notineditor = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_notineditor; } else if(strcmp(name, "DefaultUndroppable") == 0) { pData->curElement = ELEMENT; - pData->curItem.defaultundroppable = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_defaultundroppable; } else if(strcmp(name, "Unaerodynamic") == 0) { pData->curElement = ELEMENT; - pData->curItem.unaerodynamic = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_unaerodynamic; } else if(strcmp(name, "Electronic") == 0) { pData->curElement = ELEMENT; - pData->curItem.electronic = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_electronic; } else if(strcmp(name, "Inseparable") == 0) { @@ -699,7 +710,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "GasMask") == 0) { pData->curElement = ELEMENT; - pData->curItem.gasmask = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_gasmask; } else if(strcmp(name, "Bipod") == 0) { @@ -802,47 +814,56 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "GrenadeLauncher") == 0) { pData->curElement = ELEMENT; - pData->curItem.grenadelauncher = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_grenadelauncher; } else if(strcmp(name, "LockBomb") == 0) { pData->curElement = ELEMENT; - pData->curItem.lockbomb = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_lockbomb; } else if(strcmp(name, "Flare") == 0) { pData->curElement = ELEMENT; - pData->curItem.flare = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_flare; } else if(strcmp(name, "Duckbill") == 0) { pData->curElement = ELEMENT; - pData->curItem.duckbill = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_duckbill; } else if(strcmp(name, "Detonator") == 0) { pData->curElement = ELEMENT; - pData->curItem.detonator = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_detonator; } else if(strcmp(name, "RemoteDetonator") == 0) { pData->curElement = ELEMENT; - pData->curItem.remotedetonator = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_remotedetonator; } else if(strcmp(name, "ThermalOptics") == 0) { pData->curElement = ELEMENT; - pData->curItem.thermaloptics = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_thermaloptics; } else if(strcmp(name, "SciFi") == 0) { pData->curElement = ELEMENT; - pData->curItem.scifi = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_scifi; } else if(strcmp(name, "NewInv") == 0) { pData->curElement = ELEMENT; - pData->curItem.newinv = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_newinv; } else if(strcmp(name, "AttachmentSystem") == 0) { @@ -852,17 +873,20 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "HideMuzzleFlash") == 0) { pData->curElement = ELEMENT; - pData->curItem.hidemuzzleflash = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_hidemuzzleflash; } else if(strcmp(name, "Cannon") == 0) { pData->curElement = ELEMENT; - pData->curItem.cannon = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_cannon; } else if(strcmp(name, "RocketRifle") == 0) { pData->curElement = ELEMENT; - pData->curItem.rocketrifle = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_rocketrifle; } else if(strcmp(name, "Alcohol") == 0) { @@ -874,12 +898,14 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "Hardware") == 0) { pData->curElement = ELEMENT; - pData->curItem.hardware = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_hardware; } else if(strcmp(name, "Medical") == 0) { pData->curElement = ELEMENT; - pData->curItem.medical = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_medical; } else if(strcmp(name, "DamageBonus") == 0) { @@ -894,28 +920,26 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "Mortar") == 0) { pData->curElement = ELEMENT; - pData->curItem.mortar = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_mortar; } else if(strcmp(name, "RocketLauncher") == 0) { pData->curElement = ELEMENT; - pData->curItem.rocketlauncher = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_rocketlauncher; } else if(strcmp(name, "SingleShotRocketLauncher") == 0) { pData->curElement = ELEMENT; - pData->curItem.singleshotrocketlauncher = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_singleshotrocketlauncher; } else if(strcmp(name, "DiscardedLauncherItem") == 0) { pData->curElement = ELEMENT; pData->curItem.discardedlauncheritem = (UINT16) atol(pData->szCharData); } - else if(strcmp(name, "SingleShotRocketLauncher") == 0) - { - pData->curElement = ELEMENT; - pData->curItem.singleshotrocketlauncher = (BOOLEAN) atol(pData->szCharData); - } else if(strcmp(name, "BloodiedItem") == 0) { pData->curElement = ELEMENT; @@ -934,22 +958,26 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "BrassKnuckles") == 0) { pData->curElement = ELEMENT; - pData->curItem.brassknuckles = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_brassknuckles; } else if(strcmp(name, "Crowbar") == 0) { pData->curElement = ELEMENT; - pData->curItem.crowbar = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_crowbar; } else if(strcmp(name, "GLGrenade") == 0) { pData->curElement = ELEMENT; - pData->curItem.glgrenade = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_glgrenade; } else if(strcmp(name, "FlakJacket") == 0) { pData->curElement = ELEMENT; - pData->curItem.flakjacket = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_flakjacket; } else if(strcmp(name, "HearingRangeBonus") == 0) { @@ -989,117 +1017,140 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "LeatherJacket") == 0) { pData->curElement = ELEMENT; - pData->curItem.leatherjacket = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_leatherjacket; } else if(strcmp(name, "NeedsBatteries") == 0) { pData->curElement = ELEMENT; - pData->curItem.needsbatteries = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_needsbatteries; } else if(strcmp(name, "Batteries") == 0) { pData->curElement = ELEMENT; - pData->curItem.batteries = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_batteries; } else if(strcmp(name, "XRay") == 0) { pData->curElement = ELEMENT; - pData->curItem.xray = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_xray; } else if(strcmp(name, "WireCutters") == 0) { pData->curElement = ELEMENT; - pData->curItem.wirecutters = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_wirecutters; } else if(strcmp(name, "Toolkit") == 0) { pData->curElement = ELEMENT; - pData->curItem.toolkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_toolkit; } else if(strcmp(name, "Canteen") == 0) { pData->curElement = ELEMENT; - pData->curItem.canteen = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_canteen; } else if(strcmp(name, "Marbles") == 0) { pData->curElement = ELEMENT; - pData->curItem.marbles = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_marbles; } else if(strcmp(name, "Walkman") == 0) { pData->curElement = ELEMENT; - pData->curItem.walkman = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_walkman; } else if(strcmp(name, "RemoteTrigger") == 0) { pData->curElement = ELEMENT; - pData->curItem.remotetrigger = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_remotetrigger; } else if(strcmp(name, "RobotRemoteControl") == 0) { pData->curElement = ELEMENT; - pData->curItem.robotremotecontrol = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_robotremotecontrol; } else if(strcmp(name, "CamouflageKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.camouflagekit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_camouflagekit; } else if(strcmp(name, "LocksmithKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.locksmithkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_locksmithkit; } else if(strcmp(name, "Mine") == 0) { pData->curElement = ELEMENT; - pData->curItem.mine = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_mine; } else if ( strcmp( name, "antitankmine" ) == 0 ) { pData->curElement = ELEMENT; - pData->curItem.antitankmine = (BOOLEAN)atol( pData->szCharData ); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_antitankmine; } else if(strcmp(name, "GasCan") == 0) { pData->curElement = ELEMENT; - pData->curItem.gascan = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_gascan; } else if(strcmp(name, "CanAndString") == 0) { pData->curElement = ELEMENT; - pData->curItem.canandstring = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_canandstring; } else if(strcmp(name, "ContainsLiquid") == 0) { pData->curElement = ELEMENT; - pData->curItem.containsliquid = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_containsliquid; } else if(strcmp(name, "FingerPrintID") == 0) { pData->curElement = ELEMENT; - pData->curItem.fingerprintid = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_fingerprintid; } else if(strcmp(name, "Rock") == 0) { pData->curElement = ELEMENT; - pData->curItem.rock = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_rock; } else if(strcmp(name, "MedicalKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.medicalkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_medicalkit; } else if(strcmp(name, "FirstAidKit") == 0) { pData->curElement = ELEMENT; - pData->curItem.firstaidkit = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_firstaidkit; } else if(strcmp(name, "MetalDetector") == 0) { pData->curElement = ELEMENT; - pData->curItem.metaldetector = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag |= ITEM_metaldetector; } if(strcmp(name, "PercentTunnelVision") == 0) //Madd: had to scrap the "else" due to a compiler limit { @@ -1109,7 +1160,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) if(strcmp(name, "Jar") == 0) { pData->curElement = ELEMENT; - pData->curItem.jar = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_jar; } if(strcmp(name, "BestLaserRange") == 0) { @@ -1228,7 +1280,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "barrel") == 0) { pData->curElement = ELEMENT; - pData->curItem.barrel = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_barrel; } else if(strcmp(name, "usOverheatingCooldownFactor") == 0) { @@ -1263,17 +1316,20 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "TripWireActivation") == 0) { pData->curElement = ELEMENT; - pData->curItem.tripwireactivation = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_tripwireactivation; } else if(strcmp(name, "TripWire") == 0) { pData->curElement = ELEMENT; - pData->curItem.tripwire = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_tripwire; } else if(strcmp(name, "Directional") == 0) { pData->curElement = ELEMENT; - pData->curItem.directional = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_directional; } else if(strcmp(name, "DrugType") == 0) { @@ -1283,7 +1339,8 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "BlockIronSight") == 0) { pData->curElement = ELEMENT; - pData->curItem.blockironsight = (BOOLEAN) atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_blockironsight; } else if(strcmp(name, "ItemFlag") == 0) { @@ -1394,12 +1451,14 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if (strcmp(name, "fAllowClimbing") == 0) { pData->curElement = ELEMENT; - pData->curItem.fAllowClimbing = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fAllowClimbing; } else if ( strcmp( name, "cigarette" ) == 0 ) { pData->curElement = ELEMENT; - pData->curItem.cigarette = (BOOLEAN)atol( pData->szCharData ); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_cigarette; } else if ( strcmp( name, "usPortionSize" ) == 0 ) { @@ -1502,22 +1561,26 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if (strcmp(name, "ProvidesRobotCamo") == 0) { pData->curElement = ELEMENT; - pData->curItem.fProvidesRobotCamo = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fProvidesRobotCamo; } else if (strcmp(name, "ProvidesRobotNightVision") == 0) { pData->curElement = ELEMENT; - pData->curItem.fProvidesRobotNightVision = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fProvidesRobotNightVision; } else if (strcmp(name, "ProvidesRobotLaserBonus") == 0) { pData->curElement = ELEMENT; - pData->curItem.fProvidesRobotLaserBonus = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_fProvidesRobotLaserBonus; } else if (strcmp(name, "DiseaseSystemExclusive") == 0) { pData->curElement = ELEMENT; - pData->curItem.DiseaseSystemExclusive = (BOOLEAN)atol(pData->szCharData); + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_DiseaseSystemExclusive; } else if (strcmp(name, "TransportGroupMinProgress") == 0) { @@ -1907,12 +1970,6 @@ BOOLEAN WriteItemStats() } FilePrintf(hFile,"\r\n"); - - - - - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemClass); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasAttachmentClass); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasLayoutClass); @@ -1929,41 +1986,27 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bReliability); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRepairEase); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_DAMAGEABLE ? TRUE : FALSE); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_REPAIRABLE ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_WATER_DAMAGES ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_METAL ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_SINKS ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_SHOW_STATUS ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_HIDDEN_ADDON ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_TWO_HANDED ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_NOT_BUYABLE ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_ATTACHMENT ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_BIGGUNLIST ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_NOT_EDITOR ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_DEFAULT_UNDROPPABLE ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_UNAERODYNAMIC ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_ELECTRONIC ? TRUE : FALSE ); - //FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fFlags & ITEM_INSEPARABLE ? TRUE : FALSE ); + if (ItemIsDamageable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRepairable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDamagedByWater(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMetal(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemSinks(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (HasItemFlag2(cnt, ITEM_showstatus)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsHiddenAddon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsTwoHanded(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsNotBuyable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsHiddenAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInTonsOfGuns(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInScifi(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInNIV(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsNotInEditor(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsUndroppableByDefault(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsUnaerodynamic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsElectronic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemHasHiddenMuzzleFlash(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damageable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].repairable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].waterdamages ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].metal ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sinks ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].showstatus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hiddenaddon ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].twohanded ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].notbuyable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].attachment ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].biggunlist ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].scifi ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].newinv ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubAttachmentSystem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].notineditor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].defaultundroppable ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].unaerodynamic ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].electronic ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].inseparable ); FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][0] ); @@ -1971,7 +2014,6 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", WeaponROF[cnt]); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentnoisereduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hidemuzzleflash ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bipod ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); @@ -1997,17 +2039,19 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].meleedamagebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].grenadelauncher ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].duckbill ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].glgrenade ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mine ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].antitankmine ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].mortar ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketlauncher ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].singleshotrocketlauncher ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rocketrifle); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cannon); + + if (ItemIsMortar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsSingleShotRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGrenadeLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDuckbill(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGLgrenade(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsATMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRocketRifle(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemHasFingerPrintID(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCannon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); for(UINT8 cnt2 = 0; cnt2 < MAX_DEFAULT_ATTACHMENTS; cnt2++){ if(Item[cnt].defaultattachments[cnt2] != 0){ @@ -2015,29 +2059,30 @@ BOOLEAN WriteItemStats() } } - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brassknuckles ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].crowbar ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bloodieditem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rock ); + if (ItemIsBrassKnuckles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCrowbar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRock(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bloodieditem ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].urbanCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].desertCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].snowCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].stealthbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].flakjacket ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].leatherjacket ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].detonator ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].remotedetonator ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].remotetrigger ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].lockbomb ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].flare ); + if (ItemIsFlakJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsLeatherJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRemoteDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRemoteTrigger(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsLockBomb(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsFlare(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsRobotRemote(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsWalkman(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsThermalOptics(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGasmask(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].robotremotecontrol ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].walkman ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hearingrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].visionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nightvisionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].dayvisionrangebonus ); @@ -2045,30 +2090,26 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brightlightvisionrangebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].itemsizebonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percenttunnelvision ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].thermaloptics ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].gasmask ); - - FilePrintf(hFile,"\t\t%3.2f\r\n", Item[cnt].alcohol ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hardware ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].medical ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camouflagekit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].locksmithkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].toolkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].firstaidkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].medicalkit ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].wirecutters ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].canteen ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].gascan ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].marbles ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].canandstring ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].jar ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].xray ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].batteries ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].needsbatteries ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].containsliquid ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].metaldetector ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fingerprintid ); + + if (ItemIsHardware(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMedical(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCamoKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsLocksmithKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsToolkit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsFirstAidKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMedicalKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsWirecutters(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCanteen(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsGascan(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMarbles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCanAndString(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsJar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemHasXRay(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemNeedsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemContainsLiquid(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsMetalDetector(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); // HEADROCK HAM 4: Print out new values FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].scopemagfactor ); @@ -2119,7 +2160,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\r\n"); // Flugente FTW 1.2 - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].barrel ); + if (ItemIsBarrel(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].usOverheatingCooldownFactor ); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatTemperatureModificator ); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatCooldownModificator ); @@ -2128,16 +2169,13 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].attachmentclass ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tripwireactivation ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tripwire ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].directional ); + if (ItemHasTripwireActivation(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsTripwire(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsDirectional(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemBlocksIronsight(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].blockironsight ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemFlag ); - + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].foodtype ); //JMich_SkillModifiers: Adding the values here as well @@ -2161,10 +2199,10 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubSleepModifier ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usSpotting ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sBackpackWeightModifier); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fAllowClimbing); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cigarette ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPortionSize ); + if (ItemAllowsClimbing(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsCigarette(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if ( HasItemFlag( cnt, DISEASEPROTECTION_1 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( HasItemFlag( cnt, DISEASEPROTECTION_2 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( HasItemFlag( cnt, BLOOD_BAG) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); @@ -2182,11 +2220,11 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotTargetingSkillGrant ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotChassisSkillGrant ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotUtilitySkillGrant ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotCamo ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotNightVision ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].fProvidesRobotLaserBonus ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].DiseaseSystemExclusive); + if (ItemProvidesRobotCamo(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\r\n"); } From 93e89798ec233eac96ebaf1ce88b81c0dc67033a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 2 Oct 2024 21:24:02 +0300 Subject: [PATCH 028/571] Merc can be assigned to patient in well-fed state (#327) Previously merc had to be in overfed state for both food and water --- Strategic/Assignments.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index eea73652..3645f296 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -1562,7 +1562,7 @@ BOOLEAN CanCharacterPatient( SOLDIERTYPE *pSoldier ) return ( TRUE ); // Flugente: stats can also be damaged - if ( !UsingFoodSystem() || ( pSoldier->bFoodLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel > FoodMoraleMods[FOOD_NORMAL].bThreshold ) ) + if ( !UsingFoodSystem() || ( pSoldier->bFoodLevel >= FoodMoraleMods[FOOD_NORMAL].bThreshold && pSoldier->bDrinkLevel >= FoodMoraleMods[FOOD_NORMAL].bThreshold ) ) { if ( pSoldier->usStarveDamageHealth > 0 || pSoldier->usStarveDamageStrength > 0 ) return ( TRUE ); From 8040c5d826da13da4d8fc562ad0c19f0d7c544c0 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:29:47 +0300 Subject: [PATCH 029/571] Use functions for logging load & save game times (#328) Less copy and paste. Allows these very simple timings to be logged from elsewhere as well. --- Ja2/CMakeLists.txt | 1 + Ja2/SaveLoadGame.cpp | 215 +++++++++---------------------------------- Ja2/TimeLogging.cpp | 72 +++++++++++++++ Ja2/TimeLogging.h | 8 ++ 4 files changed, 122 insertions(+), 174 deletions(-) create mode 100644 Ja2/TimeLogging.cpp create mode 100644 Ja2/TimeLogging.h diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index aeafd680..d4b60792 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -30,6 +30,7 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/TimeLogging.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp" diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 7d8cc015..dc30a1e7 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -138,7 +138,6 @@ #include "Map Screen Interface Map Inventory.h"//dnl ch51 081009 #include "Sys Globals.h"//dnl ch74 201013 #include "Ambient Control.h" // added by Flugente for HandleNewSectorAmbience(...) - ///////////////////////////////////////////////////// // // Local Defines @@ -177,7 +176,11 @@ extern void initMapViewAndBorderCoordinates(void); UINT32 guiNumberOfMapTempFiles; //Test purposes UINT32 guiSizeOfTempFiles; CHAR gzNameOfMapTempFile[128]; +#endif + //#define LOADSAVEGAME_LOGTIME 1 +#ifdef LOADSAVEGAME_LOGTIME +#include "TimeLogging.h" #endif extern SOLDIERTYPE *gpSMCurrentMerc; @@ -3588,14 +3591,8 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) alreadySaving = true; #ifdef LOADSAVEGAME_LOGTIME - // Flugente: log how long this takes - clock_t starttime = clock(); - clock_t t0; - clock_t t1 = starttime; - - FILE* fp_timelog = fopen("LoadSavedGame_TimeLog.txt", "a"); + TimingLogInitialize("TimeLog_LoadSavedGame.txt"); #endif - //clear out the save game header memset( &SaveGameHeader, 0, sizeof( SAVED_GAME_HEADER ) ); @@ -3775,14 +3772,9 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) //Create the name of the file CreateSavedGameFileNameFromNumber( ubSaveGameID, zSaveGameName ); #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - fprintf(fp_timelog, "Save savegame: %s\n", zSaveGameName); - - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "Shutdown stuff\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLogWrite("Save "); + TimingLogWrite(zSaveGameName); + TimingLog("\nShutdown stuff", 10); #endif //if the file already exists, delete it @@ -3919,12 +3911,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Tactical Status" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveTacticalStatusFromSavedGame done\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveTacticalStatusToSavedGame", 6); #endif @@ -3966,12 +3953,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Laptop Info" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveLaptopInfoFromSavedGame done\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveLaptopInfoToSavedGame", 7); #endif // @@ -4003,12 +3985,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Soldier Structure" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveSoldierStructure done\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveSoldierStructure", 8); #endif @@ -4071,12 +4048,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Strategic Information" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveStrategicInfoFromSavedFile done\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveStrategicInfoToSavedFile", 6); #endif /*// Flugente: Save the strategic supply @@ -4126,12 +4098,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Strategic Movement Groups" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveStrategicMovementGroupsFromSavedGameFile done\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveStrategicMovementGroupsToSaveGameFile", 3); #endif @@ -4148,12 +4115,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "All the Map Temp files" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveMapTempFilesFromSavedGameFile done\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveMapTempFilesToSavedGameFile", 6); #endif if( !SaveQuestInfoToSavedGameFile( hFile ) ) @@ -4319,12 +4281,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Militia Movement" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveMilitiaMovementInformationFromSavedGameFile done\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveMilitiaMovementInformationToSaveGameFile", 2); #endif if( !SaveBulletStructureToSaveGameFile( hFile ) ) @@ -4564,12 +4521,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) SaveGameFilePosition( FileGetPos( hFile ), "Lua global" ); #endif #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "SaveLuaGlobalFromLoadGameFile done\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("SaveLuaGlobalToSaveGameFile", 7); #endif if( !SaveDataSaveToSaveGameFile( hFile ) ) @@ -4669,12 +4621,7 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) goto FAILED_TO_SAVE; } #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "File read done\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } + TimingLog("File read done", 10); #endif //Close the saved game file @@ -4755,22 +4702,9 @@ BOOLEAN SaveGame( int ubSaveGameID, STR16 pGameDesc ) alreadySaving = false; #if LOADSAVEGAME_LOGTIME - if (fp_timelog) - { - t0 = t1; - t1 = clock(); - fprintf(fp_timelog, "Update functions\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } - - if (fp_timelog) - { - t0 = starttime; - t1 = clock(); - fprintf(fp_timelog, "SaveSavedGame total\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); - } - - if (fp_timelog) - fclose(fp_timelog); + TimingLog("Update functions", 9); + TimingLogTotalTime("SaveSavedGame total", 9); + TimingLogStop(); #endif return( TRUE ); @@ -4780,6 +4714,9 @@ FAILED_TO_SAVE: #ifdef JA2BETAVERSION SaveGameFilePosition( FileGetPos( hFile ), "Failed to Save!!!" ); #endif +#if LOADSAVEGAME_LOGTIME + TimingLogStop(); +#endif FileClose( hFile ); @@ -4825,8 +4762,6 @@ extern int gEnemyPreservedTempFileVersion[256]; extern int gCivPreservedTempFileVersion[256]; -#include "time.h" - BOOLEAN LoadSavedGame( int ubSavedGameID ) { HWFILE hFile; @@ -4845,12 +4780,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif #ifdef LOADSAVEGAME_LOGTIME - // Flugente: log how long this takes - clock_t starttime = clock(); - clock_t t0; - clock_t t1 = starttime; - - FILE *fp_timelog = fopen( "LoadSavedGame_TimeLog.txt", "a" ); + TimingLogInitialize("TimeLog_LoadSavedGame.txt"); #endif uiRelStartPerc = uiRelEndPerc =0; @@ -4933,14 +4863,9 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) CreateSavedGameFileNameFromNumber( ubSavedGameID, zSaveGameName ); #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - fprintf( fp_timelog, "Load savegame: %s\n", zSaveGameName ); - - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "Shutdown stuff\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLogWrite("Load "); + TimingLogWrite(zSaveGameName); + TimingLog("\nShutdown stuff", 10); #endif // open the save game file @@ -5061,19 +4986,14 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #ifdef JA2BETAVERSION LoadGameFilePosition( FileGetPos( hFile ), "Tactical Status" ); #endif +#if LOADSAVEGAME_LOGTIME + TimingLog("LoadTacticalStatusFromSavedGame", 6); +#endif //This gets reset by the above function gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; -#if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadTacticalStatusFromSavedGame done\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } -#endif //Load the game clock ingo if( !LoadGameClock( hFile ) ) @@ -5194,12 +5114,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadLaptopInfoFromSavedGame done\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("LoadLaptopInfoFromSavedGame", 7); #endif uiRelEndPerc += 0; @@ -5242,12 +5157,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadSoldierStructure done\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("LoadSoldierStructure", 8); #endif uiRelEndPerc += 1; @@ -5376,12 +5286,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadStrategicInfoFromSavedFile done\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("LoadStrategicInfoFromSavedFile", 6); #endif uiRelEndPerc += 1; @@ -5442,12 +5347,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) ValidateStrategicGroups(); #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadStrategicMovementGroupsFromSavedGameFile done\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("LoadStrategicMovementGroupsFromSavedGameFile", 2); #endif uiRelEndPerc += 30; @@ -5467,12 +5367,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadMapTempFilesFromSavedGameFile done\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("LoadMapTempFilesFromSavedGameFile", 5); #endif uiRelEndPerc += 1; @@ -5771,12 +5666,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadMilitiaMovementInformationFromSavedGameFile done\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("LoadMilitiaMovementInformationFromSavedGameFile", 2); #endif uiRelEndPerc += 1; @@ -6336,12 +6226,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) #endif #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "LoadLuaGlobalFromLoadGameFile done\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("LoadLuaGlobalFromLoadGameFile", 6); #endif if( guiCurrentSaveGameVersion >= VEHICLES_DATATYPE_CHANGE && guiCurrentSaveGameVersion < NO_VEHICLE_SAVE) @@ -6573,12 +6458,7 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) } #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "File read done\t\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } + TimingLog("File read done", 10); #endif // @@ -7023,22 +6903,9 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) gGameExternalOptions.gfAllowReinforcements = zDiffSetting[gGameOptions.ubDifficultyLevel].bAllowReinforcements; #if LOADSAVEGAME_LOGTIME - if ( fp_timelog ) - { - t0 = t1; - t1 = clock(); - fprintf( fp_timelog, "Update functions\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } - - if ( fp_timelog ) - { - t0 = starttime; - t1 = clock(); - fprintf( fp_timelog, "LoadSavedGame total\t\t\t\t\t\t\t\t\t\t\t\t: %fs\n\n", ( (float)( t1 - t0 ) / CLOCKS_PER_SEC ) ); - } - - if ( fp_timelog ) - fclose( fp_timelog ); + TimingLog("Update functions", 9); + TimingLogTotalTime("LoadSavedGame total", 9); + TimingLogStop(); #endif DebugQuestInfo("\n--------- Game loaded ---------"); diff --git a/Ja2/TimeLogging.cpp b/Ja2/TimeLogging.cpp new file mode 100644 index 00000000..a35f9853 --- /dev/null +++ b/Ja2/TimeLogging.cpp @@ -0,0 +1,72 @@ +#include "TimeLogging.h" +#include "time.h" +#include + + +clock_t starttime; +clock_t t0; +clock_t t1; +FILE* fp_timelog = nullptr; + + +static void indent(int n) +{ + for (int i = 0; i < n; i++) + fputc('\t', fp_timelog); +} + +void TimingLogInitialize(const CHAR8* filename) +{ + starttime = clock(); + t1 = starttime; + + if (!fp_timelog) + { + fp_timelog = fopen(filename, "a"); + } +} + + +void TimingLog(const CHAR8* logEvent, int n) +{ + if (fp_timelog) + { + t0 = t1; + t1 = clock(); + fprintf(fp_timelog, "%s", logEvent); + indent(n); + fprintf(fp_timelog, ": %f s\n", ((float)(t1 - t0) / CLOCKS_PER_SEC)); + } +} + + +void TimingLogTotalTime(const CHAR8* logEvent, int n) +{ + if (fp_timelog) + { + t1 = clock(); + fprintf(fp_timelog, "%s", logEvent); + indent(n); + fprintf(fp_timelog, ": %f s\n", ((float)(t1 - starttime) / CLOCKS_PER_SEC)); + } +} + + +void TimingLogWrite(const CHAR8* text) +{ + if (fp_timelog) + { + fprintf(fp_timelog, text); + } +} + + +void TimingLogStop() +{ + if (fp_timelog) + { + fprintf(fp_timelog, "\n"); + fclose(fp_timelog); + fp_timelog = nullptr; + } +} diff --git a/Ja2/TimeLogging.h b/Ja2/TimeLogging.h new file mode 100644 index 00000000..7caab289 --- /dev/null +++ b/Ja2/TimeLogging.h @@ -0,0 +1,8 @@ +#pragma once +#include "Types.h" + +void TimingLogInitialize(const CHAR8* filename); +void TimingLog(const CHAR8* logEvent, int n); +void TimingLogTotalTime(const CHAR8* logEvent, int n); +void TimingLogWrite(const CHAR8* text); +void TimingLogStop(); From 85ad2e5e7215c5304fc8ce73ae4eba3072ae5db3 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Fri, 8 Nov 2024 09:08:38 +0100 Subject: [PATCH 030/571] Text EDB Pop-up Disease Protection adjusted - face protection had a misleading text, stating item should be worn at face - that's no longer true, so adjusted text to avoid player confusion - adjusted text to distinguish between both disease protections variations --- Utils/_EnglishText.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index d2684b28..820bef40 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -8736,8 +8736,8 @@ STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]= L"\n \nThis item requires both hands to be used.", L"\n \nThis item will block your iron sights\nso you cannot use them.", L"\n \nThis ammo can destroy light walls\nand various other objects.", - L"\n \nIf worn on your face, this will lower\nthe chance to be infected by other people.", - L"\n \nIf kept in your inventory, this will lower\nthe chance to be infected by other people.", + L"\n \nIf kept ready in your inventory,\nthis will lower the chance to be infected\nby airborne transmitted pathogens of other people.", + L"\n \nIf kept ready in your inventory,\nthis will lower the chance to be infected\nby contact transmitted pathogens of other people.", L"\n \nIf equipped in a hand, this will block incoming damage.", L"\n \nYou can take photos with this.", L"\n \nThis item makes you more effective at burying corpses.", From f48fadb8025f63741d914eb265077cac71b240cb Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Nov 2024 23:50:52 +0200 Subject: [PATCH 031/571] Improve AbstractXMLParser error reporting (#330) The more detailed error message that used to go only to Livelog.txt is now also displayed in the ingame error screen, providing more helpful error message to players when making bug reports/asking for help --- Ja2/Init.cpp | 12 +++++++----- Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp | 9 +++++---- Tactical/LogicalBodyTypes/AbstractXMLLoader.h | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 605a13a7..44a90d76 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -438,11 +438,13 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) if (isMultiplayer == false) { using namespace LogicalBodyTypes; - SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME), LBT_LAYERSFILENAME); - SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME), LBT_PALETTESFILENAME); - SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME), LBT_ANIMSURFACESFILENAME); - SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME), LBT_FILTERSFILENAME); - SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME), LBT_BODYTYPESFILENAME); + CHAR8 errorBuf[512]{"Failed loading LogicalBodyTypes external data!"}; + + SGP_THROW_IFFALSE(Layers::Instance().LoadFromFile(directoryName, LBT_LAYERSFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(PaletteDB::Instance().LoadFromFile(directoryName, LBT_PALETTESFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(SurfaceDB::Instance().LoadFromFile(directoryName, LBT_ANIMSURFACESFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(FilterDB::Instance().LoadFromFile(directoryName, LBT_FILTERSFILENAME, errorBuf), errorBuf); + SGP_THROW_IFFALSE(BodyTypeDB::Instance().LoadFromFile(directoryName, LBT_BODYTYPESFILENAME, errorBuf), errorBuf); } } diff --git a/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp b/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp index ab182259..93d74672 100644 --- a/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp +++ b/Tactical/LogicalBodyTypes/AbstractXMLLoader.cpp @@ -24,14 +24,15 @@ AbstractXMLLoader::ParseData* AbstractXMLLoader::MakeParseData(XML_Parser* parse return new ParseData(parser); } -bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* fileName) { +bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* fileName, CHAR8* errorBuf) { HWFILE hFile; UINT32 uiBytesRead; UINT32 uiFSize; CHAR8* lpcBuffer; char fileNameFull[MAX_PATH + 1]; if (strlen(fileName) + strlen(directoryName) >= MAX_PATH) { - LiveMessage("Can't load file. Concatinated filename too long for buffer!"); + sprintf(errorBuf, "Can't load file %s%s, Concatenated filename too long for buffer!", directoryName, fileName); + LiveMessage(errorBuf); return false; } SetDirectoryName(directoryName); @@ -46,12 +47,14 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file DebugMsg(TOPIC_JA2, DBG_LEVEL_3, msg.c_str()); hFile = FileOpen(fileNameFull, FILE_ACCESS_READ, FALSE); if (!hFile) { + sprintf(errorBuf, "Can't open %s", fileNameFull); delete data; return false; } uiFSize = FileGetSize(hFile); lpcBuffer = (CHAR8*)MemAlloc(uiFSize + 1); if (!FileRead(hFile, lpcBuffer, uiFSize, &uiBytesRead)) { + sprintf(errorBuf, "Error reading %s to buffer", fileNameFull); MemFree(lpcBuffer); delete data; return false; @@ -72,7 +75,6 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file try { if (!XML_Parse(parser, lpcBuffer, uiFSize, TRUE)) { - CHAR8 errorBuf[512]; sprintf(errorBuf, "XML Parser Error in %s[%d]: %s", fileNameFull, XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser))); LiveMessage(errorBuf); MemFree(lpcBuffer); @@ -80,7 +82,6 @@ bool AbstractXMLLoader::LoadFromFile(const char* directoryName, const char* file return false; } } catch (XMLParseException e) { - CHAR8 errorBuf[512]; sprintf(errorBuf, "XML Parser Exception in %s[%d]: %s", fileNameFull, e._LINE, e.what()); LiveMessage(errorBuf); MemFree(lpcBuffer); diff --git a/Tactical/LogicalBodyTypes/AbstractXMLLoader.h b/Tactical/LogicalBodyTypes/AbstractXMLLoader.h index 765c127b..20749ba0 100644 --- a/Tactical/LogicalBodyTypes/AbstractXMLLoader.h +++ b/Tactical/LogicalBodyTypes/AbstractXMLLoader.h @@ -55,7 +55,7 @@ private: public: AbstractXMLLoader(XML_StartElementHandler startHandler, XML_EndElementHandler endHandler, XML_CharacterDataHandler charHandler, ParseDataFactoryFunc parseDataFactF = MakeParseData); ~AbstractXMLLoader(void); - bool LoadFromFile(const char* directoryName, const char* fileName); + bool LoadFromFile(const char* directoryName, const char* fileName, CHAR8* errorBuf); const char* GetFileName(); const char* GetDirectoryName(); void SetFileName(const char* fileName); From 4e253d0ec0e14a35af6ad3594e44fec3c64192a6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:24:10 +0200 Subject: [PATCH 032/571] Update Dialogue Control.cpp Fix an access to member variable that prevented compilation --- Tactical/Dialogue Control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 659c8c48..6ffe3ee1 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -900,11 +900,11 @@ void HandleDialogue( ) } else if ( QItem.uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_CONTRACT_WANTS_TO_RENEW ) { - HandleMercIsWillingToRenew( (UINT16)QItem->uiSpecialEventData ); + HandleMercIsWillingToRenew( (UINT16)QItem.uiSpecialEventData ); } else if ( QItem.uiSpecialEventFlag & DIALOGUE_SPECIAL_EVENT_CONTRACT_NOGO_TO_RENEW ) { - HandleMercIsNotWillingToRenew( (UINT16)QItem->uiSpecialEventData ); + HandleMercIsNotWillingToRenew( (UINT16)QItem.uiSpecialEventData ); } else { From 17875978e0feef80b95215dd39299e3786296977 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:24:30 +0200 Subject: [PATCH 033/571] Update LOS.cpp Fix missing variable declaration --- Tactical/LOS.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 9f70af34..d7ad5a97 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -2434,7 +2434,7 @@ INT32 SoldierToLocationWindowTest( SOLDIERTYPE * pStartSoldier, INT32 sEndGridNo INT32 SoldierTo3DLocationLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, INT8 bAware, int iTileSightLimit, bool adjustForSight ) { FLOAT dStartZPos, dEndZPos; - INT16 sXPos, sYPos; + INT16 sX, sY, sX2, sY2; UINT16 ubTargetID; BOOLEAN fOk; From bc870123bf7e7f633472d80f144890e18d17b428 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:29:07 +0200 Subject: [PATCH 034/571] Implement page scrolling in Laptop Personnel page Pressing Shift and right or left arrow buttons, 'a' or 'd' buttons, or previous or next ingame buttons now advance one whole page. Without shift pressed down, all three function as original and move one merc at a time. --- Laptop/personnel.cpp | 153 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 141 insertions(+), 12 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 935b5cf0..524465d9 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -921,7 +921,7 @@ void RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired, // WDS - make number of mercenaries, etc. be configurable -BOOLEAN NextPersonnelFace( void ) +static BOOLEAN NextPersonnelFace( void ) { if (fCurrentTeamMode) { @@ -965,7 +965,7 @@ BOOLEAN NextPersonnelFace( void ) return TRUE; } -BOOLEAN PrevPersonnelFace( void ) +static BOOLEAN PrevPersonnelFace( void ) { if (fCurrentTeamMode) { // Anyone to display? @@ -1021,6 +1021,107 @@ BOOLEAN PrevPersonnelFace( void ) return TRUE; } +static BOOLEAN NextPersonnelFacePage(void) +{ + if (fCurrentTeamMode) + { + // Anyone to display? + if (currentTeamIndex == -1) { + return TRUE; + } + + fReDrawScreenFlag = TRUE; + // wrap around? + currentTeamIndex += MAX_MERCS_ON_SCREEN; + if (currentTeamIndex >= maxCurrentTeamIndex) + { + currentTeamIndex = 0; + currentTeamFirstIndex = 0; + return FALSE; + } + else + { + currentTeamFirstIndex += MAX_MERCS_ON_SCREEN; + } + } + else { + // Anyone to display? + if (iCurPortraitId == -1) { + return TRUE; + } + + iCurPortraitId += MAX_MERCS_ON_SCREEN; + if (iCurPortraitId >= (GetNumberOfDeadOnPastTeam() + GetNumberOfLeftOnPastTeam() + GetNumberOfOtherOnPastTeam()) - giCurrentUpperLeftPortraitNumber) + { + // about to go off the end + giCurrentUpperLeftPortraitNumber = 0; + iCurPortraitId = 0; + } + else + { + giCurrentUpperLeftPortraitNumber += MAX_MERCS_ON_SCREEN; + iCurPortraitId = 0; + } + + // get of this merc in this slot + iCurrentPersonSelectedId = iCurPortraitId; + fReDrawScreenFlag = TRUE; + } + + return TRUE; +} + +static BOOLEAN PrevPersonnelFacePage(void) +{ + if (fCurrentTeamMode) { + // Anyone to display? + if (currentTeamIndex == -1) { + return TRUE; + } + + fReDrawScreenFlag = TRUE; + currentTeamIndex -= MAX_MERCS_ON_SCREEN; + // wrap around? + if (currentTeamIndex <= 0) { + currentTeamIndex = maxCurrentTeamIndex; + currentTeamFirstIndex = (currentTeamIndex / MAX_MERCS_ON_SCREEN) * MAX_MERCS_ON_SCREEN; + if (currentTeamIndex == 0) { + return FALSE; + } + } + else { + currentTeamFirstIndex -= MAX_MERCS_ON_SCREEN; + } + } + else + { + // Anyone to display? + if (iCurPortraitId == -1) { + return TRUE; + } + + iCurPortraitId -= MAX_MERCS_ON_SCREEN; + + if ((iCurPortraitId <= 0) && (giCurrentUpperLeftPortraitNumber == 0)) + { + // about to go off the end + giCurrentUpperLeftPortraitNumber = (GetNumberOfDeadOnPastTeam() + GetNumberOfLeftOnPastTeam() + GetNumberOfOtherOnPastTeam()) - (GetNumberOfDeadOnPastTeam() + GetNumberOfLeftOnPastTeam() + GetNumberOfOtherOnPastTeam()) % MAX_MERCS_ON_SCREEN; + iCurPortraitId = (GetNumberOfDeadOnPastTeam() + GetNumberOfLeftOnPastTeam() + GetNumberOfOtherOnPastTeam()) % MAX_MERCS_ON_SCREEN; + } + else + { + giCurrentUpperLeftPortraitNumber -= MAX_MERCS_ON_SCREEN; + iCurPortraitId = MAX_MERCS_ON_SCREEN - 1; + } + // get of this merc in this slot + + iCurrentPersonSelectedId = iCurPortraitId; + fReDrawScreenFlag = TRUE; + } + + return TRUE; +} + void CreatePersonnelButtons( void ) { @@ -1109,7 +1210,14 @@ void LeftButtonCallBack(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags&=~(BUTTON_CLICKED_ON); fReDrawScreenFlag=TRUE; - PrevPersonnelFace( ); + if (_KeyDown(SHIFT)) + { + PrevPersonnelFacePage(); + } + else + { + PrevPersonnelFace( ); + } uiCurrentInventoryIndex = 0; guiSliderPosition = 0; @@ -1156,21 +1264,26 @@ void RightButtonCallBack(GUI_BUTTON *btn,INT32 reason) { if(!(btn->uiFlags & BUTTON_CLICKED_ON)) { - fReDrawScreenFlag=TRUE; + fReDrawScreenFlag=TRUE; } - btn->uiFlags|=(BUTTON_CLICKED_ON); + btn->uiFlags|=(BUTTON_CLICKED_ON); } else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) { if(btn->uiFlags & BUTTON_CLICKED_ON) { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - NextPersonnelFace( ); - uiCurrentInventoryIndex = 0; - guiSliderPosition = 0; - - + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fReDrawScreenFlag=TRUE; + if (_KeyDown(SHIFT)) + { + NextPersonnelFacePage(); + } + else + { + NextPersonnelFace( ); + } + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; } } } @@ -6759,6 +6872,22 @@ void HandlePersonnelKeyboard( void ) guiSliderPosition = 0; fPausedReDrawScreenFlag = TRUE; break; + case SHIFT_LEFTARROW: + case 'A': + fReDrawScreenFlag = TRUE; + PrevPersonnelFacePage(); + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + fPausedReDrawScreenFlag = TRUE; + break; + case SHIFT_RIGHTARROW: + case 'D': + fReDrawScreenFlag = TRUE; + NextPersonnelFacePage(); + uiCurrentInventoryIndex = 0; + guiSliderPosition = 0; + fPausedReDrawScreenFlag = TRUE; + break; case SHIFT_TAB: if ( !fCurrentTeamMode ) { From f99065d0c6df5d120703d8379633a4bff5847000 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 15:30:42 +0200 Subject: [PATCH 035/571] Remove unused button callback functions Unimplemented feature of browsing 4 mercs forward/backwards in personnel page. --- Laptop/personnel.cpp | 62 -------------------------------------------- 1 file changed, 62 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 524465d9..be713290 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -322,8 +322,6 @@ void RenderPersonnelStats(INT32 iId, INT32 iSlot); void RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ); void LeftButtonCallBack(GUI_BUTTON *btn,INT32 reason); void RightButtonCallBack(GUI_BUTTON *btn,INT32 reason); -void LeftFFButtonCallBack(GUI_BUTTON *btn,INT32 reason); -void RightFFButtonCallBack(GUI_BUTTON *btn,INT32 reason); void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ); void CreatePersonnelButtons( void ); void DeletePersonnelButtons( void ); @@ -1225,36 +1223,6 @@ void LeftButtonCallBack(GUI_BUTTON *btn,INT32 reason) } } -void LeftFFButtonCallBack(GUI_BUTTON *btn,INT32 reason) -{ - if (!(btn->uiFlags & BUTTON_ENABLED)) - return; - - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { - fReDrawScreenFlag=TRUE; - } - btn->uiFlags|=(BUTTON_CLICKED_ON); - } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if(btn->uiFlags & BUTTON_CLICKED_ON) - { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - PrevPersonnelFace( ); - PrevPersonnelFace( ); - PrevPersonnelFace( ); - PrevPersonnelFace( ); - - // set states - SetPersonnelButtonStates( ); - } - } -} - void RightButtonCallBack(GUI_BUTTON *btn,INT32 reason) { if (!(btn->uiFlags & BUTTON_ENABLED)) @@ -1288,36 +1256,6 @@ void RightButtonCallBack(GUI_BUTTON *btn,INT32 reason) } } -void RightFFButtonCallBack(GUI_BUTTON *btn,INT32 reason) -{ - if (!(btn->uiFlags & BUTTON_ENABLED)) - return; - - if(reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) - { - if(!(btn->uiFlags & BUTTON_CLICKED_ON)) - { - fReDrawScreenFlag=TRUE; - } - btn->uiFlags|=(BUTTON_CLICKED_ON); - } - else if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) - { - if(btn->uiFlags & BUTTON_CLICKED_ON) - { - btn->uiFlags&=~(BUTTON_CLICKED_ON); - fReDrawScreenFlag=TRUE; - NextPersonnelFace( ); - NextPersonnelFace( ); - NextPersonnelFace( ); - NextPersonnelFace( ); - - // set states - SetPersonnelButtonStates( ); - } - } -} - void DisplayHeader( void ) { SetFont(PERS_HEADER_FONT); From a81820d0d7985686f779c06c0e5bfb6fd28b6e69 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:46:39 +0200 Subject: [PATCH 036/571] Fix UB compilation --- Tactical/Overhead.cpp | 6 +++--- Tactical/Overhead.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 88f58a42..1b155c8d 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -10876,11 +10876,11 @@ BOOLEAN CanMsgBoxForPlayerToBeNotifiedOfSomeoneElseInSector() } -INT8 NumMercsOnPlayerTeam( ) +UINT16 NumMercsOnPlayerTeam( ) { - INT32 cnt; + INT32 cnt; SOLDIERTYPE *pSoldier; - UINT8 ubCount = 0; + UINT16 ubCount = 0; cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 4d2ba7d9..33c6cfae 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -333,10 +333,10 @@ void SetMsgBoxForPlayerBeNotifiedOfSomeoneElseInSector(); void HandleDisplayingOfPlayerLostDialogue( ); // UTILITY FUNCTIONS -INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); -UINT8 NumEnemyInSector( ); -UINT8 NumCapableEnemyInSector( ); -INT8 NumMercsOnPlayerTeam( ); +UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); +UINT16 NumEnemyInSector( ); +UINT16 NumCapableEnemyInSector( ); +UINT16 NumMercsOnPlayerTeam( ); #endif extern BOOLEAN sniperwarning; From 2b024d63c6598bbb0b87b13adeb86f4f8def8cb0 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:46:55 +0200 Subject: [PATCH 037/571] Fix endless loop --- Tactical/Turn Based Input.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index e502460a..6346f087 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -2209,7 +2209,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // sevenfm: unready weapon for all selected if (!fFound) { - UINT8 cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + UINT16 cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; for (SOLDIERTYPE *pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pSoldier++) { if (pSoldier->bActive && pSoldier->bInSector && pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED && WeaponReady(pSoldier)) @@ -8311,7 +8311,7 @@ void HandleTBBackpacks(void) bool backpackDropped = false; SOLDIERTYPE* pTeamSoldier; - for (UINT8 ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++) + for (UINT16 ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++) { pTeamSoldier = MercPtrs[ubLoop]; From fdd6859726327f36d568ab329a9dd2067e35ac21 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 20:23:38 +0200 Subject: [PATCH 038/571] Implement multiselection for contract renewal --- Strategic/Assignments.cpp | 216 ++++++++++++++++++++++++++++++++------ Strategic/mapscreen.cpp | 90 +++++++++++++++- Strategic/mapscreen.h | 4 +- 3 files changed, 273 insertions(+), 37 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index d68ef086..ec1410df 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -560,8 +560,6 @@ void HandleShadingOfLinesForSnitchSectorMenu( void ); // Flugente: prisoner menu void HandleShadingOfLinesForPrisonerMenu( void ); -// post message about contract -void PostContractMessage( SOLDIERTYPE *pCharacter, INT32 iContract ); BOOLEAN DisplayVehicleMenu( SOLDIERTYPE *pSoldier ); BOOLEAN DisplayRepairMenu( SOLDIERTYPE *pSoldier ); @@ -12879,40 +12877,69 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) switch( iValue ) { - case( CONTRACT_MENU_DAY ): - MercContractHandling( pSoldier, CONTRACT_EXTEND_1_DAY ); - PostContractMessage( pSoldier, CONTRACT_EXTEND_1_DAY ); + case( CONTRACT_MENU_DAY ): + if (gSelectedSoldiers.size() > 0) + { + for (size_t i=0; i < gSelectedSoldiers.size(); ++i) + { + pSoldier = gSelectedSoldiers[i]; + MercContractHandling(pSoldier, CONTRACT_EXTEND_1_DAY); + } + } + else + { + MercContractHandling( pSoldier, CONTRACT_EXTEND_1_DAY ); + } fOkToClose = TRUE; break; case( CONTRACT_MENU_WEEK ): - MercContractHandling( pSoldier, CONTRACT_EXTEND_1_WEEK ); - PostContractMessage( pSoldier, CONTRACT_EXTEND_1_WEEK ); + if (gSelectedSoldiers.size() > 0) + { + for (size_t i = 0; i < gSelectedSoldiers.size(); ++i) + { + pSoldier = gSelectedSoldiers[i]; + MercContractHandling(pSoldier, CONTRACT_EXTEND_1_WEEK); + } + } + else + { + MercContractHandling(pSoldier, CONTRACT_EXTEND_1_WEEK); + } fOkToClose = TRUE; break; case( CONTRACT_MENU_TWO_WEEKS ): - MercContractHandling( pSoldier, CONTRACT_EXTEND_2_WEEK ); - PostContractMessage( pSoldier, CONTRACT_EXTEND_2_WEEK ); + if (gSelectedSoldiers.size() > 0) + { + for (size_t i = 0; i < gSelectedSoldiers.size(); ++i) + { + pSoldier = gSelectedSoldiers[i]; + MercContractHandling(pSoldier, CONTRACT_EXTEND_2_WEEK); + } + } + else + { + MercContractHandling(pSoldier, CONTRACT_EXTEND_2_WEEK); + } fOkToClose = TRUE; break; case( CONTRACT_MENU_TERMINATE ): - gpDismissSoldier = pSoldier; + gpDismissSoldier = pSoldier; - // If in the renewal sequence.. do right away... - // else put up requester. - if ( gfInContractMenuFromRenewSequence ) - { - MercDismissConfirmCallBack( MSG_BOX_RETURN_YES ); - } - else - { - // The game should be unpaused when this message box disappears - UnPauseGame(); - DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 48 ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, MercDismissConfirmCallBack ); - } - - fOkToClose = TRUE; + // If in the renewal sequence.. do right away... + // else put up requester. + if ( gfInContractMenuFromRenewSequence ) + { + MercDismissConfirmCallBack( MSG_BOX_RETURN_YES ); + } + else + { + // The game should be unpaused when this message box disappears + UnPauseGame(); + DoMapMessageBox( MSG_BOX_BASIC_STYLE, gzLateLocalizedString[ 48 ], MAP_SCREEN, MSG_BOX_FLAG_YESNO, MercDismissConfirmCallBack ); + } + fOkToClose = TRUE; break; } @@ -12929,14 +12956,13 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) fGlowContractRegion = FALSE; fShowContractMenu = FALSE; - // dirty region + // dirty region fTeamPanelDirty = TRUE; fMapScreenBottomDirty = TRUE; fCharacterInfoPanelDirty = TRUE; - gfRenderPBInterface = TRUE; + gfRenderPBInterface = TRUE; } - return; } @@ -14723,14 +14749,6 @@ void HandleShadingOfLinesForSquadMenu( void ) } -void PostContractMessage( SOLDIERTYPE *pCharacter, INT32 iContract ) -{ - // send a message stating that offer of contract extension made - //MapScreenMessage(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Offered to extend %s's contract by another %s.", pCharacter->GetName(), pContractExtendStrings[ iContract ] ); - - return; -} - BOOLEAN DisplayVehicleMenu( SOLDIERTYPE *pSoldier ) { BOOLEAN fVehiclePresent=FALSE; @@ -15294,6 +15312,134 @@ void CreateContractBox( SOLDIERTYPE *pCharacter ) } + +void CreateContractBoxMultiSelect(INT32 DailySalaries, INT32 WeeklySalaries, INT32 BiweeklySalaries) +{ + UINT32 hStringHandle; + UINT32 uiCounter; + CHAR16 sString[50]; + CHAR16 sDollarString[50]; + + // rebuild contractbox for this merc + RemoveBox(ghContractBox); + ghContractBox = -1; + fShowContractMenu = TRUE; + + ContractPosition.iX = (SCREEN_WIDTH - INTERFACE_WIDTH) / 2 + OrigContractPosition.iX; + ContractPosition.iY = yResOffset + OrigContractPosition.iY; + + if (giBoxY != 0) + { + ContractPosition.iX = giBoxY; + } + + CreatePopUpBox(&ghContractBox, ContractDimensions, ContractPosition, (POPUP_BOX_FLAG_CLIP_TEXT | POPUP_BOX_FLAG_RESIZE)); + SetBoxBuffer(ghContractBox, FRAME_BUFFER); + SetBorderType(ghContractBox, guiPOPUPBORDERS); + SetBackGroundSurface(ghContractBox, guiPOPUPTEX); + SetMargins(ghContractBox, 6, 6, 4, 4); + SetLineSpace(ghContractBox, 2); + + // set current box to this one + SetCurrentBox(ghContractBox); + + // not null character? + //if (pCharacter != NULL) + { + for (uiCounter = 0; uiCounter < MAX_CONTRACT_MENU_STRING_COUNT; uiCounter++) + { + switch (uiCounter) + { + case(CONTRACT_MENU_CURRENT_FUNDS): + /* + // add current balance after title string + swprintf( sDollarString, L"%d", LaptopSaveInfo.iCurrentBalance); + InsertCommasForDollarFigure( sDollarString ); + InsertDollarSignInToString( sDollarString ); + swprintf( sString, L"%s %s", pContractStrings[uiCounter], sDollarString ); + AddMonoString(&hStringHandle, sString); + */ + AddMonoString(&hStringHandle, pContractStrings[uiCounter]); + break; + case(CONTRACT_MENU_DAY): + + //if (pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC) + //{ + // swprintf(sDollarString, L"%d", 0); + //} + //else + { + swprintf(sDollarString, L"%d", DailySalaries); + } + InsertCommasForDollarFigure(sDollarString); + InsertDollarSignInToString(sDollarString); + swprintf(sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString); + AddMonoString(&hStringHandle, sString); + break; + case(CONTRACT_MENU_WEEK): + + //if (pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC) + //{ + // swprintf(sDollarString, L"%d", 0); + //} + //else + { + swprintf(sDollarString, L"%d", WeeklySalaries); + } + + InsertCommasForDollarFigure(sDollarString); + InsertDollarSignInToString(sDollarString); + swprintf(sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString); + AddMonoString(&hStringHandle, sString); + break; + case(CONTRACT_MENU_TWO_WEEKS): + + //if (pCharacter->ubWhatKindOfMercAmI != MERC_TYPE__AIM_MERC) + //{ + // swprintf(sDollarString, L"%d", 0); + //} + //else + { + swprintf(sDollarString, L"%d", BiweeklySalaries); + } + + + InsertCommasForDollarFigure(sDollarString); + InsertDollarSignInToString(sDollarString); + swprintf(sString, L"%s ( %s )", pContractStrings[uiCounter], sDollarString); + AddMonoString(&hStringHandle, sString); + break; + default: + AddMonoString(&hStringHandle, pContractStrings[uiCounter]); + break; + } + UnHighLightLine(hStringHandle); + } + } + + + SetBoxFont(ghContractBox, MAP_SCREEN_FONT); + SetBoxHighLight(ghContractBox, FONT_WHITE); + SetBoxForeground(ghContractBox, FONT_LTGREEN); + SetBoxBackground(ghContractBox, FONT_BLACK); + + // shaded color..for darkened text + SetBoxShade(ghContractBox, FONT_GRAY7); + + //if (pCharacter != NULL) + { + // now set the color for the current balance value + SetBoxLineForeground(ghContractBox, 0, FONT_YELLOW); + } + + // resize box to text + ResizeBoxToText(ghContractBox); + + fTeamPanelDirty = TRUE; + fCharacterInfoPanelDirty = TRUE; +} + + void CreateAttributeBox( void ) { UINT32 hStringHandle; diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index cac4c6b3..d1bf91a4 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -131,6 +131,8 @@ #include "LuaInitNPCs.h" #endif +std::vector gSelectedSoldiers{}; + // Flugente: militia movement // plot @@ -790,6 +792,7 @@ void InterruptTimeForMenus( void ); void CreateAttributeBox( void ); void CreateVehicleBox( void ); void CreateContractBox( SOLDIERTYPE *pCharacter ); +void CreateContractBoxMultiSelect(INT32 DailySalaries, INT32 WeeklySalaries, INT32 BiweeklySalaries); void CreateAssignmentsBox( void ); void CreateTrainingBox( void ); void CreateMercRemoveAssignBox( void ); @@ -12014,6 +12017,67 @@ void TeamListSleepRegionMvtCallBack( MOUSE_REGION *pRegion, INT32 iReason ) } +static void HandleSelectedMercsContract() +{ + INT32 iCounter = 0; + UINT8 ubNumberOfSelectedSoldiers = 0; + INT32 DailySalaries = 0; + INT32 WeeklySalaries = 0; + INT32 BiweeklySalaries = 0; + SOLDIERTYPE* pSoldier = nullptr; + gSelectedSoldiers.clear(); + + for (iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter) + { + pSoldier = nullptr; + + // if the current character in the list is valid...then grab soldier pointer for the character + if (gCharactersList[iCounter].fValid) + { + // get the soldier pointer + pSoldier = &Menptr[gCharactersList[iCounter].usSolID]; + + if (pSoldier->bActive == FALSE) + { + continue; + } + + if (IsEntryInSelectedListSet((INT8)iCounter) == FALSE) + { + continue; + } + + if (CanExtendContractForCharSlot((INT8)iCounter)) + { + // up the total number of soldiers + gSelectedSoldiers.push_back(pSoldier); + ubNumberOfSelectedSoldiers++; + + DailySalaries += gMercProfiles[pSoldier->ubProfile].sSalary; + WeeklySalaries += gMercProfiles[pSoldier->ubProfile].uiWeeklySalary; + BiweeklySalaries += gMercProfiles[pSoldier->ubProfile].uiBiWeeklySalary; + + bSelectedContractChar = bSelectedInfoChar; + giContractHighLine = bSelectedContractChar; + } + } + } + + if (ubNumberOfSelectedSoldiers > 1) + { + for (size_t i = 0; i < ubNumberOfSelectedSoldiers; i++) + { + CheckIfSalaryIncreasedAndSayQuote(gSelectedSoldiers[i], false); + } + + CreateContractBoxMultiSelect(DailySalaries, WeeklySalaries, BiweeklySalaries); + } + else if (ubNumberOfSelectedSoldiers == 1) + { + RequestContractMenu(); + } +} + void TeamListContractRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) { @@ -12027,6 +12091,7 @@ void TeamListContractRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // marke strogg more mercs must add skipped mercs FIRSTmercTOdisplay iValue = MSYS_GetRegionUserData( pRegion, 0 ); +#if 0 if( gCharactersList[ iValue ].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) @@ -12047,7 +12112,29 @@ void TeamListContractRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) ContractRegionBtnCallback( pRegion, iReason ); } +#else + if (iReason & MSYS_CALLBACK_REASON_LBUTTON_UP) + { + if ((gCharactersList[iValue + FIRSTmercTOdisplay].fValid == TRUE)) + { + // HEADROCK HAM B2.8: Added argument for multi-select entire squads + if (HandleCtrlOrShiftInTeamPanel((INT8)iValue + FIRSTmercTOdisplay, FALSE)) + { + return; + } + // reset list if the clicked character isn't also selected + ChangeSelectedInfoChar((INT8)iValue + FIRSTmercTOdisplay, (BOOLEAN)(IsEntryInSelectedListSet((INT8)iValue + FIRSTmercTOdisplay) == FALSE)); + + HandleSelectedMercsContract(); + } + else + { + // reset selected characters + ResetAllSelectedCharacterModes(); + } + } +#endif if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { // reset selected characters @@ -12741,7 +12828,8 @@ void HandleShadingOfLinesForContractMenu( void ) } // if THIS soldier is involved in a fight (dismissing in a hostile sector IS ok...) - if( ( gTacticalStatus.uiFlags & INCOMBAT ) && pSoldier->bInSector ) + // Also if we have multiple mercs selected, disable terminating contracts + if( gSelectedSoldiers.size() > 0 || (( gTacticalStatus.uiFlags & INCOMBAT ) && pSoldier->bInSector )) { ShadeStringInBox( ghContractBox, CONTRACT_MENU_TERMINATE ); } diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index 47ae7936..44deeb25 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -134,6 +134,8 @@ extern BOOLEAN gfInChangeArrivalSectorMode; extern BOOLEAN gfSkyriderEmptyHelpGiven; +extern std::vector gSelectedSoldiers; + BOOLEAN SetInfoChar(UINT16 ubID); void EndMapScreen( BOOLEAN fDuringFade ); @@ -228,4 +230,4 @@ void RetreatBandageCallback( UINT8 ubResult ); bool isWidescreenUI(void); -#endif \ No newline at end of file +#endif From 5cf0ef4bdefc3a379f886961561648ab2def8411 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 9 Nov 2024 22:52:21 +0200 Subject: [PATCH 039/571] Correct variables from INT8 to INT16 --- Ja2/SaveLoadGame.cpp | 14 +- Ja2/gamescreen.cpp | 8 +- Strategic/Assignments.cpp | 2 +- Strategic/Map Screen Interface.cpp | 40 +++--- Strategic/Map Screen Interface.h | 12 +- Strategic/mapscreen.cpp | 58 ++++---- Tactical/Overhead.h | 204 ++++++++++++++--------------- Tactical/Soldier Control.h | 2 +- 8 files changed, 170 insertions(+), 170 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 7af72c6b..575b25b7 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -304,7 +304,7 @@ typedef struct INT16 sContractRehireSoldierID; - GAME_OPTIONS GameOptions; + GAME_OPTIONS GameOptions; UINT32 uiSeedNumber; @@ -322,7 +322,7 @@ typedef struct BOOLEAN fDisableMapInterfaceDueToBattle; INT32 sBoxerGridNo[ NUM_BOXERS ]; - UINT8 ubBoxerID[ NUM_BOXERS ]; + UINT16 ubBoxerID[ NUM_BOXERS ]; BOOLEAN fBoxerFought[ NUM_BOXERS ]; BOOLEAN fHelicopterDestroyed; //if the chopper is destroyed @@ -412,7 +412,7 @@ typedef struct UINT32 uiMeanWhileFlags; - INT8 bSelectedInfoChar; + INT16 bSelectedInfoChar; INT8 bHospitalPriceModifier; INT8 bUnused2[ 2 ]; @@ -1936,7 +1936,7 @@ use of this function should allow changes to be made to various structures withi INT32 ReadFieldByField(HWFILE hFile, PTR pDest, UINT32 uiFieldSize, UINT32 uiElementSize, UINT32 uiCurByteCount) { UINT32 uiNumBytesRead; - char padding[10]; + char padding[10]; UINT32 uiBytesRead = uiCurByteCount; // used to track our new byte count UINT32 sampleBytesRead = uiBytesRead; // used to determine how much padding is needed @@ -8794,7 +8794,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fDisableDueToBattleRoster, sizeof(sGeneralInfo.fDisableDueToBattleRoster), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fDisableMapInterfaceDueToBattle, sizeof(sGeneralInfo.fDisableMapInterfaceDueToBattle), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sBoxerGridNo, sizeof(sGeneralInfo.sBoxerGridNo), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubBoxerID, sizeof(sGeneralInfo.ubBoxerID), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubBoxerID, sizeof(sGeneralInfo.ubBoxerID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fBoxerFought, sizeof(sGeneralInfo.fBoxerFought), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fHelicopterDestroyed, sizeof(sGeneralInfo.fHelicopterDestroyed), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fShowMapScreenHelpText, sizeof(sGeneralInfo.fShowMapScreenHelpText), sizeof(BOOLEAN), numBytesRead); @@ -8872,7 +8872,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fExplosionQueueActive, sizeof(sGeneralInfo.fExplosionQueueActive), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubUnused, sizeof(sGeneralInfo.ubUnused), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.uiMeanWhileFlags, sizeof(sGeneralInfo.uiMeanWhileFlags), sizeof(UINT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.bSelectedInfoChar, sizeof(sGeneralInfo.bSelectedInfoChar), sizeof(INT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.bSelectedInfoChar, sizeof(sGeneralInfo.bSelectedInfoChar), sizeof(INT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.bHospitalPriceModifier, sizeof(sGeneralInfo.bHospitalPriceModifier), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.bUnused2, sizeof(sGeneralInfo.bUnused2), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.iHospitalTempBalance, sizeof(sGeneralInfo.iHospitalTempBalance), sizeof(INT32), numBytesRead); @@ -9096,7 +9096,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) fDisableMapInterfaceDueToBattle = sGeneralInfo.fDisableMapInterfaceDueToBattle; memcpy( &gsBoxerGridNo, &sGeneralInfo.sBoxerGridNo, NUM_BOXERS * sizeof( INT32 ) ); - memcpy( &gubBoxerID, &sGeneralInfo.ubBoxerID, NUM_BOXERS * sizeof( UINT8 ) ); + memcpy( &gubBoxerID, &sGeneralInfo.ubBoxerID, NUM_BOXERS * sizeof( UINT16 ) ); memcpy( &gfBoxerFought, &sGeneralInfo.fBoxerFought, NUM_BOXERS * sizeof( BOOLEAN ) ); //Load the helicopter status diff --git a/Ja2/gamescreen.cpp b/Ja2/gamescreen.cpp index 0e5321fb..dcaa3be8 100644 --- a/Ja2/gamescreen.cpp +++ b/Ja2/gamescreen.cpp @@ -735,11 +735,11 @@ UINT32 MainGameScreenHandle(void) if ( !ARE_IN_FADE_IN( ) ) { - HandleAutoBandagePending( ); + HandleAutoBandagePending( ); - #ifdef JA2UB - HandleThePlayerBeNotifiedOfSomeoneElseInSector(); - #endif +#ifdef JA2UB + HandleThePlayerBeNotifiedOfSomeoneElseInSector(); +#endif } diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index ec1410df..f1711ed8 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -18418,7 +18418,7 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn continue; } - if( IsEntryInSelectedListSet( ( INT8 )iCounter ) == FALSE ) + if( IsEntryInSelectedListSet( iCounter ) == FALSE ) { continue; } diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 1bb2343e..b606329e 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -450,7 +450,7 @@ void InitalizeVehicleAndCharacterList( void ) memset(&gCharactersList, 0, sizeof( gCharactersList )); } -void SetEntryInSelectedCharacterList( INT8 bEntry ) +void SetEntryInSelectedCharacterList( INT16 bEntry ) { Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); @@ -458,7 +458,7 @@ void SetEntryInSelectedCharacterList( INT8 bEntry ) fSelectedListOfMercsForMapScreen[ bEntry ] = TRUE; } -void ResetEntryForSelectedList( INT8 bEntry ) +void ResetEntryForSelectedList( INT16 bEntry ) { Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); @@ -480,7 +480,7 @@ void ResetSelectedListForMapScreen( void ) } } -BOOLEAN IsEntryInSelectedListSet( INT8 bEntry ) +BOOLEAN IsEntryInSelectedListSet( INT16 bEntry ) { Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); @@ -489,7 +489,7 @@ BOOLEAN IsEntryInSelectedListSet( INT8 bEntry ) return( fSelectedListOfMercsForMapScreen[ bEntry ] ); } -void ToggleEntryInSelectedList( INT8 bEntry ) +void ToggleEntryInSelectedList( INT16 bEntry ) { Assert( ( bEntry >= 0 ) && ( bEntry < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ); @@ -497,9 +497,9 @@ void ToggleEntryInSelectedList( INT8 bEntry ) fSelectedListOfMercsForMapScreen[ bEntry ] = !( fSelectedListOfMercsForMapScreen[ bEntry ] ); } -void BuildSelectedListFromAToB( INT8 bA, INT8 bB ) +void BuildSelectedListFromAToB( INT16 bA, INT16 bB ) { - INT8 bStart =0, bEnd = 0; + INT16 bStart =0, bEnd = 0; // run from a to b..set slots as selected @@ -636,7 +636,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) if ( !CanSoldierMoveWithVehicleId( pSoldier2, pSoldier->iVehicleId ) ) { // reset entry for selected list - ResetEntryForSelectedList( ( INT8 )iCounter ); + ResetEntryForSelectedList( iCounter ); } } // if anchor guy IS a vehicle @@ -645,7 +645,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) if ( !CanSoldierMoveWithVehicleId( pSoldier2, pSoldier->bVehicleID ) ) { // reset entry for selected list - ResetEntryForSelectedList( ( INT8 )iCounter ); + ResetEntryForSelectedList( iCounter ); } } // if this guy is IN a vehicle @@ -654,7 +654,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) if ( !CanSoldierMoveWithVehicleId( pSoldier, pSoldier2->iVehicleId ) ) { // reset entry for selected list - ResetEntryForSelectedList( ( INT8 )iCounter ); + ResetEntryForSelectedList( iCounter ); } } // if this guy IS a vehicle @@ -663,13 +663,13 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) if ( !CanSoldierMoveWithVehicleId( pSoldier, pSoldier2->bVehicleID ) ) { // reset entry for selected list - ResetEntryForSelectedList( ( INT8 )iCounter ); + ResetEntryForSelectedList( iCounter ); } } // reject those not a squad (vehicle handled above) else if( pSoldier2->bAssignment >= ON_DUTY ) { - ResetEntryForSelectedList( ( INT8 )iCounter ); + ResetEntryForSelectedList( iCounter ); } else { @@ -678,14 +678,14 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) ( pSoldier->sSectorY != pSoldier2->sSectorY ) || ( pSoldier->bSectorZ != pSoldier2->bSectorZ ) ) { - ResetEntryForSelectedList( ( INT8 )iCounter ); + ResetEntryForSelectedList( iCounter ); } // if either is between sectors, they must be in the same movement group if ( ( pSoldier->flags.fBetweenSectors || pSoldier2->flags.fBetweenSectors ) && ( pSoldier->ubGroupID != pSoldier2->ubGroupID ) ) { - ResetEntryForSelectedList( ( INT8 )iCounter ); + ResetEntryForSelectedList( iCounter ); } } @@ -715,7 +715,7 @@ void SelectUnselectedMercsWhoMustMoveWithThisGuy( void ) if ( AnyMercInSameSquadOrVehicleIsSelected( pSoldier ) ) { // then also select this guy - SetEntryInSelectedCharacterList( ( INT8 ) iCounter ); + SetEntryInSelectedCharacterList( iCounter ); } } } @@ -2600,7 +2600,7 @@ void GoToNextCharacterInList( void ) { if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) ) { - ChangeSelectedInfoChar( ( INT8 )iCount, TRUE ); + ChangeSelectedInfoChar( iCount, TRUE ); break; } else @@ -2635,7 +2635,7 @@ void GoToFirstCharacterInList( void ) { if ( ( gCharactersList[ iCounter ].fValid ) && ( iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCounter ) ) { - ChangeSelectedInfoChar( ( INT8 )iCounter, TRUE ); + ChangeSelectedInfoChar( iCounter, TRUE ); break; } } @@ -2661,7 +2661,7 @@ void GoToLastCharacterInList( void ) { if ( ( gCharactersList[ iCounter ].fValid ) && ( iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCounter ) ) { - ChangeSelectedInfoChar( ( INT8 )iCounter, TRUE ); + ChangeSelectedInfoChar( iCounter, TRUE ); break; } } @@ -2691,7 +2691,7 @@ void GoToPrevCharacterInList( void ) { if ( ( gCharactersList[ iCount ].fValid ) && ( iCount < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ValidSelectableCharForNextOrPrev( iCount ) ) { - ChangeSelectedInfoChar( ( INT8 )iCount, TRUE ); + ChangeSelectedInfoChar( iCount, TRUE ); break; } else @@ -4602,11 +4602,11 @@ void HandleSettingTheSelectedListOfMercs( void ) // make DEST column glow giDestHighLine = iCounter; - ChangeSelectedInfoChar( ( INT16 ) iCounter, TRUE ); + ChangeSelectedInfoChar( iCounter, TRUE ); } // add this guy to the selected list of grunts - SetEntryInSelectedCharacterList( ( INT8 )iCounter ); + SetEntryInSelectedCharacterList( iCounter ); } } } diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 69c19e3a..44adfbc6 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -437,24 +437,24 @@ extern BOOLEAN fResetContractGlow; void InitalizeVehicleAndCharacterList( void ); // set this entry to as selected -void SetEntryInSelectedCharacterList( INT8 bEntry ); +void SetEntryInSelectedCharacterList( INT16 bEntry ); // set this entry to as unselected -void ResetEntryForSelectedList( INT8 bEntry ); +void ResetEntryForSelectedList( INT16 bEntry ); // reset selected list void ResetSelectedListForMapScreen( ); // build a selected list from a to b, inclusive -void BuildSelectedListFromAToB( INT8 bA, INT8 bB ); +void BuildSelectedListFromAToB( INT16 bA, INT16 bB ); // isa this entry int he selected character list set? -BOOLEAN IsEntryInSelectedListSet( INT8 bEntry ); +BOOLEAN IsEntryInSelectedListSet( INT16 bEntry ); // is there more than one person selected? BOOLEAN MultipleCharacterListEntriesSelected( void ); // toggle this entry on or off -void ToggleEntryInSelectedList( INT8 bEntry ); +void ToggleEntryInSelectedList( INT16 bEntry ); // reset assignments for mercs on selected list who have this assignment // HEADROCK HAM 3.6: Argument was unused... adding my own. @@ -745,4 +745,4 @@ extern BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbError extern BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index d1bf91a4..97d670ba 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -930,7 +930,7 @@ void ChangeMapScreenMaskCursor( UINT16 usCursor ); void CancelOrShortenPlottedPath( void ); // HEADROCK HAM B2.8: Added argument to enable multi-selecting entire squads -BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickAssignments ); +BOOLEAN HandleCtrlOrShiftInTeamPanel( INT16 bCharNumber, BOOLEAN fFromRightClickAssignments ); INT32 GetContractExpiryTime( SOLDIERTYPE *pSoldier ); @@ -7648,7 +7648,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { bSelectedAssignChar = ( INT16 )giHighLine; RebuildAssignmentsBox( ); - ChangeSelectedInfoChar( ( INT16 ) giHighLine, FALSE ); + ChangeSelectedInfoChar( giHighLine, FALSE ); fShowAssignmentMenu = TRUE; } } @@ -11329,12 +11329,12 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads - if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay, FALSE )) + if ( HandleCtrlOrShiftInTeamPanel( iValue + FIRSTmercTOdisplay, FALSE )) { return; } - ChangeSelectedInfoChar( ( INT8 ) iValue+ FIRSTmercTOdisplay, TRUE ); + ChangeSelectedInfoChar( iValue+ FIRSTmercTOdisplay, TRUE ); pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID ]; @@ -11387,7 +11387,7 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID ]; // select this character - ChangeSelectedInfoChar( ( INT8 ) iValue+ FIRSTmercTOdisplay, TRUE ); + ChangeSelectedInfoChar( iValue+ FIRSTmercTOdisplay, TRUE ); if (!isWidescreenUI()) { @@ -11484,13 +11484,13 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads - if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay, FALSE )) + if ( HandleCtrlOrShiftInTeamPanel( iValue + FIRSTmercTOdisplay, FALSE )) { return; } // reset list if the clicked character isn't also selected - ChangeSelectedInfoChar( ( INT8 ) iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( ( INT8 ) iValue + FIRSTmercTOdisplay) == FALSE ) ); + ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( iValue + FIRSTmercTOdisplay) == FALSE ) ); pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID ]; @@ -11554,7 +11554,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads - if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay, TRUE )) + if ( HandleCtrlOrShiftInTeamPanel( iValue + FIRSTmercTOdisplay, TRUE )) { return; } @@ -11571,7 +11571,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE ) { - ChangeSelectedInfoChar( ( INT8 ) iValue + FIRSTmercTOdisplay, TRUE ); + ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, TRUE ); pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID ]; @@ -11612,7 +11612,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if ( AnyMercInSameSquadOrVehicleIsSelected( pSoldier ) ) { // then also select this guy - SetEntryInSelectedCharacterList( ( INT8 ) iCounter ); + SetEntryInSelectedCharacterList( iCounter ); } } } @@ -11723,13 +11723,13 @@ void TeamListDestinationRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE && ValidSelectableCharForNextOrPrev(iValue + FIRSTmercTOdisplay)) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads - if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay , FALSE )) + if ( HandleCtrlOrShiftInTeamPanel( iValue + FIRSTmercTOdisplay , FALSE )) { return; } // reset list if the clicked character isn't also selected - ChangeSelectedInfoChar( ( INT8 ) iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( ( INT8 ) iValue + FIRSTmercTOdisplay ) == FALSE ) ); + ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( iValue + FIRSTmercTOdisplay ) == FALSE ) ); // deselect any characters/vehicles that can't accompany the clicked merc DeselectSelectedListMercsWhoCantMoveWithThisGuy( &( Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID ] ) ); @@ -11809,7 +11809,7 @@ void TeamListDestinationRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) MakeMapModesSuitableForDestPlotting( ( INT8 ) iValue + FIRSTmercTOdisplay ); // reset list if the clicked character isn't also selected - ChangeSelectedInfoChar( ( INT8 ) iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( ( INT8 ) iValue + FIRSTmercTOdisplay ) == FALSE ) ); + ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( iValue + FIRSTmercTOdisplay ) == FALSE ) ); CancelPathsOfAllSelectedCharacters(); @@ -11900,13 +11900,13 @@ void TeamListSleepRegionBtnCallBack( MOUSE_REGION *pRegion, INT32 iReason ) if( ( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE ) ) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads - if ( HandleCtrlOrShiftInTeamPanel( ( INT8 ) iValue + FIRSTmercTOdisplay , FALSE )) + if ( HandleCtrlOrShiftInTeamPanel( iValue + FIRSTmercTOdisplay , FALSE )) { return; } // reset list if the clicked character isn't also selected - ChangeSelectedInfoChar( ( INT8 ) iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( ( INT8 ) iValue + FIRSTmercTOdisplay ) == FALSE ) ); + ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( iValue + FIRSTmercTOdisplay ) == FALSE ) ); // if this slot's sleep status can be changed if ( CanChangeSleepStatusForCharSlot( (INT8) iValue + FIRSTmercTOdisplay ) ) @@ -12042,7 +12042,7 @@ static void HandleSelectedMercsContract() continue; } - if (IsEntryInSelectedListSet((INT8)iCounter) == FALSE) + if (IsEntryInSelectedListSet(iCounter) == FALSE) { continue; } @@ -12118,13 +12118,13 @@ void TeamListContractRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if ((gCharactersList[iValue + FIRSTmercTOdisplay].fValid == TRUE)) { // HEADROCK HAM B2.8: Added argument for multi-select entire squads - if (HandleCtrlOrShiftInTeamPanel((INT8)iValue + FIRSTmercTOdisplay, FALSE)) + if (HandleCtrlOrShiftInTeamPanel(iValue + FIRSTmercTOdisplay, FALSE)) { return; } // reset list if the clicked character isn't also selected - ChangeSelectedInfoChar((INT8)iValue + FIRSTmercTOdisplay, (BOOLEAN)(IsEntryInSelectedListSet((INT8)iValue + FIRSTmercTOdisplay) == FALSE)); + ChangeSelectedInfoChar(iValue + FIRSTmercTOdisplay, (BOOLEAN)(IsEntryInSelectedListSet(iValue + FIRSTmercTOdisplay) == FALSE)); HandleSelectedMercsContract(); } @@ -14925,13 +14925,13 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse // this guy is selected if( pSelectedSoldier[ iCounter ] == pCurrentSoldier ) { - SetEntryInSelectedCharacterList( ( INT8 ) iCounterA ); + SetEntryInSelectedCharacterList( iCounterA ); } // update who the currently selected info guy is if( pPreviousSelectedInfoChar == pCurrentSoldier ) { - ChangeSelectedInfoChar( ( INT8 ) iCounterA, FALSE ); + ChangeSelectedInfoChar( iCounterA, FALSE ); } } } @@ -15537,7 +15537,7 @@ void CancelOrShortenPlottedPath( void ) } -BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickAssignments ) +BOOLEAN HandleCtrlOrShiftInTeamPanel( INT16 bCharNumber, BOOLEAN fFromRightClickAssignments ) { // HEADROCK HAM B2.8: New condition based on new argument. if (fFromRightClickAssignments) @@ -15569,7 +15569,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE && pSelected->iVehicleId == pSoldier->bVehicleID ) ) { // then also select this guy - SetEntryInSelectedCharacterList( ( INT8 ) iCounter ); + SetEntryInSelectedCharacterList( iCounter ); } } @@ -15582,7 +15582,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA // make sure only trainers/trainees of the same stat are selected together. if (pSoldier->bTrainStat == pSelected->bTrainStat) { - SetEntryInSelectedCharacterList( ( INT8 ) iCounter ); + SetEntryInSelectedCharacterList( iCounter ); } } @@ -15591,7 +15591,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA pSoldier->sSectorY == pSelected->sSectorY && pSoldier->sZLevel == pSelected->sZLevel ) { - SetEntryInSelectedCharacterList( ( INT8 ) iCounter ); + SetEntryInSelectedCharacterList( iCounter ); } } } @@ -15624,7 +15624,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE && pSelected->iVehicleId == pSoldier->bVehicleID ) ) { // then also select this guy - ResetEntryForSelectedList( ( INT8 ) iCounter ); + ResetEntryForSelectedList( iCounter ); } } @@ -15637,7 +15637,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA // make sure only trainers/trainees of the same stat are selected together. if (pSoldier->bTrainStat == pSelected->bTrainStat) { - ResetEntryForSelectedList( ( INT8 ) iCounter ); + ResetEntryForSelectedList( iCounter ); } } @@ -15646,7 +15646,7 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT8 bCharNumber, BOOLEAN fFromRightClickA pSoldier->sSectorY == pSelected->sSectorY && pSoldier->sZLevel == pSelected->sZLevel ) { - ResetEntryForSelectedList( ( INT8 ) iCounter ); + ResetEntryForSelectedList( iCounter ); } } } @@ -15852,7 +15852,7 @@ void CopyPathToAllSelectedCharacters( PathStPtr pPath ) void CancelPathsOfAllSelectedCharacters() { - INT8 bCounter = 0; + INT16 bCounter = 0; SOLDIERTYPE *pSoldier = NULL; BOOLEAN fSkyriderMsgShown = FALSE; @@ -17049,7 +17049,7 @@ void ClearPreviousPaths( void ) void SelectAllCharactersInSquad( INT8 bSquadNumber ) { - INT8 bCounter; + INT16 bCounter; BOOLEAN fFirstOne = TRUE; SOLDIERTYPE *pSoldier; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 33c6cfae..b3378957 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -23,12 +23,12 @@ enum // TACTICAL ENGINE STATUS FLAGS typedef struct { - UINT16 bFirstID; - UINT16 bLastID; + UINT16 bFirstID; + UINT16 bLastID; COLORVAL RadarColor; INT8 bSide; - INT16 bMenInSector; - UINT16 ubLastMercToRadio; + INT16 bMenInSector; + UINT16 ubLastMercToRadio; INT8 bTeamActive; INT8 bAwareOfOpposition; INT8 bHuman; @@ -60,108 +60,108 @@ enum struct TacticalStatusType { - UINT32 uiFlags; + UINT32 uiFlags; TacticalTeamType Team[ MAXTEAMS ]; - UINT8 ubCurrentTeam; - INT32 sSlideTarget; - INT16 sSlideReason; - UINT32 uiTimeSinceMercAIStart; - INT8 fPanicFlags; - INT32 sPanicTriggerGridNoUnused; - INT16 sHandGrid; - UINT16 ubSpottersCalledForBy; - UINT16 ubTheChosenOne; - UINT32 uiTimeOfLastInput; - UINT32 uiTimeSinceDemoOn; - UINT32 uiCountdownToRestart; - BOOLEAN fGoingToEnterDemo; - BOOLEAN fNOTDOLASTDEMO; - BOOLEAN fMultiplayer; - BOOLEAN fCivGroupHostile[ NUM_CIV_GROUPS ]; - UINT8 ubLastBattleSectorX; - UINT8 ubLastBattleSectorY; - BOOLEAN fLastBattleWon; - INT8 bOriginalSizeOfEnemyForce; - INT8 bPanicTriggerIsAlarmUnused; - BOOLEAN fVirginSector; - BOOLEAN fEnemyInSector; - BOOLEAN fInterruptOccurred; - INT8 bRealtimeSpeed; - UINT8 ubEnemyIntention; - UINT8 ubEnemyIntendedRetreatDirection; - UINT16 ubEnemySightingOnTheirTurnEnemyID; - UINT16 ubEnemySightingOnTheirTurnPlayerID; - BOOLEAN fEnemySightingOnTheirTurn; - BOOLEAN fAutoBandageMode; - UINT8 ubAttackBusyCount; - INT8 bNumEnemiesFoughtInBattleUnused; - UINT16 ubEngagedInConvFromActionMercID; - UINT16 usTactialTurnLimitCounter; - BOOLEAN fInTopMessage; - UINT8 ubTopMessageType; - CHAR16 zTopMessageString[20]; - UINT16 usTactialTurnLimitMax; - UINT32 uiTactialTurnLimitClock; - BOOLEAN fTactialTurnLimitStartedBeep; - INT8 bBoxingState; - INT8 bConsNumTurnsNotSeen; - UINT8 ubArmyGuysKilled; + UINT8 ubCurrentTeam; + INT32 sSlideTarget; + INT16 sSlideReason; + UINT32 uiTimeSinceMercAIStart; + INT8 fPanicFlags; + INT32 sPanicTriggerGridNoUnused; + INT16 sHandGrid; + UINT16 ubSpottersCalledForBy; + UINT16 ubTheChosenOne; + UINT32 uiTimeOfLastInput; + UINT32 uiTimeSinceDemoOn; + UINT32 uiCountdownToRestart; + BOOLEAN fGoingToEnterDemo; + BOOLEAN fNOTDOLASTDEMO; + BOOLEAN fMultiplayer; + BOOLEAN fCivGroupHostile[ NUM_CIV_GROUPS ]; + UINT8 ubLastBattleSectorX; + UINT8 ubLastBattleSectorY; + BOOLEAN fLastBattleWon; + INT8 bOriginalSizeOfEnemyForce; + INT8 bPanicTriggerIsAlarmUnused; + BOOLEAN fVirginSector; + BOOLEAN fEnemyInSector; + BOOLEAN fInterruptOccurred; + INT8 bRealtimeSpeed; + UINT8 ubEnemyIntention; + UINT8 ubEnemyIntendedRetreatDirection; + UINT16 ubEnemySightingOnTheirTurnEnemyID; + UINT16 ubEnemySightingOnTheirTurnPlayerID; + BOOLEAN fEnemySightingOnTheirTurn; + BOOLEAN fAutoBandageMode; + UINT8 ubAttackBusyCount; + INT8 bNumEnemiesFoughtInBattleUnused; + UINT16 ubEngagedInConvFromActionMercID; + UINT16 usTactialTurnLimitCounter; + BOOLEAN fInTopMessage; + UINT8 ubTopMessageType; + CHAR16 zTopMessageString[20]; + UINT16 usTactialTurnLimitMax; + UINT32 uiTactialTurnLimitClock; + BOOLEAN fTactialTurnLimitStartedBeep; + INT8 bBoxingState; + INT8 bConsNumTurnsNotSeen; + UINT8 ubArmyGuysKilled; - INT32 sPanicTriggerGridNo[ NUM_PANIC_TRIGGERS ]; - INT8 bPanicTriggerIsAlarm[ NUM_PANIC_TRIGGERS ]; - UINT8 ubPanicTolerance[ NUM_PANIC_TRIGGERS ]; - BOOLEAN fAtLeastOneGuyOnMultiSelect; - BOOLEAN fSaidCreatureFlavourQuote; - BOOLEAN fHaveSeenCreature; - BOOLEAN fKilledEnemyOnAttack; - UINT16 ubEnemyKilledOnAttack; - INT8 bEnemyKilledOnAttackLevel; - UINT16 ubEnemyKilledOnAttackLocation; - BOOLEAN fItemsSeenOnAttack; - BOOLEAN ubItemsSeenOnAttackSoldier; - BOOLEAN fBeenInCombatOnce; - BOOLEAN fSaidCreatureSmellQuote; - UINT32 usItemsSeenOnAttackGridNo; - BOOLEAN fLockItemLocators; - UINT8 ubLastQuoteSaid; - UINT8 ubLastQuoteProfileNUm; - BOOLEAN fCantGetThrough; - INT32 sCantGetThroughGridNo; - INT32 sCantGetThroughSoldierGridNo; - UINT16 ubCantGetThroughID; - BOOLEAN fDidGameJustStart; - BOOLEAN fStatChangeCheatOn; - UINT8 ubLastRequesterTargetID; - BOOLEAN fGoodToAllowCrows; - UINT8 ubNumCrowsPossible; - UINT32 uiTimeCounterForGiveItemSrc; - BOOLEAN fUnLockUIAfterHiddenInterrupt; - INT8 bNumFoughtInBattle[ MAXTEAMS ]; - UINT32 uiDecayBloodLastUpdate; - UINT32 uiTimeSinceLastInTactical; - BOOLEAN fHasAGameBeenStarted; - INT8 bConsNumTurnsWeHaventSeenButEnemyDoes; - BOOLEAN fSomeoneHit; - UINT32 uiTimeSinceLastOpplistDecay; - INT8 bMercArrivingQuoteBeingUsed; - UINT16 ubEnemyKilledOnAttackKiller; - BOOLEAN fCountingDownForGuideDescription; - INT8 bGuideDescriptionCountDown; - UINT8 ubGuideDescriptionToUse; - INT8 bGuideDescriptionSectorX; - INT8 bGuideDescriptionSectorY; - INT8 fEnemyFlags; - BOOLEAN fAutoBandagePending; - BOOLEAN fHasEnteredCombatModeSinceEntering; - BOOLEAN fDontAddNewCrows; - UINT8 ubMorePadding; - UINT16 sCreatureTenseQuoteDelay; - UINT32 uiCreatureTenseQuoteLastUpdate; + INT32 sPanicTriggerGridNo[ NUM_PANIC_TRIGGERS ]; + INT8 bPanicTriggerIsAlarm[ NUM_PANIC_TRIGGERS ]; + UINT8 ubPanicTolerance[ NUM_PANIC_TRIGGERS ]; + BOOLEAN fAtLeastOneGuyOnMultiSelect; + BOOLEAN fSaidCreatureFlavourQuote; + BOOLEAN fHaveSeenCreature; + BOOLEAN fKilledEnemyOnAttack; + UINT16 ubEnemyKilledOnAttack; + INT8 bEnemyKilledOnAttackLevel; + UINT16 ubEnemyKilledOnAttackLocation; + BOOLEAN fItemsSeenOnAttack; + BOOLEAN ubItemsSeenOnAttackSoldier; + BOOLEAN fBeenInCombatOnce; + BOOLEAN fSaidCreatureSmellQuote; + UINT32 usItemsSeenOnAttackGridNo; + BOOLEAN fLockItemLocators; + UINT8 ubLastQuoteSaid; + UINT8 ubLastQuoteProfileNUm; + BOOLEAN fCantGetThrough; + INT32 sCantGetThroughGridNo; + INT32 sCantGetThroughSoldierGridNo; + UINT16 ubCantGetThroughID; + BOOLEAN fDidGameJustStart; + BOOLEAN fStatChangeCheatOn; + UINT8 ubLastRequesterTargetID; + BOOLEAN fGoodToAllowCrows; + UINT8 ubNumCrowsPossible; + UINT32 uiTimeCounterForGiveItemSrc; + BOOLEAN fUnLockUIAfterHiddenInterrupt; + INT8 bNumFoughtInBattle[ MAXTEAMS ]; + UINT32 uiDecayBloodLastUpdate; + UINT32 uiTimeSinceLastInTactical; + BOOLEAN fHasAGameBeenStarted; + INT8 bConsNumTurnsWeHaventSeenButEnemyDoes; + BOOLEAN fSomeoneHit; + UINT32 uiTimeSinceLastOpplistDecay; + INT8 bMercArrivingQuoteBeingUsed; + UINT16 ubEnemyKilledOnAttackKiller; + BOOLEAN fCountingDownForGuideDescription; + INT8 bGuideDescriptionCountDown; + UINT8 ubGuideDescriptionToUse; + INT8 bGuideDescriptionSectorX; + INT8 bGuideDescriptionSectorY; + INT8 fEnemyFlags; + BOOLEAN fAutoBandagePending; + BOOLEAN fHasEnteredCombatModeSinceEntering; + BOOLEAN fDontAddNewCrows; + UINT8 ubMorePadding; + UINT16 sCreatureTenseQuoteDelay; + UINT32 uiCreatureTenseQuoteLastUpdate; // SANDRO - added these - UINT16 ubLastRequesterSurgeryTargetID; - UINT8 ubInterruptPending; + UINT16 ubLastRequesterSurgeryTargetID; + UINT8 ubInterruptPending; // sevenfm: Ctrl+D disable interrupts - BOOLEAN ubDisablePlayerInterrupts; + BOOLEAN ubDisablePlayerInterrupts; // PADDING GONE!!!!! }; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 63503bbf..bfc9e6a6 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1543,7 +1543,7 @@ public: /////////////////////////////////////////////////////// // Flugente: this was the location of required variables required for the now removed poison feature. They can be used again UINT8 ubMilitiaAssists; // Flugente: stores militia assists - INT8 sNonNPCTraderID; // Flugente: we can set up non-NPC soldiers to be merchants, we store their dealer id here (value > 0 means arms dealer entry x) + INT8 sNonNPCTraderID; // Flugente: we can set up non-NPC soldiers to be merchants, we store their dealer id here (value > 0 means arms dealer entry x) //INT8 bUnusedINT8_3; UINT16 usDragPersonID; // Flugente: id of person we are dragging From 508310be3e67dfd930f623652e6427c40ed665f9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 10 Nov 2024 01:19:05 +0200 Subject: [PATCH 040/571] Change UINT8 to UINT16 for soldierInitLists & hostiles in sector --- Strategic/Auto Resolve.cpp | 28 +++--- Strategic/Campaign Types.h | 52 +++++------ Strategic/Creature Spreading.cpp | 36 ++++---- Strategic/Creature Spreading.h | 26 +++--- Strategic/LuaInitNPCs.cpp | 4 +- Strategic/Player Command.cpp | 2 +- Strategic/Queen Command.cpp | 81 +++++++++-------- Strategic/Queen Command.h | 24 +++--- Strategic/Reinforcement.cpp | 8 +- Strategic/Reinforcement.h | 6 +- Strategic/UndergroundInit.cpp | 17 +++- Tactical/Enemy Soldier Save.cpp | 12 +-- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Init List.cpp | 144 +++++++++++++++---------------- Tactical/Soldier Init List.h | 18 ++-- 15 files changed, 236 insertions(+), 224 deletions(-) diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 6d0ce078..7715042d 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -163,13 +163,13 @@ typedef struct AUTORESOLVE_STRUCT UINT8 ubEnemyLeadership; UINT8 ubPlayerLeadership; - UINT8 ubMercs, ubCivs, ubEnemies; - UINT8 ubAdmins, ubTroops, ubElites, ubTanks, ubJeeps, ubRobots; - UINT8 ubYMCreatures, ubYFCreatures, ubAMCreatures, ubAFCreatures; - UINT8 ubBloodcats; - UINT8 ubZombies; - UINT8 ubBandits; - UINT8 ubAliveMercs, ubAliveCivs, ubAliveEnemies; + UINT16 ubMercs, ubCivs, ubEnemies; + UINT16 ubAdmins, ubTroops, ubElites, ubTanks, ubJeeps, ubRobots; + UINT16 ubYMCreatures, ubYFCreatures, ubAMCreatures, ubAFCreatures; + UINT16 ubBloodcats; + UINT16 ubZombies; + UINT16 ubBandits; + UINT16 ubAliveMercs, ubAliveCivs, ubAliveEnemies; UINT8 ubMercCols, ubMercRows; UINT8 ubEnemyCols, ubEnemyRows; UINT8 ubCivCols, ubCivRows; @@ -410,10 +410,10 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY ) GROUP *pGroup, *pDeleteGroup; SECTORINFO *pSector; INT32 i; - UINT8 ubNumEnemies[ NUM_ENEMY_RANKS ]; - UINT8 ubNumTanks = 0; - UINT8 ubNumJeeps = 0; - UINT8 ubNumRobots = 0; + UINT16 ubNumEnemies[NUM_ENEMY_RANKS]{}; + UINT16 ubNumTanks = 0; + UINT16 ubNumJeeps = 0; + UINT16 ubNumRobots = 0; UINT8 ubRankIndex; //Clear any possible battle locator @@ -3067,7 +3067,7 @@ void CalculateAutoResolveInfo() &gpAR->ubAMCreatures, &gpAR->ubAFCreatures ); } - gpAR->ubEnemies = (UINT8)min( gpAR->ubYMCreatures + gpAR->ubYFCreatures + gpAR->ubAMCreatures + gpAR->ubAFCreatures, MAX_AR_TEAM_SIZE ); + gpAR->ubEnemies = min( gpAR->ubYMCreatures + gpAR->ubYFCreatures + gpAR->ubAMCreatures + gpAR->ubAFCreatures, MAX_AR_TEAM_SIZE ); } else if ( GetEnemyEncounterCode() == BLOODCAT_ATTACK_CODE || GetEnemyEncounterCode() == ZOMBIE_ATTACK_CODE || @@ -3087,7 +3087,7 @@ void CalculateAutoResolveInfo() gpAR->ubBandits = gubNumCreaturesAttackingTown; } - gpAR->ubEnemies = (UINT8)min( gubNumCreaturesAttackingTown, MAX_AR_TEAM_SIZE ); + gpAR->ubEnemies = min( gubNumCreaturesAttackingTown, MAX_AR_TEAM_SIZE ); } else { @@ -3096,7 +3096,7 @@ void CalculateAutoResolveInfo() GetNumberOfEnemiesInFiveSectors( gpAR->ubSectorX, gpAR->ubSectorY, &gpAR->ubAdmins, &gpAR->ubTroops, &gpAR->ubElites, &gpAR->ubRobots, &gpAR->ubTanks, &gpAR->ubJeeps ); - gpAR->ubEnemies = (UINT8)min( gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubElites + gpAR->ubTanks + gpAR->ubJeeps + gpAR->ubRobots, MAX_AR_TEAM_SIZE ); + gpAR->ubEnemies = min( gpAR->ubAdmins + gpAR->ubTroops + gpAR->ubElites + gpAR->ubTanks + gpAR->ubJeeps + gpAR->ubRobots, MAX_AR_TEAM_SIZE ); } gfTransferTacticalOppositionToAutoResolve = FALSE; diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index 37be5a19..238568a9 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -487,18 +487,18 @@ typedef struct SECTORINFO //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. + 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; //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 ubTroopsInBattle, ubElitesInBattle, ubAdminsInBattle, ubCreaturesInBattle; + UINT16 ubNumTroops; //the actual number of troops here. + UINT16 ubNumElites; //the actual number of elites here. + UINT16 ubNumAdmins; //the actual number of admins here. + UINT16 ubNumCreatures; //only set when immediately before ground attack made! + UINT16 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 @@ -511,8 +511,8 @@ typedef struct SECTORINFO //throught the sector without entering it. INT8 bNameId; INT8 bUSUSED; - INT8 bBloodCats; - INT8 bBloodCatPlacements; + INT16 bBloodCats; + INT16 bBloodCatPlacements; INT8 UNUSEDbSAMCondition; UINT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, @@ -551,8 +551,8 @@ typedef struct SECTORINFO UINT32 uiTimeAIArtillerywasOrdered; // Flugente: updated every time an artillery strike is ordered from the militia - UINT8 ubNumTanks; - UINT8 ubTanksInBattle; + UINT16 ubNumTanks; + UINT16 ubTanksInBattle; // Flugente: disease UINT16 usNumCorpses; // number of corpses in this sector @@ -565,8 +565,8 @@ typedef struct SECTORINFO FLOAT dFortification_UnappliedProgress; // progress done via assignment work. As we cannot update unloaded sectors, update happens once sector is loaded // Flugente: enemy jeeps - UINT8 ubNumJeeps; - UINT8 ubJeepsInBattle; + UINT16 ubNumJeeps; + UINT16 ubJeepsInBattle; UINT8 usWorkers; UINT8 ubWorkerTrainingHundredths; @@ -583,8 +583,8 @@ typedef struct SECTORINFO UINT8 ubNumElites_Turncoat; UINT8 usExplorationProgress; - UINT8 ubNumRobots; - UINT8 ubRobotsInBattle; + UINT16 ubNumRobots; + UINT16 ubRobotsInBattle; INT8 bPadding[ 6 ]; }SECTORINFO; @@ -600,18 +600,18 @@ typedef struct UNDERGROUND_SECTORINFO { UINT32 uiFlags; UINT8 ubSectorX, ubSectorY, ubSectorZ; - UINT8 ubNumElites, ubNumTroops, ubNumAdmins, ubNumCreatures; + UINT16 ubNumElites, ubNumTroops, ubNumAdmins, ubNumCreatures; UINT8 fVisited; - INT8 ubTravelRating; //Represents how travelled a sector is. Typically, the higher the travel rating, + 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 ubNumBloodcats; // Bloodcat population + UINT16 ubNumBloodcats; // Bloodcat population UINT8 ubCreatureHabitat; //determines how creatures live in this sector (see creature spreading.c) - UINT8 ubElitesInBattle, ubTroopsInBattle, ubAdminsInBattle, ubCreaturesInBattle; + UINT16 ubElitesInBattle, ubTroopsInBattle, ubAdminsInBattle, ubCreaturesInBattle; // adding these (should not change struct layout due to padding) UINT8 ubMusicMode, ubUnsed; @@ -622,20 +622,20 @@ typedef struct UNDERGROUND_SECTORINFO BOOLEAN fCampaignSector; #endif - UINT8 uiNumberOfPrisonersOfWar[PRISONER_MAX]; + UINT16 uiNumberOfPrisonersOfWar[PRISONER_MAX]; - UINT8 ubNumTanks; - UINT8 ubTanksInBattle; + UINT16 ubNumTanks; + UINT16 ubTanksInBattle; // Flugente: fortification FLOAT dFortification_MaxPossible; // the amount of fortification that can still be done in this sector, given the current layout plans. Is updated every time we unload a sector FLOAT dFortification_UnappliedProgress; // progress done via assignment work. As we cannot update unloaded sectors, update happens once sector is loaded - UINT8 ubNumJeeps; - UINT8 ubJeepsInBattle; + UINT16 ubNumJeeps; + UINT16 ubJeepsInBattle; UINT8 usExplorationProgress; - UINT8 ubNumRobots; - UINT8 ubRobotsInBattle; + UINT16 ubNumRobots; + UINT16 ubRobotsInBattle; INT8 bPadding[10]; //no padding left! @@ -656,4 +656,4 @@ enum CreateMusic CM_ALWAYS, }; -#endif \ No newline at end of file +#endif diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index 13581a26..1bd1c033 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -139,11 +139,11 @@ INT32 giDestroyedLairID = 0; //prebattle interface, autoresolve, etc. INT16 gsCreatureInsertionCode = 0; INT32 gsCreatureInsertionGridNo = 0; -UINT8 gubNumCreaturesAttackingTown = 0; -UINT8 gubYoungMalesAttackingTown = 0; -UINT8 gubYoungFemalesAttackingTown = 0; -UINT8 gubAdultMalesAttackingTown = 0; -UINT8 gubAdultFemalesAttackingTown = 0; +UINT16 gubNumCreaturesAttackingTown = 0; +UINT16 gubYoungMalesAttackingTown = 0; +UINT16 gubYoungFemalesAttackingTown = 0; +UINT16 gubAdultMalesAttackingTown = 0; +UINT16 gubAdultFemalesAttackingTown = 0; UINT8 gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; UINT8 gubSectorIDOfCreatureAttack = 0; @@ -1634,8 +1634,8 @@ BOOLEAN MineClearOfMonsters( UINT8 ubMineIndex ) return TRUE; } -void DetermineCreatureTownComposition( UINT8 ubNumCreatures, UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ) +void DetermineCreatureTownComposition( UINT16 ubNumCreatures, UINT16 *pubNumYoungMales, UINT16 *pubNumYoungFemales, + UINT16 *pubNumAdultMales, UINT16 *pubNumAdultFemales ) { INT32 i, iRandom; UINT8 ubYoungMalePercentage = 10; @@ -1667,8 +1667,8 @@ void DetermineCreatureTownComposition( UINT8 ubNumCreatures, UINT8 *pubNumYoungM } } -void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures, UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ) +void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT16 *pubNumCreatures, UINT16 *pubNumYoungMales, UINT16 *pubNumYoungFemales, + UINT16 *pubNumAdultMales, UINT16 *pubNumAdultFemales ) { SOLDIERTYPE *pSoldier; @@ -1704,7 +1704,7 @@ void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCr } } -void DetermineOtherCreatureTownCompositionBasedOnTacticalInformation( UINT8* pubNumCreatures, UINT8* pubNumBloodcats, UINT8* pubNumZombies, UINT8* pubNumBandits ) +void DetermineOtherCreatureTownCompositionBasedOnTacticalInformation( UINT16* pubNumCreatures, UINT16* pubNumBloodcats, UINT16* pubNumZombies, UINT16* pubNumBandits ) { SOLDIERTYPE *pSoldier; @@ -1750,13 +1750,13 @@ BOOLEAN PrepareCreaturesForBattle() UINT8 ubAdultMalePercentage; UINT8 ubAdultFemalePercentage; UINT8 ubCreatureHabitat; - UINT8 ubNumLarvae = 0; - UINT8 ubNumInfants = 0; - UINT8 ubNumYoungMales = 0; - UINT8 ubNumYoungFemales = 0; - UINT8 ubNumAdultMales = 0; - UINT8 ubNumAdultFemales = 0; - UINT8 ubNumCreatures; + UINT16 ubNumLarvae = 0; + UINT16 ubNumInfants = 0; + UINT16 ubNumYoungMales = 0; + UINT16 ubNumYoungFemales = 0; + UINT16 ubNumAdultMales = 0; + UINT16 ubNumAdultFemales = 0; + UINT16 ubNumCreatures; if( !gubCreatureBattleCode ) { @@ -2422,4 +2422,4 @@ void ResetCreatureAttackVariables() gubAdultFemalesAttackingTown = 0; gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; gubSectorIDOfCreatureAttack = 0; -} \ No newline at end of file +} diff --git a/Strategic/Creature Spreading.h b/Strategic/Creature Spreading.h index e7e812c6..67b1daea 100644 --- a/Strategic/Creature Spreading.h +++ b/Strategic/Creature Spreading.h @@ -30,11 +30,11 @@ BOOLEAN GetWarpOutOfMineCodes( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSecto extern INT16 gsCreatureInsertionCode; extern INT32 gsCreatureInsertionGridNo; -extern UINT8 gubNumCreaturesAttackingTown; -extern UINT8 gubYoungMalesAttackingTown; -extern UINT8 gubYoungFemalesAttackingTown; -extern UINT8 gubAdultMalesAttackingTown; -extern UINT8 gubAdultFemalesAttackingTown; +extern UINT16 gubNumCreaturesAttackingTown; +extern UINT16 gubYoungMalesAttackingTown; +extern UINT16 gubYoungFemalesAttackingTown; +extern UINT16 gubAdultMalesAttackingTown; +extern UINT16 gubAdultFemalesAttackingTown; extern UINT8 gubSectorIDOfCreatureAttack; enum{ CREATURE_BATTLE_CODE_NONE, @@ -53,15 +53,15 @@ enum { }; extern UINT8 guCreatureAttackType; -void DetermineCreatureTownComposition( UINT8 ubNumCreatures, - UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ); +void DetermineCreatureTownComposition( UINT16 ubNumCreatures, + UINT16 *pubNumYoungMales, UINT16 *pubNumYoungFemales, + UINT16 *pubNumAdultMales, UINT16 *pubNumAdultFemales ); -void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT8 *pubNumCreatures, - UINT8 *pubNumYoungMales, UINT8 *pubNumYoungFemales, - UINT8 *pubNumAdultMales, UINT8 *pubNumAdultFemales ); +void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT16 *pubNumCreatures, + UINT16 *pubNumYoungMales, UINT16 *pubNumYoungFemales, + UINT16 *pubNumAdultMales, UINT16 *pubNumAdultFemales ); -void DetermineOtherCreatureTownCompositionBasedOnTacticalInformation( UINT8* pubNumCreatures, UINT8* pubNumBloodcats, UINT8* pubNumZombies, UINT8* pubNumBandits ); +void DetermineOtherCreatureTownCompositionBasedOnTacticalInformation( UINT16* pubNumCreatures, UINT16* pubNumBloodcats, UINT16* pubNumZombies, UINT16* pubNumBandits ); BOOLEAN PlayerGroupIsInACreatureInfestedMine(); @@ -114,4 +114,4 @@ extern CREATURECOMPOSITION gCreatureComposition[ MAX_NUMBER_OF_CREATURE_COMPOSIT // Flugente: reset code for creature attacks void ResetCreatureAttackVariables(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 7b9eb60f..c8a19d6f 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -220,7 +220,7 @@ static int l_iStringToUse(lua_State *L); static int l_StopVideo(lua_State *L); static int l_StartVideo(lua_State *L); -UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ); +extern UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ); BOOLEAN LoadLuaGlobalFromLoadGameFile( HWFILE hFile ); BOOLEAN SaveLuaGlobalToSaveGameFile( HWFILE hFile ); @@ -13574,7 +13574,7 @@ static int l_SetPhotoFactLaptopData( lua_State *L ) return 0; } -extern UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); +extern UINT16 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); static int l_GetNumHostilesInSector( lua_State *L ) { diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index efa91292..729a957c 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -543,7 +543,7 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO { // Enemies can steal items left lying about, each one can carry out up to X kg (defined in RemoveRandomItemsInSector). // Don't care underground sectors here -- we are in overground code branch. - UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; + UINT16 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; GetNumberOfStationaryEnemiesInSector( sMapX, sMapY, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumRobots, &ubNumTanks, &ubNumJeeps ); RemoveRandomItemsInSector( sMapX, sMapY, bMapZ, (UINT32)ubNumAdmins + ubNumTroops + ubNumElites ); } diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 676c21d3..077d373d 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -141,9 +141,9 @@ void ValidateEnemiesHaveWeapons() } //Counts enemies and crepitus, but not bloodcats. -UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) +UINT16 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) { - UINT8 ubNumHostiles = 0; + UINT16 ubNumHostiles = 0; AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE); AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE ); @@ -158,7 +158,7 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) pSector = FindUnderGroundSector( sSectorX, sSectorY, (UINT8)sSectorZ ); if( pSector ) { - ubNumHostiles = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumCreatures + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); + ubNumHostiles = (pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumCreatures + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); } } else @@ -168,7 +168,7 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) //Count stationary hostiles pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ]; - ubNumHostiles = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumCreatures + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); + ubNumHostiles = (pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumCreatures + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); //Count mobile enemies pGroup = gpGroupList; @@ -185,9 +185,9 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) return ubNumHostiles; } -UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) +UINT16 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) { - UINT8 ubNumEnemies = 0; + UINT16 ubNumEnemies = 0; AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE); AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE ); @@ -202,7 +202,7 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) pSector = FindUnderGroundSector( sSectorX, sSectorY, (UINT8)sSectorZ ); if( pSector ) { - ubNumEnemies = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); + ubNumEnemies = (pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); } } else @@ -212,7 +212,7 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) //Count stationary enemies pSector = &SectorInfo[ SECTOR( sSectorX, sSectorY ) ]; - ubNumEnemies = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); + ubNumEnemies = (pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); //Count mobile enemies pGroup = gpGroupList; @@ -230,11 +230,11 @@ UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) } // returns how many members of a team are in a sector - not intended for OUR_TEAM! -UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam ) +UINT16 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam ) { SECTORINFO *pSector; GROUP *pGroup; - UINT8 ubNumTroops; + UINT16 ubNumTroops = 0; // HEADROCK: This is a TEMPORARY fix to avoid the assertion error. Not sure this is the best solution, // probably isn't. But I need this bit to work. @@ -255,14 +255,14 @@ UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubT if ( ubTeam == ENEMY_TEAM ) { - ubNumTroops = (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); + ubNumTroops = (pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); if ( is_networked ) ubNumTroops += numenemyLAN((UINT8)sSectorX,(UINT8)sSectorY ); //hayden } else if ( ubTeam == MILITIA_TEAM ) { - ubNumTroops = (UINT8)(pSector->ubNumberOfCivsAtLevel[0] + pSector->ubNumberOfCivsAtLevel[1] + pSector->ubNumberOfCivsAtLevel[2]); + ubNumTroops = (pSector->ubNumberOfCivsAtLevel[0] + pSector->ubNumberOfCivsAtLevel[1] + pSector->ubNumberOfCivsAtLevel[2]); } else if ( ubTeam == CREATURE_TEAM ) { @@ -309,7 +309,7 @@ UINT16 NumEnemyArmedVehiclesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTe { SECTORINFO *pSector; GROUP *pGroup; - UINT16 ubNum; + UINT16 ubNum = 0; // HEADROCK: This is a TEMPORARY fix to avoid the assertion error. Not sure this is the best solution, // probably isn't. But I need this bit to work. @@ -344,7 +344,7 @@ UINT16 NumEnemyArmedVehiclesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTe return ubNum; } -UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) +UINT16 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) { SECTORINFO *pSector; @@ -368,14 +368,14 @@ UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) return( 0 ); } - return (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks + pSector->ubNumJeeps + pSector->ubNumRobots); + return (pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks + pSector->ubNumJeeps + pSector->ubNumRobots); } -UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) +UINT16 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) { GROUP *pGroup; SECTORINFO *pSector; - UINT8 ubNumTroops; + UINT16 ubNumTroops; AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE); AssertLE( sSectorX, MAXIMUM_VALID_X_COORDINATE ); AssertGE( sSectorY, MINIMUM_VALID_Y_COORDINATE); @@ -396,13 +396,13 @@ UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) if( pSector->ubGarrisonID == ROADBLOCK ) { //consider these troops as mobile troops even though they are in a garrison - ubNumTroops += (UINT8)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); + ubNumTroops += (pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumRobots + pSector->ubNumJeeps + pSector->ubNumTanks); } return ubNumTroops; } -void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ) +void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ) { GROUP *pGroup; SECTORINFO *pSector; @@ -441,7 +441,7 @@ void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pu } } -void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ) +void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT16 usTeam, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ) { GROUP *pGroup; AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE); @@ -468,7 +468,7 @@ void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSe } -void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ) +void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ) { SECTORINFO *pSector; AssertGE( sSectorX, MINIMUM_VALID_X_COORDINATE); @@ -486,9 +486,9 @@ void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumJeeps = pSector->ubNumJeeps; } -void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ) +void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ) { - UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; + UINT16 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; GetNumberOfStationaryEnemiesInSector( sSectorX, sSectorY, pubNumAdmins, pubNumTroops, pubNumElites, pubNumRobots, pubNumTanks, pubNumJeeps ); @@ -576,9 +576,9 @@ void EndTacticalBattleForEnemy() } } -UINT8 NumFreeSlots( UINT8 ubTeam ) +UINT16 NumFreeSlots( UINT8 ubTeam ) { - UINT8 ubNumFreeSlots = 0; + UINT16 ubNumFreeSlots = 0; //Count the number of free enemy slots. It is possible to have multiple groups exceed the maximum. for ( INT32 i = gTacticalStatus.Team[ubTeam].bFirstID; i <= gTacticalStatus.Team[ubTeam].bLastID; ++i ) @@ -590,13 +590,12 @@ UINT8 NumFreeSlots( UINT8 ubTeam ) // the militia team size can be restricted by the ini if ( ubTeam == MILITIA_TEAM ) { - ubNumFreeSlots = (UINT8)max( 0, (INT8)ubNumFreeSlots - (INT8)(gGameExternalOptions.ubGameMaximumNumberOfRebels - gGameExternalOptions.iMaxMilitiaPerSector) ); + ubNumFreeSlots = (UINT16)max( 0, (INT16)ubNumFreeSlots - (INT16)(gGameExternalOptions.ubGameMaximumNumberOfRebels - gGameExternalOptions.iMaxMilitiaPerSector) ); } return ubNumFreeSlots; } -#pragma optimize("",off) //Called when entering a sector so the campaign AI can automatically insert the //correct number of troops of each type based on the current number in the sector //in global focus (gWorldSectorX/Y) @@ -1187,7 +1186,7 @@ BOOLEAN PrepareEnemyForUndergroundBattle() Assert( FALSE ); return FALSE; } -#pragma optimize("",on) + //The queen AI layer must process the event by subtracting forces, etc. void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) { @@ -2176,12 +2175,12 @@ void NotifyPlayersOfNewEnemies() } } -void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumRobots, UINT8 ubNumTanks, UINT8 ubNumJeeps, BOOLEAN fMagicallyAppeared ) +void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT16 ubNumAdmins, UINT16 ubNumTroops, UINT16 ubNumElites, UINT16 ubNumRobots, UINT16 ubNumTanks, UINT16 ubNumJeeps, BOOLEAN fMagicallyAppeared ) { SOLDIERTYPE *pSoldier; MAPEDGEPOINTINFO MapEdgepointInfo; - UINT8 ubCurrSlot; - UINT8 ubTotalSoldiers; + UINT16 ubCurrSlot; + UINT16 ubTotalSoldiers; UINT8 bDesiredDirection=0; // while transport groups can't normally reinforce, this covers the case where a transport group enters a sector (via normal movement) @@ -2323,7 +2322,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if( ubNumTroops && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumTroops) ) + else if( ubNumTroops && Random( ubTotalSoldiers ) < (ubNumElites + ubNumTroops) ) { ubNumTroops--; ubTotalSoldiers--; @@ -2346,7 +2345,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if( ubNumAdmins && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumTroops + ubNumAdmins) ) + else if( ubNumAdmins && Random( ubTotalSoldiers ) < (ubNumElites + ubNumTroops + ubNumAdmins) ) { ubNumAdmins--; ubTotalSoldiers--; @@ -2369,7 +2368,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if( ubNumRobots && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumTroops + ubNumAdmins + ubNumRobots) ) + else if( ubNumRobots && Random( ubTotalSoldiers ) < (ubNumElites + ubNumTroops + ubNumAdmins + ubNumRobots) ) { ubNumRobots--; ubTotalSoldiers--; @@ -2392,7 +2391,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if( ubNumTanks && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumTroops + ubNumAdmins + ubNumRobots + ubNumTanks) && ubNumberOfVehicles < 9 ) + else if( ubNumTanks && Random( ubTotalSoldiers ) < (ubNumElites + ubNumTroops + ubNumAdmins + ubNumRobots + ubNumTanks) && ubNumberOfVehicles < 9 ) { ubNumTanks--; ubTotalSoldiers--; @@ -2415,7 +2414,7 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if ( ubNumJeeps && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumTroops + ubNumAdmins + ubNumRobots + ubNumTanks + ubNumJeeps) && ubNumberOfVehicles < 9 ) + else if ( ubNumJeeps && Random( ubTotalSoldiers ) < (ubNumElites + ubNumTroops + ubNumAdmins + ubNumRobots + ubNumTanks + ubNumJeeps) && ubNumberOfVehicles < 9 ) { ubNumJeeps--; ubTotalSoldiers--; @@ -2463,12 +2462,12 @@ void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub #endif } -void AddMilitiaToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumGreens, UINT8 ubNumRegulars, UINT8 ubNumElites, BOOLEAN fMagicallyAppeared ) +void AddMilitiaToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT16 ubNumGreens, UINT16 ubNumRegulars, UINT16 ubNumElites, BOOLEAN fMagicallyAppeared ) { SOLDIERTYPE *pSoldier; MAPEDGEPOINTINFO MapEdgepointInfo; - UINT8 ubCurrSlot; - UINT8 ubTotalSoldiers; + UINT16 ubCurrSlot; + UINT16 ubTotalSoldiers; UINT8 bDesiredDirection = 0; switch ( ubStrategicInsertionCode ) @@ -2558,7 +2557,7 @@ void AddMilitiaToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if ( ubNumRegulars && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumRegulars) ) + else if ( ubNumRegulars && Random( ubTotalSoldiers ) < (ubNumElites + ubNumRegulars) ) { ubNumRegulars--; ubTotalSoldiers--; @@ -2581,7 +2580,7 @@ void AddMilitiaToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ub } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if ( ubNumGreens && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumRegulars + ubNumGreens) ) + else if ( ubNumGreens && Random( ubTotalSoldiers ) < (ubNumElites + ubNumRegulars + ubNumGreens) ) { ubNumGreens--; ubTotalSoldiers--; diff --git a/Strategic/Queen Command.h b/Strategic/Queen Command.h index 541206d0..ead2f97e 100644 --- a/Strategic/Queen Command.h +++ b/Strategic/Queen Command.h @@ -12,26 +12,26 @@ extern BOOLEAN gfPendingNonPlayerTeam[PLAYER_PLAN]; -UINT8 NumFreeSlots( UINT8 ubTeam ); +UINT16 NumFreeSlots( UINT8 ubTeam ); //Counts enemies and crepitus, but not bloodcats. -UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); +UINT16 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); -UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); +UINT16 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); // returns how many members of a team are in a sector - not intended for OUR_TEAM! -UINT8 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam ); +UINT16 NumNonPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, UINT8 ubTeam ); // returns how many members of a team are in a sector - only intended for OUR_TEAM! POWs not included UINT16 NumPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, INT8 sSectorZ ); UINT16 NumEnemyArmedVehiclesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam ); -UINT8 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); -UINT8 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); -void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ); -void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT8 usTeam, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ); -void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ); -void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ); +UINT16 NumStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); +UINT16 NumMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY ); +void GetNumberOfMobileEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ); +void GetNumberOfMobileEnemiesInSectorWithoutRoadBlock( INT16 sSectorX, INT16 sSectorY, UINT16 usTeam, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ); +void GetNumberOfStationaryEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ); +void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ); //Called when entering a sector so the campaign AI can automatically insert the //correct number of troops of each type based on the current number in the sector @@ -39,8 +39,8 @@ void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAd BOOLEAN PrepareEnemyForSectorBattle(); BOOLEAN PrepareEnemyForUndergroundBattle(); -void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumRobots, UINT8 ubNumTanks, UINT8 abNumJeeps, BOOLEAN fMagicallyAppeared ); -void AddMilitiaToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT8 ubNumGreens, UINT8 ubNumRegulars, UINT8 ubNumElites, BOOLEAN fMagicallyAppeared ); +void AddEnemiesToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT16 ubNumAdmins, UINT16 ubNumTroops, UINT16 ubNumElites, UINT16 ubNumRobots, UINT16 ubNumTanks, UINT16 abNumJeeps, BOOLEAN fMagicallyAppeared ); +void AddMilitiaToBattle( GROUP *pGroup, UINT8 ubStrategicInsertionCode, UINT16 ubNumGreens, UINT16 ubNumRegulars, UINT16 ubNumElites, BOOLEAN fMagicallyAppeared ); void AddPossiblePendingEnemiesToBattle(); void EndTacticalBattleForEnemy(); diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index 2adaa4f9..081ada33 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -29,9 +29,9 @@ UINT8 gubReinforcementMinEnemyStaticGroupSize = 12; UINT32 guiMilitiaReinforceTurn = 0, guiMilitiaArrived = 0;//dnl ch68 090913 -void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ) +void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ) { - UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; + UINT16 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; UINT16 pusMoveDir[4][3]; //first column in this matrix is number of sector, except for 4th row UINT8 ubDirNumber, ubIndex; @@ -156,9 +156,9 @@ void ActivateTurncoatsForAutoResolve( INT16 sSectorX, INT16 sSectorY ) } } -UINT8 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY ) +UINT16 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY ) { - UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; + UINT16 ubNumAdmins, ubNumTroops, ubNumElites, ubNumRobots, ubNumTanks, ubNumJeeps; GetNumberOfEnemiesInFiveSectors( sMapX, sMapY, &ubNumAdmins, &ubNumTroops, &ubNumElites, &ubNumRobots, &ubNumTanks, &ubNumJeeps ); diff --git a/Strategic/Reinforcement.h b/Strategic/Reinforcement.h index e6017b51..05079013 100644 --- a/Strategic/Reinforcement.h +++ b/Strategic/Reinforcement.h @@ -2,16 +2,16 @@ #define __REINFORCEMENT_H__ //For Autoresolve (mostly) -void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT8 *pubNumAdmins, UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 *pubNumRobots, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ); +void GetNumberOfEnemiesInFiveSectors( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumAdmins, UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 *pubNumRobots, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ); void ActivateTurncoatsForAutoResolve( INT16 sSectorX, INT16 sSectorY ); BOOLEAN IsGroupInARightSectorToReinforce( GROUP *pGroup, INT16 sSectorX, INT16 sSectorY ); UINT8 GetAdjacentSectors( UINT8 pSectors[4], INT16 sSectorX, INT16 sSectorY ); UINT16 CountAllMilitiaInFiveSectors(INT16 sMapX, INT16 sMapY); -UINT8 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY ); +UINT16 NumEnemiesInFiveSectors( INT16 sMapX, INT16 sMapY ); //For Tactical UINT8 DoReinforcementAsPendingNonPlayer( INT16 sMapX, INT16 sMapY, UINT8 usTeam ); void AddPossiblePendingMilitiaToBattle(); GROUP* GetNonPlayerGroupInSectorForReinforcement( INT16 sMapX, INT16 sMapY, UINT8 usTeam ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/UndergroundInit.cpp b/Strategic/UndergroundInit.cpp index a5ea0904..9e102d26 100644 --- a/Strategic/UndergroundInit.cpp +++ b/Strategic/UndergroundInit.cpp @@ -19,7 +19,7 @@ extern "C" { #include "connect.h" // externals -UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ); +extern UNDERGROUND_SECTORINFO* NewUndergroundNode( UINT8 ubSectorX, UINT8 ubSectorY, UINT8 ubSectorZ ); extern BOOLEAN gfGettingNameFromSaveLoadScreen; // helper functions @@ -49,6 +49,21 @@ bool LuaTable::getValue(const char * index, UINT8& value) return false; } +template <> +bool LuaTable::getValue(const char* index, UINT16& value) +{ + int dummy; + + bool b = getValue(index, dummy); + if (b) + { + value = static_cast(dummy); + return true; + } + + return false; +} + // Calls into Lua script to let build underground sector list. BOOLEAN LuaUnderground::InitializeSectorList() { diff --git a/Tactical/Enemy Soldier Save.cpp b/Tactical/Enemy Soldier Save.cpp index 0d11d98a..2fdfa34f 100644 --- a/Tactical/Enemy Soldier Save.cpp +++ b/Tactical/Enemy Soldier Save.cpp @@ -39,7 +39,7 @@ int gCivPreservedTempFileVersion[256]; BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *pNode, GROUP *pGroup = NULL ); -BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT8 *pubNumRobots, UINT8 *pubNumElites, UINT8 *pubNumRegulars, UINT8 *pubNumAdmins, UINT8 *pubNumCreatures, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ); +BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT16 *pubNumRobots, UINT16 *pubNumElites, UINT16 *pubNumRegulars, UINT16 *pubNumAdmins, UINT16 *pubNumCreatures, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ); BOOLEAN gfRestoringEnemySoldiersFromTempFile = FALSE; BOOLEAN gfRestoringCiviliansFromTempFile = FALSE; @@ -100,8 +100,8 @@ BOOLEAN LoadEnemySoldiersFromTempFile() #endif INT8 bSectorZ; UINT8 ubSectorID; - UINT8 ubNumRobots = 0, ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0, ubNumTanks = 0, ubNumJeeps = 0; - UINT8 ubStrategicRobots, ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures, ubStrategicTanks, ubStrategicJeeps; + UINT16 ubNumRobots = 0, ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0, ubNumTanks = 0, ubNumJeeps = 0; + UINT16 ubStrategicRobots, ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures, ubStrategicTanks, ubStrategicJeeps; gfRestoringEnemySoldiersFromTempFile = TRUE; @@ -695,8 +695,8 @@ BOOLEAN NewWayOfLoadingEnemySoldiersFromTempFile() #endif INT8 bSectorZ; UINT8 ubSectorID; - UINT8 ubNumRobots = 0, ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0, ubNumTanks = 0, ubNumJeeps = 0; - UINT8 ubStrategicRobots = 0, ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures, ubStrategicTanks, ubStrategicJeeps; + UINT16 ubNumRobots = 0, ubNumElites = 0, ubNumTroops = 0, ubNumAdmins = 0, ubNumCreatures = 0, ubNumTanks = 0, ubNumJeeps = 0; + UINT16 ubStrategicRobots = 0, ubStrategicElites, ubStrategicTroops, ubStrategicAdmins, ubStrategicCreatures, ubStrategicTanks, ubStrategicJeeps; gfRestoringEnemySoldiersFromTempFile = TRUE; @@ -1638,7 +1638,7 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY -BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT8 *pubNumRobots, UINT8 *pubNumElites, UINT8 *pubNumRegulars, UINT8 *pubNumAdmins, UINT8 *pubNumCreatures, UINT8 *pubNumTanks, UINT8 *pubNumJeeps ) +BOOLEAN CountNumberOfElitesRegularsAdminsAndCreaturesFromEnemySoldiersTempFile( UINT16 *pubNumRobots, UINT16 *pubNumElites, UINT16 *pubNumRegulars, UINT16 *pubNumAdmins, UINT16 *pubNumCreatures, UINT16 *pubNumTanks, UINT16 *pubNumJeeps ) { // SOLDIERINITNODE *curr; SOLDIERCREATE_STRUCT tempDetailedPlacement; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 35cc4b59..7963e9e6 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -22475,7 +22475,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginAttachCan( INT32 sGridNo, UINT8 ubDirection } -extern UINT8 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); +extern UINT16 NumEnemiesInAnySector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ); void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection ) { diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 7cb99a45..d4ec5fe7 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -318,8 +318,8 @@ BOOLEAN LoadSoldiersFromMap(INT8** hBuffer, FLOAT dMajorMapVersion, UINT8 ubMino AssertMsg(0, "Failed to allocate memory for new basic placement in LoadSoldiersFromMap."); return(FALSE); } - Assert(cnt < 256); - pNode->ubNodeID = (UINT8)cnt; + Assert(cnt < MAX_INDIVIDUALS); + pNode->ubNodeID = cnt; if(tempBasicPlacement.fDetailedPlacement) { // Add the static detailed placement information in the same newly created node as the basic placement. Read static detailed placement from file. @@ -369,7 +369,7 @@ BOOLEAN SaveSoldiersToMap(HWFILE hFile, FLOAT dMajorMapVersion, UINT8 ubMinorMap { if(!curr) return(FALSE); - curr->ubNodeID = (UINT8)i; + curr->ubNodeID = i; curr->pBasicPlacement->Save(hFile, dMajorMapVersion, ubMinorMapVersion); if(curr->pBasicPlacement->fDetailedPlacement) { @@ -577,7 +577,6 @@ void SortSoldierInitList() } extern FLOAT gAmbushRadiusModifier; -#pragma optimize("",off) BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) { UINT8 ubProfile; @@ -855,7 +854,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) if(is_server) ScreenMsg( FONT_YELLOW, MSG_MPSYSTEM, L"report this MP error (AddPlacementToWorld-FAIL!)"); return FALSE; } -#pragma optimize("",on) + void AddPlacementToWorldByProfileID( UINT8 ubProfile ) { SOLDIERINITNODE * curr; @@ -874,12 +873,12 @@ void AddPlacementToWorldByProfileID( UINT8 ubProfile ) } } -UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) +UINT16 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT16 ubMaxNum ) { - UINT8 ubNumAdded = 0; + UINT16 ubNumAdded = 0; SOLDIERINITNODE *mark; - UINT8 ubSlotsToFill; - UINT8 ubSlotsAvailable; + UINT16 ubSlotsToFill; + UINT16 ubSlotsAvailable; SOLDIERINITNODE *curr; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierInitListTeamToWorld")); @@ -1046,22 +1045,22 @@ UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ) return ubNumAdded; } -#pragma optimize("",off) -void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTroops, UINT8 ubTotalElite, UINT8 ubTotalRobots, UINT8 ubTotalTanks, UINT8 ubTotalJeeps ) + +void AddSoldierInitListEnemyDefenceSoldiers( UINT16 ubTotalAdmin, UINT16 ubTotalTroops, UINT16 ubTotalElite, UINT16 ubTotalRobots, UINT16 ubTotalTanks, UINT16 ubTotalJeeps ) { SOLDIERINITNODE *mark; SOLDIERINITNODE *curr; INT32 iRandom; - UINT8 ubMaxNum; - UINT8 ubRobotPDSlots = 0, ubRobotDSlots = 0, ubRobotPSlots = 0, ubRobotBSlots = 0; - UINT8 ubElitePDSlots = 0, ubEliteDSlots = 0, ubElitePSlots = 0, ubEliteBSlots = 0; - UINT8 ubTroopPDSlots = 0, ubTroopDSlots = 0, ubTroopPSlots = 0, ubTroopBSlots = 0; - UINT8 ubAdminPDSlots = 0, ubAdminDSlots = 0, ubAdminPSlots = 0, ubAdminBSlots = 0; - UINT8 ubTankPDSlots = 0, ubTankDSlots = 0, ubTankPSlots = 0, ubTankBSlots = 0; - UINT8 ubJeepPDSlots = 0, ubJeepDSlots = 0, ubJeepPSlots = 0, ubJeepBSlots = 0; - UINT8 ubFreeSlots; - UINT8 *pCurrSlots=NULL; - UINT8 *pCurrTotal=NULL; + UINT16 ubMaxNum; + UINT16 ubRobotPDSlots = 0, ubRobotDSlots = 0, ubRobotPSlots = 0, ubRobotBSlots = 0; + UINT16 ubElitePDSlots = 0, ubEliteDSlots = 0, ubElitePSlots = 0, ubEliteBSlots = 0; + UINT16 ubTroopPDSlots = 0, ubTroopDSlots = 0, ubTroopPSlots = 0, ubTroopBSlots = 0; + UINT16 ubAdminPDSlots = 0, ubAdminDSlots = 0, ubAdminPSlots = 0, ubAdminBSlots = 0; + UINT16 ubTankPDSlots = 0, ubTankDSlots = 0, ubTankPSlots = 0, ubTankBSlots = 0; + UINT16 ubJeepPDSlots = 0, ubJeepDSlots = 0, ubJeepPSlots = 0, ubJeepBSlots = 0; + UINT16 ubFreeSlots; + UINT16 *pCurrSlots=NULL; + UINT16 *pCurrTotal=NULL; UINT8 ubCurrClass; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierInitListEnemyDefenceSoldiers")); @@ -1601,25 +1600,25 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTr curr = curr->next; } } -#pragma optimize("",on) + //If we are adding militia to our map, then we do a few things differently. //First of all, they exist exclusively to the enemy troops, so if the militia exists in the //sector, then they get to use the enemy placements. However, we remove any orders from //placements containing RNDPTPATROL or POINTPATROL orders, as well as remove any detailed //placement information. -void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumElites ) +void AddSoldierInitListMilitia( UINT16 ubNumGreen, UINT16 ubNumRegs, UINT16 ubNumElites ) { SOLDIERINITNODE *mark; SOLDIERINITNODE *curr; INT32 iRandom; - UINT8 ubMaxNum; + UINT16 ubMaxNum; BOOLEAN fDoPlacement; - UINT8 ubEliteSlots = 0; - UINT8 ubRegSlots = 0; - UINT8 ubGreenSlots = 0; - UINT8 ubFreeSlots; - UINT8 *pCurrSlots=NULL; - UINT8 *pCurrTotal=NULL; + UINT16 ubEliteSlots = 0; + UINT16 ubRegSlots = 0; + UINT16 ubGreenSlots = 0; + UINT16 ubFreeSlots; + UINT16 *pCurrSlots=NULL; + UINT16 *pCurrTotal=NULL; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierInitListMilitia")); @@ -1955,22 +1954,22 @@ void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumRegs, UINT8 ubNumEl } } -void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNumInfants, - UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 ubNumAdultMales, - UINT8 ubNumAdultFemales ) +void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT16 ubNumLarvae, UINT16 ubNumInfants, + UINT16 ubNumYoungMales, UINT16 ubNumYoungFemales, UINT16 ubNumAdultMales, + UINT16 ubNumAdultFemales ) { SOLDIERINITNODE *curr; INT32 iRandom; - UINT8 ubFreeSlots; + UINT16 ubFreeSlots; BOOLEAN fDoPlacement; - UINT8 ubNumCreatures; + UINT16 ubNumCreatures; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierInitListCreatures")); SortSoldierInitList(); //Okay, if we have a queen, place her first. She MUST have a special placement, else //we can't use anything. - ubNumCreatures = (UINT8)(ubNumLarvae + ubNumInfants + ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales + ubNumAdultFemales); + ubNumCreatures = (ubNumLarvae + ubNumInfants + ubNumYoungMales + ubNumYoungFemales + ubNumAdultMales + ubNumAdultFemales); if( fQueen ) { curr = gSoldierInitHead; @@ -2292,10 +2291,9 @@ void UseEditorAlternateList() //if the map was loaded again! void EvaluateDeathEffectsToSoldierInitList( SOLDIERTYPE *pSoldier ) { - SOLDIERINITNODE *curr; - UINT8 ubNodeID; - curr = gSoldierInitHead; - ubNodeID = 0; + UINT16 ubNodeID = 0; + SOLDIERINITNODE* curr = gSoldierInitHead; + if( pSoldier->bTeam == MILITIA_TEAM ) return; while( curr ) @@ -2319,7 +2317,7 @@ void EvaluateDeathEffectsToSoldierInitList( SOLDIERTYPE *pSoldier ) } } -void RemoveDetailedPlacementInfo( UINT8 ubNodeID ) +void RemoveDetailedPlacementInfo( UINT16 ubNodeID ) { SOLDIERINITNODE *curr; curr = gSoldierInitHead; @@ -2345,7 +2343,7 @@ BOOLEAN SaveSoldierInitListLinks( HWFILE hfile ) { SOLDIERINITNODE *curr; UINT32 uiNumBytesWritten; - UINT8 ubSlots = 0; + UINT16 ubSlots = 0; //count the number of soldier init nodes... curr = gSoldierInitHead; @@ -2355,8 +2353,8 @@ BOOLEAN SaveSoldierInitListLinks( HWFILE hfile ) curr = curr->next; } //...and save it. - FileWrite( hfile, &ubSlots, 1, &uiNumBytesWritten ); - if( uiNumBytesWritten != 1 ) + FileWrite( hfile, &ubSlots, 2, &uiNumBytesWritten ); + if( uiNumBytesWritten != 2 ) { return FALSE; } @@ -2368,8 +2366,8 @@ BOOLEAN SaveSoldierInitListLinks( HWFILE hfile ) { curr->ubSoldierID = 0; } - FileWrite( hfile, &curr->ubNodeID, 1, &uiNumBytesWritten ); - if( uiNumBytesWritten != 1 ) + FileWrite( hfile, &curr->ubNodeID, 2, &uiNumBytesWritten ); + if( uiNumBytesWritten != 2 ) { return FALSE; } @@ -2387,23 +2385,23 @@ BOOLEAN LoadSoldierInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubNodeID; - UINT16 ubSoldierID; + UINT16 ubSlots; + UINT16 ubSoldierID, ubNodeID; - FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSlots, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } while( ubSlots-- ) { - FileRead( hfile, &ubNodeID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubNodeID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } - FileRead( hfile, &ubSoldierID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSoldierID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } @@ -2799,18 +2797,18 @@ BOOLEAN NewWayOfLoadingEnemySoldierInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubNodeID; - UINT16 ubSoldierID; + UINT16 ubSlots; + UINT16 ubSoldierID, ubNodeID; - FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSlots, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } while( ubSlots-- ) { - FileRead( hfile, &ubNodeID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubNodeID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } @@ -2846,18 +2844,18 @@ BOOLEAN NewWayOfLoadingCivilianInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubNodeID; - UINT16 ubSoldierID; + UINT16 ubSlots; + UINT16 ubSoldierID, ubNodeID; - FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSlots, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } while( ubSlots-- ) { - FileRead( hfile, &ubNodeID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubNodeID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } @@ -2893,18 +2891,18 @@ BOOLEAN LookAtButDontProcessEnemySoldierInitListLinks( HWFILE hfile ) { UINT32 uiNumBytesRead; SOLDIERINITNODE *curr; - UINT8 ubSlots, ubNodeID; - UINT16 ubSoldierID; + UINT16 ubSlots; + UINT16 ubSoldierID, ubNodeID; - FileRead( hfile, &ubSlots, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubSlots, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } while( ubSlots-- ) { - FileRead( hfile, &ubNodeID, 1, &uiNumBytesRead ); - if( uiNumBytesRead != 1 ) + FileRead( hfile, &ubNodeID, 2, &uiNumBytesRead ); + if( uiNumBytesRead != 2 ) { return FALSE; } @@ -3329,4 +3327,4 @@ void SectorAddDownedPilot( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) // remove the flag. We can only find the pilot the first time we visit this sector after the heli was shut down pSector->usSectorInfoFlag &= ~SECTORINFO_ENEMYHELI_SHOTDOWN; } -} \ No newline at end of file +} diff --git a/Tactical/Soldier Init List.h b/Tactical/Soldier Init List.h index ed1002a2..0eb2f2ef 100644 --- a/Tactical/Soldier Init List.h +++ b/Tactical/Soldier Init List.h @@ -6,7 +6,7 @@ typedef struct SOLDIERINITNODE { - UINT8 ubNodeID; + UINT16 ubNodeID; UINT16 ubSoldierID; BASIC_SOLDIERCREATE_STRUCT *pBasicPlacement; SOLDIERCREATE_STRUCT *pDetailedPlacement; @@ -39,13 +39,13 @@ SOLDIERINITNODE* AddBasicPlacementToSoldierInitList( BASIC_SOLDIERCREATE_STRUCT void RemoveSoldierNodeFromInitList( SOLDIERINITNODE *pNode ); SOLDIERINITNODE* FindSoldierInitNodeWithID( UINT16 usID ); -UINT8 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT8 ubMaxNum ); -void AddSoldierInitListEnemyDefenceSoldiers( UINT8 ubTotalAdmin, UINT8 ubTotalTroops, UINT8 ubTotalElite, UINT8 ubTotalRobots, UINT8 ubTotalTanks, UINT8 ubTotalJeeps ); -void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT8 ubNumLarvae, UINT8 ubNumInfants, - UINT8 ubNumYoungMales, UINT8 ubNumYoungFemales, UINT8 ubNumAdultMales, - UINT8 ubNumAdultFemales ); +UINT16 AddSoldierInitListTeamToWorld( INT8 bTeam, UINT16 ubMaxNum ); +void AddSoldierInitListEnemyDefenceSoldiers( UINT16 ubTotalAdmin, UINT16 ubTotalTroops, UINT16 ubTotalElite, UINT16 ubTotalRobots, UINT16 ubTotalTanks, UINT16 ubTotalJeeps ); +void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT16 ubNumLarvae, UINT16 ubNumInfants, + UINT16 ubNumYoungMales, UINT16 ubNumYoungFemales, UINT16 ubNumAdultMales, + UINT16 ubNumAdultFemales ); void AddSoldierInitListOtherCreatures( UINT8 usNum ); -void AddSoldierInitListMilitia( UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites ); +void AddSoldierInitListMilitia( UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites ); void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites ); void AddSoldierInitListBloodcats(); @@ -55,7 +55,7 @@ void UseEditorAlternateList(); void AddPlacementToWorldByProfileID( UINT8 ubProfile ); void EvaluateDeathEffectsToSoldierInitList( SOLDIERTYPE *pSoldier ); -void RemoveDetailedPlacementInfo( UINT8 ubNodeID ); +void RemoveDetailedPlacementInfo( UINT16 ubNodeID ); void AddProfilesUsingProfileInsertionData(); void AddProfilesNotUsingProfileInsertionData(); @@ -69,4 +69,4 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); // Flugente: decide wether to add a downed pilot if a helicopter was shot down here void SectorAddDownedPilot( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); -#endif \ No newline at end of file +#endif From d9edc9362b33cd48de67c2034fb19256587181e6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:01:17 +0200 Subject: [PATCH 041/571] Fix loading of tactical status ubEnemyKilledOnAttacker is size UINT16 but loading function was reading only UINT8 worth for it --- Ja2/SaveLoadGame.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 575b25b7..3d634441 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -7740,16 +7740,16 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fSomeoneHit, sizeof(gTacticalStatus.fSomeoneHit), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiTimeSinceLastOpplistDecay, sizeof(gTacticalStatus.uiTimeSinceLastOpplistDecay), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bMercArrivingQuoteBeingUsed, sizeof(gTacticalStatus.bMercArrivingQuoteBeingUsed), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyKilledOnAttackKiller, sizeof(gTacticalStatus.ubEnemyKilledOnAttackKiller), sizeof(UINT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubEnemyKilledOnAttackKiller, sizeof(gTacticalStatus.ubEnemyKilledOnAttackKiller), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fCountingDownForGuideDescription, sizeof(gTacticalStatus.fCountingDownForGuideDescription), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bGuideDescriptionCountDown, sizeof(gTacticalStatus.bGuideDescriptionCountDown), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubGuideDescriptionToUse, sizeof(gTacticalStatus.ubGuideDescriptionToUse), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bGuideDescriptionSectorX, sizeof(gTacticalStatus.bGuideDescriptionSectorX), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.bGuideDescriptionSectorY, sizeof(gTacticalStatus.bGuideDescriptionSectorY), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fEnemyFlags, sizeof(gTacticalStatus.fEnemyFlags), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus. fAutoBandagePending, sizeof(gTacticalStatus. fAutoBandagePending), sizeof(BOOLEAN), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus. fHasEnteredCombatModeSinceEntering, sizeof(gTacticalStatus. fHasEnteredCombatModeSinceEntering), sizeof(BOOLEAN), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus. fDontAddNewCrows, sizeof(gTacticalStatus. fDontAddNewCrows), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fAutoBandagePending, sizeof(gTacticalStatus. fAutoBandagePending), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fHasEnteredCombatModeSinceEntering, sizeof(gTacticalStatus. fHasEnteredCombatModeSinceEntering), sizeof(BOOLEAN), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fDontAddNewCrows, sizeof(gTacticalStatus. fDontAddNewCrows), sizeof(BOOLEAN), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubMorePadding, sizeof(gTacticalStatus.ubMorePadding), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sCreatureTenseQuoteDelay, sizeof(gTacticalStatus.sCreatureTenseQuoteDelay), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiCreatureTenseQuoteLastUpdate, sizeof(gTacticalStatus.uiCreatureTenseQuoteLastUpdate), sizeof(UINT32), numBytesRead); From 0089e0a6405e2409e6d1884a8eb02fe5242c4b47 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:02:46 +0200 Subject: [PATCH 042/571] Change strategic enemy amounts to UINT16 --- Ja2/legion cfg.cpp | 6 +- Strategic/AI Viewer.cpp | 8 +-- Strategic/Auto Resolve.cpp | 6 +- Strategic/Map Screen Interface Map.cpp | 2 +- Strategic/MilitiaSquads.cpp | 2 +- Strategic/MilitiaSquads.h | 4 +- Strategic/Strategic AI.cpp | 90 ++++++++++++------------ Strategic/Strategic AI.h | 6 +- Strategic/Strategic Movement.h | 28 ++++---- Strategic/Strategic Transport Groups.cpp | 16 ++--- Strategic/Strategic Transport Groups.h | 2 +- 11 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Ja2/legion cfg.cpp b/Ja2/legion cfg.cpp index 2004c497..0534251c 100644 --- a/Ja2/legion cfg.cpp +++ b/Ja2/legion cfg.cpp @@ -81,9 +81,9 @@ void RandomStats (); void RandomAddEnemy( UINT8 SectorX, UINT8 SectorY, UINT8 Level ) { UNDERGROUND_SECTORINFO *pSector; -UINT8 ubNumAdmins = 0; -UINT8 ubNumTroops = 0; -UINT8 ubNumElites = 0; +UINT16 ubNumAdmins = 0; +UINT16 ubNumTroops = 0; +UINT16 ubNumElites = 0; if ( Level != 0 ) { diff --git a/Strategic/AI Viewer.cpp b/Strategic/AI Viewer.cpp index 3c1945fe..9f2006f0 100644 --- a/Strategic/AI Viewer.cpp +++ b/Strategic/AI Viewer.cpp @@ -157,7 +157,7 @@ void ViewCreaturesCallback( GUI_BUTTON *btn, INT32 reason ); void ExtractAndUpdatePopulations(); void PrintEnemyPopTable(); void PrintEnemiesKilledTable(); -UINT8 ChooseEnemyIconColor( UINT8 ubAdmins, UINT8 ubTroops, UINT8 ubElites, UINT8 ubTanks, UINT8 ubJeeps ); +UINT8 ChooseEnemyIconColor( UINT16 ubAdmins, UINT16 ubTroops, UINT16 ubElites, UINT16 ubTanks, UINT16 ubJeeps ); void BlitGroupIcon( UINT8 ubIconType, UINT8 ubIconColor, UINT32 uiX, UINT32 uiY, HVOBJECT hVObject ); void PrintDetailedEnemiesInSectorInfo( INT32 iScreenX, INT32 iScreenY, UINT8 ubSectorX, UINT8 ubSectorY ); @@ -536,7 +536,7 @@ void RenderMovingGroupsAndMercs() GROUP *pGroup; HVOBJECT hVObject; INT32 x, y; - UINT8 ubNumTroops, ubNumAdmins, ubNumElites, ubNumTanks, ubNumJeeps; + UINT16 ubNumTroops, ubNumAdmins, ubNumElites, ubNumTanks, ubNumJeeps; float ratio; INT32 minX, maxX, minY, maxY; UINT8 ubIconType; @@ -722,7 +722,7 @@ void RenderInfoInSector() { SECTORINFO *pSector; GROUP *pGroup; - UINT8 ubNumAdmins = 0, ubNumTroops = 0, ubNumElites = 0, ubNumTanks = 0, ubNumJeeps = 0, ubAdminsInBattle = 0, ubTroopsInBattle = 0, ubElitesInBattle = 0, ubTanksInBattle = 0, ubJeepsInBattle = 0,ubNumGroups = 0; + UINT16 ubNumAdmins = 0, ubNumTroops = 0, ubNumElites = 0, ubNumTanks = 0, ubNumJeeps = 0, ubAdminsInBattle = 0, ubTroopsInBattle = 0, ubElitesInBattle = 0, ubTanksInBattle = 0, ubJeepsInBattle = 0,ubNumGroups = 0; pSector = &SectorInfo[ SECTOR( ubSectorX, ubSectorY ) ]; @@ -1832,7 +1832,7 @@ void PrintEnemiesKilledTable() -UINT8 ChooseEnemyIconColor( UINT8 ubAdmins, UINT8 ubTroops, UINT8 ubElites, UINT8 ubTanks, UINT8 ubJeeps ) +UINT8 ChooseEnemyIconColor( UINT16 ubAdmins, UINT16 ubTroops, UINT16 ubElites, UINT16 ubTanks, UINT16 ubJeeps ) { UINT8 ubIconColor; diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 7715042d..565cf5bb 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -755,9 +755,9 @@ void AssociateEnemiesWithStrategicGroups() { SECTORINFO *pSector; GROUP *pGroup; - UINT8 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots; //how many soldiers of the type do we still have to assign to a group? - UINT8 ubISNumAdmins, ubISNumTroops, ubISNumElites, ubISNumTanks, ubISNumJeeps, ubISNumRobots; - UINT8 ubNumElitesInGroup, ubNumTroopsInGroup, ubNumAdminsInGroup, ubNumTanksInGroup, ubNumJeepsInGroup, ubNumRobotsInGroup; + UINT16 ubNumAdmins, ubNumTroops, ubNumElites, ubNumTanks, ubNumJeeps, ubNumRobots; //how many soldiers of the type do we still have to assign to a group? + UINT16 ubISNumAdmins, ubISNumTroops, ubISNumElites, ubISNumTanks, ubISNumJeeps, ubISNumRobots; + UINT16 ubNumElitesInGroup, ubNumTroopsInGroup, ubNumAdminsInGroup, ubNumTanksInGroup, ubNumJeepsInGroup, ubNumRobotsInGroup; INT32 i; UINT8 pSectors[4]; UINT8 ubDirAmount; diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 046bdc57..8fd4fa52 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -8090,7 +8090,7 @@ void MilitiaGroupBoxButtonCallback( GUI_BUTTON *btn, INT32 reason ) UINT8 militiatype = id / 2; // for now, always alter by 1 - UINT8 howmany = 1; + UINT16 howmany = 1; // either add or remove a militia from currently selected group if ( id % 2 ) diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 303ea283..149a6c97 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -70,7 +70,7 @@ #define DIR_SOUTH 2 #define DIR_WEST 3 -UINT8 gpAttackDirs[5][4]; // 0. Green Militia 1. Regular Militia 2. Elite Militia 3. Insertion code +UINT16 gpAttackDirs[5][4]; // 0. Green Militia 1. Regular Militia 2. Elite Militia 3. Insertion code UINT8 guiDirNumber = 0; BOOLEAN gfMSBattle = FALSE; diff --git a/Strategic/MilitiaSquads.h b/Strategic/MilitiaSquads.h index f86a8a62..d07913dd 100644 --- a/Strategic/MilitiaSquads.h +++ b/Strategic/MilitiaSquads.h @@ -9,7 +9,7 @@ //#define MAXIMUM_MILITIA_SQUAD_SIZE 30 -extern UINT8 gpAttackDirs[5][4]; +extern UINT16 gpAttackDirs[5][4]; extern UINT8 guiDirNumber; // Flugente: militia in this sector is ordered to move according to flags that were applied to it prior @@ -50,4 +50,4 @@ void DissolveAllMilitiaGroupsInSector( INT16 sMapX, INT16 sMapY ); BOOLEAN MilitiaGroupEntersCurrentSector( UINT8 usGroupId, INT16 sMapX, INT16 sMapY ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index bf1d52b5..8fbed770 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -470,9 +470,9 @@ BOOLEAN SendReinforcementsForPatrol( INT32 iPatrolID, GROUP **pOptionalGroup ); void ClearPreviousAIGroupAssignment( GROUP *pGroup ); -void CalcNumTroopsBasedOnComposition( UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 ubTotal, INT32 iCompositionID ); +void CalcNumTroopsBasedOnComposition( UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 ubTotal, INT32 iCompositionID ); void ConvertGroupTroopsToComposition( GROUP *pGroup, INT32 iCompositionID ); -void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT8 ubSize ); +void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT16 ubSize ); //If there are any enemy groups that will be moving through this sector due, they will have to repath which //will cause them to avoid the sector. Returns the number of redirected groups. @@ -1151,8 +1151,8 @@ void InitStrategicAI() INT32 iStartPop, iDesiredPop, iPriority; SECTORINFO *pSector = NULL; GROUP *pGroup; - UINT8 ubNumTroops; - UINT8 ubNumRobots, ubNumTanks, ubNumJeeps; + UINT16 ubNumTroops; + UINT16 ubNumRobots, ubNumTanks, ubNumJeeps; INT32 iPercentElitesBonus; INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic3"); @@ -1538,9 +1538,9 @@ void InitStrategicAI() //based on the difficulty settings in the above patrol table. //if( gPatrolGroup[ i ].ubUNUSEDStartIfDifficulty <= gGameOptions.ubDifficultyLevel ) { - UINT8 troopCount = (UINT8)(gPatrolGroup[ i ].bSize + Random( 3 ) - 1); - troopCount = (UINT8)max( gubMinEnemyGroupSize, min( iMaxEnemyGroupSize, troopCount) ); - UINT8 ubNumElites; + UINT16 troopCount = (UINT16)(gPatrolGroup[ i ].bSize + Random( 3 ) - 1); + troopCount = (UINT16)max( gubMinEnemyGroupSize, min( iMaxEnemyGroupSize, troopCount) ); + UINT16 ubNumElites; InitializeGroup(GROUP_TYPE_PATROL, troopCount, ubNumTroops, ubNumElites, ubNumRobots, ubNumJeeps, ubNumTanks, Random(10) < gGameOptions.ubDifficultyLevel && i != 3 && i != 4); //Note on adding patrol groups... @@ -2237,12 +2237,12 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); if( gGarrisonGroup[ i ].ubSectorID != SECTOR( gModSettings.ubSAISpawnSectorX, gModSettings.ubSAISpawnSectorY ) ) { EliminateSurplusTroopsForGarrison( pGroup, pSector ); - pSector->ubNumAdmins = (UINT8)(pSector->ubNumAdmins + pGroup->pEnemyGroup->ubNumAdmins); - pSector->ubNumTroops = (UINT8)(pSector->ubNumTroops + pGroup->pEnemyGroup->ubNumTroops); - pSector->ubNumElites = (UINT8)(pSector->ubNumElites + pGroup->pEnemyGroup->ubNumElites); - pSector->ubNumRobots = (UINT8)(pSector->ubNumRobots + pGroup->pEnemyGroup->ubNumRobots); - pSector->ubNumTanks = (UINT8)(pSector->ubNumTanks + pGroup->pEnemyGroup->ubNumTanks); - pSector->ubNumJeeps = (UINT8)(pSector->ubNumJeeps + pGroup->pEnemyGroup->ubNumJeeps); + pSector->ubNumAdmins = (pSector->ubNumAdmins + pGroup->pEnemyGroup->ubNumAdmins); + pSector->ubNumTroops = (pSector->ubNumTroops + pGroup->pEnemyGroup->ubNumTroops); + pSector->ubNumElites = (pSector->ubNumElites + pGroup->pEnemyGroup->ubNumElites); + pSector->ubNumRobots = (pSector->ubNumRobots + pGroup->pEnemyGroup->ubNumRobots); + pSector->ubNumTanks = (pSector->ubNumTanks + pGroup->pEnemyGroup->ubNumTanks); + pSector->ubNumJeeps = (pSector->ubNumJeeps + pGroup->pEnemyGroup->ubNumJeeps); #ifdef JA2BETAVERSION LogStrategicEvent( "%d reinforcements have arrived to garrison sector %c%d", @@ -2325,7 +2325,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Strategic5"); pPatrolGroup->pEnemyGroup->ubNumRobots += pGroup->pEnemyGroup->ubNumRobots; pPatrolGroup->pEnemyGroup->ubNumTanks += pGroup->pEnemyGroup->ubNumTanks; pPatrolGroup->pEnemyGroup->ubNumJeeps += pGroup->pEnemyGroup->ubNumJeeps; - pPatrolGroup->ubGroupSize += (UINT8)(pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins + pPatrolGroup->ubGroupSize += (pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumRobots + pGroup->pEnemyGroup->ubNumTanks + pGroup->pEnemyGroup->ubNumJeeps); #ifdef JA2BETAVERSION LogStrategicEvent( "%d reinforcements have joined patrol group at sector %c%d (new size: %d)", @@ -2678,7 +2678,7 @@ void CheckEnemyControlledSector( UINT8 ubSectorID ) { if( pGroup->pEnemyGroup->ubPendingReinforcements > 4 ) { - UINT8 ubNum = (UINT8)(3 + Random( 3 )); + UINT16 ubNum = (UINT16)(3 + Random( 3 )); pGroup->pEnemyGroup->ubNumTroops += ubNum; pGroup->ubGroupSize += ubNum; pGroup->pEnemyGroup->ubPendingReinforcements -= ubNum; @@ -3044,7 +3044,7 @@ BOOLEAN SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoi GROUP *pGroup; UINT8 ubSrcSectorX, ubSrcSectorY, ubDstSectorX, ubDstSectorY; UINT8 ubNumExtraReinforcements; - UINT8 ubGroupSize; + UINT16 ubGroupSize; BOOLEAN fLimitMaxTroopsAllowable = FALSE; Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ @@ -3171,7 +3171,7 @@ BOOLEAN SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoi pGroup->ubMoveType = ONE_WAY; gGarrisonGroup[ iDstGarrisonID ].ubPendingGroupID = pGroup->ubGroupID; - ubGroupSize = (UINT8)(pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumRobots + pGroup->pEnemyGroup->ubNumTanks + pGroup->pEnemyGroup->ubNumJeeps); + ubGroupSize = (UINT16)(pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumRobots + pGroup->pEnemyGroup->ubNumTanks + pGroup->pEnemyGroup->ubNumJeeps); if( ubNumExtraReinforcements ) { @@ -3261,7 +3261,7 @@ BOOLEAN SendReinforcementsForGarrison( INT32 iDstGarrisonID, UINT16 usDefencePoi pGroup->ubOriginalSector = (UINT8)SECTOR( ubDstSectorX, ubDstSectorY ); pGroup->ubMoveType = ONE_WAY; gGarrisonGroup[ iDstGarrisonID ].ubPendingGroupID = pGroup->ubGroupID; - ubGroupSize = (UINT8)(pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumRobots + pGroup->pEnemyGroup->ubNumTanks + pGroup->pEnemyGroup->ubNumJeeps); + ubGroupSize = (UINT16)(pGroup->pEnemyGroup->ubNumTroops + pGroup->pEnemyGroup->ubNumElites + pGroup->pEnemyGroup->ubNumAdmins + pGroup->pEnemyGroup->ubNumRobots + pGroup->pEnemyGroup->ubNumTanks + pGroup->pEnemyGroup->ubNumJeeps); if( ubNumExtraReinforcements ) { @@ -4510,15 +4510,15 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto UINT8 stagesector0, stagesector1, stagesector2, stagesector3; UINT8 assaultsector0, assaultsector1, assaultsector2, assaultsector3; unsigned ubNumSoldiers; - UINT8 ubNumRobots = 0; - UINT8 ubNumTanks = 0; - UINT8 ubNumJeeps = 0; + UINT16 ubNumRobots = 0; + UINT16 ubNumTanks = 0; + UINT16 ubNumJeeps = 0; UINT32 totalusedsoldiers = 0; - UINT8 grouptroops[4] = {0,0,0,0}; - UINT8 groupelites[4] = {0,0,0,0}; - UINT8 grouprobots[4] = {0,0,0,0}; - UINT8 grouptanks[4] = {0,0,0,0}; - UINT8 groupjeeps[4] = {0, 0, 0, 0}; + UINT16 grouptroops[4] = {0,0,0,0}; + UINT16 groupelites[4] = {0,0,0,0}; + UINT16 grouprobots[4] = {0,0,0,0}; + UINT16 grouptanks[4] = {0,0,0,0}; + UINT16 groupjeeps[4] = {0, 0, 0, 0}; UINT32 difficultyMod; switch (gGameOptions.ubDifficultyLevel) @@ -5211,12 +5211,12 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto soldiersThisSquad = (unsigned)gGameExternalOptions.iMaxEnemyGroupSize; } ubNumSoldiers -= soldiersThisSquad; - UINT8 adminsThisSquad = 0; - UINT8 troopsThisSquad = 0; - UINT8 elitesThisSquad = 0; - UINT8 robotsThisSquad = 0; - UINT8 tanksThisSquad = 0; - UINT8 jeepsThisSquad = 0; + UINT16 adminsThisSquad = 0; + UINT16 troopsThisSquad = 0; + UINT16 elitesThisSquad = 0; + UINT16 robotsThisSquad = 0; + UINT16 tanksThisSquad = 0; + UINT16 jeepsThisSquad = 0; // this is an attack group, but set it to patrol since we'll set the admin/regular/elite composition by hand here InitializeGroup(GROUP_TYPE_PATROL, soldiersThisSquad, troopsThisSquad, elitesThisSquad, robotsThisSquad, jeepsThisSquad, tanksThisSquad, Random(10 * 100) < difficultyMod * direness); if (direness < 25) { @@ -5259,7 +5259,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto // Note: 1st optional parm is a count of troops to send // 2nd optional parm is the composition of troops if (option1 > 0 && option1 < 256) { - ubNumSoldiers = (UINT8)(option1); + ubNumSoldiers = option1; } else { // Something is goofy, just send a default sized squad ubNumSoldiers = gubMinEnemyGroupSize; @@ -5351,7 +5351,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto if ( !gfUnlimitedTroops ) giReinforcementPool -= ubNumSoldiers; - UINT8 ubNumTroops, ubNumElites; + UINT16 ubNumTroops, ubNumElites; // set the type to patrol as we're manually tuning the group composition here (100% elites + ASD upgrades) InitializeGroup(GROUP_TYPE_PATROL, ubNumSoldiers, ubNumTroops, ubNumElites, ubNumRobots, ubNumJeeps, ubNumTanks, Random(10*100) < difficultyMod * HighestPlayerProgressPercentage()); @@ -6751,7 +6751,7 @@ void ClearPreviousAIGroupAssignment( GROUP *pGroup ) } } -void CalcNumTroopsBasedOnComposition( UINT8 *pubNumTroops, UINT8 *pubNumElites, UINT8 ubTotal, INT32 iCompositionID ) +void CalcNumTroopsBasedOnComposition( UINT16 *pubNumTroops, UINT16 *pubNumElites, UINT16 ubTotal, INT32 iCompositionID ) { *pubNumTroops = gArmyComp[ iCompositionID ].bTroopPercentage * ubTotal / 100; *pubNumElites = gArmyComp[ iCompositionID ].bElitePercentage * ubTotal / 100; @@ -6795,19 +6795,19 @@ void ConvertGroupTroopsToComposition( GROUP *pGroup, INT32 iCompositionID ) ValidateLargeGroup( pGroup ); } -void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT8 ubSize ) +void RemoveSoldiersFromGarrisonBasedOnComposition( INT32 iGarrisonID, UINT16 ubSize ) { SECTORINFO *pSector; INT32 iCompositionID; - UINT8 ubNumTroops, ubNumElites; + UINT16 ubNumTroops, ubNumElites; //debug stuff - UINT8 ubOrigSectorAdmins; - UINT8 ubOrigSectorTroops; - UINT8 ubOrigSectorElites; - UINT8 ubOrigNumElites; - UINT8 ubOrigNumTroops; - UINT8 ubOrigSize; + UINT16 ubOrigSectorAdmins; + UINT16 ubOrigSectorTroops; + UINT16 ubOrigSectorElites; + UINT16 ubOrigNumElites; + UINT16 ubOrigNumTroops; + UINT16 ubOrigSize; Ensure_RepairedGarrisonGroup( &gGarrisonGroup, &giGarrisonArraySize ); /* added NULL fix, 2007-03-03, Sgt. Kolja */ iCompositionID = gGarrisonGroup[ iGarrisonID ].ubComposition; @@ -7084,12 +7084,12 @@ void ASDInitializePatrolGroup(GROUP *pGroup) } } -void InitializeGroup( const GROUP_TYPE groupType, const UINT8 groupSize, ENEMYGROUP& enemyGroup, const BOOLEAN asdUpgrade ) +void InitializeGroup( const GROUP_TYPE groupType, const UINT16 groupSize, ENEMYGROUP& enemyGroup, const BOOLEAN asdUpgrade ) { InitializeGroup( groupType, groupSize, enemyGroup.ubNumTroops, enemyGroup.ubNumElites, enemyGroup.ubNumRobots, enemyGroup.ubNumJeeps, enemyGroup.ubNumTanks, asdUpgrade ); } -void InitializeGroup( const GROUP_TYPE groupType, const UINT8 groupSize, UINT8 &troopCount, UINT8 &eliteCount, UINT8 &robotCount, UINT8 &jeepCount, UINT8 &tankCount, const BOOLEAN asdUpgrade ) +void InitializeGroup( const GROUP_TYPE groupType, const UINT16 groupSize, UINT16 &troopCount, UINT16 &eliteCount, UINT16 &robotCount, UINT16 &jeepCount, UINT16 &tankCount, const BOOLEAN asdUpgrade ) { troopCount = groupSize; eliteCount = 0; diff --git a/Strategic/Strategic AI.h b/Strategic/Strategic AI.h index 5c7986af..bac2582d 100644 --- a/Strategic/Strategic AI.h +++ b/Strategic/Strategic AI.h @@ -84,8 +84,8 @@ enum GROUP_TYPE }; void ASDInitializePatrolGroup(GROUP *pGroup); -void InitializeGroup(const GROUP_TYPE groupType, const UINT8 groupSize, ENEMYGROUP& enemyGroup, const BOOLEAN asdUpgrade); -void InitializeGroup(const GROUP_TYPE groupType, const UINT8 groupSize, UINT8 &troopCount, UINT8 &eliteCount, UINT8 &robotCount, UINT8 &jeepCount, UINT8 &tankCount, const BOOLEAN asdUpgrade); +void InitializeGroup(const GROUP_TYPE groupType, const UINT16 groupSize, ENEMYGROUP& enemyGroup, const BOOLEAN asdUpgrade); +void InitializeGroup(const GROUP_TYPE groupType, const UINT16 groupSize, UINT16 &troopCount, UINT16 &eliteCount, UINT16 &robotCount, UINT16 &jeepCount, UINT16 &tankCount, const BOOLEAN asdUpgrade); extern BOOLEAN gfDisplayStrategicAILogs; extern BOOLEAN gfFirstBattleMeanwhileScenePending; @@ -181,4 +181,4 @@ typedef struct GARRISON_GROUP #define REGULAR_MILITIA_POINTS_MODIFIER 2 #define ELITE_MILITIA_POINTS_MODIFIER 3 -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Movement.h b/Strategic/Strategic Movement.h index 1b49768a..d1aad931 100644 --- a/Strategic/Strategic Movement.h +++ b/Strategic/Strategic Movement.h @@ -62,28 +62,28 @@ typedef struct PLAYERGROUP typedef struct ENEMYGROUP { - UINT8 ubNumTroops; //number of regular troops in the group - UINT8 ubNumElites; //number of elite troops in the group - UINT8 ubNumAdmins; //number of administrators in the group + UINT16 ubNumTroops; //number of regular troops in the group + UINT16 ubNumElites; //number of elite troops in the group + UINT16 ubNumAdmins; //number of administrators in the group UINT8 ubLeaderProfileID; //could be Mike, maybe the warden... someone new, but likely nobody. - UINT8 ubPendingReinforcements;//This group is waiting for reinforcements before attacking or attempting to fortify newly aquired sector. - UINT8 ubAdminsInBattle; //number of administrators in currently in battle. + UINT16 ubPendingReinforcements;//This group is waiting for reinforcements before attacking or attempting to fortify newly aquired sector. + UINT16 ubAdminsInBattle; //number of administrators in currently in battle. UINT8 ubIntention; //the type of group this is: patrol, assault, spies, etc. - UINT8 ubTroopsInBattle; //number of soldiers currently in battle. - UINT8 ubElitesInBattle; //number of elite soldiers currently in battle. + UINT16 ubTroopsInBattle; //number of soldiers currently in battle. + UINT16 ubElitesInBattle; //number of elite soldiers currently in battle. // WDS - New AI - UINT8 ubNumTanks; - UINT8 ubTanksInBattle; - UINT8 ubNumJeeps; - UINT8 ubJeepsInBattle; + UINT16 ubNumTanks; + UINT16 ubTanksInBattle; + UINT16 ubNumJeeps; + UINT16 ubJeepsInBattle; // Flugente: number of turncoats UINT8 ubNumAdmins_Turncoat; UINT8 ubNumTroops_Turncoat; UINT8 ubNumElites_Turncoat; - UINT8 ubNumRobots; //number of enemy robots in the group - UINT8 ubRobotsInBattle; //number of enemy robots currently in battle. + UINT16 ubNumRobots; //number of enemy robots in the group + UINT16 ubRobotsInBattle; //number of enemy robots currently in battle. INT8 bPadding[11]; }ENEMYGROUP; @@ -120,7 +120,7 @@ typedef struct GROUP BOOLEAN fVehicle; //vehicle controlled group? BOOLEAN fPersistant; //This flag when set prevents the group from being automatically deleted when it becomes empty. UINT8 ubGroupID; //the unique ID of the group (used for hooking into events and SOLDIERTYPE) - UINT8 ubGroupSize; //total number of individuals in the group. + UINT16 ubGroupSize; //total number of individuals in the group. UINT8 ubSectorX, ubSectorY; //last/curr sector occupied UINT8 ubSectorZ; UINT8 ubNextX, ubNextY; //next sector destination diff --git a/Strategic/Strategic Transport Groups.cpp b/Strategic/Strategic Transport Groups.cpp index 16916e3f..ccd981d0 100644 --- a/Strategic/Strategic Transport Groups.cpp +++ b/Strategic/Strategic Transport Groups.cpp @@ -52,10 +52,10 @@ extern ARMY_GUN_CHOICE_TYPE gExtendedArmyGunChoices[SOLDIER_GUN_CHOICE_SELECTION extern ARMY_GUN_CHOICE_TYPE gArmyItemChoices[SOLDIER_GUN_CHOICE_SELECTIONS][MAX_ITEM_TYPES]; extern BOOLEAN gfTownUsesLoyalty[MAX_TOWNS]; -std::map> transportGroupIdToSoldierMap; +std::map> transportGroupIdToSoldierMap; std::map transportGroupSectorInfo; -void PopulateTransportGroup(UINT8& admins, UINT8& troops, UINT8& elites, UINT8& jeeps, UINT8& tanks, UINT8& robots, UINT8 progress, int difficulty, BOOLEAN trySpecialCase); +void PopulateTransportGroup(UINT16& admins, UINT16& troops, UINT16& elites, UINT16& jeeps, UINT16& tanks, UINT16& robots, UINT8 progress, int difficulty, BOOLEAN trySpecialCase); BOOLEAN DeployTransportGroup() { @@ -128,7 +128,7 @@ BOOLEAN DeployTransportGroup() TRANSPORT_GROUP_DEBUG(L"DeployTransportGroup sending group to sectorId: %d (%d/%d)", ubSectorID, SECTORX(ubSectorID), SECTORY(ubSectorID)); - UINT8 admins, troops, elites, robots, jeeps, tanks; + UINT16 admins, troops, elites, robots, jeeps, tanks; const UINT8 progress = min(125, HighestPlayerProgressPercentage() + recentLossCount * 5); PopulateTransportGroup(admins, troops, elites, jeeps, tanks, robots, progress, difficulty, mineSectorIds.size() == 1); @@ -152,7 +152,7 @@ BOOLEAN DeployTransportGroup() BOOLEAN ForceDeployTransportGroup(UINT8 sectorId) { - UINT8 admins, troops, elites, robots, jeeps, tanks; + UINT16 admins, troops, elites, robots, jeeps, tanks; const INT8 recentLossCount = min(5, GetAllStrategicEventsOfType(EVENT_TRANSPORT_GROUP_DEFEATED).size()); const UINT8 progress = min(125, HighestPlayerProgressPercentage() + recentLossCount * 5); const UINT8 difficulty = gGameOptions.ubDifficultyLevel; @@ -603,7 +603,7 @@ void UpdateTransportGroupInventory() { SOLDIERTYPE* pSoldier = &Menptr[slot]; - const std::map>::iterator groupIter = transportGroupIdToSoldierMap.find(pSoldier->ubGroupID); + const std::map>::iterator groupIter = transportGroupIdToSoldierMap.find(pSoldier->ubGroupID); if (groupIter != transportGroupIdToSoldierMap.end()) { // let's find out if this group is coming home or still outgoing to its target destination @@ -620,7 +620,7 @@ void UpdateTransportGroupInventory() } // found a matching transport groupid - std::map::iterator soldierClassIter = groupIter->second.find(SOLDIER_CLASS_JEEP); + std::map::iterator soldierClassIter = groupIter->second.find(SOLDIER_CLASS_JEEP); if (cachedGroupJeepCount.find(groupIter->first) == cachedGroupJeepCount.end()) { cachedGroupJeepCount[groupIter->first] = soldierClassIter == groupIter->second.end() ? 0 : groupIter->second[SOLDIER_CLASS_JEEP]; @@ -874,7 +874,7 @@ void UpdateTransportGroupInventory() } } -void AddToTransportGroupMap(UINT8 groupId, int soldierClass, UINT8 amount) +void AddToTransportGroupMap(UINT8 groupId, int soldierClass, UINT16 amount) { if (gGameExternalOptions.fStrategicTransportGroupsEnabled == FALSE) { @@ -913,7 +913,7 @@ void NotifyTransportGroupDefeated() AddStrategicEvent(EVENT_TRANSPORT_GROUP_DEFEATED, GetWorldTotalMin() + 60 * hoursToRememberDefeat, 0); } -void PopulateTransportGroup(UINT8& admins, UINT8& troops, UINT8& elites, UINT8& jeeps, UINT8& tanks, UINT8& robots, UINT8 progress, int difficulty, BOOLEAN trySpecialCase) +void PopulateTransportGroup(UINT16& admins, UINT16& troops, UINT16& elites, UINT16& jeeps, UINT16& tanks, UINT16& robots, UINT8 progress, int difficulty, BOOLEAN trySpecialCase) { admins = troops = elites = robots = jeeps = tanks = 0; diff --git a/Strategic/Strategic Transport Groups.h b/Strategic/Strategic Transport Groups.h index 3fd873c5..897777fd 100644 --- a/Strategic/Strategic Transport Groups.h +++ b/Strategic/Strategic Transport Groups.h @@ -22,7 +22,7 @@ void UpdateTransportGroupInventory(); const std::map GetTransportGroupSectorInfo(); -void AddToTransportGroupMap(UINT8 groupId, int soldierClass, UINT8 amount); +void AddToTransportGroupMap(UINT8 groupId, int soldierClass, UINT16 amount); void ClearTransportGroupMap(); void NotifyTransportGroupDefeated(); From 040410b450a5b4df4fa8c9eab09c905921da8dbd Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:03:46 +0200 Subject: [PATCH 043/571] Whitespace formatting for SAVED_GAME_HEADER --- Ja2/SaveLoadGame.h | 52 ++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/Ja2/SaveLoadGame.h b/Ja2/SaveLoadGame.h index 0bf89f50..ea873e35 100644 --- a/Ja2/SaveLoadGame.h +++ b/Ja2/SaveLoadGame.h @@ -38,41 +38,29 @@ class SOLDIERTYPE; typedef struct { - UINT32 uiSavedGameVersion; - CHAR8 zGameVersionNumber[ GAME_VERSION_LENGTH ]; - - CHAR16 sSavedGameDesc[ SIZE_OF_SAVE_GAME_DESC ]; - - UINT32 uiFlags; - + UINT32 uiSavedGameVersion; + CHAR8 zGameVersionNumber[ GAME_VERSION_LENGTH ]; + CHAR16 sSavedGameDesc[ SIZE_OF_SAVE_GAME_DESC ]; + UINT32 uiFlags; #ifdef CRIPPLED_VERSION - UINT8 ubCrippleFiller[20]; + UINT8 ubCrippleFiller[20]; #endif - - //The following will be used to quickly access info to display in the save/load screen - UINT32 uiDay; - UINT8 ubHour; - UINT8 ubMin; - INT16 sSectorX; - INT16 sSectorY; - INT8 bSectorZ; - UINT16 ubNumOfMercsOnPlayersTeam; - INT32 iCurrentBalance; - - UINT32 uiCurrentScreen; - - BOOLEAN fAlternateSector; - - BOOLEAN fWorldLoaded; - - UINT8 ubLoadScreenID; //The load screen that should be used when loading the saved game - - GAME_OPTIONS sInitialGameOptions; //need these in the header so we can get the info from it on the save load screen. - - UINT32 uiRandom; - - UINT8 ubFiller[494]; // WANNE: Decrease this filler by 1, for each new UINT8 variable! + UINT32 uiDay; + UINT8 ubHour; + UINT8 ubMin; + INT16 sSectorX; + INT16 sSectorY; + INT8 bSectorZ; + UINT16 ubNumOfMercsOnPlayersTeam; + INT32 iCurrentBalance; + UINT32 uiCurrentScreen; + BOOLEAN fAlternateSector; + BOOLEAN fWorldLoaded; + UINT8 ubLoadScreenID; //The load screen that should be used when loading the saved game + GAME_OPTIONS sInitialGameOptions; //need these in the header so we can get the info from it on the save load screen. + UINT32 uiRandom; + UINT8 ubFiller[494]; // WANNE: Decrease this filler by 1, for each new UINT8 variable! } SAVED_GAME_HEADER; From fcf2b27d1ac7a13c4a163eeca082b6e2098f3dff Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 11 Nov 2024 00:08:30 +0200 Subject: [PATCH 044/571] More UINT8 -> UINT16 changes --- Strategic/Auto Resolve.cpp | 8 +-- Strategic/Campaign Types.h | 2 +- Strategic/Map Screen Interface Map.cpp | 12 ++--- Strategic/MilitiaIndividual.cpp | 4 +- Strategic/MilitiaIndividual.h | 6 +-- Strategic/MilitiaSquads.cpp | 72 +++++++++++++------------- Strategic/PreBattle Interface.cpp | 12 ++--- Strategic/Queen Command.cpp | 6 +-- Strategic/Rebel Command.cpp | 2 +- Strategic/Rebel Command.h | 2 +- Strategic/Strategic Movement.cpp | 8 +-- Strategic/Strategic Movement.h | 2 +- Strategic/Town Militia.cpp | 36 ++++++------- Strategic/Town Militia.h | 14 ++--- Strategic/mapscreen.cpp | 6 +-- Tactical/Inventory Choosing.cpp | 8 +-- Tactical/Inventory Choosing.h | 4 +- Tactical/Militia Control.cpp | 2 +- Tactical/Overhead.cpp | 2 +- Tactical/Soldier Init List.cpp | 30 +++++------ Tactical/Soldier Init List.h | 4 +- 21 files changed, 121 insertions(+), 121 deletions(-) diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 565cf5bb..5a1cb23a 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -2048,7 +2048,7 @@ static void ARCreateMilitia( UINT8 mclass, INT32 i, INT16 sX, INT16 sY) swprintf( gpCivs[i].pSoldier->name, gpStrategicString[ STR_AR_MILITIA_NAME ] ); } -static void ARCreateMilitiaSquad( UINT8 *cnt, UINT8 ubEliteMilitia, UINT8 ubRegMilitia, UINT8 ubGreenMilitia, INT16 sX, INT16 sY) +static void ARCreateMilitiaSquad( UINT16 *cnt, UINT16 ubEliteMilitia, UINT16 ubRegMilitia, UINT16 ubGreenMilitia, INT16 sX, INT16 sY) { while( *cnt < gpAR->ubCivs && (ubEliteMilitia || ubRegMilitia || ubGreenMilitia) ) { @@ -2077,10 +2077,10 @@ void CreateAutoResolveInterface() VOBJECT_DESC VObjectDesc; INT32 i, index; HVOBJECT hVObject; - UINT8 ubGreenMilitia, ubRegMilitia, ubEliteMilitia; + UINT16 ubGreenMilitia, ubRegMilitia, ubEliteMilitia; UINT16 pMoveDir[4][3]; UINT8 uiDirNumber = 0; - UINT8 cnt; + UINT16 cnt; //Setup new autoresolve blanket interface. MSYS_DefineRegion( &gpAR->AutoResolveRegion, 0 + xResOffset, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH-1, 0, @@ -2200,7 +2200,7 @@ void CreateAutoResolveInterface() ubGreenMilitia = MilitiaInSectorOfRank( gpAR->ubSectorX, gpAR->ubSectorY, GREEN_MILITIA ); // see if we get any bonus militia from nearby towns - UINT8 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0; + UINT16 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0; RebelCommand::GetBonusMilitia(gpAR->ubSectorX, gpAR->ubSectorY, bonusGreenMilitia, bonusRegularMilitia, bonusEliteMilitia, FALSE); // no need to create a group for autoresolve as we're just increasing local militia pop ubEliteMilitia += bonusEliteMilitia; ubRegMilitia += bonusRegularMilitia; diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index 238568a9..f5b6d996 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -519,7 +519,7 @@ typedef struct SECTORINFO //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 ubNumberOfCivsAtLevel[ MAX_MILITIA_LEVELS ]; // town militia per experience class, 0/1/2 is GREEN/REGULAR/ELITE // HEADROCK HAM 3.6: Adding separate training percentage for MOBILES. UINT8 usFiller3; UINT8 usFiller1; diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 8fd4fa52..8fcb5381 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -6231,14 +6231,14 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen4"); usSector = SECTOR( sSectorX, sSectorY ); // distribute here - SectorInfo[usSector].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] = ( UINT8 )( iNumberOfGreens / iNumberUnderControl ); - SectorInfo[usSector].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = ( UINT8 )( iNumberOfRegulars / iNumberUnderControl ); - SectorInfo[usSector].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] = ( UINT8 )( iNumberOfElites / iNumberUnderControl ); + SectorInfo[usSector].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] = ( UINT16 )( iNumberOfGreens / iNumberUnderControl ); + SectorInfo[usSector].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] = ( UINT16 )( iNumberOfRegulars / iNumberUnderControl ); + SectorInfo[usSector].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] = ( UINT16 )( iNumberOfElites / iNumberUnderControl ); // Flugente: indivdual militia - DropIndividualMilitia( usSector, GREEN_MILITIA, (UINT8)(iNumberOfGreens / iNumberUnderControl) ); - DropIndividualMilitia( usSector, REGULAR_MILITIA, (UINT8)(iNumberOfRegulars / iNumberUnderControl) ); - DropIndividualMilitia( usSector, ELITE_MILITIA, (UINT8)(iNumberOfElites / iNumberUnderControl) ); + DropIndividualMilitia( usSector, GREEN_MILITIA, (UINT16)(iNumberOfGreens / iNumberUnderControl) ); + DropIndividualMilitia( usSector, REGULAR_MILITIA, (UINT16)(iNumberOfRegulars / iNumberUnderControl) ); + DropIndividualMilitia( usSector, ELITE_MILITIA, (UINT16)(iNumberOfElites / iNumberUnderControl) ); // Flugente: as we do not move the group militia, we have to make sure we don't accidentally overfill a sector sTotalSoFar = NumNonPlayerTeamMembersInSector( sSectorX, sSectorY, MILITIA_TEAM ); diff --git a/Strategic/MilitiaIndividual.cpp b/Strategic/MilitiaIndividual.cpp index dade1619..28cd25af 100644 --- a/Strategic/MilitiaIndividual.cpp +++ b/Strategic/MilitiaIndividual.cpp @@ -1004,7 +1004,7 @@ void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier, BOOLEAN aAutoResolve pSoldier->ubMilitiaAssists = 0; } -void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ) +void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites ) { if ( !usGreens && !usRegulars && !usElites ) return; @@ -1042,7 +1042,7 @@ void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UI // militia are disbanded - we have to take note of that -void DisbandIndividualMilitia( UINT8 aSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ) +void DisbandIndividualMilitia( UINT8 aSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites ) { std::vector::iterator itend = gIndividualMilitiaVector.end( ); for ( std::vector::iterator it = gIndividualMilitiaVector.begin( ); it != itend; ++it ) diff --git a/Strategic/MilitiaIndividual.h b/Strategic/MilitiaIndividual.h index e03e7a95..bb7747e7 100644 --- a/Strategic/MilitiaIndividual.h +++ b/Strategic/MilitiaIndividual.h @@ -179,10 +179,10 @@ FLOAT PromoteIndividualMilitiaInSector( UINT8 aSector, FLOAT aPointsToAdd ); // handle possible militia promotion and individual militia update void HandlePossibleMilitiaPromotion( SOLDIERTYPE* pSoldier, BOOLEAN aAutoResolve ); -void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ); +void MoveIndividualMilitiaProfiles( UINT8 aSourceSector, UINT8 aTargetSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites ); // militia are disbanded - we have to take note of that -void DisbandIndividualMilitia( UINT8 aSector, UINT8 usGreens, UINT8 usRegulars, UINT8 usElites ); +void DisbandIndividualMilitia( UINT8 aSector, UINT16 usGreens, UINT16 usRegulars, UINT16 usElites ); void PromoteIndividualMilitia( UINT8 aSector, UINT8 aSoldierClass ); @@ -195,4 +195,4 @@ UINT32 GetDailyUpkeep_IndividualMilitia( UINT32& arNumGreen, UINT32& arNumRegula void PickIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); void DropIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 149a6c97..793798ff 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -140,12 +140,12 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); SECTORINFO *pTSectorInfo = &( SectorInfo[ SECTOR( sTMapX, sTMapY ) ] ); - UINT8 bGreensSourceTeam = 0, bGreensDestTeam = 0; - UINT8 bRegularsSourceTeam = 0, bRegularsDestTeam = 0; - UINT8 bElitesSourceTeam = 0, bElitesDestTeam = 0; - UINT8 bTotalGreens = 0, bTotalRegulars = 0, bTotalElites = 0; + UINT16 bGreensSourceTeam = 0, bGreensDestTeam = 0; + UINT16 bRegularsSourceTeam = 0, bRegularsDestTeam = 0; + UINT16 bElitesSourceTeam = 0, bElitesDestTeam = 0; + UINT16 bTotalGreens = 0, bTotalRegulars = 0, bTotalElites = 0; UINT8 bTotalGreensPercent = 0, bTotalRegularsPercent = 0, bTotalElitesPercent = 0; - INT8 bNewSourceGroupSize = 0, bNewDestGroupSize = 0, bGroupSizeRatio = 0; + INT16 bNewSourceGroupSize = 0, bNewDestGroupSize = 0, bGroupSizeRatio = 0; UINT8 ubChanceToSpreadOut; ////////////////////////////////////////////////////////// @@ -165,8 +165,8 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL { // Wilderness->Wilderness movement. Calculate Spread Out chance based on threats. - UINT8 ubNumEnemiesNearOrigin = NumEnemiesInFiveSectors( sMapX, sMapY ); - UINT8 ubNumEnemiesNearTarget = NumEnemiesInFiveSectors( sTMapX, sTMapY ); + UINT16 ubNumEnemiesNearOrigin = NumEnemiesInFiveSectors( sMapX, sMapY ); + UINT16 ubNumEnemiesNearTarget = NumEnemiesInFiveSectors( sTMapX, sTMapY ); if (ubNumEnemiesNearOrigin == 0 && ubNumEnemiesNearTarget > 0 ) @@ -264,9 +264,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL // Flugente: mobiles take along their gear // move only gear for those who come new into a sector - UINT8 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); - UINT8 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); - UINT8 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); + UINT16 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); + UINT16 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); + UINT16 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens); @@ -306,9 +306,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL // Flugente: mobiles take along their gear // move only gear for those who come new into a sector - UINT8 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); - UINT8 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); - UINT8 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); + UINT16 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); + UINT16 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); + UINT16 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens); @@ -336,7 +336,7 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL { // Source team moves En-Masse to target sector. - bNewDestGroupSize = __min( (NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) + NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM )), (UINT8)gGameExternalOptions.iMaxMilitiaPerSector ); + bNewDestGroupSize = __min( (NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) + NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM )), (UINT16)gGameExternalOptions.iMaxMilitiaPerSector ); bNewSourceGroupSize = __max( 0, (NumNonPlayerTeamMembersInSector( sTMapX, sTMapY, MILITIA_TEAM ) + NumNonPlayerTeamMembersInSector( sMapX, sMapY, MILITIA_TEAM )) - gGameExternalOptions.iMaxMilitiaPerSector ); // If there are still going to be two teams after the transfer @@ -396,9 +396,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL // Flugente: mobiles take along their gear // move only gear for those who come new into a sector - UINT8 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); - UINT8 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); - UINT8 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); + UINT16 elites = max(0, bElitesDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ ELITE_MILITIA ]); + UINT16 regulars = max(0, bRegularsDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]); + UINT16 greens = max(0, bGreensDestTeam - pTSectorInfo->ubNumberOfCivsAtLevel[ GREEN_MILITIA ]); MoveMilitiaEquipment(sMapX, sMapY, sTMapX, sTMapY, elites, regulars, greens); @@ -432,9 +432,9 @@ void MoveMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY, BOOL // Flugente: update individual militia data ApplyTacticalLifeRatioToMilitia( ); - UINT8 greens = pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; - UINT8 regulars = pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; - UINT8 elites = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; + UINT16 greens = pSectorInfo->ubNumberOfCivsAtLevel[GREEN_MILITIA]; + UINT16 regulars = pSectorInfo->ubNumberOfCivsAtLevel[REGULAR_MILITIA]; + UINT16 elites = pSectorInfo->ubNumberOfCivsAtLevel[ELITE_MILITIA]; StrategicRemoveMilitiaFromSector( sMapX, sMapY, GREEN_MILITIA, greens ); StrategicRemoveMilitiaFromSector( sMapX, sMapY, REGULAR_MILITIA, regulars ); @@ -549,7 +549,7 @@ UINT16 CountDirectionEnemyRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) for( sLMY = MINIMUM_VALID_Y_COORDINATE; sLMY <= MAXIMUM_VALID_Y_COORDINATE ; ++sLMY ) { // SECTORINFO *pSectorInfo = &( SectorInfo[ uiSector ] ); - UINT8 uiSumOfEnemyTroops = NumNonPlayerTeamMembersInSector( sLMX, sLMY, ENEMY_TEAM ); + UINT16 uiSumOfEnemyTroops = NumNonPlayerTeamMembersInSector( sLMX, sLMY, ENEMY_TEAM ); //pSectorInfo->ubNumAdmins + pSectorInfo->ubNumTroops + pSectorInfo->ubNumElites; // there's an enemy @@ -605,21 +605,21 @@ UINT16 CountDirectionRating( INT16 sMapX, INT16 sMapY, UINT8 uiDir ) return iRes; } - UINT8 ubMaxSquadSize = gGameExternalOptions.iMaxMilitiaPerSector; + UINT16 ubMaxSquadSize = gGameExternalOptions.iMaxMilitiaPerSector; - UINT8 ubSourceGreens = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; - UINT8 ubSourceRegulars = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; - UINT8 ubSourceElites = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; - UINT8 ubTargetGreens = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; - UINT8 ubTargetRegulars = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; - UINT8 ubTargetElites = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; + UINT16 ubSourceGreens = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; + UINT16 ubSourceRegulars = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; + UINT16 ubSourceElites = SectorInfo[SECTOR(sMapX, sMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; + UINT16 ubTargetGreens = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]; + UINT16 ubTargetRegulars = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]; + UINT16 ubTargetElites = SectorInfo[SECTOR(sDMapX, sDMapY)].ubNumberOfCivsAtLevel[ ELITE_MILITIA ]; - UINT8 ubSourceMilitia = ubSourceGreens + ubSourceRegulars + ubSourceElites; - UINT8 ubTargetMilitia = ubTargetGreens + ubTargetRegulars + ubTargetElites; + UINT16 ubSourceMilitia = ubSourceGreens + ubSourceRegulars + ubSourceElites; + UINT16 ubTargetMilitia = ubTargetGreens + ubTargetRegulars + ubTargetElites; UINT16 usSourceEnemiesInFiveSectors = NumEnemiesInFiveSectors( sMapX, sMapY ); UINT16 usTargetEnemiesInFiveSectors = NumEnemiesInFiveSectors( sDMapX, sDMapY ); - UINT8 ubTargetEnemies = NumNonPlayerTeamMembersInSector( sDMapX, sDMapY, ENEMY_TEAM ); + UINT16 ubTargetEnemies = NumNonPlayerTeamMembersInSector( sDMapX, sDMapY, ENEMY_TEAM ); UINT16 usSourceMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sMapX, sMapY ); UINT16 usTargetMilitiaInFiveSectors = CountAllMilitiaInFiveSectors( sDMapX, sDMapY ); @@ -1112,7 +1112,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) UINT16 pMoveDir[4][3]; UINT8 uiDirNumber = 0; UINT8 x; - UINT8 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0; + UINT16 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0; SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); BOOLEAN fMoreTroopsLeft[4] = {FALSE,FALSE,FALSE,FALSE}; BOOLEAN fFirstLoop = TRUE; @@ -1175,7 +1175,7 @@ void DoMilitiaHelpFromAdjacentSectors( INT16 sMapX, INT16 sMapY ) // Flugente: order sNumber reinforcements from src sector to target sector BOOLEAN CallMilitiaReinforcements( INT16 sTargetMapX, INT16 sTargetMapY, INT16 sSrcMapX, INT16 sSrcMapY, UINT16 sNumber ) { - UINT8 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0; + UINT16 uiNumGreen = 0, uiNumReg = 0, uiNumElite = 0; SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sTargetMapX, sTargetMapY ) ] ); guiDirNumber = 0; @@ -1236,9 +1236,9 @@ BOOLEAN CallMilitiaReinforcements( INT16 sTargetMapX, INT16 sTargetMapY, INT16 s { ++sMilitiaMoved; - UINT8 militia_green = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, GREEN_MILITIA ); - UINT8 militia_troop = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, REGULAR_MILITIA ); - UINT8 militia_elite = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, ELITE_MILITIA ); + UINT16 militia_green = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, GREEN_MILITIA ); + UINT16 militia_troop = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, REGULAR_MILITIA ); + UINT16 militia_elite = MilitiaInSectorOfRank( sTargetMapX, sTargetMapY, ELITE_MILITIA ); gpAttackDirs[guiDirNumber][0] += militia_green - uiNumGreen; gpAttackDirs[guiDirNumber][1] += militia_troop - uiNumReg; diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 003a1fe2..effe444f 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -298,9 +298,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) VOBJECT_DESC VObjectDesc; INT32 i; UINT8 ubGroupID = 0; - UINT8 ubNumStationaryEnemies = 0; - UINT8 ubNumMobileEnemies = 0; - UINT8 ubNumMercs; + UINT16 ubNumStationaryEnemies = 0; + UINT16 ubNumMobileEnemies = 0; + UINT16 ubNumMercs; BOOLEAN fUsePluralVersion = FALSE; INT8 bBestExpLevel = 0; BOOLEAN fRetreatAnOption = TRUE; @@ -2387,9 +2387,9 @@ void RetreatAllInvolvedMilitiaGroups() return; // as group size will be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE, see how many troops are allowed and reduce sector count accordingly - UINT8 greens = pSector->ubNumberOfCivsAtLevel[0]; - UINT8 regulars = pSector->ubNumberOfCivsAtLevel[1]; - UINT8 elites = pSector->ubNumberOfCivsAtLevel[2]; + UINT16 greens = pSector->ubNumberOfCivsAtLevel[0]; + UINT16 regulars = pSector->ubNumberOfCivsAtLevel[1]; + UINT16 elites = pSector->ubNumberOfCivsAtLevel[2]; pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sBattleSectorX, sBattleSectorY ), greens, regulars, elites ); diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 077d373d..58452a63 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -1771,8 +1771,8 @@ void AddPossiblePendingEnemiesToBattle() BOOLEAN fMagicallyAppeared=FALSE; #endif - UINT8 ubSlots, ubNumAvailable; - UINT8 ubNumRobots, ubNumElites, ubNumTroops, ubNumAdmins, ubNumTanks, ubNumJeeps; + UINT16 ubSlots, ubNumAvailable; + UINT16 ubNumRobots, ubNumElites, ubNumTroops, ubNumAdmins, ubNumTanks, ubNumJeeps; UINT8 ubNumGroupsInSector; UINT8 ubGroupIndex; GROUP *pGroup; @@ -2000,7 +2000,7 @@ void AddPossiblePendingEnemiesToBattle() pGroup = pGroupInSectorList[ ubGroupIndex]; // Flugente fix: check for underflow... - UINT8 currentgroupsize = pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle + UINT16 currentgroupsize = pGroup->pEnemyGroup->ubElitesInBattle + pGroup->pEnemyGroup->ubTroopsInBattle + pGroup->pEnemyGroup->ubAdminsInBattle + pGroup->pEnemyGroup->ubRobotsInBattle + pGroup->pEnemyGroup->ubTanksInBattle + pGroup->pEnemyGroup->ubJeepsInBattle; if ( currentgroupsize > pGroup->ubGroupSize ) ubNumAvailable = 0; diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index 7961b78a..1688ea83 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -3182,7 +3182,7 @@ INT32 GetMiningPolicyBonus(INT16 townId) return 0; } -void GetBonusMilitia(INT16 sx, INT16 sy, UINT8& green, UINT8& regular, UINT8& elite, BOOLEAN createGroup) +void GetBonusMilitia(INT16 sx, INT16 sy, UINT16& green, UINT16& regular, UINT16& elite, BOOLEAN createGroup) { if (!gGameExternalOptions.fRebelCommandEnabled) return; diff --git a/Strategic/Rebel Command.h b/Strategic/Rebel Command.h index 22b6fd3b..d29cff3f 100644 --- a/Strategic/Rebel Command.h +++ b/Strategic/Rebel Command.h @@ -188,7 +188,7 @@ void ApplyMilitiaBonuses(SOLDIERTYPE* pMilitia); UINT8 GetApproximateEnemyLocationResolutionIndex(); FLOAT GetAssignmentBonus(INT16 x, INT16 y); INT32 GetMiningPolicyBonus(INT16 townId); -void GetBonusMilitia(INT16 x, INT16 y, UINT8& green, UINT8& regular, UINT8& elite, BOOLEAN createGroup); +void GetBonusMilitia(INT16 x, INT16 y, UINT16& green, UINT16& regular, UINT16& elite, BOOLEAN createGroup); INT16 GetFortificationsBonus(UINT8 sector); FLOAT GetHarriersSpeedPenalty(UINT8 sector); FLOAT GetLoyaltyGainModifier(); diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 21baa737..588f91c1 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -806,7 +806,7 @@ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmin return NULL; } -GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT8& arusNumAdmins, UINT8& arusNumTroops, UINT8& arusNumElites ) +GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT16& arusNumAdmins, UINT16& arusNumTroops, UINT16& arusNumElites ) { GROUP *pNew; AssertMsg( uiSector >= 0 && uiSector <= 255, String( "CreateNewMilitiaGroupDepartingFromSector with out of range value of %d", uiSector ) ); @@ -846,7 +846,7 @@ GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT8& arusNum pNew->pEnemyGroup->ubNumAdmins = arusNumAdmins; pNew->pEnemyGroup->ubNumTroops = arusNumTroops; pNew->pEnemyGroup->ubNumElites = arusNumElites; - pNew->ubGroupSize = (UINT8)(arusNumAdmins + arusNumTroops + arusNumElites); + pNew->ubGroupSize = arusNumAdmins + arusNumTroops + arusNumElites; pNew->ubTransportationMask = FOOT; pNew->fVehicle = FALSE; pNew->ubCreatedSectorID = pNew->ubOriginalSector; @@ -1120,7 +1120,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating gfCantRetreatInPBI = TRUE; } - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ]; gpTacticalTraversalChosenSoldier = pSoldier; @@ -1149,7 +1149,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating gfCantRetreatInPBI = TRUE; } - ubChosenMerc = (UINT8)Random( ubNumMercs ); + ubChosenMerc = (UINT16)Random( ubNumMercs ); pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ]; diff --git a/Strategic/Strategic Movement.h b/Strategic/Strategic Movement.h index d1aad931..1acd86d3 100644 --- a/Strategic/Strategic Movement.h +++ b/Strategic/Strategic Movement.h @@ -204,7 +204,7 @@ BOOLEAN SetGroupPatrolParameters( UINT8 ubGroupID, UINT8 ubRestAtFL, UINT8 ubRes //............................................................ GROUP* CreateNewEnemyGroupDepartingFromSector( UINT32 uiSector, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumRobots, UINT8 ubNumTanks, UINT8 ubNumJeeps ); -GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT8& arusNumAdmins, UINT8& arusNumTroops, UINT8& arusNumElites ); +GROUP* CreateNewMilitiaGroupDepartingFromSector( UINT32 uiSector, UINT16& arusNumAdmins, UINT16& arusNumTroops, UINT16& arusNumElites ); #ifdef JA2UB GROUP* CreateNewEnemyGroupDepartingFromSectorUsingZLevel( UINT32 uiSector, UINT8 ubSectorZ, UINT8 ubNumAdmins, UINT8 ubNumTroops, UINT8 ubNumElites, UINT8 ubNumTanks ); diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index feaf4aed..976b9545 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -471,7 +471,7 @@ INT8 MilitiaRankToSoldierClass(UINT8 ubRank) return(bSoldierClass); } -void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany) +void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany) { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); @@ -486,15 +486,15 @@ void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 u fMapPanelDirty = TRUE; } -void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT8 ubHowMany) +void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT16 ubHowMany) { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); // damn well better have that many around to promote! //Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubCurrentRank ] >= ubHowMany); - UINT8 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubCurrentRank ); - UINT8 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubCurrentRank ); + UINT16 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubCurrentRank ); + UINT16 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubCurrentRank ); //KM : July 21, 1999 patch fix if ( ubCurrentRank >= ELITE_MILITIA || stationary + ingroups < ubHowMany ) @@ -503,8 +503,8 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa } // determine how many static and - if necessary - group-based militia we have to remove - UINT8 reducestatic = min( stationary, ubHowMany ); - UINT8 reducegroups = min( ingroups, ubHowMany - reducestatic ); + UINT16 reducestatic = min( stationary, ubHowMany ); + UINT16 reducegroups = min( ingroups, ubHowMany - reducestatic ); pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank] -= reducestatic; pSectorInfo->ubNumberOfCivsAtLevel[ubCurrentRank + 1] += reducestatic; @@ -541,7 +541,7 @@ void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRa fMapPanelDirty = TRUE; } -void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany) +void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany) { SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); @@ -549,8 +549,8 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI // damn well better have that many around to remove! //Assert(pSectorInfo->ubNumberOfCivsAtLevel[ ubRank ] >= ubHowMany); - UINT8 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank ); - UINT8 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank ); + UINT16 stationary = MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank ); + UINT16 ingroups = MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank ); //KM : July 21, 1999 patch fix if ( stationary + ingroups < ubHowMany ) @@ -559,8 +559,8 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI } // determine how many static and - if necessary - group-based militia we have to remove - UINT8 reducestatic = min( stationary, ubHowMany ); - UINT8 reducegroups = min( ingroups, ubHowMany - reducestatic ); + UINT16 reducestatic = min( stationary, ubHowMany ); + UINT16 reducegroups = min( ingroups, ubHowMany - reducestatic ); pSectorInfo->ubNumberOfCivsAtLevel[ubRank] -= reducestatic; @@ -571,21 +571,21 @@ void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UI { if ( ubRank == GREEN_MILITIA ) { - UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumAdmins ); + UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumAdmins ); pGroup->pEnemyGroup->ubNumAdmins -= reduced; pGroup->ubGroupSize -= reduced; reducegroups -= reduced; } else if ( ubRank == REGULAR_MILITIA ) { - UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumTroops ); + UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumTroops ); pGroup->pEnemyGroup->ubNumTroops -= reduced; pGroup->ubGroupSize -= reduced; reducegroups -= reduced; } else if ( ubRank == ELITE_MILITIA ) { - UINT8 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumElites ); + UINT16 reduced = min( reducegroups, pGroup->pEnemyGroup->ubNumElites ); pGroup->pEnemyGroup->ubNumElites -= reduced; pGroup->ubGroupSize -= reduced; reducegroups -= reduced; @@ -705,12 +705,12 @@ void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY) } } -UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank) +UINT16 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank) { return MilitiaInSectorOfRankStationary( sMapX, sMapY, ubRank ) + MilitiaInSectorOfRankInGroups( sMapX, sMapY, ubRank ); } -UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank ) +UINT16 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank ) { if ( ubRank < MAX_MILITIA_LEVELS ) return SectorInfo[SECTOR( sMapX, sMapY )].ubNumberOfCivsAtLevel[ubRank]; @@ -718,9 +718,9 @@ UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank ) return 0; } -UINT8 MilitiaInSectorOfRankInGroups( INT16 sMapX, INT16 sMapY, UINT8 ubRank ) +UINT16 MilitiaInSectorOfRankInGroups( INT16 sMapX, INT16 sMapY, UINT8 ubRank ) { - UINT8 count = 0; + UINT16 count = 0; GROUP *pGroup = gpGroupList; while ( pGroup ) diff --git a/Strategic/Town Militia.h b/Strategic/Town Militia.h index 33824893..db584d71 100644 --- a/Strategic/Town Militia.h +++ b/Strategic/Town Militia.h @@ -30,9 +30,9 @@ INT8 SoldierClassToMilitiaRank(UINT8 ubSoldierClass); INT8 MilitiaRankToSoldierClass(UINT8 ubRank); // these add, promote, and remove militias of a certain rank -void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany); -void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT8 ubHowMany); -void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT8 ubHowMany); +void StrategicAddMilitiaToSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany); +void StrategicPromoteMilitiaInSector(INT16 sMapX, INT16 sMapY, UINT8 ubCurrentRank, UINT16 ubHowMany); +void StrategicRemoveMilitiaFromSector(INT16 sMapX, INT16 sMapY, UINT8 ubRank, UINT16 ubHowMany); void StrategicRemoveAllStaticMilitiaFromSector( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); @@ -49,9 +49,9 @@ UINT8 FindBestMilitiaTrainingLeadershipInSector ( INT16 sMapX, INT16 sMapY, INT8 // call this if the player attacks his own militia void HandleMilitiaDefections(INT16 sMapX, INT16 sMapY); -UINT8 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank); -UINT8 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); -UINT8 MilitiaInSectorOfRankInGroups( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); +UINT16 MilitiaInSectorOfRank(INT16 sMapX, INT16 sMapY, UINT8 ubRank); +UINT16 MilitiaInSectorOfRankStationary( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); +UINT16 MilitiaInSectorOfRankInGroups( INT16 sMapX, INT16 sMapY, UINT8 ubRank ); // Returns TRUE if sector is under player control, has no enemies in it, and isn't currently in combat mode BOOLEAN SectorOursAndPeaceful( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); @@ -135,4 +135,4 @@ FLOAT GetIntel(); void AddRaidPersonnel( INT32 aBloodcats, INT32 aZombie, INT32 aBandits ); void GetRaidPersonnel( INT32& arBloodcats, INT32& arZombie, INT32& arBandits ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 97d670ba..2afd246f 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -17506,9 +17506,9 @@ BOOLEAN MilitiaPlotStart( ) return FALSE; // as group size will be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE, see how many troops are allowed and reduce sector count accordingly - UINT8 greens = pSector->ubNumberOfCivsAtLevel[0]; - UINT8 regulars = pSector->ubNumberOfCivsAtLevel[1]; - UINT8 elites = pSector->ubNumberOfCivsAtLevel[2]; + UINT16 greens = pSector->ubNumberOfCivsAtLevel[0]; + UINT16 regulars = pSector->ubNumberOfCivsAtLevel[1]; + UINT16 elites = pSector->ubNumberOfCivsAtLevel[2]; // when we start plotting, the group is still empty - we add militia later GROUP* pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sSelMapX, sSelMapY ), greens, regulars, elites ); diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index 72bfa796..4bab504f 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -3924,23 +3924,23 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, } } -void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT8 usElites, UINT8 usRegulars, UINT8 usGreens) +void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT16 usElites, UINT16 usRegulars, UINT16 usGreens) { if ( !gGameExternalOptions.fMilitiaUseSectorInventory ) return; // atm there is no class-specific selection, but that might change in the future - for (UINT8 i = 0; i < usElites; ++i) + for (UINT16 i = 0; i < usElites; ++i) { MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_ELITE_MILITIA); } - for (UINT8 i = 0; i < usRegulars; ++i) + for (UINT16 i = 0; i < usRegulars; ++i) { MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_REG_MILITIA); } - for (UINT8 i = 0; i < usGreens; ++i) + for (UINT16 i = 0; i < usGreens; ++i) { MoveOneMilitiaEquipmentSet( sSourceX, sSourceY, sTargetX, sTargetY, SOLDIER_CLASS_GREEN_MILITIA); } diff --git a/Tactical/Inventory Choosing.h b/Tactical/Inventory Choosing.h index 6f75e339..0fa4a469 100644 --- a/Tactical/Inventory Choosing.h +++ b/Tactical/Inventory Choosing.h @@ -121,9 +121,9 @@ extern ARMY_GUN_CHOICE_TYPE gArmyItemChoices[SOLDIER_GUN_CHOICE_SELECTIONS][MAX_ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, INT8 bSoldierClass); // move a number of militia equipment sets between sectors -void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT8 usElites, UINT8 usRegulars, UINT8 usGreens); +void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 sTargetY, UINT16 usElites, UINT16 usRegulars, UINT16 usGreens); // take militia items from sector void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index 715db535..e5fad2d8 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -199,7 +199,7 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll) { SECTORINFO *pSector; INT32 x; - UINT8 ubGreen, ubRegs, ubElites; + UINT16 ubGreen, ubRegs, ubElites; if( gbWorldSectorZ > 0 ) return; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 1b155c8d..84fbb739 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -994,7 +994,7 @@ BOOLEAN ExecuteOverhead( ) // check if bonus militia join us if (checkBonusMilitia == TRUE && gGameExternalOptions.fRebelCommandEnabled && gubPBSectorZ == 0) { - UINT8 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0; + UINT16 bonusGreenMilitia = 0, bonusRegularMilitia = 0, bonusEliteMilitia = 0; RebelCommand::GetBonusMilitia(gubPBSectorX, gubPBSectorY, bonusGreenMilitia, bonusRegularMilitia, bonusEliteMilitia, TRUE); checkBonusMilitia = FALSE; } diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index d4ec5fe7..3db1f288 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -2109,12 +2109,12 @@ void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT16 ubNumLarvae, UINT16 ubN } } -void AddSoldierInitListOtherCreatures( UINT8 usNum ) +void AddSoldierInitListOtherCreatures( UINT16 usNum ) { SOLDIERINITNODE *curr; - UINT8 ubFreeSlots; + UINT16 ubFreeSlots; BOOLEAN fDoPlacement; - UINT8 ubNumCreatures = usNum; + UINT16 ubNumCreatures = usNum; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "AddSoldierInitListBloodcats" ) ); @@ -2465,7 +2465,7 @@ void AddSoldierInitListBloodcats() else { //We don't yet know the number of bloodcat placements in this sector so //count them now, and permanently record it. - INT8 bBloodCatPlacements = 0; + INT16 bBloodCatPlacements = 0; curr = gSoldierInitHead; while( curr ) { @@ -2513,11 +2513,11 @@ void AddSoldierInitListBloodcats() } if( pSector->bBloodCats > 0 ) { //Add them to the world now... - UINT8 ubNumAdded = 0; - UINT8 ubMaxNum = (UINT8)pSector->bBloodCats; + UINT16 ubNumAdded = 0; + UINT16 ubMaxNum = (UINT16)pSector->bBloodCats; SOLDIERINITNODE *mark; - UINT8 ubSlotsToFill; - UINT8 ubSlotsAvailable; + UINT16 ubSlotsToFill; + UINT16 ubSlotsAvailable; SOLDIERINITNODE *curr; //Sort the list in the following manner: @@ -2983,12 +2983,12 @@ void StripEnemyDetailedPlacementsIfSectorWasPlayerLiberated() //#define CENTRAL_GRIDNO 13202 //#define CENTRAL_RADIUS 30 -void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites ) +void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites ) { SOLDIERTYPE *pSoldier; MAPEDGEPOINTINFO MapEdgepointInfo; - UINT8 ubCurrSlot; - UINT8 ubTotalSoldiers; + UINT16 ubCurrSlot; + UINT16 ubTotalSoldiers; UINT8 bDesiredDirection=0; ubTotalSoldiers = ubNumGreen + ubNumReg + ubNumElites; @@ -3073,7 +3073,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if( ubNumReg && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumReg) ) + else if( ubNumReg && (UINT16)Random( ubTotalSoldiers ) < (ubNumElites + ubNumReg) ) { ubNumReg--; ubTotalSoldiers--; @@ -3113,7 +3113,7 @@ void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNu } UpdateMercInSector( pSoldier, gWorldSectorX, gWorldSectorY, 0 ); } - else if( ubNumGreen && (UINT8)Random( ubTotalSoldiers ) < (UINT8)(ubNumElites + ubNumReg + ubNumGreen) ) + else if( ubNumGreen && (UINT16)Random( ubTotalSoldiers ) < (UINT16)(ubNumElites + ubNumReg + ubNumGreen) ) { ubNumGreen--; ubTotalSoldiers--; @@ -3219,7 +3219,7 @@ void SectorAddAssassins( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) return; // now count militia, and which type (green, regular, elite) is most numerous - that will be the best type to blend in - UINT8 militiacnt = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA ); + UINT16 militiacnt = MilitiaInSectorOfRank( sMapX, sMapY, GREEN_MILITIA ); UINT8 militiadisguise = GREEN_MILITIA; if ( MilitiaInSectorOfRank( sMapX, sMapY, REGULAR_MILITIA ) > militiacnt ) { @@ -3290,7 +3290,7 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) } // we can't spawn if all civilian slots are already taken (we leave a bit of reserve for more important civs) - UINT8 maxcivs = max(0, gGameExternalOptions.ubGameMaximumNumberOfCivilians - 3); + UINT16 maxcivs = max(0, gGameExternalOptions.ubGameMaximumNumberOfCivilians - 3); for (UINT16 i = numberofpows; i < numprisoners; ++i) { diff --git a/Tactical/Soldier Init List.h b/Tactical/Soldier Init List.h index 0eb2f2ef..4774bd97 100644 --- a/Tactical/Soldier Init List.h +++ b/Tactical/Soldier Init List.h @@ -44,9 +44,9 @@ void AddSoldierInitListEnemyDefenceSoldiers( UINT16 ubTotalAdmin, UINT16 ubTotal void AddSoldierInitListCreatures( BOOLEAN fQueen, UINT16 ubNumLarvae, UINT16 ubNumInfants, UINT16 ubNumYoungMales, UINT16 ubNumYoungFemales, UINT16 ubNumAdultMales, UINT16 ubNumAdultFemales ); -void AddSoldierInitListOtherCreatures( UINT8 usNum ); +void AddSoldierInitListOtherCreatures( UINT16 usNum ); void AddSoldierInitListMilitia( UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites ); -void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT8 ubNumGreen, UINT8 ubNumReg, UINT8 ubNumElites ); +void AddSoldierInitListMilitiaOnEdge( UINT8 ubStrategicInsertionCode, UINT16 ubNumGreen, UINT16 ubNumReg, UINT16 ubNumElites ); void AddSoldierInitListBloodcats(); From 6c33009fab63e010b6bd309dbd84fd9b31748875 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 11 Nov 2024 00:14:51 +0200 Subject: [PATCH 045/571] Remove bLastKnownEnemies from SECTORINFO As per the old comment, even though the field value is updated partially according to whether there are known enemies present or not, it's not used for anything. --- Strategic/Auto Resolve.cpp | 2 -- Strategic/Campaign Types.h | 3 --- Strategic/PreBattle Interface.cpp | 4 ---- Strategic/Queen Command.cpp | 17 ----------------- Strategic/Strategic Movement.cpp | 23 ----------------------- Tactical/Overhead.cpp | 5 ----- 6 files changed, 54 deletions(-) diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 5a1cb23a..2d833ef6 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -460,7 +460,6 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY ) pSector->ubNumJeeps = 0; pSector->ubNumRobots = 0; pSector->ubNumCreatures = 0; - pSector->bLastKnownEnemies = 0; //Remove the mobile forces here, but only if battle is over. while( pGroup ) { @@ -1839,7 +1838,6 @@ void RenderAutoResolve() HandleMoraleEvent( NULL, MORALE_BATTLE_WON, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); if( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_WON, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); - SectorInfo[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].bLastKnownEnemies = 0; SetThisSectorAsPlayerControlled( gpAR->ubSectorX, gpAR->ubSectorY, 0, TRUE ); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalVictory[0]; diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index f5b6d996..2c490fcb 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -500,9 +500,6 @@ typedef struct SECTORINFO UINT16 ubNumCreatures; //only set when immediately before ground attack made! UINT16 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 - UINT32 ubDayOfLastCreatureAttack; UINT32 uiFacilitiesFlags; // the flags for various facilities diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index effe444f..36fd826a 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -407,8 +407,6 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gubPBSectorY = gpBattleGroup->ubSectorY; gubPBSectorZ = gpBattleGroup->ubSectorZ; - // get number of enemies thought to be here - SectorInfo[SECTOR( gubPBSectorX, gubPBSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM ); fMapPanelDirty = TRUE; } else if( gfPersistantPBI ) @@ -1547,14 +1545,12 @@ void RenderPreBattleInterface() { // don't know how many swprintf( str, L"?" ); - SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = -2; } else { // know exactly how many i = NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM ); swprintf( str, L"%d", i ); - SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = (INT8)i; } x = 57 + (27 - StringPixLength( str, FONT14ARIAL )) / 2; y = 36; diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 58452a63..23bddfc8 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -1190,7 +1190,6 @@ BOOLEAN PrepareEnemyForUndergroundBattle() //The queen AI layer must process the event by subtracting forces, etc. void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) { - INT32 iNumEnemiesInSector; SECTORINFO *pSector; INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); @@ -1737,22 +1736,6 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) } } } - if( !pSoldier->bSectorZ ) - { - pSector = &SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ]; - iNumEnemiesInSector = NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ); - if( iNumEnemiesInSector ) - { - if( pSector->bLastKnownEnemies >= 0 ) - { - pSector->bLastKnownEnemies = (INT8)iNumEnemiesInSector; - } - } - else - { - pSector->bLastKnownEnemies = 0; - } - } } //Well, not so rarely with mobile reinforcements! diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 588f91c1..323f9100 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -1946,11 +1946,6 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if ( pGroup->usGroupTeam == OUR_TEAM ) { - if( pGroup->ubSectorZ == 0 ) - { - SectorInfo[SECTOR( pGroup->ubSectorX, pGroup->ubSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM ); - } - // Flugente: do not award experience gain if we never left if (!fNeverLeft) { @@ -3769,8 +3764,6 @@ INT32 GetTravelTimeForFootTeam( UINT8 ubSector, UINT8 ubDirection ) void HandleArrivalOfReinforcements( GROUP *pGroup ) { SOLDIERTYPE *pSoldier; - SECTORINFO *pSector; - INT32 iNumEnemiesInSector; INT32 cnt; if ( pGroup->usGroupTeam == OUR_TEAM ) @@ -3834,22 +3827,6 @@ void HandleArrivalOfReinforcements( GROUP *pGroup ) gfPendingNonPlayerTeam[MILITIA_TEAM] = TRUE; AddPossiblePendingMilitiaToBattle( ); } - - //Update the known number of enemies in the sector. - pSector = &SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ]; - iNumEnemiesInSector = NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM ); - if( iNumEnemiesInSector ) - { - if( pSector->bLastKnownEnemies >= 0 ) - { - pSector->bLastKnownEnemies = (INT8)iNumEnemiesInSector; - } - //if we don't know how many enemies there are, then we can't update this value. - } - else - { - pSector->bLastKnownEnemies = 0; - } } BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnter, INT32 *iCountExit, BOOLEAN *fAboutToArriveEnter ) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 84fbb739..5aa32012 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -7520,11 +7520,6 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if ( fBattleLost || fBattleWon ) { - if( !gbWorldSectorZ ) - { - SectorInfo[SECTOR( gWorldSectorX, gWorldSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ); - } - // Flugente: note number of wounded for campaign stats UpdateWoundedFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); } From 3c2592881ff365756b8c673e52ec1ec1f5748091 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:15:36 +0200 Subject: [PATCH 046/571] Fix ShadeMapElements function declaration --- Strategic/Map Screen Interface Map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 8fcb5381..31c577e9 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -522,7 +522,7 @@ void ShowTownText( void ); void DrawTownLabels(STR16 pString, STR16 pStringA,UINT16 usFirstX, UINT16 usFirstY); void ShowTeamAndVehicles(INT32 fShowFlags); BOOLEAN ShadeMapElem( INT16 sMapX, INT16 sMapY, INT32 iColor ); -BOOLEAN ShadeMapElements(const INT32(&colorMap)[16][16]); +BOOLEAN ShadeMapElements(const INT32(&colorMap)[MAXIMUM_VALID_Y_COORDINATE][MAXIMUM_VALID_X_COORDINATE]); void AdjustXForLeftMapEdge(STR16 wString, INT16 *psX, INT32 iFont); void BlitTownGridMarkers( void ); void BlitMineGridMarkers( void ); From d6370b7463f52a364a62495d6c41ca38b34574f0 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:21:55 +0200 Subject: [PATCH 047/571] Fix invisible cows and bloodcats --- Tactical/Animation Data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Animation Data.cpp b/Tactical/Animation Data.cpp index 7cd94389..0a582d63 100644 --- a/Tactical/Animation Data.cpp +++ b/Tactical/Animation Data.cpp @@ -1022,7 +1022,7 @@ BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 } // get structure data if any - pStructureFileRef = InternalGetAnimationStructureRef( (UINT8)usSoldierID, usSurfaceIndex, usAnimState, TRUE ); + pStructureFileRef = InternalGetAnimationStructureRef( usSoldierID, usSurfaceIndex, usAnimState, TRUE ); if ( pStructureFileRef != NULL ) { From aad6ed8297b41cdbd623dda7b1bf46f1ade1e05c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:29:36 +0200 Subject: [PATCH 048/571] Implemented SoldierID type to replace SOLDIERTYPE->ubID Goal is to convert all use of SOLDIERTYPE->ubID and any other ID fields that reference the same ID to a safer type than UINT16. Same with any function that's supposed to take ubID --- Tactical/Overhead Types.h | 72 +++++++++++++++++++++++++++++++++++++- Tactical/Soldier Control.h | 2 +- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 2ca0d5db..a8d45707 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -32,7 +32,7 @@ //TACTICAL OVERHEAD STUFF //#define NO_SOLDIER TOTAL_SOLDIERS // SAME AS NOBODY //#define NOBODY NO_SOLDIER -#define NOBODY TOTAL_SOLDIERS +//#define NOBODY TOTAL_SOLDIERS @@ -375,4 +375,74 @@ typedef struct // strcmp returns 0 if true! #define COMPARE_PALETTEREP_ID( a, b ) ( strcmp( a, b ) ? FALSE : TRUE ) + +typedef struct SoldierID +{ + UINT16 i; + + // Implicit conversion and constructor to provide compatibility with unchanged code + // TODO: Remove once SoldierID is used everywhere and these are no longer needed + inline operator UINT16() const { return i; } + SoldierID(const UINT16 val = 0) + : i(val) + {} +} SoldierID; + +//inline bool operator==(const SoldierID lhs, const SoldierID rhs) { return lhs.i == rhs.i; } +//inline bool operator!=(const SoldierID lhs, const SoldierID rhs) { return lhs.i != rhs.i; } + +inline bool operator<(const SoldierID lhs, const SoldierID rhs) { return lhs.i < rhs.i; } +inline bool operator<(const SoldierID lhs, const int rhs) { return lhs.i < rhs; } +inline bool operator<(const int lhs, const SoldierID rhs) { return lhs < rhs.i; } +inline bool operator<(const unsigned int lhs, const SoldierID rhs) { return lhs < rhs.i; } +inline bool operator<(const UINT16 lhs, const SoldierID rhs) { return lhs < rhs.i; } + +inline bool operator>(const SoldierID lhs, const SoldierID rhs) { return lhs.i > rhs.i; } +inline bool operator>(const SoldierID lhs, const int rhs) { return lhs.i > rhs; } +inline bool operator>(const int lhs, const SoldierID rhs) { return lhs > rhs.i; } +inline bool operator>(const UINT16 lhs, const SoldierID rhs) { return lhs > rhs.i; } + +inline bool operator<=(const SoldierID lhs, const SoldierID rhs) { return lhs.i <= rhs.i; } +inline bool operator<=(const SoldierID lhs, const int rhs) { return lhs.i <= rhs; } +inline bool operator<=(const SoldierID lhs, const UINT16 rhs) { return lhs.i <= rhs; } +inline bool operator<=(const int lhs, const SoldierID rhs) { return lhs <= rhs.i; } +inline bool operator<=(const UINT32 lhs, const SoldierID rhs) { return lhs <= rhs.i; } +inline bool operator<=(const UINT16 lhs, const SoldierID rhs) { return lhs <= rhs.i; } +inline bool operator<=(const INT16 lhs, const SoldierID rhs) { return lhs <= rhs.i; } + +inline bool operator>=(const SoldierID lhs, const SoldierID rhs) { return lhs.i >= rhs.i; } +inline bool operator>=(const SoldierID lhs, const int rhs) { return lhs.i >= rhs; } +inline bool operator>=(const SoldierID lhs, const UINT16 rhs) { return lhs.i >= rhs; } +inline bool operator>=(const int lhs, const SoldierID rhs) { return lhs >= rhs.i; } +inline bool operator>=(const unsigned int lhs, const SoldierID rhs) { return lhs >= rhs.i; } +inline bool operator>=(const UINT16 lhs, const SoldierID rhs) { return lhs >= rhs.i; } + +inline SoldierID operator-(const SoldierID lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs.i - rhs.i) }; } +inline SoldierID operator-(const SoldierID lhs, const int rhs) { return SoldierID{ static_cast(lhs.i - rhs) }; } +inline SoldierID operator-(const SoldierID lhs, const unsigned int rhs) { return SoldierID{ static_cast(lhs.i - rhs) }; } +inline SoldierID operator-(const SoldierID lhs, const UINT16 rhs) { return SoldierID{ static_cast(lhs.i - rhs) }; } +inline SoldierID operator-(const int lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs - rhs.i) }; } +inline SoldierID operator-(const unsigned int lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs - rhs.i) }; } + +inline SoldierID operator+(const SoldierID lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs.i + rhs.i) }; } +inline SoldierID operator+(const SoldierID lhs, const int rhs) { return SoldierID{ static_cast(lhs.i + rhs) }; } +inline SoldierID operator+(const SoldierID lhs, const unsigned int rhs) { return SoldierID{ static_cast(lhs.i + rhs) }; } +inline SoldierID operator+(const SoldierID lhs, const UINT16 rhs) { return SoldierID{ static_cast(lhs.i + rhs) }; } +inline SoldierID operator+(const unsigned int lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs + rhs.i) }; } +inline SoldierID operator+(const INT16 lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs + rhs.i) }; } + +inline SoldierID operator--(SoldierID lhs) +{ + lhs.i -= 1; + return lhs; +} + +inline SoldierID operator++(SoldierID lhs) +{ + lhs.i += 1; + return lhs; +} + +//TODO: Change this to constexpr after SoldierID is ready and the user defined constructor from uint16 is not needed anymore. +inline const SoldierID NOBODY{ TOTAL_SOLDIERS }; #endif diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index bfc9e6a6..81dc88bc 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1103,7 +1103,7 @@ public: // properly until it is all fixed and the files updated. public: // ID - UINT16 ubID; + SoldierID ubID; CHAR16 name[ 10 ]; INT16 GetMaxDistanceVisible(INT32 sGridNo = -1, INT8 bLevel = -1, int calcAsType = -1); From 4d740055daea2d97e2832bbfc97756b964aeedff Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:33:32 +0200 Subject: [PATCH 049/571] Provide access function to MenPtrs, MercPtrs & MercSlots All raw array accesses should be done with these instead. --- Tactical/Overhead.cpp | 20 ++++++++++++++++++++ Tactical/Overhead.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 5aa32012..05cbe6b3 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -274,6 +274,26 @@ UINT32 guiNumMercSlots = 0; SOLDIERTYPE* AwaySlots[ TOTAL_SOLDIERS ]; UINT32 guiNumAwaySlots = 0; +SOLDIERTYPE* SoldierFromID(const SoldierID id) +{ + if (id >= TOTAL_SOLDIERS) + { + return nullptr; + } + + return &Menptr[id.i]; +} + +SOLDIERTYPE* SoldierFromID(const SoldierID id, SOLDIERTYPE* Array[TOTAL_SOLDIERS]) +{ + if (id >= TOTAL_SOLDIERS) + { + return nullptr; + } + + return Array[id.i]; +} + // DEF: changed to have client wait for gPlayerNum assigned from host UINT8 gbPlayerNum = 0; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index b3378957..9f123297 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -433,5 +433,8 @@ BOOLEAN IsCivFactionMemberAliveInSector( UINT8 usCivilianGroup ); BOOLEAN IsFreeSlotAvailable( int aTeam ); void AttemptToCapturePlayerSoldiers(); + +SOLDIERTYPE* SoldierFromID(const SoldierID id); +SOLDIERTYPE* SoldierFromID(const SoldierID id, SOLDIERTYPE* Array[TOTAL_SOLDIERS]); #endif From f5b14476462085539eadc30bb708ff23250f047c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:12:37 +0200 Subject: [PATCH 050/571] Move MercSlots zeroing to same loop where MercPtrs are set One less for loop that way --- Tactical/Overhead.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 05cbe6b3..d8a47380 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -674,13 +674,15 @@ void ShutdownTacticalEngine( ) BOOLEAN InitOverhead( ) { UINT32 cnt; - UINT16 cnt2; + UINT16 cnt2; // Set pointers list for( cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) { MercPtrs[ cnt ] = &Menptr[ cnt ]; MercPtrs[ cnt ]->bActive = FALSE; + // Zero out merc slots! + MercSlots[cnt] = NULL; } memset( &gTacticalStatus, 0, sizeof( TacticalStatusType ) ); UINT8 maxteams; @@ -774,11 +776,6 @@ BOOLEAN InitOverhead( ) } } - // Zero out merc slots! - for ( cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) - { - MercSlots[ cnt ] = NULL; - } // Set other tactical flags gTacticalStatus.uiFlags = TURNBASED | TRANSLUCENCY_TYPE; From 0103a871cc3438fe490ce25362bcfe815cdbadfd Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 14 Nov 2024 00:43:48 +0200 Subject: [PATCH 051/571] Operator overloads for accessing SOLDIERTYPE* through SoldierID --- Tactical/Overhead Types.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index a8d45707..4f22eed1 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -376,6 +376,9 @@ typedef struct #define COMPARE_PALETTEREP_ID( a, b ) ( strcmp( a, b ) ? FALSE : TRUE ) +struct SOLDIERTYPE; +extern SOLDIERTYPE *MercPtrs[TOTAL_SOLDIERS]; + typedef struct SoldierID { UINT16 i; @@ -386,6 +389,9 @@ typedef struct SoldierID SoldierID(const UINT16 val = 0) : i(val) {} + + SOLDIERTYPE* operator->() { return MercPtrs[i]; } + const SOLDIERTYPE* operator->() const { return MercPtrs[i]; } } SoldierID; //inline bool operator==(const SoldierID lhs, const SoldierID rhs) { return lhs.i == rhs.i; } From 1345d925217f68c082e498478d1c8b3dd7841a86 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 14 Nov 2024 00:45:50 +0200 Subject: [PATCH 052/571] Convert Soldier Find.cpp to SoldierID --- Strategic/Assignments.cpp | 2 +- Tactical/Handle UI.cpp | 12 ++--- Tactical/Handle UI.h | 16 +++---- Tactical/Overhead.cpp | 4 +- Tactical/Overhead.h | 2 +- Tactical/Points.cpp | 4 +- Tactical/Real Time Input.cpp | 2 +- Tactical/Soldier Ani.cpp | 2 +- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Find.cpp | 91 +++++++++++++++++------------------- Tactical/Soldier Find.h | 12 ++--- Tactical/opplist.cpp | 46 +++++++++--------- 12 files changed, 95 insertions(+), 100 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index f1711ed8..75de1b8e 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -292,7 +292,7 @@ extern BOOLEAN fInMapMode; INT8 gbTrainingMode = -1; // who is the highlighted guy -extern UINT16 gusUIFullTargetID; +extern SoldierID gusUIFullTargetID; // showing town info? extern BOOLEAN fShowTownInfo; diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 92e9e6d4..f72f4848 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -272,12 +272,12 @@ extern BOOLEAN gfGetNewPathThroughPeople; extern BOOLEAN gfIgnoreOnSelectedGuy; extern BOOLEAN gfInOpenDoorMenu; -BOOLEAN gfUIFullTargetFound; -UINT32 guiUIFullTargetFlags; -UINT16 gusUIFullTargetID; -BOOLEAN gfUISelectiveTargetFound; -UINT32 guiUISelectiveTargetFlags; -UINT16 gusUISelectiveTargetID; +BOOLEAN gfUIFullTargetFound; +UINT32 guiUIFullTargetFlags; +SoldierID gusUIFullTargetID; +BOOLEAN gfUISelectiveTargetFound; +UINT32 guiUISelectiveTargetFlags; +SoldierID gusUISelectiveTargetID; SOLDIERTYPE *gpRequesterMerc = NULL; SOLDIERTYPE *gpRequesterTargetMerc = NULL; diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index 14b15f1e..5109cc85 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -268,16 +268,16 @@ extern BOOLEAN gfUIHandlePhysicsTrajectory; // GLOBALS FOR FAST LOOKUP FOR FINDING MERCS FROM THE MOUSE -extern BOOLEAN gfUISelectiveTargetFound; -extern UINT16 gusUISelectiveTargetID; -extern UINT32 guiUISelectiveTargetFlags; +extern BOOLEAN gfUISelectiveTargetFound; +extern SoldierID gusUISelectiveTargetID; +extern UINT32 guiUISelectiveTargetFlags; -extern BOOLEAN gfUIFullTargetFound; -extern UINT16 gusUIFullTargetID; -extern UINT32 guiUIFullTargetFlags; +extern BOOLEAN gfUIFullTargetFound; +extern SoldierID gusUIFullTargetID; +extern UINT32 guiUIFullTargetFlags; extern BOOLEAN gfUIConfirmExitArrows; -extern INT32 gsJumpOverGridNo; +extern INT32 gsJumpOverGridNo; extern UINT32 HandleTacticalUI(void); extern UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent ); @@ -382,4 +382,4 @@ void GetGridNoScreenXY( INT32 sGridNo, INT16 *pScreenX, INT16 *pScreenY ); //Legion by Jazz void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index d8a47380..33f5dd89 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -5482,7 +5482,7 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect INT32 sClosest = -1, sSpot; INT32 sCloseGridNo = NOWHERE; UINT32 uiMercFlags; - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; UINT8 ubDir; STRUCTURE *pDoor; UINT8 ubWallOrientation; @@ -5845,7 +5845,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub INT32 sClosest = -1, sSpot, sSpot2; INT32 sCloseGridNo = NOWHERE; UINT32 uiMercFlags; - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; UINT8 ubDir; STRUCTURE *pDoor; UINT8 ubWallOrientation; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 9f123297..f75aa410 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -260,7 +260,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ); BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange); -BOOLEAN IsValidTargetMerc( UINT16 ubSoldierID ); +BOOLEAN IsValidTargetMerc( SoldierID ubSoldierID ); // FUNCTIONS FOR MANIPULATING MERC SLOTS - A LIST OF ALL ACTIVE MERCS INT32 GetFreeMercSlot( ); diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index ee07e3f0..2ca80a77 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -2006,7 +2006,7 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT32 sGridNo { UINT8 ubDirection; UINT32 uiMercFlags; - UINT16 usTargID; + SoldierID usTargID; BOOLEAN fAddingTurningCost = FALSE; BOOLEAN fAddingRaiseGunCost = FALSE; @@ -2189,7 +2189,7 @@ UINT16 CalculateRaiseGunCost(SOLDIERTYPE *pSoldier, BOOLEAN fAddingRaiseGunCost, INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, UINT8 ubAddTurningCost, UINT8 ubForceRaiseGunCost ) { UINT32 uiMercFlags; - UINT16 usTargID; + SoldierID usTargID; INT16 bFullAPs; INT16 bAimSkill; INT16 bAPCost = APBPConstants[AP_MIN_AIM_ATTACK]; diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index b8c21c52..81b606ba 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -180,7 +180,7 @@ void GetRTMouseButtonInput( UINT32 *puiNewEvent ) void QueryRTLeftButton( UINT32 *puiNewEvent ) { - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; SOLDIERTYPE *pSoldier; SOLDIERTYPE *pVehicle; UINT32 uiMercFlags; diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 9d8c420a..49bcea84 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -2046,7 +2046,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) { SOLDIERTYPE *pTSoldier; UINT32 uiMercFlags; - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; if ( FindSoldier( pSoldier->sTargetGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 7963e9e6..2b256bb3 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -13269,7 +13269,7 @@ void SOLDIERTYPE::EVENT_SoldierEnterVehicle( INT32 sGridNo, UINT8 ubDirection, U { SOLDIERTYPE *pTSoldier; UINT32 uiMercFlags; - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { diff --git a/Tactical/Soldier Find.cpp b/Tactical/Soldier Find.cpp index 72941d04..718cf8ee 100644 --- a/Tactical/Soldier Find.cpp +++ b/Tactical/Soldier Find.cpp @@ -46,11 +46,8 @@ BOOLEAN IsGridNoInScreenRect( INT32 sGridNo, SGPRect *pRect ); BOOLEAN IsPointInScreenRect( INT16 sXPos, INT16 sYPos, SGPRect *pRect ); void GetSoldierScreenRect( SOLDIERTYPE *pSoldier, SGPRect *pRect ); -// This value is used to keep a small static array of uBID's which are stacked -#define MAX_STACKED_MERCS 10 - -UINT32 gScrollSlideInertiaDirection[ NUM_WORLD_DIRECTIONS ] = +UINT32 gScrollSlideInertiaDirection[ NUM_WORLD_DIRECTIONS ] = { 3, 0, @@ -62,25 +59,29 @@ UINT32 gScrollSlideInertiaDirection[ NUM_WORLD_DIRECTIONS ] = 3, }; + +// This value is used to keep a small static array of uBID's which are stacked +#define MAX_STACKED_MERCS 10 + // Struct used for cycling through multiple mercs per mouse position typedef struct { INT8 bNum; - UINT16 ubIDs[ MAX_STACKED_MERCS ]; + SoldierID ubIDs[ MAX_STACKED_MERCS ]; INT8 bCur; BOOLEAN fUseGridNo; INT32 sUseGridNoGridNo; } SOLDIER_STACK_TYPE; -SOLDIER_STACK_TYPE gSoldierStack; -BOOLEAN gfHandleStack = FALSE; +SOLDIER_STACK_TYPE gSoldierStack; +BOOLEAN gfHandleStack = FALSE; -extern BOOLEAN gUIActionModeChangeDueToMouseOver; -extern UINT32 guiUITargetSoldierId; +extern BOOLEAN gUIActionModeChangeDueToMouseOver; +extern UINT32 guiUITargetSoldierId; -BOOLEAN FindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFlags ) +BOOLEAN FindSoldierFromMouse( SoldierID *pusSoldierIndex, UINT32 *pMercFlags ) { INT32 usMapPos; @@ -97,7 +98,7 @@ BOOLEAN FindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFlags ) return( FALSE ); } -BOOLEAN SelectiveFindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFlags ) +BOOLEAN SelectiveFindSoldierFromMouse( SoldierID *pusSoldierIndex, UINT32 *pMercFlags ) { INT32 usMapPos; @@ -115,7 +116,7 @@ BOOLEAN SelectiveFindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFla } -UINT32 GetSoldierFindFlags( UINT16 ubID ) +UINT32 GetSoldierFindFlags( const SoldierID ubID ) { UINT32 MercFlags = 0; SOLDIERTYPE *pSoldier; @@ -123,7 +124,7 @@ UINT32 GetSoldierFindFlags( UINT16 ubID ) // Get pSoldier! pSoldier = MercPtrs[ ubID ]; - // FInd out and set flags + // Find out and set flags if ( ubID == gusSelectedSoldier ) { MercFlags |= SELECTED_MERC; @@ -136,12 +137,12 @@ UINT32 GetSoldierFindFlags( UINT16 ubID ) } else { - // It's our own merc - MercFlags |= OWNED_MERC; + // It's our own merc + MercFlags |= OWNED_MERC; if ( pSoldier->bAssignment < ON_DUTY ) { - MercFlags |= ONDUTY_MERC; + MercFlags |= ONDUTY_MERC; } } } @@ -191,20 +192,20 @@ extern BOOLEAN CheckVideoObjectScreenCoordinateInData( HVOBJECT hSrcVObject, UIN // THIS FUNCTION IS CALLED FAIRLY REGULARLY -BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, UINT32 uiFlags ) +BOOLEAN FindSoldier( INT32 sGridNo, SoldierID *pusSoldierIndex, UINT32 *pMercFlags, UINT32 uiFlags ) { - UINT32 cnt; + UINT32 cnt; SOLDIERTYPE *pSoldier; - SGPRect aRect; - BOOLEAN fSoldierFound = FALSE; - INT16 sXMapPos, sYMapPos, sScreenX, sScreenY; - INT16 sMaxScreenMercY, sHeighestMercScreenY = -32000; - BOOLEAN fDoFull; - UINT16 ubBestMerc = NOBODY; - UINT16 usAnimSurface; - INT32 iMercScreenX, iMercScreenY; - BOOLEAN fInScreenRect = FALSE; - BOOLEAN fInGridNo = FALSE; + SGPRect aRect; + BOOLEAN fSoldierFound = FALSE; + INT16 sXMapPos, sYMapPos, sScreenX, sScreenY; + INT16 sMaxScreenMercY, sHeighestMercScreenY = -32000; + BOOLEAN fDoFull; + SoldierID ubBestMerc = NOBODY; + UINT16 usAnimSurface; + INT32 iMercScreenX, iMercScreenY; + BOOLEAN fInScreenRect = FALSE; + BOOLEAN fInGridNo = FALSE; *pusSoldierIndex = NOBODY; @@ -227,8 +228,8 @@ BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, for ( cnt = 0; cnt < guiNumMercSlots; cnt++ ) { pSoldier = MercSlots[ cnt ]; - fInScreenRect = FALSE; - fInGridNo = FALSE; + fInScreenRect = FALSE; + fInGridNo = FALSE; if ( pSoldier != NULL ) { @@ -339,7 +340,7 @@ BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, if ( usAnimSurface != INVALID_ANIMATION_SURFACE ) { iMercScreenX = (INT32)( sScreenX - aRect.iLeft ); - iMercScreenY = (INT32)( -1 * ( sScreenY - aRect.iBottom ) ); + iMercScreenY = (INT32)( -1 * ( sScreenY - aRect.iBottom ) ); if ( !CheckVideoObjectScreenCoordinateInData( gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject, pSoldier->usAniFrame, iMercScreenX, iMercScreenY ) ) { @@ -359,7 +360,7 @@ BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, { gfHandleStack = TRUE; - // Add this one! + // Add this one! gSoldierStack.ubIDs[ gSoldierStack.bNum ] = pSoldier->ubID; gSoldierStack.bNum++; @@ -430,7 +431,7 @@ BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, if ( fSoldierFound && ubBestMerc != NOBODY ) { - *pusSoldierIndex = (UINT16)ubBestMerc; + *pusSoldierIndex = ubBestMerc; (*pMercFlags) = GetSoldierFindFlags( ubBestMerc ); @@ -460,8 +461,8 @@ BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags, BOOLEAN CycleSoldierFindStack( INT32 usMapPos ) { - UINT16 usSoldierIndex; - UINT32 uiMercFlags; + SoldierID usSoldierIndex; + UINT32 uiMercFlags; // Have we initalized for this yet? if ( !gfHandleStack ) @@ -521,10 +522,9 @@ BOOLEAN CycleSoldierFindStack( INT32 usMapPos ) SOLDIERTYPE * SimpleFindSoldier( INT32 sGridNo, INT8 bLevel ) { - UINT16 ubID; + SoldierID ubID = WhoIsThere2( sGridNo, bLevel ); - ubID = WhoIsThere2( sGridNo, bLevel ); - if ( ubID == NOBODY ) + if ( ubID >= NOBODY ) { return( NULL ); } @@ -534,7 +534,7 @@ SOLDIERTYPE * SimpleFindSoldier( INT32 sGridNo, INT8 bLevel ) } } -BOOLEAN IsValidTargetMerc( UINT16 ubSoldierID ) +BOOLEAN IsValidTargetMerc( SoldierID ubSoldierID ) { SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ]; @@ -785,14 +785,9 @@ BOOLEAN GridNoOnScreen( INT32 sGridNo ) } -BOOLEAN SoldierOnScreen( UINT16 usID ) +BOOLEAN SoldierOnScreen( SoldierID usID ) { - SOLDIERTYPE *pSoldier; - - // Get pointer of soldier - pSoldier = MercPtrs[ usID ]; - - return( GridNoOnScreen( pSoldier->sGridNo ) ); + return( GridNoOnScreen( usID->sGridNo ) ); } @@ -1006,7 +1001,7 @@ BOOLEAN FindRelativeSoldierPosition( SOLDIERTYPE *pSoldier, UINT16 *usFlags, INT } // VERY quickly finds a soldier at gridno , ( that is visible ) -UINT16 QuickFindSoldier( INT32 sGridNo ) +SoldierID QuickFindSoldier( INT32 sGridNo ) { UINT32 cnt; SOLDIERTYPE *pSoldier = NULL; @@ -1020,7 +1015,7 @@ UINT16 QuickFindSoldier( INT32 sGridNo ) { if ( pSoldier->sGridNo == sGridNo && pSoldier->bVisible != -1 ) { - return( (UINT16)cnt ); + return( cnt ); } } diff --git a/Tactical/Soldier Find.h b/Tactical/Soldier Find.h index 6616dfb4..e35fc20a 100644 --- a/Tactical/Soldier Find.h +++ b/Tactical/Soldier Find.h @@ -30,16 +30,16 @@ class SOLDIERTYPE; #define FINDSOLDIERSELECTIVESAMELEVEL( l ) ( ( ( FIND_SOLDIER_SELECTIVE | FIND_SOLDIER_SAMELEVEL ) | ( l << 16 ) ) ) -BOOLEAN FindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFlags ); -BOOLEAN SelectiveFindSoldierFromMouse( UINT16 *pusSoldierIndex, UINT32 *pMercFlags ); -BOOLEAN FindSoldier( INT32 sGridNo, UINT16 *pusSoldierIndex, UINT32 *pMercFlags , UINT32 uiFlags ); +BOOLEAN FindSoldierFromMouse( SoldierID *pusSoldierIndex, UINT32 *pMercFlags ); +BOOLEAN SelectiveFindSoldierFromMouse( SoldierID *pusSoldierIndex, UINT32 *pMercFlags ); +BOOLEAN FindSoldier( INT32 sGridNo, SoldierID *pusSoldierIndex, UINT32 *pMercFlags , UINT32 uiFlags ); SOLDIERTYPE * SimpleFindSoldier( INT32 sGridNo, INT8 bLevel ); BOOLEAN CycleSoldierFindStack( INT32 usMapPos ); BOOLEAN GridNoOnScreen( INT32 sGridNo ); -BOOLEAN SoldierOnScreen( UINT16 usID ); +BOOLEAN SoldierOnScreen( SoldierID usID ); BOOLEAN SoldierLocationRelativeToScreen( INT32 sGridNo, UINT16 usReasonID, INT8 *pbDirection, UINT32 *puiScrollFlags ); void GetSoldierScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *psScreenY ); void GetSoldierAnimDims( SOLDIERTYPE *pSoldier, INT16 *psHeight, INT16 *psWidth ); @@ -48,9 +48,9 @@ void GetSoldierTRUEScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *ps BOOLEAN IsPointInSoldierBoundingBox( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY ); BOOLEAN FindRelativeSoldierPosition( SOLDIERTYPE *pSoldier, UINT16 *usFlags, INT16 sX, INT16 sY ); -UINT16 QuickFindSoldier( INT32 sGridNo ); +SoldierID QuickFindSoldier( INT32 sGridNo ); void GetGridNoScreenPos( INT32 sGridNo, UINT8 ubLevel, INT16 *psScreenX, INT16 *psScreenY ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 663d2a40..3c68ee3a 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -3985,11 +3985,11 @@ extern UINT32 guiNumBackSaves; void DebugSoldierPage1( ) { - SOLDIERTYPE *pSoldier; - UINT16 usSoldierIndex; - UINT32 uiMercFlags; - INT32 usMapPos; - UINT8 ubLine=0; + SOLDIERTYPE *pSoldier; + SoldierID usSoldierIndex; + UINT32 uiMercFlags; + INT32 usMapPos; + UINT8 ubLine=0; if ( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) { @@ -4168,13 +4168,13 @@ void DebugSoldierPage1( ) void DebugSoldierPage2( ) { - SOLDIERTYPE *pSoldier; - UINT16 usSoldierIndex; - UINT32 uiMercFlags; - INT32 usMapPos; - TILE_ELEMENT TileElem; - LEVELNODE *pNode; - UINT8 ubLine; + SOLDIERTYPE *pSoldier; + SoldierID usSoldierIndex; + UINT32 uiMercFlags; + INT32 usMapPos; + TILE_ELEMENT TileElem; + LEVELNODE *pNode; + UINT8 ubLine; if ( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) { @@ -4442,11 +4442,11 @@ void DebugSoldierPage2( ) void DebugSoldierPage3( ) { - SOLDIERTYPE *pSoldier; - UINT16 usSoldierIndex; - UINT32 uiMercFlags; - INT32 usMapPos; - UINT8 ubLine; + SOLDIERTYPE *pSoldier; + SoldierID usSoldierIndex; + UINT32 uiMercFlags; + INT32 usMapPos; + UINT8 ubLine; if ( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) { @@ -4835,12 +4835,12 @@ void WriteQuantityAndAttachments( OBJECTTYPE *pObject, INT32 yp ) void DebugSoldierPage4( ) { - SOLDIERTYPE *pSoldier; - UINT32 uiMercFlags; - CHAR16 szOrders[20]; - CHAR16 szAttitude[20]; - UINT16 usSoldierIndex; - UINT8 ubLine; + SOLDIERTYPE *pSoldier; + UINT32 uiMercFlags; + CHAR16 szOrders[20]; + CHAR16 szAttitude[20]; + SoldierID usSoldierIndex; + UINT8 ubLine; if ( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) { From c04cc4cfcc7098f118370226199a58b0aa088240 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 14 Nov 2024 01:00:05 +0200 Subject: [PATCH 053/571] Update Map Screen Interface.h --- Strategic/Map Screen Interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 44adfbc6..7837887f 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -322,7 +322,7 @@ extern BOOLEAN fLockOutMapScreenInterface; // The character data structure typedef struct { - UINT16 usSolID;// soldier ID in MenPtrs + SoldierID usSolID;// soldier ID in MenPtrs BOOLEAN fValid;// is the current soldier a valid soldier } MapScreenCharacterSt; From 1327d186ed1d5265358b29b0bd42a220bfbac9a2 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 14 Nov 2024 01:08:38 +0200 Subject: [PATCH 054/571] Use usSolID directly usSolID *is* ubID from Menptr! --- Strategic/mapscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 2afd246f..6aaf41b5 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -12911,7 +12911,7 @@ void HandleChangeOfInfoChar( void ) if( gCharactersList[ bOldInfoChar ].fValid == TRUE ) { // set face in active - SetAutoFaceInActiveFromSoldier( Menptr[ gCharactersList[ bOldInfoChar ].usSolID ].ubID ); + SetAutoFaceInActiveFromSoldier( gCharactersList[ bOldInfoChar ].usSolID ); } } From 568aa0a0b8bc269cf789c36bcc2a2fdb2d83b078 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 00:04:39 +0200 Subject: [PATCH 055/571] Update Item Types.cpp --- Tactical/Item Types.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index df85bad6..324cde2e 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -48,9 +48,9 @@ bool checkLBEArrayIntegrity(bool verbose) { ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"LBENODE integrity check start: checking soldier items..."); for (int i = 0; i < CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS; i++) { - if (!gCharactersList[i].fValid || gCharactersList[i].usSolID < 0) continue; + if (!gCharactersList[i].fValid || gCharactersList[i].usSolID >= NOBODY) continue; - int id = gCharactersList[i].usSolID; + SoldierID id = gCharactersList[i].usSolID; SOLDIERTYPE soldier = Menptr[id]; if (verbose)ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"LBENODE integrity check start: checking soldier items (%s)...", soldier.name); From 6a0d02e9b93f089675a9ca7d7958aff323602eb6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:03:21 +0200 Subject: [PATCH 056/571] Change type from BOOLEAN(!) to SoldierID --- Tactical/Overhead.cpp | 2 +- Tactical/Soldier Ani.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 33f5dd89..8c413bff 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6783,7 +6783,7 @@ void SetEnemyPresence( ) } -extern BOOLEAN gfLastMercTalkedAboutKillingID; +extern SoldierID gfLastMercTalkedAboutKillingID; BOOLEAN SoldierHasSeenEnemiesLastFewTurns( SOLDIERTYPE *pTeamSoldier ) { diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 49bcea84..1b86246b 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -78,7 +78,7 @@ class SOLDIERTYPE; //#define TIME_FOR_RANDOM_ANIM_CHECK 10 #define TIME_FOR_RANDOM_ANIM_CHECK 1 -BOOLEAN gfLastMercTalkedAboutKillingID = NOBODY; +SoldierID gfLastMercTalkedAboutKillingID = NOBODY; extern void AddFuelToVehicle( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ); From 735075869ce748e64460cb8d9688d9fab3110ddb Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:14:30 +0200 Subject: [PATCH 057/571] Fix incorrect variables ubImprintID uses SOLDIERTYPE->ubProfile, not SOLDIERTYPE->ubID in every other instance of the code. This one's clearly a mistake. --- TacticalAI/FindLocations.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 14574528..1b726e20 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -1988,7 +1988,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if ( pItem->usItemClass == IC_GUN && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { // maybe this gun has ammo (adjust for whether it is better than ours!) - if ( (*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) + if ( (*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NO_PROFILE && (*pObj)[0]->data.ubImprintID != pSoldier->ubProfile) ) { iTempValue = 0; } @@ -2029,7 +2029,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if (pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { DebugAI(AI_MSG_INFO, pSoldier, String("weapon has good status")); - if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NO_PROFILE && (*pObj)[0]->data.ubImprintID != pSoldier->ubProfile) ) ) { // jammed or out of ammo, skip it! DebugAI(AI_MSG_INFO, pSoldier, String("jammed or out of ammo, skip it!")); @@ -2080,7 +2080,7 @@ INT8 SearchForItems( SOLDIERTYPE * pSoldier, INT8 bReason, UINT16 usItem ) if ( pItem->usItemClass & IC_WEAPON && (*pObj)[0]->data.objectStatus >= MINIMUM_REQUIRED_STATUS ) { DebugAI(AI_MSG_INFO, pSoldier, String("gun has good status")); - if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NOBODY && (*pObj)[0]->data.ubImprintID != pSoldier->ubID) ) ) + if ( (pItem->usItemClass & IC_GUN) && ((*pObj)[0]->data.gun.bGunAmmoStatus < 0 || (*pObj)[0]->data.gun.ubGunShotsLeft == 0 || (ItemHasFingerPrintID(pObj->usItem) && (*pObj)[0]->data.ubImprintID != NO_PROFILE && (*pObj)[0]->data.ubImprintID != pSoldier->ubProfile) ) ) { // jammed or out of ammo, skip it! DebugAI(AI_MSG_INFO, pSoldier, String("jammed or out of ammo, skip it!")); From 0def972901778b0d0b5332ea1dbd2465776750ba Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:28:06 +0200 Subject: [PATCH 058/571] Convert SetInfoChar & DrawFace to use SoldierID --- Strategic/mapscreen.cpp | 4 ++-- Strategic/mapscreen.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 6aaf41b5..81a3e340 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -1902,7 +1902,7 @@ BOOLEAN InitializeInvPanelCoordsRobot() } // the tries to select a mapscreen character by his soldier ID -BOOLEAN SetInfoChar( UINT16 ubID ) +BOOLEAN SetInfoChar( SoldierID ubID ) { for (INT16 bCounter = 0; bCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; bCounter++) { @@ -2223,7 +2223,7 @@ void GlowTrashCan( void ) void DrawFace( INT16 sCharNumber ) { SOLDIERTYPE *pSoldier = NULL; - static INT16 sOldId = -1; + static SoldierID sOldId = NOBODY; // draws the face of the currently selected merc, being displayed int he upper left hand corner diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index 44deeb25..e17da45b 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -137,7 +137,7 @@ extern BOOLEAN gfSkyriderEmptyHelpGiven; extern std::vector gSelectedSoldiers; -BOOLEAN SetInfoChar(UINT16 ubID); +BOOLEAN SetInfoChar(SoldierID ubID); void EndMapScreen( BOOLEAN fDuringFade ); void ReBuildCharactersList( void ); From d07dcf477acc6ba90a3933bc2fbe7eb900778e55 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:30:28 +0200 Subject: [PATCH 059/571] Update Scheduling.h --- Strategic/Scheduling.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/Scheduling.h b/Strategic/Scheduling.h index 084223fa..a18c4df0 100644 --- a/Strategic/Scheduling.h +++ b/Strategic/Scheduling.h @@ -63,7 +63,7 @@ public: UINT32 usData2[MAX_SCHEDULE_ACTIONS]; // Secondary information, not used by most actions UINT8 ubAction[MAX_SCHEDULE_ACTIONS]; UINT8 ubScheduleID; - UINT16 ubSoldierID; + SoldierID ubSoldierID; UINT16 usFlags; public: SCHEDULENODE& operator=(const _OLD_SCHEDULENODE& src); From b9deb3cc1969c08e681270774eb11e318a99d064 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:31:22 +0200 Subject: [PATCH 060/571] PossiblyStartEnemyTaunt( uiTargetId ) to SoldierID --- Tactical/Civ Quotes.cpp | 2 +- Tactical/Civ Quotes.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 5a02d724..01dfd72a 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -1095,7 +1095,7 @@ BOOLEAN LoadCivQuotesFromLoadGameFile( HWFILE hFile ) //-------------------------------------------------------------- #pragma optimize("", off) // anv: start enemy taunt with probabilty depending on taunt settings -void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 uiTargetID ) +void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SoldierID uiTargetID ) { SOLDIERTYPE *pTarget = NULL; if( uiTargetID != NOBODY ) diff --git a/Tactical/Civ Quotes.h b/Tactical/Civ Quotes.h index 0c466651..4dda1ae0 100644 --- a/Tactical/Civ Quotes.h +++ b/Tactical/Civ Quotes.h @@ -154,7 +154,7 @@ enum TAUNTTYPE//enemy taunts - SANDRO TAUNT_RIPOSTE }; -void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, UINT32 uiTargetID = NOBODY ); +void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SoldierID uiTargetID = NOBODY ); void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTarget = NULL ); //enemy taunts - SANDRO // anv: added pTarget argument void ShowTauntPopupBox( SOLDIERTYPE *pCiv, STR16 gzTauntQuote ); @@ -179,4 +179,4 @@ void BeginChatQuote( SOLDIERTYPE *pCiv, INT16 sX, INT16 sY ); BOOLEAN CivQuoteActive(); -#endif \ No newline at end of file +#endif From 1c631cb85f2b66567af10cf48811b61209c2ee46 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:32:25 +0200 Subject: [PATCH 061/571] REAL_OBJECT.ubLastTargetTakenDamage -> SoldierID --- TileEngine/physics.cpp | 4 ++-- TileEngine/physics.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index b5847a62..ac3761b5 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -2471,7 +2471,7 @@ void CheckForObjectHittingMerc( REAL_OBJECT *pObject, UINT16 usStructureID ) // Is it a guy? if ( usStructureID < INVALID_STRUCTURE_ID ) { - if ( pObject->ubLastTargetTakenDamage != (UINT8)usStructureID ) + if ( pObject->ubLastTargetTakenDamage != usStructureID ) { // Flugente: if this fails, something is very wrong indeed Assert(usStructureIDEVENT_SoldierGotHit( NOTHING, sDamage, sBreath, pSoldier->ubDirection, 0, pObject->ubOwner, FIRE_WEAPON_TOSSED_OBJECT_SPECIAL, 0, 0, NOWHERE ); - pObject->ubLastTargetTakenDamage = (UINT8)( usStructureID ); + pObject->ubLastTargetTakenDamage = usStructureID; } } } diff --git a/TileEngine/physics.h b/TileEngine/physics.h index 81effb21..249334c8 100644 --- a/TileEngine/physics.h +++ b/TileEngine/physics.h @@ -133,7 +133,7 @@ public: BOOLEAN fPotentialForDebug; INT32 sLevelNodeGridNo; INT32 iSoundID; - UINT8 ubLastTargetTakenDamage; + SoldierID ubLastTargetTakenDamage; // OJW - 20091002 - mp explosives UINT8 mpTeam; // the intiating clients team INT32 mpRealObjectID; // ID from the initiating client @@ -183,4 +183,4 @@ INT32 RandomGridFromRadius( INT32 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRad UINT32 GetArtilleryTargetGridNo( UINT32 sTargetGridNo, INT8 bRadius ); BOOLEAN GetArtilleryLaunchParams(UINT32 sStartingGridNo, UINT32 sTargetGridNo, UINT8 ubTargetLevel, INT16 sStartZ, INT16 sEndZ, UINT16 usLauncher, OBJECTTYPE* pObj, FLOAT* pdForce, FLOAT* pdDegrees); -#endif \ No newline at end of file +#endif From 337cf1804f6ae53fcbe71b6016a62da5b33e2faa Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:32:35 +0200 Subject: [PATCH 062/571] Update Overhead Types.h --- Tactical/Overhead Types.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 4f22eed1..1807979a 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -392,13 +392,30 @@ typedef struct SoldierID SOLDIERTYPE* operator->() { return MercPtrs[i]; } const SOLDIERTYPE* operator->() const { return MercPtrs[i]; } + inline operator SOLDIERTYPE* () { return MercPtrs[i]; } + inline operator const SOLDIERTYPE*() const { return MercPtrs[i]; } } SoldierID; -//inline bool operator==(const SoldierID lhs, const SoldierID rhs) { return lhs.i == rhs.i; } -//inline bool operator!=(const SoldierID lhs, const SoldierID rhs) { return lhs.i != rhs.i; } +inline bool operator==(const SoldierID lhs, const SoldierID rhs) { return lhs.i == rhs.i; } +inline bool operator==(const SoldierID lhs, const int rhs) { return lhs.i == rhs; } +inline bool operator==(const SoldierID lhs, const UINT32 rhs) { return lhs.i == rhs; } +inline bool operator==(const SoldierID lhs, const UINT16 rhs) { return lhs.i == rhs; } +inline bool operator==(const SoldierID lhs, const INT16 rhs) { return lhs.i == rhs; } +inline bool operator==(const int lhs, const SoldierID rhs) { return lhs == rhs.i; } +inline bool operator==(const UINT16 lhs, const SoldierID rhs) { return lhs == rhs.i; } +inline bool operator==(const INT16 lhs, const SoldierID rhs) { return lhs == rhs.i; } + +inline bool operator!=(const SoldierID lhs, const SoldierID rhs) { return lhs.i != rhs.i; } +inline bool operator!=(const SoldierID lhs, const UINT32 rhs) { return lhs.i != rhs; } +inline bool operator!=(const SoldierID lhs, const UINT16 rhs) { return lhs.i != rhs; } +inline bool operator!=(const int lhs, const SoldierID rhs) { return lhs != rhs.i; } +inline bool operator!=(const UINT32 lhs, const SoldierID rhs) { return lhs != rhs.i; } +inline bool operator!=(const UINT16 lhs, const SoldierID rhs) { return lhs != rhs.i; } +inline bool operator!=(const INT16 lhs, const SoldierID rhs) { return lhs != rhs.i; } inline bool operator<(const SoldierID lhs, const SoldierID rhs) { return lhs.i < rhs.i; } inline bool operator<(const SoldierID lhs, const int rhs) { return lhs.i < rhs; } +inline bool operator<(const SoldierID lhs, UINT16 rhs) { return lhs.i < rhs; } inline bool operator<(const int lhs, const SoldierID rhs) { return lhs < rhs.i; } inline bool operator<(const unsigned int lhs, const SoldierID rhs) { return lhs < rhs.i; } inline bool operator<(const UINT16 lhs, const SoldierID rhs) { return lhs < rhs.i; } From cba88ab2bc701fb81efb7735596801e78a7c6185 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:34:10 +0200 Subject: [PATCH 063/571] Update LuaInitNPCs.cpp convert l_ACTION_ITEM_SEX (lua_State *L) to use SoldierID properly --- Strategic/LuaInitNPCs.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index c8a19d6f..e5634f6d 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -7129,7 +7129,7 @@ static int l_ACTION_ITEM_SEX (lua_State *L) if ( ! (gTacticalStatus.uiFlags & INCOMBAT) ) { - UINT16 ubID; + SoldierID soldier; OBJECTTYPE DoorCloser; INT16 sTeleportSpot; INT16 sDoorSpot; @@ -7142,16 +7142,16 @@ static int l_ACTION_ITEM_SEX (lua_State *L) if ( TileIsOutOfBounds(sGridNo) ) return 0; - ubID = WhoIsThere2( sGridNo, 0 ); - if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) ) + soldier = WhoIsThere2( sGridNo, 0 ); + if ( (soldier != NOBODY) && (soldier->bTeam == gbPlayerNum) ) { - if ( InARoom( sGridNo, &usRoom ) && InARoom( MercPtrs[ ubID ]->sOldGridNo, &usOldRoom ) && usOldRoom != usRoom ) + if ( InARoom( sGridNo, &usRoom ) && InARoom( soldier->sOldGridNo, &usOldRoom ) && usOldRoom != usRoom ) { // also require there to be a miniskirt civ in the room if ( HookerInRoom( usRoom ) ) { // stop the merc... - MercPtrs[ ubID ]->EVENT_StopMerc( MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection ); + soldier->EVENT_StopMerc( soldier->sGridNo, soldier->ubDirection ); if ( sGridNo == gModSettings.iCarlaDoorGridNo +1 ) { @@ -7181,25 +7181,25 @@ static int l_ACTION_ITEM_SEX (lua_State *L) PerformItemAction( sDoorSpot, &DoorCloser ); // Flugente: additional dialogue - AdditionalTacticalCharacterDialogue_CallsLua( MercPtrs[ubID], ADE_SEX ); + AdditionalTacticalCharacterDialogue_CallsLua( soldier, ADE_SEX ); // have sex HandleNPCDoAction( 0, NPC_ACTION_SEX, 0 ); // move the merc outside of the room again - sTeleportSpot = FindGridNoFromSweetSpotWithStructData( MercPtrs[ ubID ], STANDING, sTeleportSpot, 2, &ubDirection, FALSE ); - MercPtrs[ ubID ]->ChangeSoldierState( STANDING, 0, TRUE ); - TeleportSoldier( MercPtrs[ ubID ], sTeleportSpot, FALSE ); + sTeleportSpot = FindGridNoFromSweetSpotWithStructData( soldier, STANDING, sTeleportSpot, 2, &ubDirection, FALSE ); + soldier->ChangeSoldierState( STANDING, 0, TRUE ); + TeleportSoldier( soldier, sTeleportSpot, FALSE ); - HandleMoraleEvent( MercPtrs[ ubID ], MORALE_SEX, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - FatigueCharacter( MercPtrs[ ubID ] ); - FatigueCharacter( MercPtrs[ ubID ] ); - FatigueCharacter( MercPtrs[ ubID ] ); - FatigueCharacter( MercPtrs[ ubID ] ); - DirtyMercPanelInterface( MercPtrs[ ubID ], DIRTYLEVEL1 ); + HandleMoraleEvent( soldier, MORALE_SEX, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + FatigueCharacter( soldier ); + FatigueCharacter( soldier ); + FatigueCharacter( soldier ); + FatigueCharacter( soldier ); + DirtyMercPanelInterface( soldier, DIRTYLEVEL1 ); // Flugente: we might get a disease from this... - HandlePossibleInfection( MercPtrs[ubID], NULL, INFECTION_TYPE_SEX ); + HandlePossibleInfection( soldier, NULL, INFECTION_TYPE_SEX ); } } } From e9c8124dc2a069fd9535d8a8405d5c5907b35856 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:05:19 +0200 Subject: [PATCH 064/571] Fix UB compilation --- Strategic/Queen Command.cpp | 12 ++++++------ Tactical/Ja25_Tactical.cpp | 18 +++++++++--------- Tactical/Ja25_Tactical.h | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 23bddfc8..487ee8fe 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -3158,8 +3158,8 @@ void HandleBloodCatDeaths( SECTORINFO *pSector ) //if ALL the bloodcats are killed if( pSector->bBloodCats == 0 ) { - UINT8 bId1=-1; - UINT8 bId2=-1; + SoldierID bId1 = NOBODY; + SoldierID bId2 = NOBODY; UINT8 bNum=0; SetFactTrue( FACT_PLAYER_KILLED_ALL_BETTYS_BLOODCATS ); @@ -3174,13 +3174,13 @@ void HandleBloodCatDeaths( SECTORINFO *pSector ) if( bNum != 0 ) { //must make sure TEX doesnt say the quote - if( bId1 != NOBODY && Menptr[ bId1 ].ubProfile != TEX_UB ) + if( bId1 != NOBODY && bId1->ubProfile != TEX_UB ) { - TacticalCharacterDialogue( &Menptr[ bId1 ], QUOTE_UB_HANDLE_BLOODCATDEATHS ); + TacticalCharacterDialogue( bId1, QUOTE_UB_HANDLE_BLOODCATDEATHS ); } - else if( bId2 != NOBODY && Menptr[ bId2 ].ubProfile != TEX_UB ) + else if( bId2 != NOBODY && bId2->ubProfile != TEX_UB ) { - TacticalCharacterDialogue( &Menptr[ bId2 ], QUOTE_UB_HANDLE_BLOODCATDEATHS ); + TacticalCharacterDialogue( bId2, QUOTE_UB_HANDLE_BLOODCATDEATHS ); } } } diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 4893ce49..417dc46e 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -84,7 +84,7 @@ typedef struct //Morris items //UINT32 MORRIS_INSTRUCTION_NOTE = 1362; -UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ); +UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ); //******************************************************************* // @@ -584,7 +584,7 @@ UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ) return( usNumMercsPresent ); } -UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ) +UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ) { UINT8 usNumMercs; UINT8 RandomSoldierIdArray[ NUM_MERCS_WITH_NEW_QUOTES ]; @@ -875,20 +875,20 @@ void HandlePowerGenAlarm() } else { - UINT8 bSoldierId1, bSoldierId2, bSoldierId3; + SoldierID bSoldierId1, bSoldierId2, bSoldierId3; Get3RandomQualifiedMercs( &bSoldierId1, &bSoldierId2, &bSoldierId3 ); - if( bSoldierId1 != -1 && Menptr[ bSoldierId1 ].ubProfile != BIGGENS_UB ) //BIGGENS + if( bSoldierId1 != NOBODY && bSoldierId1->ubProfile != BIGGENS_UB ) //BIGGENS { - TacticalCharacterDialogue( &Menptr[ bSoldierId1 ], QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); + TacticalCharacterDialogue( bSoldierId1, QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); } - else if( bSoldierId2 != -1 && Menptr[ bSoldierId2 ].ubProfile != BIGGENS_UB ) //BIGGENS + else if( bSoldierId2 != NOBODY && bSoldierId2->ubProfile != BIGGENS_UB ) //BIGGENS { - TacticalCharacterDialogue( &Menptr[ bSoldierId2 ], QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); + TacticalCharacterDialogue( bSoldierId2, QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); } - else if( bSoldierId3 != -1 && Menptr[ bSoldierId3 ].ubProfile != BIGGENS_UB ) // BIGGENS + else if( bSoldierId3 != NOBODY && bSoldierId3->ubProfile != BIGGENS_UB ) // BIGGENS { - TacticalCharacterDialogue( &Menptr[ bSoldierId3 ], QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); + TacticalCharacterDialogue( bSoldierId3, QUOTE_HATED_1_ON_TEAM_LONGTIMETOHATE ); } } } diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 4f086238..a8b12371 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -50,7 +50,7 @@ BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQu UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ); -extern UINT8 Get3RandomQualifiedMercs( UINT8 *pSoldierId1, UINT8 *pSoldierId2, UINT8 *pSoldierId3 ); +extern UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ); void HandleWhenCertainPercentageOfEnemiesDie(); @@ -151,4 +151,4 @@ extern void InitGridNoUB(); #endif -#endif \ No newline at end of file +#endif From b98732daa7db604ef294edea60f4ae23e85581b5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 19:06:34 +0200 Subject: [PATCH 065/571] Convert gusSelectedSoldier to SoldierID --- Ja2/aniviewscreen.cpp | 2 +- Ja2/gamescreen.cpp | 12 +- Ja2/jascreens.cpp | 44 +++---- Strategic/strategicmap.cpp | 10 +- Tactical/Dialogue Control.cpp | 18 +-- Tactical/DisplayCover.cpp | 17 ++- Tactical/Handle UI Plan.cpp | 3 +- Tactical/Handle UI.cpp | 14 +-- Tactical/Interface Control.cpp | 4 +- Tactical/Interface Cursors.cpp | 4 +- Tactical/Interface Panels.cpp | 6 +- Tactical/Interface Utils.cpp | 2 +- Tactical/Interface.cpp | 6 +- Tactical/Overhead.cpp | 64 +++++----- Tactical/Overhead.h | 4 +- Tactical/Real Time Input.cpp | 34 +++--- Tactical/ShopKeeper Interface.cpp | 10 +- Tactical/Soldier Control.cpp | 2 +- Tactical/SoldierTooltips.cpp | 16 +-- Tactical/Squads.cpp | 2 +- Tactical/Strategic Exit GUI.cpp | 32 ++--- Tactical/TeamTurns.cpp | 22 ++-- Tactical/Turn Based Input.cpp | 196 +++++++++++++++--------------- Tactical/UI Cursors.cpp | 2 +- Tactical/opplist.cpp | 12 +- TileEngine/Explosion Control.cpp | 9 +- TileEngine/Interactive Tiles.cpp | 4 +- TileEngine/overhead map.cpp | 2 +- TileEngine/renderworld.cpp | 4 +- TileEngine/worlddef.cpp | 2 +- 30 files changed, 270 insertions(+), 289 deletions(-) diff --git a/Ja2/aniviewscreen.cpp b/Ja2/aniviewscreen.cpp index 638e67a2..9a3f3946 100644 --- a/Ja2/aniviewscreen.cpp +++ b/Ja2/aniviewscreen.cpp @@ -104,7 +104,7 @@ UINT32 AniEditScreenHandle(void) fToggle2 = FALSE; ubCurLoadedState = 0; - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; gTacticalStatus.uiFlags |= LOADING_SAVED_GAME; diff --git a/Ja2/gamescreen.cpp b/Ja2/gamescreen.cpp index dcaa3be8..d1f48eb4 100644 --- a/Ja2/gamescreen.cpp +++ b/Ja2/gamescreen.cpp @@ -261,17 +261,17 @@ void EnterTacticalScreen( ) if ( gusSelectedSoldier != NOBODY ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: check our guy")); - if ( !OK_CONTROLLABLE_MERC( MercPtrs[ gusSelectedSoldier ] ) ) + if ( !OK_CONTROLLABLE_MERC( gusSelectedSoldier ) ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: SelectNextAvailSoldier, merc not controllable")); - SelectNextAvailSoldier( MercPtrs[ gusSelectedSoldier ] ); + SelectNextAvailSoldier( gusSelectedSoldier ); } DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: who is selected? %d", gusSelectedSoldier)); // ATE: If the current guy is sleeping, change.... - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->flags.fMercAsleep ) + if ( gusSelectedSoldier != NOBODY && gusSelectedSoldier->flags.fMercAsleep ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("EnterTacticalScreen: SelectNextAvailSoldier, merc asleep")); - SelectNextAvailSoldier( MercPtrs[ gusSelectedSoldier ] ); + SelectNextAvailSoldier( gusSelectedSoldier ); } } else @@ -684,7 +684,7 @@ UINT32 MainGameScreenHandle(void) // Select a guy if he hasn;' if( !gfTacticalPlacementGUIActive ) { - if ( gusSelectedSoldier != NOBODY && OK_INTERRUPT_MERC( MercPtrs[ gusSelectedSoldier ] ) ) + if ( gusSelectedSoldier != NOBODY && OK_INTERRUPT_MERC( gusSelectedSoldier ) ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("maingamescreenhandle: selectsoldier")); SelectSoldier( gusSelectedSoldier, FALSE, TRUE ); @@ -933,7 +933,7 @@ UINT32 MainGameScreenHandle(void) if ( gusSelectedSoldier != NOBODY ) { if( !gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] ) - MercPtrs[ gusSelectedSoldier ]->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); + gusSelectedSoldier->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); } } diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index b431dd2e..5362171a 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -514,31 +514,25 @@ UINT32 PalEditScreenShutdown(void) void PalEditRenderHook( ) { - SOLDIERTYPE *pSoldier; - - if ( gusSelectedSoldier != NOBODY ) + if ( gusSelectedSoldier < NOBODY && gusSelectedSoldier->bActive) { - // Set to current - GetSoldier( &pSoldier, gusSelectedSoldier ); - - DisplayPaletteRep( pSoldier->HeadPal, 50, 10, FRAME_BUFFER ); - DisplayPaletteRep( pSoldier->PantsPal, 50, 50, FRAME_BUFFER ); - DisplayPaletteRep( pSoldier->VestPal, 50, 90, FRAME_BUFFER ); - DisplayPaletteRep( pSoldier->SkinPal, 50, 130, FRAME_BUFFER ); - + DisplayPaletteRep( gusSelectedSoldier->HeadPal, 50, 10, FRAME_BUFFER ); + DisplayPaletteRep( gusSelectedSoldier->PantsPal, 50, 50, FRAME_BUFFER ); + DisplayPaletteRep( gusSelectedSoldier->VestPal, 50, 90, FRAME_BUFFER ); + DisplayPaletteRep( gusSelectedSoldier->SkinPal, 50, 130, FRAME_BUFFER ); } } BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) { - UINT8 ubType; - SOLDIERTYPE *pSoldier; - UINT8 ubPaletteRep; - UINT32 cnt; - UINT8 ubStartRep = 0; - UINT8 ubEndRep = 0; + SOLDIERTYPE *pSoldier; + UINT32 cnt; + UINT8 ubType; + UINT8 ubPaletteRep; + UINT8 ubStartRep = 0; + UINT8 ubEndRep = 0; - if ( gusSelectedSoldier == NOBODY ) + if ( gusSelectedSoldier >= NOBODY || gusSelectedSoldier->bActive == FALSE ) { return( FALSE ); } @@ -549,11 +543,10 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) return( TRUE ); } + pSoldier = gusSelectedSoldier; + if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'h' )) { - // Get Soldier - GetSoldier( &pSoldier, gusSelectedSoldier ); - // Get index of current CHECKF( GetPaletteRepIndexFromID( pSoldier->HeadPal, &ubPaletteRep ) ); ubType = gpPalRep[ ubPaletteRep ].ubType; @@ -582,9 +575,6 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'v' )) { - // Get Soldier - GetSoldier( &pSoldier, gusSelectedSoldier ); - // Get index of current CHECKF( GetPaletteRepIndexFromID( pSoldier->VestPal, &ubPaletteRep ) ); ubType = gpPalRep[ ubPaletteRep ].ubType; @@ -612,9 +602,6 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 'p' )) { - // Get Soldier - GetSoldier( &pSoldier, gusSelectedSoldier ); - // Get index of current CHECKF( GetPaletteRepIndexFromID( pSoldier->PantsPal, &ubPaletteRep ) ); ubType = gpPalRep[ ubPaletteRep ].ubType; @@ -642,9 +629,6 @@ BOOLEAN PalEditKeyboardHook( InputAtom *pInputEvent ) if ((pInputEvent->usEvent == KEY_DOWN )&& ( pInputEvent->usParam == 's' )) { - // Get Soldier - GetSoldier( &pSoldier, gusSelectedSoldier ); - // Get index of current CHECKF( GetPaletteRepIndexFromID( pSoldier->SkinPal, &ubPaletteRep ) ); ubType = gpPalRep[ ubPaletteRep ].ubType; diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index b0f37b70..cca5a3ee 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -3993,7 +3993,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32 // This guy should always be 1 ) selected and 2 ) close enough to exit sector to leave if ( gusSelectedSoldier != NOBODY ) { - pValidSoldier = MercPtrs[gusSelectedSoldier]; + pValidSoldier = gusSelectedSoldier; ubDirection = GetInsertionDataFromAdjacentMoveDirection( ubTacticalDirection, sAdditionalData ); } @@ -4839,13 +4839,13 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu UINT8 ubNumMercs = 0, ubNumEPCs = 0; UINT8 ubPlayerControllableMercsInSquad = 0; - if ( gusSelectedSoldier == NOBODY ) + if ( gusSelectedSoldier >= NOBODY ) { //must have a selected soldier to be allowed to tactically traverse. return FALSE; } // anv: vehicles can't use inner exit grids - if ( bExitDirection == (-1) && MercPtrs[gusSelectedSoldier]->bAssignment == VEHICLE ) + if ( bExitDirection == (-1) && gusSelectedSoldier->bAssignment == VEHICLE ) { return FALSE; } @@ -4959,12 +4959,12 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu // If we are here, at least one guy is controllable in this sector, at least he can go! if ( fAtLeastOneMercControllable ) { - ubPlayerControllableMercsInSquad = (UINT8)NumberOfPlayerControllableMercsInSquad( MercPtrs[gusSelectedSoldier]->bAssignment ); + ubPlayerControllableMercsInSquad = (UINT8)NumberOfPlayerControllableMercsInSquad( gusSelectedSoldier->bAssignment ); if ( fAtLeastOneMercControllable <= ubPlayerControllableMercsInSquad ) { //if the selected merc is an EPC and we can only leave with that merc, then prevent it //as EPCs aren't allowed to leave by themselves. Instead of restricting this in the //exiting sector gui, we restrict it by explaining it with a message box. - if ( AM_AN_EPC( MercPtrs[gusSelectedSoldier] ) ) + if ( AM_AN_EPC( gusSelectedSoldier ) ) { if ( AM_A_ROBOT( pSoldier ) && !pSoldier->CanRobotBeControlled( ) ) { diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 6ffe3ee1..cc8c8e67 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -657,13 +657,13 @@ void HandleDialogue( ) { if( gfMorrisShouldSayHi ) { - SOLDIERTYPE * pMorris; - SOLDIERTYPE * pSoldier; - INT16 sPlayerGridNo; - UINT8 ubPlayerID; - UINT8 ubQualifiedSoldierIDArray[ NUM_MERCS_WITH_NEW_QUOTES ]; - UINT8 ubNumQualifiedMercs=0; - UINT8 ubCnt=0; + SOLDIERTYPE *pMorris; + SOLDIERTYPE *pSoldier; + INT16 sPlayerGridNo; + SoldierID ubPlayerID; + UINT8 ubQualifiedSoldierIDArray[ NUM_MERCS_WITH_NEW_QUOTES ]; + UINT8 ubNumQualifiedMercs=0; + UINT8 ubCnt=0; if( !( gMercProfiles[ MORRIS_UB ].ubMiscFlags2 & PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE ) ) { @@ -676,7 +676,7 @@ void HandleDialogue( ) ubPlayerID = WhoIsThere2( sPlayerGridNo, 0 ); if (ubPlayerID != NOBODY) { - InitiateConversation( pMorris, MercPtrs[ ubPlayerID ], NPC_INITIAL_QUOTE, 0 ); + InitiateConversation( pMorris, ubPlayerID, NPC_INITIAL_QUOTE, 0 ); gMercProfiles[ pMorris->ubProfile ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_SAID_FIRSTSEEN_QUOTE; } } @@ -1887,7 +1887,7 @@ BOOLEAN CharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 iFaceI { if ( gusSelectedSoldier != NOBODY ) { - AdditionalTacticalCharacterDialogue_CallsLua( MercPtrs[gusSelectedSoldier], ADE_DIALOGUE_REACTION, ubCharacterNum, usQuoteNum, ( gMercProfiles[ubCharacterNum].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) ? 1 : 0 ); + AdditionalTacticalCharacterDialogue_CallsLua( gusSelectedSoldier, ADE_DIALOGUE_REACTION, ubCharacterNum, usQuoteNum, ( gMercProfiles[ubCharacterNum].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) ? 1 : 0 ); } } // if team members talk, anyone may answer diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index b4324511..40f674f1 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -538,11 +538,10 @@ void DisplayCover( BOOLEAN forceUpdate ) static void CalculateCoverFromEnemies() { - if (gusSelectedSoldier == NOBODY) + if (gusSelectedSoldier == NOBODY || gusSelectedSoldier->bActive == false) return; - SOLDIERTYPE* pSoldier; - GetSoldier(&pSoldier, gusSelectedSoldier); + SOLDIERTYPE* pSoldier = gusSelectedSoldier; const INT8 OurSoldierStealth = GetStealth(pSoldier); const INT8 OurSoldierLBESightAdjustment = GetSightAdjustmentBasedOnLBE(pSoldier); @@ -673,10 +672,10 @@ void CalculateCover() INT8 ubZ; SOLDIERTYPE* pSoldier; - if (gusSelectedSoldier == NOBODY) + if (gusSelectedSoldier == NOBODY || gusSelectedSoldier->bActive == false) return; - GetSoldier(&pSoldier, gusSelectedSoldier); + pSoldier = gusSelectedSoldier; for (ubX = gsMinCellX; ubX <= gsMaxCellX; ++ubX) { @@ -1199,7 +1198,7 @@ void CalculateMines() return; } - const INT32& sSelectedSoldierGridNo = MercPtrs[ gusSelectedSoldier ]->sGridNo; + const INT32& sSelectedSoldierGridNo = gusSelectedSoldier->sGridNo; for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX ) { @@ -1453,7 +1452,7 @@ void CalculateTraitRange() return; } - const INT32& sSelectedSoldierGridNo = MercPtrs[ gusSelectedSoldier ]->sGridNo; + const INT32& sSelectedSoldierGridNo = gusSelectedSoldier->sGridNo; for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX ) { @@ -1591,7 +1590,7 @@ void CalculateTrackerRange( ) UINT16 range = gSkillTraitValues.usSVTrackerMaxRange * trackerskill; - const INT32& sSelectedSoldierGridNo = MercPtrs[gusSelectedSoldier]->sGridNo; + const INT32& sSelectedSoldierGridNo = gusSelectedSoldier->sGridNo; for ( ubX = gsMinCellX; ubX <= gsMaxCellX; ++ubX ) { @@ -1775,7 +1774,7 @@ void CalculateWeapondata() BOOLEAN guninhand = WeaponInHand( pSoldier ); - INT32 sSelectedSoldierGridNo = MercPtrs[gusSelectedSoldier]->sGridNo; + INT32 sSelectedSoldierGridNo = gusSelectedSoldier->sGridNo; if ( TileIsOutOfBounds( sSelectedSoldierGridNo ) ) return; diff --git a/Tactical/Handle UI Plan.cpp b/Tactical/Handle UI Plan.cpp index 33b0708d..0669e172 100644 --- a/Tactical/Handle UI Plan.cpp +++ b/Tactical/Handle UI Plan.cpp @@ -197,7 +197,7 @@ BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) pPlanSoldier->ChangeSoldierState( pPlanSoldier->usUIMovementMode, 0, FALSE ); // Change selected soldier - gusSelectedSoldier = (UINT16)pPlanSoldier->ubID; + gusSelectedSoldier = pPlanSoldier->ubID; // Change global planned mode to this guy! gpUIPlannedSoldier = pPlanSoldier; @@ -243,6 +243,7 @@ void EndUIPlan( ) SOLDIERTYPE *pSoldier; // Zero out any planned soldiers + //FIXME for( cnt = MAX_NUM_SOLDIERS; cnt < TOTAL_SOLDIERS; cnt++ ) { pSoldier = MercPtrs[ cnt ]; diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index f72f4848..92eeec76 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -1013,7 +1013,7 @@ void SetUIMouseCursor( ) if( GetMouseMapPos( &usMapPos) ) { - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->pathing.bLevel == 0 ) + if ( gusSelectedSoldier != NOBODY && gusSelectedSoldier->pathing.bLevel == 0 ) { // ATE: Is this place revealed? if ( !InARoom( usMapPos, &usRoomNum ) || ( InARoom( usMapPos, &usRoomNum ) && gpWorldLevelData[ usMapPos ].uiFlags & MAPELEMENT_REVEALED ) ) @@ -1953,7 +1953,7 @@ UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) if ( gfUIFullTargetFound ) { // No, ok display message IF this is the first time at this gridno - if ( gsOutOfRangeGridNo != MercPtrs[ gusUIFullTargetID ]->sGridNo || gubOutOfRangeMerc != gusSelectedSoldier ) + if ( gsOutOfRangeGridNo != gusUIFullTargetID->sGridNo || gubOutOfRangeMerc != gusSelectedSoldier ) { // Display ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ OUT_OF_RANGE_STRING ] ); @@ -1961,7 +1961,7 @@ UINT32 UIHandleAOnTerrain( UI_EVENT *pUIEvent ) //PlayJA2Sample( TARGET_OUT_OF_RANGE, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); // Set - gsOutOfRangeGridNo = MercPtrs[ gusUIFullTargetID ]->sGridNo; + gsOutOfRangeGridNo = gusUIFullTargetID->sGridNo; gubOutOfRangeMerc = gusSelectedSoldier; } } @@ -2058,7 +2058,7 @@ UINT32 UIHandleCWait( UI_EVENT *pUIEvent ) { if( pSoldier->flags.uiStatusFlags & SOLDIER_DRIVER ) { - pSoldier = GetSoldierStructureForVehicle( MercPtrs[ gusSelectedSoldier ]->iVehicleId ); + pSoldier = GetSoldierStructureForVehicle( gusSelectedSoldier->iVehicleId ); } pInvTile = GetCurInteractiveTile( ); @@ -3746,7 +3746,7 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) // anv: don't switch if passengers are blocked from attacking if( gusSelectedSoldier != NOBODY ) { - SOLDIERTYPE *pSelectedSoldier = MercPtrs[gusSelectedSoldier]; + SOLDIERTYPE *pSelectedSoldier = gusSelectedSoldier; if( pSelectedSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { SOLDIERTYPE *pVehicle = GetSoldierStructureForVehicle( pSelectedSoldier->iVehicleId ); @@ -6386,7 +6386,7 @@ BOOLEAN IsValidTalkableNPC( UINT16 ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMer if ( gusSelectedSoldier != NOBODY ) { - if ( AM_A_ROBOT( MercPtrs[ gusSelectedSoldier ] ) ) + if ( AM_A_ROBOT( gusSelectedSoldier ) ) { return( FALSE ); } @@ -7042,7 +7042,7 @@ BOOLEAN SelectedGuyInBusyAnimation( ) if ( gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; if ( pSoldier->usAnimState == LOB_ITEM || pSoldier->usAnimState == THROW_ITEM || diff --git a/Tactical/Interface Control.cpp b/Tactical/Interface Control.cpp index 1d733042..294f03e2 100644 --- a/Tactical/Interface Control.cpp +++ b/Tactical/Interface Control.cpp @@ -317,7 +317,7 @@ void SetUpInterface( ) { if ( gusSelectedSoldier != NOBODY ) { - if ( MercPtrs[ gusSelectedSoldier ]->sGridNo != gsUIHandleShowMoveGridLocation ) + if ( gusSelectedSoldier->sGridNo != gsUIHandleShowMoveGridLocation ) { if ( gfUIHandleShowMoveGrid == 2 ) { @@ -327,7 +327,7 @@ void SetUpInterface( ) } else { - if ( MercPtrs[ gusSelectedSoldier ]->bStealthMode ) + if ( gusSelectedSoldier->bStealthMode ) { AddTopmostToHead( gsUIHandleShowMoveGridLocation, GetSnapCursorIndex( FIRSTPOINTERS9 ) ); gpWorldLevelData[gsUIHandleShowMoveGridLocation].pTopmostHead->ubShadeLevel=DEFAULT_SHADE_LEVEL; diff --git a/Tactical/Interface Cursors.cpp b/Tactical/Interface Cursors.cpp index aaae395b..386e086a 100644 --- a/Tactical/Interface Cursors.cpp +++ b/Tactical/Interface Cursors.cpp @@ -354,7 +354,7 @@ BOOLEAN DrawUICursor( ) // ATE; Is the current guy in steath mode? if ( gusSelectedSoldier != NOBODY ) { - if ( MercPtrs[ gusSelectedSoldier ]->bStealthMode ) + if ( gusSelectedSoldier->bStealthMode ) { usTileCursor = FIRSTPOINTERS9; } @@ -367,7 +367,7 @@ BOOLEAN DrawUICursor( ) // ATE; Is the current guy in steath mode? if ( gusSelectedSoldier != NOBODY ) { - if ( MercPtrs[ gusSelectedSoldier ]->bStealthMode ) + if ( gusSelectedSoldier->bStealthMode ) { usTileCursor = FIRSTPOINTERS10; } diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 0a8ebe93..defdd7d7 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -6201,7 +6201,7 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( OK_CONTROLLABLE_MERC( MercPtrs[ ubSoldierID ] ) && !( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) { //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s added", MercPtrs[ ubSoldierID ]->name ); - MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; + gusSelectedSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; MercPtrs[ ubSoldierID ]->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; EndMultiSoldierSelection( TRUE ); } @@ -6213,7 +6213,7 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) MercPtrs[ ubSoldierID ]->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); if (ubSoldierID != gusSelectedSoldier) { - MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; + gusSelectedSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; } EndMultiSoldierSelection( TRUE ); } @@ -7194,7 +7194,7 @@ UINT16 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLif //Select next squad iCurrentSquad = CurrentSquad( ); - pNewSoldier = FindNextActiveSquad( MercPtrs[ gusSelectedSoldier ] ); + pNewSoldier = FindNextActiveSquad( gusSelectedSoldier ); if ( pNewSoldier->bAssignment != iCurrentSquad ) { diff --git a/Tactical/Interface Utils.cpp b/Tactical/Interface Utils.cpp index b0bbfae5..53417ea2 100644 --- a/Tactical/Interface Utils.cpp +++ b/Tactical/Interface Utils.cpp @@ -43,7 +43,7 @@ extern UINT32 guiBrownBackgroundForTeamPanel; extern UINT32 guiGoldBackgroundForTeamPanel; // selected grunt -extern UINT16 gusSelectedSoldier; +extern SoldierID gusSelectedSoldier; // car portraits enum{ diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 34bdc582..8ba363ec 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -851,7 +851,7 @@ void PopupMovementMenu( UI_EVENT *pUIEvent ) if ( gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; } // Blit background! @@ -6136,7 +6136,7 @@ void ShowEnemyWeapon( INT16 sX, INT16 sY, SOLDIERTYPE* pTargetSoldier ) INT32 iVisibleDistance; if ( gusSelectedSoldier != NOBODY ) - pSelectedSoldier = MercPtrs[ gusSelectedSoldier ]; + pSelectedSoldier = gusSelectedSoldier; else return; @@ -6182,7 +6182,7 @@ void ShowEnemyHealthBar( INT16 sX, INT16 sY, SOLDIERTYPE* pSoldier ) SOLDIERTYPE *pSelectedSoldier; if ( gusSelectedSoldier != NOBODY ) - pSelectedSoldier = MercPtrs[ gusSelectedSoldier ]; + pSelectedSoldier = gusSelectedSoldier; else return; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 8c413bff..5a67e3c3 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -298,7 +298,7 @@ SOLDIERTYPE* SoldierFromID(const SoldierID id, SOLDIERTYPE* Array[TOTAL_SOLDIERS UINT8 gbPlayerNum = 0; // Global for current selected soldier -UINT16 gusSelectedSoldier = NOBODY; +SoldierID gusSelectedSoldier = NOBODY; INT8 gbShowEnemies = FALSE; BOOLEAN gfMovingAnimation = FALSE; @@ -3362,7 +3362,7 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF if ( gusSelectedSoldier != NOBODY ) { // Get guy - pOldSoldier = MercPtrs[ gusSelectedSoldier ]; + pOldSoldier = gusSelectedSoldier; pOldSoldier->flags.fShowLocator = FALSE; pOldSoldier->flags.fFlashLocator = FALSE; @@ -4249,8 +4249,8 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) //if the person was Raul, and we are to say the blown up quotes if( pSoldierOld->ubProfile == RAUL_UB /*RAUL */ && IsJa25GeneralFlagSet( JA_GF__RAUL_BLOW_HIMSELF_UP ) ) { - UINT8 SoldierId1; - UINT8 SoldierId2; + SoldierID SoldierId1; + SoldierID SoldierId2; //Get some random Soldier ID's of the valid mercs if( Get3RandomQualifiedMercs( &SoldierId1, &SoldierId2, NULL ) != 0 ) @@ -6571,8 +6571,8 @@ void EnterCombatMode( UINT8 ubStartingTeam ) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("EnterCombatMode continuing... start player turn, selected soldier = %d",gusSelectedSoldier)); // OK, make sure we have a selected guy // Madd: this was causing a weird crash becuase gusSelectedSoldier was 156 (out of the array bounds) for some reason - //if ( MercPtrs[ gusSelectedSoldier ]->aiData.bOppCnt == 0 ) - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->aiData.bOppCnt == 0 ) + //if ( gusSelectedSoldier->aiData.bOppCnt == 0 ) + if ( gusSelectedSoldier != NOBODY && gusSelectedSoldier->aiData.bOppCnt == 0 ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... nobody selected"); // OK, look through and find one.... @@ -9631,7 +9631,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) if (gTacticalStatus.ubCurrentTeam == gbPlayerNum && gusSelectedSoldier < TOTAL_SOLDIERS) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; } else { @@ -9658,7 +9658,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) return( NULL ); } - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; } if (!pSoldier) @@ -10179,7 +10179,7 @@ void RemoveManFromTeam( INT8 bTeam ) void RemoveSoldierFromTacticalSector( SOLDIERTYPE *pSoldier, BOOLEAN fAdjustSelected ) { - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE *pNewSoldier; // reset merc's opplist @@ -10935,7 +10935,7 @@ void TurnCoatAttemptMessageBoxCallBack( UINT8 ubExitValue ) INT16 approachselected = DropDownTemplate::getInstance().GetSelectedEntryKey(); - UINT8 approachchance = MercPtrs[gusSelectedSoldier]->GetTurncoatConvinctionChance( prisonerdialoguetargetID, approachselected ); + UINT8 approachchance = gusSelectedSoldier->GetTurncoatConvinctionChance( prisonerdialoguetargetID, approachselected ); // you can never turn a VIP (though we don't tell the player if someone is a VIP, lest they have an exploit to find out) if ( pSoldier->usSoldierFlagMask & SOLDIER_VIP ) @@ -10953,24 +10953,24 @@ void TurnCoatAttemptMessageBoxCallBack( UINT8 ubExitValue ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szTurncoatText[0], pSoldier->GetName() ); // increase intel penalty. We can only try to convert enemies if the penalty is low, and having a high penalty means we can't mine intel for a few hours but have to hide - MercPtrs[gusSelectedSoldier]->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] += 1; + gusSelectedSoldier->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] += 1; - StatChange( MercPtrs[gusSelectedSoldier], EXPERAMT, 2, FROM_SUCCESS ); - StatChange( MercPtrs[gusSelectedSoldier], LDRAMT, 4, FROM_SUCCESS ); + StatChange( gusSelectedSoldier, EXPERAMT, 2, FROM_SUCCESS ); + StatChange( gusSelectedSoldier, LDRAMT, 4, FROM_SUCCESS ); } else { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szTurncoatText[1], pSoldier->GetName() ); // increase intel penalty. We can only try to convert enemies if the penalty is low, and having a high penalty means we can't mine intel for a few hours but have to hide - MercPtrs[gusSelectedSoldier]->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] += 4; + gusSelectedSoldier->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] += 4; - StatChange( MercPtrs[gusSelectedSoldier], EXPERAMT, 1, FROM_FAILURE ); - StatChange( MercPtrs[gusSelectedSoldier], LDRAMT, 1, FROM_FAILURE ); + StatChange( gusSelectedSoldier, EXPERAMT, 1, FROM_FAILURE ); + StatChange( gusSelectedSoldier, LDRAMT, 1, FROM_FAILURE ); } // explain that suspicion is so high that we have to stop - if ( MercPtrs[gusSelectedSoldier]->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] >= 20 ) + if ( gusSelectedSoldier->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] >= 20 ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szTurncoatText[2] ); // use up resources spent, regardless of whether or not we were successful @@ -10979,7 +10979,7 @@ void TurnCoatAttemptMessageBoxCallBack( UINT8 ubExitValue ) INT32 bribeamount = 10 * min( 10, CurrentPlayerProgressPercentage() ); // substract money spent - AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, MercPtrs[gusSelectedSoldier]->ubProfile, GetWorldTotalMin(), -bribeamount ); + AddTransactionToPlayersBook ( TRANSFER_FUNDS_TO_MERC, gusSelectedSoldier->ubProfile, GetWorldTotalMin(), -bribeamount ); } else if ( approachselected == 4 ) { @@ -10989,7 +10989,7 @@ void TurnCoatAttemptMessageBoxCallBack( UINT8 ubExitValue ) } // spend AP - DeductPoints( MercPtrs[gusSelectedSoldier], APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); + DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); //ReduceAttackBusyCount(); } @@ -11014,12 +11014,12 @@ void HandleTurncoatAttempt( SOLDIERTYPE* pSoldier ) std::vector > dropdownvector_1; INT16 cnt = 1; - UINT8 chance = MercPtrs[gusSelectedSoldier]->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); + UINT8 chance = gusSelectedSoldier->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); swprintf( gTurncoatDropdownText[cnt-1], szTurncoatText[3], chance ); dropdownvector_1.push_back( std::make_pair( cnt, gTurncoatDropdownText[cnt - 1] ) ); ++cnt; - chance = MercPtrs[gusSelectedSoldier]->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); + chance = gusSelectedSoldier->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); swprintf( gTurncoatDropdownText[cnt - 1], szTurncoatText[4], chance ); dropdownvector_1.push_back( std::make_pair( cnt, gTurncoatDropdownText[cnt - 1] ) ); @@ -11028,7 +11028,7 @@ void HandleTurncoatAttempt( SOLDIERTYPE* pSoldier ) INT32 bribeamount = 10 * min( 10, ubCurrentProgress ); if ( bribeamount <= balance ) { - chance = MercPtrs[gusSelectedSoldier]->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); + chance = gusSelectedSoldier->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); swprintf( gTurncoatDropdownText[cnt - 1], szTurncoatText[5], bribeamount, chance ); dropdownvector_1.push_back( std::make_pair( cnt, gTurncoatDropdownText[cnt - 1] ) ); } @@ -11038,7 +11038,7 @@ void HandleTurncoatAttempt( SOLDIERTYPE* pSoldier ) int intelbribeneeded = max( 2, ( ubCurrentProgress + 5 ) / 10 ); if ( intelbribeneeded <= intelreserve ) { - chance = MercPtrs[gusSelectedSoldier]->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); + chance = gusSelectedSoldier->GetTurncoatConvinctionChance( prisonerdialoguetargetID, cnt ); swprintf( gTurncoatDropdownText[cnt - 1], szTurncoatText[6], intelbribeneeded, chance ); dropdownvector_1.push_back( std::make_pair( cnt, gTurncoatDropdownText[cnt - 1] ) ); } @@ -11163,7 +11163,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) if ( ubExitValue == 1 ) { SOLDIERTYPE *pSoldierToSurrender = MercPtrs[prisonerdialoguetargetID]; - DeductPoints( MercPtrs[gusSelectedSoldier], APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); + DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); if ( !gGameExternalOptions.fEnemyCanSurrender ) { @@ -11285,7 +11285,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) // dynamic opinion: a merc caused the remaining enemies to give up if (gGameExternalOptions.fDynamicOpinions && gusSelectedSoldier != NOBODY ) - HandleDynamicOpinionChange( MercPtrs[gusSelectedSoldier], OPINIONEVENT_BATTLE_TOOK_PRISONER, TRUE, TRUE ); + HandleDynamicOpinionChange( gusSelectedSoldier, OPINIONEVENT_BATTLE_TOOK_PRISONER, TRUE, TRUE ); } else { @@ -11295,22 +11295,22 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[STR_PRISONER_REFUSE_SURRENDER] ); // if asking for surrender while undercover and the enemy refuses, he learns who you are, so he uncovers you - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) ) + if ( gusSelectedSoldier != NOBODY && gusSelectedSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) ) { - MercPtrs[ gusSelectedSoldier ]->LooseDisguise(); + gusSelectedSoldier->LooseDisguise(); if ( gSkillTraitValues.fCOStripIfUncovered ) - MercPtrs[ gusSelectedSoldier ]->Strip(); + gusSelectedSoldier->Strip(); ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_SURRENDER_FAILED] ); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVER_SINGLE], MercPtrs[ gusSelectedSoldier ]->GetName() ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_UNCOVER_SINGLE], gusSelectedSoldier->GetName() ); } } } // we offered to surrender OURSELVES TO the enemy else if ( ubExitValue == 2 ) { - DeductPoints( MercPtrs[gusSelectedSoldier], APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); + DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); if ( !gGameExternalOptions.fPlayerCanAsktoSurrender || MercPtrs[prisonerdialoguetargetID]->bTeam == CREATURE_TEAM ) { @@ -11323,7 +11323,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) // we distract the enemy by essentially talking them to death else if ( ubExitValue == 3 ) { - DeductPoints( MercPtrs[gusSelectedSoldier], APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); + DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); // Flugente: if we are disguised and talk to a non-profile NPC, we will continue to 'chat' with the enemy as long as we aren't ordered to do something else. // This way we can easily order our spies to 'distract' enemies @@ -11367,7 +11367,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) else { // normal dialog - DeductPoints( MercPtrs[gusSelectedSoldier], APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); + DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); StartCivQuote(MercPtrs[prisonerdialoguetargetID]); } } diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index f75aa410..5ed891e3 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -170,8 +170,8 @@ struct TacticalStatusType extern UINT8 gbPlayerNum; extern INT8 gbShowEnemies; -extern UINT16 gusSelectedSoldier; -extern UINT16 gusOldSelectedSoldier; +extern SoldierID gusSelectedSoldier; +extern UINT16 gusOldSelectedSoldier; extern CHAR8 gzAlertStr[][ 30 ]; extern CHAR8 gzActionStr[][ 30 ]; diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index 81b606ba..ab0797f7 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -202,11 +202,11 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( gusSelectedSoldier != NOBODY ) { - if ( MercPtrs[ gusSelectedSoldier ]->pTempObject != NULL ) + if ( gusSelectedSoldier->pTempObject != NULL ) { return; } - if ( MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags & SOLDIER_DRIVER ) + if ( gusSelectedSoldier->flags.uiStatusFlags & SOLDIER_DRIVER ) { pVehicle = GetSoldierStructureForVehicle( MercPtrs[ usSubjectSoldier ]->iVehicleId ); usSubjectSoldier = pVehicle->ubID; @@ -448,8 +448,8 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) { // Set movement mode // OK, only change this if we are stationary! - //if ( gAnimControl[ MercPtrs[ gusSelectedSoldier ]->usAnimState ].uiFlags & ANIM_STATIONARY ) - //if ( MercPtrs[ gusSelectedSoldier ]->usAnimState == WALKING ) + //if ( gAnimControl[ gusSelectedSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) + //if ( gusSelectedSoldier->usAnimState == WALKING ) { MercPtrs[ usSubjectSoldier ]->flags.fUIMovementFast = TRUE; *puiNewEvent = C_MOVE_MERC; @@ -621,7 +621,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) //{ // if ( gusSelectedSoldier != NOBODY ) // { - // if ( !( gAnimControl[ MercPtrs[ gusSelectedSoldier ]->usAnimState ].uiFlags & ANIM_STATIONARY ) ) + // if ( !( gAnimControl[ gusSelectedSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) ) // { //gUITargetShotWaiting = TRUE; @@ -680,7 +680,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) // OK, if we have a selected guy.. make him part too.... if ( gusSelectedSoldier != NOBODY ) { - MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); + gusSelectedSoldier->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); } } @@ -715,7 +715,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) // OK, if we have a selected guy.. make him part too.... if ( gusSelectedSoldier != NOBODY ) { - MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); + gusSelectedSoldier->flags.uiStatusFlags |= (SOLDIER_MULTI_SELECTED ); } gfIgnoreOnSelectedGuy = TRUE; @@ -1017,7 +1017,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) if ( gfUICanBeginAllMoveCycle ) { // ATE: Here, check if we can do this.... - if ( !UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], usMapPos ) ) + if ( !UIOKMoveDestination( gusSelectedSoldier, usMapPos ) ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ CANT_MOVE_THERE_STR ] ); gfRTClickLeftHoldIntercepted = TRUE; @@ -1041,7 +1041,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) { gfBeginBurstSpreadTracking = FALSE; gfRTClickLeftHoldIntercepted = TRUE; - MercPtrs[ gusSelectedSoldier ]->flags.fDoSpread = FALSE; + gusSelectedSoldier->flags.fDoSpread = FALSE; fClickHoldIntercepted = TRUE; *puiNewEvent = A_END_ACTION; gCurrentUIMode = MOVE_MODE; @@ -1234,7 +1234,7 @@ void QueryRTRightButton( UINT32 *puiNewEvent ) case MOVE_MODE: case TALKCURSOR_MODE: // anv: don't switch if passengers are blocked from attacking - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; if( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { SOLDIERTYPE *pVehicle = GetSoldierStructureForVehicle( pSoldier->iVehicleId ); @@ -2032,13 +2032,13 @@ void HandleMouseRTWheel( void ) if ( _KeyDown( ALT ) ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoLowerStance(MercPtrs[ gusSelectedSoldier ]); + GotoLowerStance(gusSelectedSoldier); return; } if ( gusSelectedSoldier != NOBODY ) { //Select prev merc - bID = FindPrevActiveAndAliveMerc( MercPtrs[ gusSelectedSoldier ], TRUE, TRUE ); + bID = FindPrevActiveAndAliveMerc( gusSelectedSoldier, TRUE, TRUE ); HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); // Center to guy.... LocateSoldier( gusSelectedSoldier, SETLOCATOR ); @@ -2050,14 +2050,14 @@ void HandleMouseRTWheel( void ) if ( _KeyDown( ALT ) ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoHeigherStance( MercPtrs[ gusSelectedSoldier ] ); + GotoHeigherStance( gusSelectedSoldier ); return; } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"wheel %d", gViewportRegion.WheelState); if ( gusSelectedSoldier != NOBODY ) { //Select next merc - bID = FindNextMercInTeamPanel( MercPtrs[ gusSelectedSoldier ], FALSE, FALSE ); + bID = FindNextMercInTeamPanel( gusSelectedSoldier, FALSE, FALSE ); HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); // Center to guy.... LocateSoldier( gusSelectedSoldier, SETLOCATOR ); @@ -2073,7 +2073,7 @@ void HandleMouseRTMButton( UINT32 *puiNewEvent ) // toggle fire mode if ( ( gpItemPointer == NULL ) && ( gusSelectedSoldier != NOBODY ) && ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ BURSTMODE_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) - ChangeWeaponMode( MercPtrs[ gusSelectedSoldier ] ); + ChangeWeaponMode( gusSelectedSoldier ); } else *puiNewEvent = LC_LOOK; @@ -2140,7 +2140,7 @@ void HandleMouseRTX1Button( UINT32 *puiNewEvent ) void HandleMouseRTX2Button( UINT32 *puiNewEvent ) { if ( _KeyDown( ALT ) ) - AutoReload( MercPtrs[ gusSelectedSoldier ] ); + AutoReload( gusSelectedSoldier ); else // Toggle squad's stealth mode..... // For each guy on squad... @@ -2252,7 +2252,7 @@ void HandleRTToggleFireMode( void ) // toggle fire mode if ( ( gpItemPointer == NULL ) && ( gusSelectedSoldier != NOBODY ) && ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ BURSTMODE_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) - ChangeWeaponMode( MercPtrs[ gusSelectedSoldier ] ); + ChangeWeaponMode( gusSelectedSoldier ); } void HandleRTLocateSoldier( void ) { diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 72241b74..a09f5020 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -766,7 +766,7 @@ BOOLEAN EnterShopKeeperInterface() //ADB if we are here, we must be able to talk with an extended ear (CheckIfRadioIsEquipped()) //but if we are physically too far away, we don't have extended arms! - SOLDIERTYPE* pSoldier = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE* pSoldier = gusSelectedSoldier; SOLDIERTYPE* pShopkeeper = NULL; if ( gusIDOfCivTrader != NOBODY ) @@ -826,7 +826,7 @@ BOOLEAN EnterShopKeeperInterface() } // make sure current merc is close enough and eligible to talk to the shopkeeper. - AssertMsg( CanMercInteractWithSelectedShopkeeper( MercPtrs[ gusSelectedSoldier ] ), "Selected merc can't interact with shopkeeper. Send save AM-1"); + AssertMsg( CanMercInteractWithSelectedShopkeeper( gusSelectedSoldier ), "Selected merc can't interact with shopkeeper. Send save AM-1"); // Create a video surface to blt corner of the tactical screen that still shines through vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE; @@ -2477,7 +2477,7 @@ void EnterShopKeeperInterfaceScreen_NonNPC( INT8 ubArmsDealerID, UINT16 aMercID // Flugente: additional dialogue if ( gusSelectedSoldier != NOBODY ) - AdditionalTacticalCharacterDialogue_CallsLua( MercPtrs[gusSelectedSoldier], ADE_MERCHANT_CHAT, ubArmsDealerID >= 0 ? (UINT32)ubArmsDealerID : 0 ); + AdditionalTacticalCharacterDialogue_CallsLua( gusSelectedSoldier, ADE_MERCHANT_CHAT, ubArmsDealerID >= 0 ? (UINT32)ubArmsDealerID : 0 ); LeaveTacticalScreen( SHOPKEEPER_SCREEN ); } @@ -6780,7 +6780,7 @@ void DealWithItemsStillOnTheTable() } else { - pDropSoldier = MercPtrs[ gusSelectedSoldier ]; + pDropSoldier = gusSelectedSoldier; } // this guy HAS to be valid! @@ -7023,7 +7023,7 @@ void SelectArmsDealersDropItemToGroundRegionCallBack(MOUSE_REGION * pRegion, INT } else { - pDropSoldier = MercPtrs[ gusSelectedSoldier ]; + pDropSoldier = gusSelectedSoldier; } //if we don't have an item, pick one up diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 2b256bb3..595994bb 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2763,7 +2763,7 @@ BOOLEAN ReCreateSelectedSoldierLight( ) return(FALSE); } - pSoldier = MercPtrs[gusSelectedSoldier]; + pSoldier = gusSelectedSoldier; return(pSoldier->ReCreateSoldierLight( )); } diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index 731bb636..0adebc5a 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -132,8 +132,8 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) if ( gusSelectedSoldier != NOBODY && gusUIFullTargetID != NOBODY ) { //CHRISL: Changed the second parameter to use the same information as the 'F' hotkey uses. - //iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( MercPtrs[ gusSelectedSoldier ]->sGridNo, sSoldierGridNo ) / 10; - iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( MercPtrs[ gusSelectedSoldier ]->sGridNo, MercPtrs[ gusUIFullTargetID ]->sGridNo ) / 10; + //iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( gusSelectedSoldier->sGridNo, sSoldierGridNo ) / 10; + iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( gusSelectedSoldier->sGridNo, MercPtrs[ gusUIFullTargetID ]->sGridNo ) / 10; } // WANNE: If we want to show the tooltip of milita and no merc is present in the sector else @@ -145,14 +145,14 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) // SANDRO - don't use this if detail set to debug! if ( gGameExternalOptions.gfAllowUDTRange && gGameExternalOptions.ubSoldierTooltipDetailLevel != DL_Debug && !(gTacticalStatus.uiFlags & SHOW_ALL_MERCS) ) { - uiMaxTooltipDistance = (UINT32)( MercPtrs[ gusSelectedSoldier ]->GetMaxDistanceVisible(MercPtrs[ gusUIFullTargetID ]->sGridNo, 0, CALC_FROM_WANTED_DIR) * (gGameExternalOptions.ubUDTModifier)); + uiMaxTooltipDistance = (UINT32)( gusSelectedSoldier->GetMaxDistanceVisible(MercPtrs[ gusUIFullTargetID ]->sGridNo, 0, CALC_FROM_WANTED_DIR) * (gGameExternalOptions.ubUDTModifier)); uiMaxTooltipDistance /= 100; } //SCORE: Otherwise if we're using dynamics then do this // SANDRO - don't use this if detail set to debug! else if ( gGameExternalOptions.fEnableDynamicSoldierTooltips && gGameExternalOptions.ubSoldierTooltipDetailLevel != DL_Debug && !(gTacticalStatus.uiFlags & SHOW_ALL_MERCS) ) { - OBJECTTYPE* pObject = &(MercPtrs[gusSelectedSoldier]->inv[HANDPOS]); + OBJECTTYPE* pObject = &(gusSelectedSoldier->inv[HANDPOS]); for (attachmentList::iterator iter = (*pObject)[0]->attachments.begin(); iter != (*pObject)[0]->attachments.end(); ++iter) { if ( Item[iter->usItem].visionrangebonus > 0 && iter->exists()) { @@ -175,14 +175,14 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) { // add 10% to max tooltip viewing distance per level of the merc // sevenfm: fixed incorrect integer calculation - uiMaxTooltipDistance = (INT32)( uiMaxTooltipDistance * ( 1 + ( (FLOAT)( EffectiveExpLevel( MercPtrs[ gusSelectedSoldier ] ) ) / 10.0 ) ) ); // SANDRO - changed to effective level calc + uiMaxTooltipDistance = (INT32)( uiMaxTooltipDistance * ( 1 + ( (FLOAT)( EffectiveExpLevel( gusSelectedSoldier ) ) / 10.0 ) ) ); // SANDRO - changed to effective level calc // sevenfm: this calculation doesn't make sense: disabled //if ( gGameExternalOptions.gfAllowLimitedVision ) // uiMaxTooltipDistance *= 1 - (gGameExternalOptions.ubVisDistDecreasePerRainIntensity / 100); - if ( !(Item[MercPtrs[gusSelectedSoldier]->inv[HEAD1POS].usItem].nightvisionrangebonus > 0) && - !(Item[MercPtrs[gusSelectedSoldier]->inv[HEAD2POS].usItem].nightvisionrangebonus > 0) && + if ( !(Item[gusSelectedSoldier->inv[HEAD1POS].usItem].nightvisionrangebonus > 0) && + !(Item[gusSelectedSoldier->inv[HEAD2POS].usItem].nightvisionrangebonus > 0) && !DayTime() ) { // if night reduce max tooltip viewing distance by a factor of 4 if merc is not wearing NVG @@ -321,7 +321,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) if ( ubTooltipDetailLevel < DL_Full) { // Get the current selected merc - SOLDIERTYPE* pMerc = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE* pMerc = gusSelectedSoldier; if ( pMerc->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY ) { diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index 355bbf8a..26d7f5c3 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -926,7 +926,7 @@ BOOLEAN SetCurrentSquad( INT32 iCurrentSquad, BOOLEAN fForce ) // check if the currently selected guy is on this squad, if not, get the first one on the new squad if ( gusSelectedSoldier != NOBODY ) { - if( Menptr[ gusSelectedSoldier ].bAssignment != iCurrentTacticalSquad ) + if( gusSelectedSoldier->bAssignment != iCurrentTacticalSquad ) { // ATE: Changed this to FALSE for ackoledgement sounds.. sounds bad if just starting/entering sector.. SelectSoldier( Squad[ iCurrentTacticalSquad ][ 0 ]->ubID, FALSE, TRUE ); diff --git a/Tactical/Strategic Exit GUI.cpp b/Tactical/Strategic Exit GUI.cpp index 58d4459c..c8b87e8d 100644 --- a/Tactical/Strategic Exit GUI.cpp +++ b/Tactical/Strategic Exit GUI.cpp @@ -177,7 +177,7 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// } // anv: vehicle always move with all passengers inside - if( MercPtrs[gusSelectedSoldier]->bAssignment == VEHICLE ) + if( gusSelectedSoldier->bAssignment == VEHICLE ) { gExitDialog.fSingleMoveDisabled = TRUE; gExitDialog.fSingleMoveOn = FALSE; @@ -217,7 +217,7 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// gExitDialog.fGotoSector = TRUE; } - gExitDialog.ubNumPeopleOnSquad = NumberOfPlayerControllableMercsInSquad( MercPtrs[ gusSelectedSoldier ]->bAssignment ); + gExitDialog.ubNumPeopleOnSquad = NumberOfPlayerControllableMercsInSquad( gusSelectedSoldier->bAssignment ); //Determine for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) @@ -230,8 +230,8 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// if( !pSoldier->flags.fBetweenSectors && pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && pSoldier->stats.bLife >= OKLIFE && - ( pSoldier->bAssignment != MercPtrs[ gusSelectedSoldier ]->bAssignment || - ( pSoldier->bAssignment == VEHICLE && pSoldier->iVehicleId != MercPtrs[ gusSelectedSoldier ]->iVehicleId ) ) && + ( pSoldier->bAssignment != gusSelectedSoldier->bAssignment || + ( pSoldier->bAssignment == VEHICLE && pSoldier->iVehicleId != gusSelectedSoldier->iVehicleId ) ) && pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD && pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { //KM: We need to determine if there are more than one squad (meaning other concious mercs in a different squad or assignment) @@ -245,7 +245,7 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// // Double check that ... // if we are a EPC and are the selected guy, make single move off and disable it.... - if ( AM_AN_EPC( MercPtrs[ gusSelectedSoldier ] ) ) + if ( AM_AN_EPC( gusSelectedSoldier ) ) { // Check if there are more than one in this squad if ( gExitDialog.ubNumPeopleOnSquad > 1 ) @@ -268,7 +268,7 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// { continue; } - if( MercPtrs[ i ]->bAssignment == MercPtrs[ gusSelectedSoldier ]->bAssignment ) + if( MercPtrs[ i ]->bAssignment == gusSelectedSoldier->bAssignment ) { if( AM_AN_EPC( MercPtrs[ i ] ) ) { @@ -550,7 +550,7 @@ void UpdateSectorExitMenu( ) if( gExitDialog.fSelectedMercIsEPC ) { //EPCs cannot leave the sector alone and must be escorted CHAR16 str[ 256 ]; - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_ESCORTED_CHARACTERS_MUST_BE_ESCORTED_HELPTEXT ], MercPtrs[ gusSelectedSoldier ]->name ); + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_ESCORTED_CHARACTERS_MUST_BE_ESCORTED_HELPTEXT ], gusSelectedSoldier->name ); SetButtonFastHelpText( gExitDialog.uiSingleMoveButton, str ); SetRegionFastHelpText( &gExitDialog.SingleRegion, str ); } @@ -561,26 +561,26 @@ void UpdateSectorExitMenu( ) CHAR16 str[ 256 ]; if( !gExitDialog.fSquadHasMultipleEPCs ) { - if( gMercProfiles[ MercPtrs[ gusSelectedSoldier ]->ubProfile ].bSex == MALE ) + if( gMercProfiles[ gusSelectedSoldier->ubProfile ].bSex == MALE ) { //male singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], gusSelectedSoldier->name, MercPtrs[ gExitDialog.bSingleMoveWillIsolateEPC ]->name ); } else { //female singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->name, + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], gusSelectedSoldier->name, MercPtrs[ gExitDialog.bSingleMoveWillIsolateEPC ]->name ); } } else { - if( gMercProfiles[ MercPtrs[ gusSelectedSoldier ]->ubProfile ].bSex == MALE ) + if( gMercProfiles[ gusSelectedSoldier->ubProfile ].bSex == MALE ) { //male plural - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_PLURAL ], MercPtrs[ gusSelectedSoldier ]->name ); + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_PLURAL ], gusSelectedSoldier->name ); } else { //female plural - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_PLURAL ], MercPtrs[ gusSelectedSoldier ]->name ); + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_PLURAL ], gusSelectedSoldier->name ); } } SetButtonFastHelpText( gExitDialog.uiSingleMoveButton, str ); @@ -592,7 +592,7 @@ void UpdateSectorExitMenu( ) CHAR16 str[ 256 ]; EnableButton( gExitDialog.uiSingleMoveButton ); MSYS_EnableRegion(&(gExitDialog.SingleRegion) ); - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_SINGLE_TRAVERSAL_WILL_SEPARATE_SQUADS_HELPTEXT ], MercPtrs[ gusSelectedSoldier ]->name ); + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_SINGLE_TRAVERSAL_WILL_SEPARATE_SQUADS_HELPTEXT ], gusSelectedSoldier->name ); SetButtonFastHelpText( gExitDialog.uiSingleMoveButton, str ); SetRegionFastHelpText( &gExitDialog.SingleRegion, str ); } @@ -762,12 +762,12 @@ void RemoveSectorExitMenu( BOOLEAN fOk ) gfIgnoreScrolling = FALSE; // if we are an EPC, don't allow this if nobody else on squad - if ( fOk && AM_AN_EPC( MercPtrs[ gusSelectedSoldier ] ) ) + if ( fOk && AM_AN_EPC( gusSelectedSoldier ) ) { // Check if there are more than one in this squad if ( gExitDialog.ubNumPeopleOnSquad == 0 ) { - swprintf( Str, pMessageStrings[ MSG_EPC_CANT_TRAVERSE ], MercPtrs[ gusSelectedSoldier ]->name ); + swprintf( Str, pMessageStrings[ MSG_EPC_CANT_TRAVERSE ], gusSelectedSoldier->name ); DoMessageBox( MSG_BOX_BASIC_STYLE, Str, GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_OK, NULL, NULL ); return; diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 6173458d..d3962619 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -212,10 +212,10 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) if ( gusSelectedSoldier != NOBODY ) { // Check if this guy is able to be selected.... - if ( MercPtrs[ gusSelectedSoldier ]->stats.bLife < OKLIFE ) + if ( gusSelectedSoldier->stats.bLife < OKLIFE ) { DebugMsg(TOPIC_JA2INTERRUPT,DBG_LEVEL_3,String("StartPlayerTeamTurn: SelectNextAvailSoldier")); - SelectNextAvailSoldier( MercPtrs[ gusSelectedSoldier ] ); + SelectNextAvailSoldier( gusSelectedSoldier ); } else { @@ -230,7 +230,7 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) if ( fDoBattleSnd ) { // Say ATTENTION SOUND... - MercPtrs[ gusSelectedSoldier ]->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); + gusSelectedSoldier->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); } if ( gsInterfaceLevel == 1 ) @@ -1289,14 +1289,14 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) gfHiddenInterrupt = FALSE; // If we can continue a move, do so! - if ( MercPtrs[ gusSelectedSoldier ]->flags.fNoAPToFinishMove && pSoldier->ubReasonCantFinishMove != REASON_STOPPED_SIGHT ) + if ( gusSelectedSoldier->flags.fNoAPToFinishMove && pSoldier->ubReasonCantFinishMove != REASON_STOPPED_SIGHT ) { // Continue - MercPtrs[ gusSelectedSoldier ]->AdjustNoAPToFinishMove( FALSE ); + gusSelectedSoldier->AdjustNoAPToFinishMove( FALSE ); - if ( MercPtrs[ gusSelectedSoldier ]->sGridNo != MercPtrs[ gusSelectedSoldier ]->pathing.sFinalDestination ) + if ( gusSelectedSoldier->sGridNo != gusSelectedSoldier->pathing.sFinalDestination ) { - MercPtrs[ gusSelectedSoldier ]->EVENT_GetNewSoldierPath( MercPtrs[ gusSelectedSoldier ]->pathing.sFinalDestination, MercPtrs[ gusSelectedSoldier ]->usUIMovementMode ); + gusSelectedSoldier->EVENT_GetNewSoldierPath( gusSelectedSoldier->pathing.sFinalDestination, gusSelectedSoldier->usUIMovementMode ); } else { @@ -1332,7 +1332,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) SlideTo( NOWHERE, gusSelectedSoldier, NOBODY ,SETLOCATOR); // Say ATTENTION SOUND... - MercPtrs[ gusSelectedSoldier ]->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); + gusSelectedSoldier->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); if ( gsInterfaceLevel == 1 ) { @@ -1692,7 +1692,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponen // the selected character, ie. his friends... if ( pOpponent->bTeam == gbPlayerNum ) { - if ((ubOpponentID != gusSelectedSoldier) && (pSoldier->bSide != Menptr[gusSelectedSoldier].bSide)) + if ((ubOpponentID != gusSelectedSoldier) && (pSoldier->bSide != gusSelectedSoldier->bSide)) { return( FALSE ); } @@ -1714,7 +1714,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponen } /* old DG code for same: - if ((ubOpponentID != gusSelectedSoldier) && (pSoldier->bSide != Menptr[gusSelectedSoldier].bSide)) + if ((ubOpponentID != gusSelectedSoldier) && (pSoldier->bSide != gusSelectedSoldier->bSide)) { return(FALSE); } @@ -2356,7 +2356,7 @@ void DoneAddingToIntList( SOLDIERTYPE * pSoldier, BOOLEAN fChange, UINT8 ubInter send_interrupt( npSoldier ); - SOLDIERTYPE* pMerc = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE* pMerc = gusSelectedSoldier; //AdjustNoAPToFinishMove( pMerc, TRUE ); pMerc->HaultSoldierFromSighting(TRUE); //pMerc->fTurningFromPronePosition = FALSE;// hmmm ?? diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 6346f087..bdd31b7f 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -493,7 +493,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) { BOOLEAN fResult; - if ( ( fResult = UIOKMoveDestination( MercPtrs[ gusSelectedSoldier ], usMapPos ) ) == 1 ) + if ( ( fResult = UIOKMoveDestination( gusSelectedSoldier, usMapPos ) ) == 1 ) { // ATE: CHECK IF WE CAN GET TO POSITION // Check if we are not in combat @@ -998,10 +998,10 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) gfFirstCycleMovementStarted = TRUE; // OK, set this guy's movement mode to crawling fo rthat we will start cycling in run..... - if ( MercPtrs[ gusSelectedSoldier ]->usUIMovementMode != RUNNING ) + if ( gusSelectedSoldier->usUIMovementMode != RUNNING ) { // ATE: UNLESS WE ARE IN RUNNING MODE ALREADY - MercPtrs[ gusSelectedSoldier ]->usUIMovementMode = CRAWLING; + gusSelectedSoldier->usUIMovementMode = CRAWLING; } } @@ -1016,7 +1016,7 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) { gfBeginBurstSpreadTracking = FALSE; gfRTClickLeftHoldIntercepted = TRUE; - MercPtrs[ gusSelectedSoldier ]->flags.fDoSpread = FALSE; + gusSelectedSoldier->flags.fDoSpread = FALSE; fClickHoldIntercepted = TRUE; *puiNewEvent = A_END_ACTION; gCurrentUIMode = MOVE_MODE; @@ -1070,7 +1070,7 @@ void QueryTBRightButton( UINT32 *puiNewEvent ) case MOVE_MODE: // anv: don't switch if passengers are blocked from attacking - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; if( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { SOLDIERTYPE *pVehicle = GetSoldierStructureForVehicle( pSoldier->iVehicleId ); @@ -1627,8 +1627,8 @@ void CheatCreateItem( ) CreateItem( usitem, status, &newobj ); (newobj)[0]->data.bTemperature = temperature; - if ( !AutoPlaceObject( MercPtrs[ gusSelectedSoldier ], &newobj, FALSE ) ) - AddItemToPool( MercPtrs[ gusSelectedSoldier ]->sGridNo, &newobj, 1, 0, 0, -1 ); + if ( !AutoPlaceObject( gusSelectedSoldier, &newobj, FALSE ) ) + AddItemToPool( gusSelectedSoldier->sGridNo, &newobj, 1, 0, 0, -1 ); } } @@ -2121,7 +2121,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) gfRTClickLeftHoldIntercepted = TRUE; if ( gusSelectedSoldier != NOBODY ) { - MercPtrs[ gusSelectedSoldier ]->flags.fDoSpread = FALSE; + gusSelectedSoldier->flags.fDoSpread = FALSE; } // Before anything, delete popup box! @@ -2223,11 +2223,11 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) continue; } else if (gusSelectedSoldier != NOBODY && - MercPtrs[gusSelectedSoldier] && - !(gAnimControl[MercPtrs[gusSelectedSoldier]->usAnimState].uiFlags & ANIM_STATIONARY)) + gusSelectedSoldier && + !(gAnimControl[gusSelectedSoldier->usAnimState].uiFlags & ANIM_STATIONARY)) { // If soldier is not stationary, stop - MercPtrs[gusSelectedSoldier]->StopSoldier(); + gusSelectedSoldier->StopSoldier(); *puiNewEvent = A_CHANGE_TO_MOVE; continue; } @@ -2235,21 +2235,21 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // sevenfm: also stop dragging if (gusSelectedSoldier != NOBODY && - MercPtrs[gusSelectedSoldier] && - MercPtrs[gusSelectedSoldier]->IsDragging(false)) + gusSelectedSoldier && + gusSelectedSoldier->IsDragging(false)) { - MercPtrs[gusSelectedSoldier]->CancelDrag(); - DirtyMercPanelInterface(MercPtrs[gusSelectedSoldier], DIRTYLEVEL2); + gusSelectedSoldier->CancelDrag(); + DirtyMercPanelInterface(gusSelectedSoldier, DIRTYLEVEL2); continue; } // sevenfm: unready weapon if (gusSelectedSoldier != NOBODY && - MercPtrs[gusSelectedSoldier] && - WeaponReady(MercPtrs[gusSelectedSoldier])) + gusSelectedSoldier && + WeaponReady(gusSelectedSoldier)) { - MercPtrs[gusSelectedSoldier]->InternalSoldierReadyWeapon(MercPtrs[gusSelectedSoldier]->ubDirection, TRUE, FALSE); - HandleSight(MercPtrs[gusSelectedSoldier], SIGHT_LOOK); + gusSelectedSoldier->InternalSoldierReadyWeapon(gusSelectedSoldier->ubDirection, TRUE, FALSE); + HandleSight(gusSelectedSoldier, SIGHT_LOOK); continue; } } @@ -2313,19 +2313,19 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // { // if ( gusSelectedSoldier != NOBODY ) // { - // if ( gTacticalStatus.uiFlags & TURNBASED && !MercPtrs[ gusSelectedSoldier ]->fDontChargeReadyAPs ) + // if ( gTacticalStatus.uiFlags & TURNBASED && !gusSelectedSoldier->fDontChargeReadyAPs ) // { - // INT16 apCost = GetAPsToReadyWeapon( MercPtrs[ gusSelectedSoldier ], 0 ); - // if (MercPtrs[ gusSelectedSoldier ]->bActionPoints >= apCost ) + // INT16 apCost = GetAPsToReadyWeapon( gusSelectedSoldier, 0 ); + // if (gusSelectedSoldier->bActionPoints >= apCost ) // { - // DeductPoints( MercPtrs[ gusSelectedSoldier ],apCost , 0 ); - // DirtyMercPanelInterface( MercPtrs[ gusSelectedSoldier ], DIRTYLEVEL2 ); - // SoldierReadyWeapon( MercPtrs[ gusSelectedSoldier ] ); + // DeductPoints( gusSelectedSoldier,apCost , 0 ); + // DirtyMercPanelInterface( gusSelectedSoldier, DIRTYLEVEL2 ); + // SoldierReadyWeapon( gusSelectedSoldier ); // } // } // else // { - // SoldierReadyWeapon( MercPtrs[ gusSelectedSoldier ] ); + // SoldierReadyWeapon( gusSelectedSoldier ); // } // } @@ -2344,7 +2344,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) for ( i = 0; i < 1000; i++ ) { - CalculateLaunchItemChanceToGetThrough( MercPtrs[ gusSelectedSoldier ], &(MercPtrs[ gusSelectedSoldier ]->inv[ HANDPOS ] ), usMapPos, 0, 0, &sGridNo, TRUE, (INT8 *)&ubLevel, TRUE ); + CalculateLaunchItemChanceToGetThrough( gusSelectedSoldier, &(gusSelectedSoldier->inv[ HANDPOS ] ), usMapPos, 0, 0, &sGridNo, TRUE, (INT8 *)&ubLevel, TRUE ); } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"Physics 100 times: %d", ( GetJA2Clock( ) - iTime ) ); @@ -2412,7 +2412,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) //Select next squad iCurrentSquad = CurrentSquad( ); - pNewSoldier = FindNextActiveSquad( MercPtrs[ gusSelectedSoldier ] ); + pNewSoldier = FindNextActiveSquad( gusSelectedSoldier ); if ( pNewSoldier->bAssignment != iCurrentSquad ) { @@ -2436,7 +2436,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { //Select next merc UINT16 bID; - bID = FindNextMercInTeamPanel( MercPtrs[ gusSelectedSoldier ], FALSE, FALSE ); + bID = FindNextMercInTeamPanel( gusSelectedSoldier, FALSE, FALSE ); HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); @@ -2458,7 +2458,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( fCtrl ) { if ( gusSelectedSoldier != NOBODY ) - SwapMercPortraits( MercPtrs[ gusSelectedSoldier ], -1 ); + SwapMercPortraits( gusSelectedSoldier, -1 ); } break; @@ -2467,7 +2467,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( fCtrl ) { if ( gusSelectedSoldier != NOBODY ) - SwapMercPortraits( MercPtrs[ gusSelectedSoldier ], 1 ); + SwapMercPortraits( gusSelectedSoldier, 1 ); } break; @@ -2498,10 +2498,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // Lalien: commented out, to fix "end move & LOS bug" (same button has two different actions) // if ( gusSelectedSoldier != NOBODY ) // { - // if ( CheckForMercContMove( MercPtrs[ gusSelectedSoldier ] ) ) + // if ( CheckForMercContMove( gusSelectedSoldier ) ) // { // // Continue - // ContinueMercMovement( MercPtrs[ gusSelectedSoldier ] ); + // ContinueMercMovement( gusSelectedSoldier ); // ErasePath( TRUE ); // } // } @@ -2521,7 +2521,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel if ( ( gpItemPointer == NULL ) ) { - GotoHeigherStance( MercPtrs[ gusSelectedSoldier ] ); + GotoHeigherStance( gusSelectedSoldier ); } } } @@ -2541,7 +2541,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel if ( ( gpItemPointer == NULL ) ) { - GotoLowerStance( MercPtrs[ gusSelectedSoldier ] ); + GotoLowerStance( gusSelectedSoldier ); } } } @@ -2921,7 +2921,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( gusSelectedSoldier != NOBODY ) { - HandleTacticalFunctionSelection(MercPtrs[ gusSelectedSoldier ], usMapPos ); + HandleTacticalFunctionSelection(gusSelectedSoldier, usMapPos ); } } else if ( fAlt ) @@ -2994,8 +2994,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if (CHEATER_CHEAT_LEVEL()) { //ChangeSoldiersBodyType( TANK_NW, TRUE ); - // MercPtrs[ gusSelectedSoldier ]->flags.uiStatusFlags |= SOLDIER_CREATURE; - //EVENT_InitNewSoldierAnim( MercPtrs[ gusSelectedSoldier ], CRIPPLE_BEG, 0 , TRUE ); + // gusSelectedSoldier->flags.uiStatusFlags |= SOLDIER_CREATURE; + //EVENT_InitNewSoldierAnim( gusSelectedSoldier, CRIPPLE_BEG, 0 , TRUE ); } } else if( fAlt ) @@ -3034,12 +3034,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if (CHEATER_CHEAT_LEVEL()) { - MercPtrs[gusSelectedSoldier]->EVENT_InitNewSoldierAnim(KID_SKIPPING, 0, TRUE); + gusSelectedSoldier->EVENT_InitNewSoldierAnim(KID_SKIPPING, 0, TRUE); //ChangeSoldiersBodyType( LARVAE_MONSTER, TRUE ); - //MercPtrs[ gusSelectedSoldier ]->usAttackingWeapon = TANK_CANNON; + //gusSelectedSoldier->usAttackingWeapon = TANK_CANNON; //LocateSoldier( gusSelectedSoldier, FALSE ); - //EVENT_FireSoldierWeapon( MercPtrs[ gusSelectedSoldier ], sMapPos ); + //EVENT_FireSoldierWeapon( gusSelectedSoldier, sMapPos ); } } else if( fAlt ) @@ -3510,7 +3510,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; if ( pSoldier->aiData.bOppCnt > 0 ) { @@ -3529,7 +3529,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) //CHRISL: drop all items if ( gusSelectedSoldier != NOBODY && !(gTacticalStatus.fEnemyInSector) ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE *pSoldier = gusSelectedSoldier; for(int i = BODYPOSFINAL; iinv[i].exists() == true) @@ -3593,12 +3593,12 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) { //Display the range to the target - DisplayRangeToTarget( MercPtrs[gusSelectedSoldier], MercPtrs[gusUIFullTargetID]->sGridNo ); + DisplayRangeToTarget( gusSelectedSoldier, MercPtrs[gusUIFullTargetID]->sGridNo ); } else { //Display the range to the target - DisplayRangeToTarget( MercPtrs[gusSelectedSoldier], usGridNo ); + DisplayRangeToTarget( gusSelectedSoldier, usGridNo ); } } @@ -4022,7 +4022,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) //CHRISL: Swap gunsling if ( gusSelectedSoldier != NOBODY ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE *pSoldier = gusSelectedSoldier; if ( fAlt ) // switch to knife, or from knife to gun @@ -4324,7 +4324,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( CHEATER_CHEAT_LEVEL( ) ) { - ReloadWeapon( MercPtrs[ gusSelectedSoldier ], MercPtrs[ gusSelectedSoldier ]->ubAttackingHand ); + ReloadWeapon( gusSelectedSoldier, gusSelectedSoldier->ubAttackingHand ); } else HandleTBReload(); @@ -4355,7 +4355,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( fAlt ) { - RemoveCharacterFromSquads( MercPtrs[gusSelectedSoldier] ); + RemoveCharacterFromSquads( gusSelectedSoldier ); } else if ( !fDisableMapInterfaceDueToBattle && !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && !is_networked ) { @@ -4475,7 +4475,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) else if ( fAlt && fShift ) { //resort Team by ubID - SortSquadByID(MercPtrs[gusSelectedSoldier]->bTeam); + SortSquadByID(gusSelectedSoldier->bTeam); } else { @@ -4597,7 +4597,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { if ( gusSelectedSoldier != NOBODY ) { - CreateItem( FLAMETHROWER, 100, &( MercPtrs[ gusSelectedSoldier ]->inv[ HANDPOS ]) ); + CreateItem( FLAMETHROWER, 100, &( gusSelectedSoldier->inv[ HANDPOS ]) ); } } } @@ -4642,7 +4642,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) //Check if we have a good selected guy if ( gusSelectedSoldier != NOBODY ) { - pSoldier1 = MercPtrs[ gusSelectedSoldier ]; + pSoldier1 = gusSelectedSoldier; BOOLEAN fFoundGoodTarget = FALSE; if ( gfUIFullTargetFound ) @@ -4879,7 +4879,7 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) } else if( gfLoneEPCAttemptingTraversal ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, pExitingSectorHelpText[ EXIT_GUI_ESCORTED_CHARACTERS_CANT_LEAVE_SECTOR_ALONE_STR ], MercPtrs[ gusSelectedSoldier ]->GetName() ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, pExitingSectorHelpText[ EXIT_GUI_ESCORTED_CHARACTERS_CANT_LEAVE_SECTOR_ALONE_STR ], gusSelectedSoldier->GetName() ); gfLoneEPCAttemptingTraversal = FALSE; } else if( gubLoneMercAttemptingToAbandonEPCs ) @@ -4887,26 +4887,26 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) CHAR16 str[256]; if( gubLoneMercAttemptingToAbandonEPCs == 1 ) { //Use the singular version of the string - if( gMercProfiles[ MercPtrs[ gusSelectedSoldier ]->ubProfile ].bSex == MALE ) + if( gMercProfiles[ gusSelectedSoldier->ubProfile ].bSex == MALE ) { //male singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->GetName(), + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], gusSelectedSoldier->GetName(), MercPtrs[ gbPotentiallyAbandonedEPCSlotID ]->GetName() ); } else { //female singular - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], MercPtrs[ gusSelectedSoldier ]->GetName(), + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], gusSelectedSoldier->GetName(), MercPtrs[ gbPotentiallyAbandonedEPCSlotID ]->GetName() ); } } else { //Use the plural version of the string - if( gMercProfiles[ MercPtrs[ gusSelectedSoldier ]->ubProfile ].bSex == MALE ) + if( gMercProfiles[ gusSelectedSoldier->ubProfile ].bSex == MALE ) { //male plural - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_PLURAL ], MercPtrs[ gusSelectedSoldier ]->GetName() ); + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_PLURAL ], gusSelectedSoldier->GetName() ); } else { //female plural - swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_PLURAL ], MercPtrs[ gusSelectedSoldier ]->GetName() ); + swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_PLURAL ], gusSelectedSoldier->GetName() ); } } ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, str ); @@ -4918,7 +4918,7 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) } else { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ MERC_IS_TOO_FAR_AWAY_STR ], MercPtrs[ gusSelectedSoldier ]->GetName() ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ MERC_IS_TOO_FAR_AWAY_STR ], gusSelectedSoldier->GetName() ); } return( TRUE ); @@ -5148,7 +5148,7 @@ void CycleSelectedMercsItem() if( gusSelectedSoldier != NOBODY ) { // Get soldier... - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; UINT16 usOldHandItem = pSoldier->inv[HANDPOS].usItem; @@ -5377,7 +5377,7 @@ void SetBurstMode() { if ( gusSelectedSoldier != NOBODY ) { - ChangeWeaponMode( MercPtrs[ gusSelectedSoldier ] ); + ChangeWeaponMode( gusSelectedSoldier ); } } @@ -5386,12 +5386,12 @@ void SetScopeMode( INT32 usMapPos ) if ( gusSelectedSoldier != NOBODY ) { if ( GetMouseMapPos( &usMapPos )) - ChangeScopeMode( MercPtrs[ gusSelectedSoldier ], usMapPos ); + ChangeScopeMode( gusSelectedSoldier, usMapPos ); else - ChangeScopeMode( MercPtrs[ gusSelectedSoldier ], NOWHERE ); + ChangeScopeMode( gusSelectedSoldier, NOWHERE ); // reevaluate sight - ManLooksForOtherTeams( MercPtrs[ gusSelectedSoldier ] ); + ManLooksForOtherTeams( gusSelectedSoldier ); } } #pragma optimize("", off) @@ -6115,14 +6115,14 @@ INT8 HandleMoveModeInteractiveClick( INT32 usMapPos, UINT32 *puiNewEvent ) if ( fContinue ) { - sActionGridNo = FindAdjacentGridEx( MercPtrs[ gusSelectedSoldier ], sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); + sActionGridNo = FindAdjacentGridEx( gusSelectedSoldier, sIntTileGridNo, &ubDirection, NULL, FALSE, TRUE ); if ( sActionGridNo == -1 ) { sActionGridNo = sIntTileGridNo; } // If this is not the same tile as ours, check if we can get to dest! - if ( sActionGridNo != MercPtrs[ gusSelectedSoldier ]->sGridNo && gsCurrentActionPoints == 0 ) + if ( sActionGridNo != gusSelectedSoldier->sGridNo && gsCurrentActionPoints == 0 ) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, TacticalStr[ NO_PATH ] ); bReturnCode = -1; @@ -6403,7 +6403,7 @@ void HandleStanceChangeFromUIKeys( UINT8 ubAnimHeight ) { if( gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; // silversurfer: If we decide to stand up or press "s" again while we are standing we should reset movement to walk mode. // If we want to run we have to press "r" which is handled elsewhere. if ( ubAnimHeight == ANIM_STAND ) @@ -6508,9 +6508,9 @@ void HandleStealthChangeFromUIKeys( ) { if( gusSelectedSoldier != NOBODY ) { - if ( !AM_A_ROBOT( MercPtrs[ gusSelectedSoldier ] ) ) + if ( !AM_A_ROBOT( gusSelectedSoldier ) ) { - ToggleStealthMode( MercPtrs[ gusSelectedSoldier ] ); + ToggleStealthMode( gusSelectedSoldier ); } } } @@ -7475,12 +7475,12 @@ void HandleMouseTBWheel( void ) //change stance ->DOWN if ( _KeyDown( ALT ) ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoLowerStance(MercPtrs[ gusSelectedSoldier ]); + GotoLowerStance(gusSelectedSoldier); return; } if ( gusSelectedSoldier != NOBODY ) { - bID = FindPrevActiveAndAliveMerc( MercPtrs[ gusSelectedSoldier ], TRUE, TRUE ); + bID = FindPrevActiveAndAliveMerc( gusSelectedSoldier, TRUE, TRUE ); HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); ErasePath(TRUE); gfPlotNewMovement = TRUE; @@ -7494,14 +7494,14 @@ void HandleMouseTBWheel( void ) //change stance ->UP if ( _KeyDown( ALT ) ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoHeigherStance( MercPtrs[ gusSelectedSoldier ] ); + GotoHeigherStance( gusSelectedSoldier ); return; } //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"wheel %d", gViewportRegion.WheelState); if ( gusSelectedSoldier != NOBODY ) { //Select next merc - bID = FindNextMercInTeamPanel( MercPtrs[ gusSelectedSoldier ], FALSE, FALSE ); + bID = FindNextMercInTeamPanel( gusSelectedSoldier, FALSE, FALSE ); HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); ErasePath(TRUE); gfPlotNewMovement = TRUE; @@ -7546,7 +7546,7 @@ void HandleMouseTBX1Button( UINT32 *puiNewEvent ) void HandleMouseTBX2Button( UINT32 *puiNewEvent ) { if ( _KeyDown( ALT ) ) - AutoReload( MercPtrs[ gusSelectedSoldier ] ); + AutoReload( gusSelectedSoldier ); else HandleTBToggleStealthAll(); } @@ -7761,7 +7761,7 @@ void HandleTBCycleThroughVisibleEnemies( void ) if ( gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; if ( pSoldier->aiData.bOppCnt > 0 ) { @@ -7780,7 +7780,7 @@ void HandleTBCycleThroughVisibleEnemiesBackward( void ) if ( gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; if ( pSoldier->aiData.bOppCnt > 0 ) { @@ -7808,9 +7808,9 @@ void HandleTBChangeLevel( void ) void HandleTBSwapHands( void ) { // swap primary & secondary hand - if ( gusSelectedSoldier != NOBODY && !AM_A_ROBOT( MercPtrs[ gusSelectedSoldier ] )) + if ( gusSelectedSoldier != NOBODY && !AM_A_ROBOT( gusSelectedSoldier )) { - SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE *pSoldier = gusSelectedSoldier; UINT16 usOldHandItem = pSoldier->inv[HANDPOS].usItem; SwapHandItems( pSoldier ); pSoldier->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, pSoldier->inv[HANDPOS].usItem ); @@ -7825,7 +7825,7 @@ void HandleTBSwapGunsling( void ) if ( gusSelectedSoldier != NOBODY && UsingNewInventorySystem() == true) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; pSoldier->SwitchWeapons( ); } } @@ -7833,7 +7833,7 @@ void HandleTBSwapKnife( void ) { if ( gusSelectedSoldier != NOBODY && UsingNewInventorySystem() == true) { - SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE *pSoldier = gusSelectedSoldier; pSoldier->SwitchWeapons( TRUE ); } } @@ -7841,7 +7841,7 @@ void HandleTBSwapSidearm( void ) { if ( gusSelectedSoldier != NOBODY && UsingNewInventorySystem() == true) { - SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE *pSoldier = gusSelectedSoldier; pSoldier->SwitchWeapons( FALSE, TRUE ); } } @@ -7941,7 +7941,7 @@ void HandleTBToggleStealth( void ) } void HandleTBReload( void ) { - AutoReload( MercPtrs[ gusSelectedSoldier ] ); + AutoReload( gusSelectedSoldier ); } void HandleTBReloadAll( void ) { @@ -8242,19 +8242,19 @@ void HandleTBToggleTrapNetworkView( void ) void HandleTBGotoHigherStance( void ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoHeigherStance(MercPtrs[ gusSelectedSoldier ]); + GotoHeigherStance(gusSelectedSoldier); } void HandleTBGotoLowerStance( void ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoLowerStance( MercPtrs[ gusSelectedSoldier ] ); + GotoLowerStance( gusSelectedSoldier ); } void HandleTBLocateNextMerc( void ) { UINT16 bID; if ( gusSelectedSoldier != NOBODY ) { //Select next merc - bID = FindNextMercInTeamPanel( MercPtrs[ gusSelectedSoldier ], FALSE, FALSE ); + bID = FindNextMercInTeamPanel( gusSelectedSoldier, FALSE, FALSE ); HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); // Center to guy.... LocateSoldier( gusSelectedSoldier, SETLOCATOR ); @@ -8265,7 +8265,7 @@ void HandleTBLocatePrevMerc( void ) UINT16 bID; if ( gusSelectedSoldier != NOBODY ) { - bID = FindPrevActiveAndAliveMerc( MercPtrs[ gusSelectedSoldier ], TRUE, TRUE ); + bID = FindPrevActiveAndAliveMerc( gusSelectedSoldier, TRUE, TRUE ); HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); // Center to guy.... LocateSoldier( gusSelectedSoldier, SETLOCATOR ); @@ -8338,7 +8338,7 @@ void HandleTBDropBackpacks( void ) //if( UsingNewInventorySystem() && gusSelectedSoldier != NOBODY ) if( UsingNewInventorySystem() ) { - //SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + //SOLDIERTYPE *pSoldier = gusSelectedSoldier; SOLDIERTYPE *pTeamSoldier; UINT16 ubLoop; @@ -8376,7 +8376,7 @@ void HandleTBPickUpBackpacks( void ) //if( UsingNewInventorySystem() && gusSelectedSoldier != NOBODY ) if( UsingNewInventorySystem() ) { - //SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + //SOLDIERTYPE *pSoldier = gusSelectedSoldier; SOLDIERTYPE *pTeamSoldier; UINT16 ubLoop; @@ -8411,7 +8411,7 @@ void HandleTBPickUpBackpacks( void ) void HandleTBSoldierRun( void ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gusSelectedSoldier ]; + SOLDIERTYPE *pSoldier = gusSelectedSoldier; if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER ) ) { pSoldier = GetSoldierStructureForVehicle( pSoldier->iVehicleId ); @@ -8861,7 +8861,7 @@ void HandleTacticalStoreInvItem( void ) UINT16 APTotalCost = 0; if( gusSelectedSoldier != NOBODY ) - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; else return; @@ -8934,7 +8934,7 @@ void HandleTacticalTakeInvItem( INT32 iType ) } if( gusSelectedSoldier != NOBODY ) - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; else return; @@ -9044,7 +9044,7 @@ void HandleTacticalDropItem( UINT8 ubSlot ) UINT16 APTotalCost = 0; if( gusSelectedSoldier != NOBODY ) - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; else return; @@ -9069,7 +9069,7 @@ void HandleTacticalTakeItem( void ) SOLDIERTYPE *pSoldier; if( gusSelectedSoldier != NOBODY ) - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; else return; @@ -9108,7 +9108,7 @@ void HandleTacticalReload() INT16 bAPs = 0; if (gusSelectedSoldier != NOBODY) - pSoldier = MercPtrs[gusSelectedSoldier]; + pSoldier = gusSelectedSoldier; else return; @@ -9579,10 +9579,10 @@ void HandleTBSkillsMenu(void) { TraitsMenu(usMapPos); } - else if (gusSelectedSoldier != NOBODY && MercPtrs[gusSelectedSoldier] && !TileIsOutOfBounds(MercPtrs[gusSelectedSoldier]->sGridNo)) + else if (gusSelectedSoldier != NOBODY && gusSelectedSoldier && !TileIsOutOfBounds(gusSelectedSoldier->sGridNo)) { - LocateGridNo(MercPtrs[gusSelectedSoldier]->sGridNo); - TraitsMenu(MercPtrs[gusSelectedSoldier]->sGridNo); + LocateGridNo(gusSelectedSoldier->sGridNo); + TraitsMenu(gusSelectedSoldier->sGridNo); } } @@ -9606,7 +9606,7 @@ void HandleTBPickUpBackpacks(BOOLEAN fAll) if (gusSelectedSoldier != NOBODY) { - pSoldier = MercPtrs[gusSelectedSoldier]; + pSoldier = gusSelectedSoldier; } INT16 sAPCost = APBPConstants[AP_BACK_PACK]; diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 24c5614b..6cdd0e3d 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -364,7 +364,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos, BOOLEA // If we are in realtime, follow! if ( ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) ) { - if ( ( gAnimControl[ MercPtrs[ gusSelectedSoldier ]->usAnimState ].uiFlags & ANIM_STATIONARY ) ) + if ( ( gAnimControl[ gusSelectedSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) ) { if ( gUITargetShotWaiting ) { diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 3c68ee3a..39b72bfa 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -4642,16 +4642,16 @@ void DebugSoldierPage3( ) // OPIONION OF SELECTED MERC if ( gusSelectedSoldier != NOBODY && pSoldier->ubProfile != NO_PROFILE && ( - gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_AIM || - gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_MERC || - gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_RPC || - gMercProfiles[MercPtrs[gusSelectedSoldier]->ubProfile].Type == PROFILETYPE_IMP ) ) + gMercProfiles[gusSelectedSoldier->ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[gusSelectedSoldier->ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[gusSelectedSoldier->ubProfile].Type == PROFILETYPE_RPC || + gMercProfiles[gusSelectedSoldier->ubProfile].Type == PROFILETYPE_IMP ) ) { SetFontShade(LARGEFONT1, FONT_SHADE_GREEN); gprintf( 0, LINE_HEIGHT * ubLine, L"NPC Opinion:"); SetFontShade(LARGEFONT1, FONT_SHADE_NEUTRAL); - if (OKToCheckOpinion(MercPtrs[ gusSelectedSoldier ]->ubProfile)) - gprintf( 150, LINE_HEIGHT * ubLine, L"%d", gMercProfiles[ pSoldier->ubProfile ].bMercOpinion[ MercPtrs[ gusSelectedSoldier ]->ubProfile ] ); + if (OKToCheckOpinion(gusSelectedSoldier->ubProfile)) + gprintf( 150, LINE_HEIGHT * ubLine, L"%d", gMercProfiles[ pSoldier->ubProfile ].bMercOpinion[ gusSelectedSoldier->ubProfile ] ); ubLine++; } } diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 2c467f85..6d3c28b2 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -4387,7 +4387,7 @@ void HandleExplosionWarningAnimations( ) // show focus area if skill is active if ( gusSelectedSoldier != NOBODY ) { - SOLDIERTYPE* pSoldier = MercPtrs[gusSelectedSoldier]; + SOLDIERTYPE* pSoldier = gusSelectedSoldier; if ( pSoldier->bActive && pSoldier->bInSector) { @@ -5620,10 +5620,8 @@ void FireFragmentsTrapGun( SOLDIERTYPE* pThrower, INT32 gridno, INT16 sZ, OBJECT void HavePersonAtGridnoStop( UINT32 sGridNo ) { - UINT8 ubID; - //Sewe if there is a person at the gridno - ubID = WhoIsThere2( sGridNo, 0 ); + SoldierID ubID = WhoIsThere2( sGridNo, 0 ); //is it a valid person if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) ) @@ -5813,8 +5811,7 @@ void HandleSwitchToOpenFortifiedDoor( UINT32 sGridNo ) void HandleSeeingPowerGenFan( UINT32 sGridNo ) { -// INT8 bID; - UINT8 ubPerson; + SoldierID ubPerson; BOOLEAN fFanIsStopped; BOOLEAN fFanHasBeenStopped; SOLDIERTYPE *pSoldier; diff --git a/TileEngine/Interactive Tiles.cpp b/TileEngine/Interactive Tiles.cpp index 550df2ae..e8216082 100644 --- a/TileEngine/Interactive Tiles.cpp +++ b/TileEngine/Interactive Tiles.cpp @@ -505,7 +505,7 @@ void LogMouseOverInteractiveTile( INT32 sGridNo ) } // Also, don't allow for mercs who are on upper level... - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->pathing.bLevel == 1 ) + if ( gusSelectedSoldier != NOBODY && gusSelectedSoldier->pathing.bLevel == 1 ) { return; } @@ -789,7 +789,7 @@ BOOLEAN RefineLogicOnStruct( INT32 sGridNo, LEVELNODE *pNode ) return( FALSE ); } - if ( gusSelectedSoldier != NOBODY && MercPtrs[ gusSelectedSoldier ]->ubBodyType == ROBOTNOWEAPON ) + if ( gusSelectedSoldier != NOBODY && gusSelectedSoldier->ubBodyType == ROBOTNOWEAPON ) { return( FALSE ); } diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index e3c2dcae..9db3faca 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -567,7 +567,7 @@ void HandleOverheadMap( ) if( !gfEditMode && !gfTacticalPlacementGUIActive && gusSelectedSoldier != NOBODY ) { - pSoldier = MercPtrs[ gusSelectedSoldier ]; + pSoldier = gusSelectedSoldier; DisplayMercNameInOverhead( pSoldier ); } diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index 85eb7bd9..2a93d397 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -1069,7 +1069,7 @@ inline UINT16 * GetShadeTable(LEVELNODE * pNode, SOLDIERTYPE * pSoldier, SOLDIER SOLDIERTYPE * pSelSoldier; if (gusSelectedSoldier != NOBODY) { - pSelSoldier = MercPtrs[gusSelectedSoldier]; + pSelSoldier = gusSelectedSoldier; } else { @@ -1149,7 +1149,7 @@ inline UINT16 * GetShadeTable(LEVELNODE * pNode, SOLDIERTYPE * pSoldier, SOLDIER } //if ( gusSelectedSoldier != NOBODY ) //{ - // pSelSoldier = MercPtrs[ gusSelectedSoldier ]; + // pSelSoldier = gusSelectedSoldier; // Shade differently depending on visiblity // if ( pSoldier->bVisible == 0 || ( pSelSoldier->aiData.bOppList[ pSoldier->ubID ] == 0 ) ) // { diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 628a35e3..6265f093 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -3291,7 +3291,7 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor // CHECK IF OUR SELECTED GUY IS GONE! if(gusSelectedSoldier != NOBODY) { - if(MercPtrs[gusSelectedSoldier]->bActive == FALSE) + if(gusSelectedSoldier->bActive == FALSE) gusSelectedSoldier = NOBODY; } AdjustSoldierCreationStartValues(); From 83b3485e5819001ba31f3648f6168fdeb3370f91 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:04:05 +0200 Subject: [PATCH 066/571] Convert prisonerdialoguetargetID to SoldierID --- Tactical/Overhead.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 5a67e3c3..ea6775cc 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -10918,7 +10918,7 @@ void HandleDisplayingOfPlayerLostDialogue( ) } #endif -static UINT16 prisonerdialoguetargetID = NOBODY; +static SoldierID prisonerdialoguetargetID = NOBODY; void TurnCoatAttemptMessageBoxCallBack( UINT8 ubExitValue ) { @@ -10928,7 +10928,7 @@ void TurnCoatAttemptMessageBoxCallBack( UINT8 ubExitValue ) || gusSelectedSoldier == NOBODY ) return; - SOLDIERTYPE* pSoldier = MercPtrs[prisonerdialoguetargetID]; + SOLDIERTYPE* pSoldier = prisonerdialoguetargetID; if ( !pSoldier ) return; @@ -11162,7 +11162,7 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) if ( ubExitValue == 1 ) { - SOLDIERTYPE *pSoldierToSurrender = MercPtrs[prisonerdialoguetargetID]; + SOLDIERTYPE *pSoldierToSurrender = prisonerdialoguetargetID; DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); if ( !gGameExternalOptions.fEnemyCanSurrender ) @@ -11312,9 +11312,9 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) { DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); - if ( !gGameExternalOptions.fPlayerCanAsktoSurrender || MercPtrs[prisonerdialoguetargetID]->bTeam == CREATURE_TEAM ) + if ( !gGameExternalOptions.fPlayerCanAsktoSurrender || prisonerdialoguetargetID->bTeam == CREATURE_TEAM ) { - StartCivQuote( MercPtrs[prisonerdialoguetargetID] ); + StartCivQuote( prisonerdialoguetargetID ); return; } @@ -11329,23 +11329,23 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) // This way we can easily order our spies to 'distract' enemies if ( GetSoldier( &pSoldier, gusSelectedSoldier ) && pSoldier->bTeam == gbPlayerNum && - MercPtrs[prisonerdialoguetargetID] && - MercPtrs[prisonerdialoguetargetID]->bTeam == ENEMY_TEAM && - MercPtrs[prisonerdialoguetargetID]->ubProfile == NO_PROFILE && - MercPtrs[prisonerdialoguetargetID]->aiData.bAlertStatus < STATUS_RED && - !MercPtrs[prisonerdialoguetargetID]->RecognizeAsCombatant( gusSelectedSoldier ) ) + prisonerdialoguetargetID && + prisonerdialoguetargetID->bTeam == ENEMY_TEAM && + prisonerdialoguetargetID->ubProfile == NO_PROFILE && + prisonerdialoguetargetID->aiData.bAlertStatus < STATUS_RED && + !prisonerdialoguetargetID->RecognizeAsCombatant( gusSelectedSoldier ) ) { // both soldiers face each other - pSoldier->EVENT_SetSoldierDesiredDirection( GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, MercPtrs[prisonerdialoguetargetID]->sGridNo ) ); - MercPtrs[prisonerdialoguetargetID]->EVENT_SetSoldierDesiredDirection( GetDirectionToGridNoFromGridNo( MercPtrs[prisonerdialoguetargetID]->sGridNo, pSoldier->sGridNo ) ); + pSoldier->EVENT_SetSoldierDesiredDirection( GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, prisonerdialoguetargetID->sGridNo ) ); + prisonerdialoguetargetID->EVENT_SetSoldierDesiredDirection( GetDirectionToGridNoFromGridNo( prisonerdialoguetargetID->sGridNo, pSoldier->sGridNo ) ); - MercPtrs[prisonerdialoguetargetID]->usChatPartnerID = gusSelectedSoldier; + prisonerdialoguetargetID->usChatPartnerID = gusSelectedSoldier; pSoldier->usChatPartnerID = prisonerdialoguetargetID; } else { // normal dialog - StartCivQuote( MercPtrs[prisonerdialoguetargetID] ); + StartCivQuote( prisonerdialoguetargetID ); } } else @@ -11354,21 +11354,21 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) if (gSkillTraitValues.fCOTurncoats == TRUE && GetSoldier( &pSoldier, gusSelectedSoldier ) && pSoldier->bTeam == gbPlayerNum && - MercPtrs[prisonerdialoguetargetID] && - MercPtrs[prisonerdialoguetargetID]->bTeam == ENEMY_TEAM && - MercPtrs[prisonerdialoguetargetID]->ubProfile == NO_PROFILE && - MercPtrs[prisonerdialoguetargetID]->aiData.bAlertStatus < STATUS_RED && - !MercPtrs[prisonerdialoguetargetID]->RecognizeAsCombatant( gusSelectedSoldier ) ) + prisonerdialoguetargetID && + prisonerdialoguetargetID->bTeam == ENEMY_TEAM && + prisonerdialoguetargetID->ubProfile == NO_PROFILE && + prisonerdialoguetargetID->aiData.bAlertStatus < STATUS_RED && + !prisonerdialoguetargetID->RecognizeAsCombatant( gusSelectedSoldier ) ) { MSYS_RemoveRegion(&(gMsgBox.BackRegion)); - pSoldier->UseSkill(SKILLS_CREATE_TURNCOAT, MercPtrs[prisonerdialoguetargetID]->sGridNo, MercPtrs[prisonerdialoguetargetID]->ubID); + pSoldier->UseSkill(SKILLS_CREATE_TURNCOAT, prisonerdialoguetargetID->sGridNo, prisonerdialoguetargetID->ubID); // AP reduction is handled inside the turncoat attempt flow (TurnCoatAttemptMessageBoxCallBack) } else { // normal dialog DeductPoints( gusSelectedSoldier, APBPConstants[AP_TALK], 0, UNTRIGGERED_INTERRUPT ); - StartCivQuote(MercPtrs[prisonerdialoguetargetID]); + StartCivQuote(prisonerdialoguetargetID); } } From ecb29ae9bc80b774ea43508bf715c66c061282f1 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:09:17 +0200 Subject: [PATCH 067/571] Convert SOLDIERTYPE->usChatPartnerID to SoldierID --- Tactical/Overhead.cpp | 4 ++-- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Control.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index ea6775cc..3d10915f 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -11397,7 +11397,7 @@ void CheckChatPartners() if ( fMercQuoteThisTime ) GetSoldierScreenPos( pSoldier, &sScreenX, &sScreenY ); else - GetSoldierScreenPos( MercPtrs[pSoldier->usChatPartnerID], &sScreenX, &sScreenY ); + GetSoldierScreenPos( pSoldier->usChatPartnerID, &sScreenX, &sScreenY ); if ( gsVIEWPORT_START_X <= sScreenX && gsVIEWPORT_END_X >= sScreenX && @@ -11407,7 +11407,7 @@ void CheckChatPartners() if ( fMercQuoteThisTime ) BeginChatQuote( pSoldier, sScreenX, sScreenY ); else - BeginChatQuote( MercPtrs[pSoldier->usChatPartnerID], sScreenX, sScreenY ); + BeginChatQuote( pSoldier->usChatPartnerID, sScreenX, sScreenY ); fMercQuoteThisTime = !fMercQuoteThisTime; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 595994bb..78ba39b6 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -21010,7 +21010,7 @@ void SOLDIERTYPE::StopChatting() { if ( this->usChatPartnerID != NOBODY ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[DISTRACT_STOP_STR], this->GetName(), MercPtrs[this->usChatPartnerID]->GetName() ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[DISTRACT_STOP_STR], this->GetName(), this->usChatPartnerID->GetName() ); MercPtrs[this->usChatPartnerID]->usChatPartnerID = NOBODY; this->usChatPartnerID = NOBODY; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 81dc88bc..d28bb698 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1550,7 +1550,7 @@ public: //INT16 bUnusedINT16_4; INT16 sDragCorpseID; // Flugente: id of corpse we are dragging - UINT16 usChatPartnerID; // Flugente: the id of another merc we are 'chatting' with + SoldierID usChatPartnerID; // Flugente: the id of another merc we are 'chatting' with // Flugente: new variables for extra stats INT16 bExtraStrength; // additional strength gained via power armor From 9079f2e0c1a1522060f3ec7bdc9a25a0373a97a4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 21:20:49 +0200 Subject: [PATCH 068/571] Whitespace changes to SOLDIERTYPE --- Tactical/Soldier Control.h | 662 ++++++++++++++++++------------------- 1 file changed, 325 insertions(+), 337 deletions(-) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index d28bb698..70a032d7 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1103,452 +1103,440 @@ public: // properly until it is all fixed and the files updated. public: // ID - SoldierID ubID; - CHAR16 name[ 10 ]; + SoldierID ubID; + CHAR16 name[ 10 ]; INT16 GetMaxDistanceVisible(INT32 sGridNo = -1, INT8 bLevel = -1, int calcAsType = -1); // DESCRIPTION / STATS, ETC - UINT8 ubBodyType; - INT16 bActionPoints; //100AP - INT16 bInitialActionPoints; //100AP - INT8 bOldLife; // life at end of last turn, recorded for monster AI - INT8 bVisible; // to render or not to render... - INT8 bActive; - INT8 bTeam; // Team identifier + UINT8 ubBodyType; + INT16 bActionPoints; //100AP + INT16 bInitialActionPoints; //100AP + INT8 bOldLife; // life at end of last turn, recorded for monster AI + INT8 bVisible; // to render or not to render... + INT8 bActive; + INT8 bTeam; // Team identifier - OBJECTTYPE *pTempObject; - KEY_ON_RING *pKeyRing; + OBJECTTYPE *pTempObject; + KEY_ON_RING *pKeyRing; - UINT8 bInSector; - INT8 bFlashPortraitFrame; - INT16 sFractLife; // fraction of life pts (in hundreths) - INT8 bBleeding; // blood loss control variable - INT8 bBreath; // current breath value - INT8 bBreathMax; // max breath, affected by fatigue/sleep - INT8 bStealthMode; - INT16 sBreathRed; // current breath loss value + UINT8 bInSector; + INT8 bFlashPortraitFrame; + INT16 sFractLife; // fraction of life pts (in hundreths) + INT8 bBleeding; // blood loss control variable + INT8 bBreath; // current breath value + INT8 bBreathMax; // max breath, affected by fatigue/sleep + INT8 bStealthMode; + INT16 sBreathRed; // current breath loss value - UINT8 ubWaitActionToDo; - INT8 ubInsertionDirection; - INT8 bGunType; - UINT16 ubOppNum; - INT8 bLastRenderVisibleValue; - UINT8 ubAttackingHand; - INT16 sWeightCarriedAtTurnStart; + UINT8 ubWaitActionToDo; + INT8 ubInsertionDirection; + INT8 bGunType; + UINT16 ubOppNum; + INT8 bLastRenderVisibleValue; + UINT8 ubAttackingHand; + INT16 sWeightCarriedAtTurnStart; ///////////////////////////////////////////////////////////////////////////////// // SANDRO - added following // values for surgery feature - INT32 iHealableInjury; - BOOLEAN fDoingSurgery; + INT32 iHealableInjury; + BOOLEAN fDoingSurgery; // value for unregainable breath feature (for Martial Arts) - signed long lUnregainableBreath; + signed long lUnregainableBreath; // this stores possible stats lost due to critical hits - UINT8 ubCriticalStatDamage[ NUM_DAMAGABLE_STATS ]; + UINT8 ubCriticalStatDamage[ NUM_DAMAGABLE_STATS ]; ///////////////////////////////////////////////////////////////////////////////// //NEW MOVEMENT INFORMATION for Strategic Movement - UINT8 ubGroupID; //the movement group the merc is currently part of. - //sSectorX and sSectorY will reflect the sector the - //merc was at last. + UINT8 ubGroupID; // The movement group the merc is currently part of. + // sSectorX and sSectorY will reflect the sector the + // merc was at last. - UINT8 ubMovementNoiseHeard;// 8 flags by direction + UINT8 ubMovementNoiseHeard;// 8 flags by direction // WORLD POSITION STUFF - FLOAT dXPos; - FLOAT dYPos; + FLOAT dXPos; + FLOAT dYPos; // HEADROCK HAM 4: These two vars are appropriated for the new Shooting Mechanism. // They represent the soldier's position at the start of his turn. - //FLOAT dOldXPos; - //FLOAT dOldYPos; - INT16 sOldXPos; - INT16 sOldYPos; - INT32 sInitialGridNo; - INT32 sGridNo; - UINT8 ubDirection; - INT16 sHeightAdjustment; - INT16 sDesiredHeight; - INT32 sTempNewGridNo; // New grid no for advanced animations - INT16 sRoomNo; - INT8 bOverTerrainType; - INT8 bOldOverTerrainType; + //FLOAT dOldXPos; + //FLOAT dOldYPos; + INT16 sOldXPos; + INT16 sOldYPos; + INT32 sInitialGridNo; + INT32 sGridNo; + UINT8 ubDirection; + INT16 sHeightAdjustment; + INT16 sDesiredHeight; + INT32 sTempNewGridNo; // New grid no for advanced animations + INT16 sRoomNo; + INT8 bOverTerrainType; + INT8 bOldOverTerrainType; - INT8 bCollapsed; // collapsed due to being out of APs - INT8 bBreathCollapsed; // collapsed due to being out of APs + INT8 bCollapsed; // collapsed due to being out of APs + INT8 bBreathCollapsed; // collapsed due to being out of APs - - UINT8 ubDesiredHeight; - UINT16 usPendingAnimation; - UINT8 ubPendingStanceChange; - UINT16 usAnimState; + UINT8 ubDesiredHeight; + UINT16 usPendingAnimation; + UINT8 ubPendingStanceChange; + UINT16 usAnimState; + UINT32 uiAIDelay; + INT16 sReloadDelay; + UINT16 ubAttackerID; + UINT16 ubPreviousAttackerID; - - - UINT32 uiAIDelay; - INT16 sReloadDelay; - UINT16 ubAttackerID; - UINT16 ubPreviousAttackerID; - - INT32 sInsertionGridNo; + INT32 sInsertionGridNo; AnimationSurfaceCacheType AnimCache; // will be 9 bytes once changed to pointers - UINT8 bSide; - UINT8 bViewRange; - INT8 bNewOppCnt; - INT8 bService; // first aid, or other time consuming process + UINT8 bSide; + UINT8 bViewRange; + INT8 bNewOppCnt; + INT8 bService; // first aid, or other time consuming process - UINT16 usAniCode; - UINT16 usAniFrame; - INT16 sAniDelay; + UINT16 usAniCode; + UINT16 usAniFrame; + INT16 sAniDelay; // MOVEMENT TO NEXT TILE HANDLING STUFF - UINT8 ubDelayedMovementCauseMerc; - INT32 sDelayedMovementCauseGridNo; - INT32 sReservedMovementGridNo; + UINT8 ubDelayedMovementCauseMerc; + INT32 sDelayedMovementCauseGridNo; + INT32 sReservedMovementGridNo; // Weapon Stuff - INT32 sTargetGridNo; - INT8 bTargetLevel; - INT8 bTargetCubeLevel; - INT32 sLastTarget; + INT32 sTargetGridNo; + INT8 bTargetLevel; + INT8 bTargetCubeLevel; + INT32 sLastTarget; // HEADROCK HAM 4: the muzzle offset of the shooter's previous bullet. (NCTH) - FLOAT dPrevMuzzleOffsetX[2]; - FLOAT dPrevMuzzleOffsetY[2]; + FLOAT dPrevMuzzleOffsetX[2]; + FLOAT dPrevMuzzleOffsetY[2]; // HEADROCK HAM 4: Two more values. These record the shooter's previous Counter Force applied on the gun. - FLOAT dPrevCounterForceX[2]; - FLOAT dPrevCounterForceY[2]; + FLOAT dPrevCounterForceX[2]; + FLOAT dPrevCounterForceY[2]; // CHRISL: Track initial offsets for autofire - FLOAT dInitialMuzzleOffsetX; - FLOAT dInitialMuzzleOffsetY; + FLOAT dInitialMuzzleOffsetX; + FLOAT dInitialMuzzleOffsetY; - INT8 bTilesMoved; - FLOAT dNextBleed; + INT8 bTilesMoved; + FLOAT dNextBleed; - UINT8 ubTilesMovedPerRTBreathUpdate; - UINT16 usLastMovementAnimPerRTBreathUpdate; + UINT8 ubTilesMovedPerRTBreathUpdate; + UINT16 usLastMovementAnimPerRTBreathUpdate; - INT16 sLocatorFrame; + INT16 sLocatorFrame; - INT32 iFaceIndex; + INT32 iFaceIndex; // FULL 3-d TILE STUFF ( keep records of three tiles infront ) - UINT16 usFrontArcFullTileList[ MAX_FULLTILE_DIRECTIONS ]; - INT32 usFrontArcFullTileGridNos[ MAX_FULLTILE_DIRECTIONS ]; + UINT16 usFrontArcFullTileList[ MAX_FULLTILE_DIRECTIONS ]; + INT32 usFrontArcFullTileGridNos[ MAX_FULLTILE_DIRECTIONS ]; // PALETTE MANAGEMENT STUFF - PaletteRepID HeadPal; // 30 - PaletteRepID PantsPal; // 30 - PaletteRepID VestPal; // 30 - PaletteRepID SkinPal; // 30 - PaletteRepID MiscPal; // 30 - - - - - SGPPaletteEntry *p8BPPPalette; // 4 - UINT16 *p16BPPPalette; - UINT16 *pShades[ NUM_SOLDIER_SHADES ]; // Shading tables - UINT16 *pGlowShades[ 20 ]; // - UINT16 *pCurrentShade; - UINT8 ubFadeLevel; - UINT8 ubServiceCount; - UINT16 ubServicePartner; - THROW_PARAMS *pThrowParams; - INT8 bReverse; - LEVELNODE *pLevelNode; - LEVELNODE *pExternShadowLevelNode; - LEVELNODE *pRoofUILevelNode; - + PaletteRepID HeadPal; // 30 + PaletteRepID PantsPal; // 30 + PaletteRepID VestPal; // 30 + PaletteRepID SkinPal; // 30 + PaletteRepID MiscPal; // 30 + SGPPaletteEntry *p8BPPPalette; // 4 + UINT16 *p16BPPPalette; + UINT16 *pShades[ NUM_SOLDIER_SHADES ]; // Shading tables + UINT16 *pGlowShades[ 20 ]; // + UINT16 *pCurrentShade; + UINT8 ubFadeLevel; + UINT8 ubServiceCount; + UINT16 ubServicePartner; + THROW_PARAMS *pThrowParams; + INT8 bReverse; + LEVELNODE *pLevelNode; + LEVELNODE *pExternShadowLevelNode; + LEVELNODE *pRoofUILevelNode; // UNBLIT BACKGROUND - UINT16 *pBackGround; - UINT16 *pZBackground; - UINT16 usUnblitX, usUnblitY; - UINT16 usUnblitWidth, usUnblitHeight; + UINT16 *pBackGround; + UINT16 *pZBackground; + UINT16 usUnblitX, usUnblitY; + UINT16 usUnblitWidth, usUnblitHeight; - UINT8 ubStrategicInsertionCode; - INT32 usStrategicInsertionData; + UINT8 ubStrategicInsertionCode; + INT32 usStrategicInsertionData; - INT32 iLight; - INT32 iMuzFlash; - INT8 bMuzFlashCount; + INT32 iLight; + INT32 iMuzFlash; + INT8 bMuzFlashCount; - INT16 sX; - INT16 sY; + INT16 sX; + INT16 sY; - UINT16 usOldAniState; - INT16 sOldAniCode; + UINT16 usOldAniState; + INT16 sOldAniCode; - INT8 bBulletsLeft; - UINT8 ubSuppressionPoints; + INT8 bBulletsLeft; + UINT8 ubSuppressionPoints; // STUFF FOR RANDOM ANIMATIONS - UINT32 uiTimeOfLastRandomAction; - INT16 usLastRandomAnim; + UINT32 uiTimeOfLastRandomAction; + INT16 usLastRandomAnim; + UINT16 usAnimSurface; + UINT16 sZLevel; - UINT16 usAnimSurface; - UINT16 sZLevel; - - INT16 sWalkToAttackMovementMode;//shadooow: stores movement mode used in last pathing - INT32 sWalkToAttackGridNo; - INT16 sWalkToAttackWalkToCost; + INT16 sWalkToAttackMovementMode;//shadooow: stores movement mode used in last pathing + INT32 sWalkToAttackGridNo; + INT16 sWalkToAttackWalkToCost; - INT16 sLocatorOffX; - INT16 sLocatorOffY; - UINT16 *pForcedShade; + INT16 sLocatorOffX; + INT16 sLocatorOffY; + UINT16 *pForcedShade; - INT8 bDisplayDamageCount; - UINT8 sWalkToAttackEndDirection;//shadooow: stores direction of merc at the destination grid - INT16 sDamage; - INT16 sDamageX; - INT16 sDamageY; - INT8 bDamageDir; - INT8 bDoBurst; - INT16 usUIMovementMode; - INT8 bUIInterfaceLevel; + INT8 bDisplayDamageCount; + UINT8 sWalkToAttackEndDirection;//shadooow: stores direction of merc at the destination grid + INT16 sDamage; + INT16 sDamageX; + INT16 sDamageY; + INT8 bDamageDir; + INT8 bDoBurst; + INT16 usUIMovementMode; + INT8 bUIInterfaceLevel; - UINT8 ubProfile; - UINT8 ubQuoteRecord; - UINT8 ubQuoteActionID; - UINT8 ubBattleSoundID; + UINT8 ubProfile; + UINT8 ubQuoteRecord; + UINT8 ubQuoteActionID; + UINT8 ubBattleSoundID; - UINT8 ubClosePanelFrame; - UINT8 ubDeadPanelFrame; - INT8 bOpenPanelFrame; + UINT8 ubClosePanelFrame; + UINT8 ubDeadPanelFrame; + INT8 bOpenPanelFrame; - INT16 sPanelFaceX; - INT16 sPanelFaceY; + INT16 sPanelFaceX; + INT16 sPanelFaceY; // QUOTE STUFF - INT8 bNumHitsThisTurn; - UINT16 usQuoteSaidFlags; - INT8 bLastSkillCheck; - INT8 ubSkillCheckAttempts; + INT8 bNumHitsThisTurn; + UINT16 usQuoteSaidFlags; + INT8 bLastSkillCheck; + INT8 ubSkillCheckAttempts; - INT8 bVocalVolume; // verbal sounds need to differ in volume + INT8 bVocalVolume; // verbal sounds need to differ in volume - INT8 bStartFallDir; + INT8 bStartFallDir; - UINT8 ubPendingDirection; - UINT32 uiAnimSubFlags; + UINT8 ubPendingDirection; + UINT32 uiAnimSubFlags; - UINT8 bAimShotLocation; - UINT8 ubHitLocation; - UINT8 bAimMeleeLocation; + UINT8 bAimShotLocation; + UINT8 ubHitLocation; + UINT8 bAimMeleeLocation; - UINT16 *pEffectShades[ NUM_SOLDIER_EFFECTSHADES ]; // Shading tables for effects + UINT16 *pEffectShades[ NUM_SOLDIER_EFFECTSHADES ]; // Shading tables for effects - UINT8 ubPlannedUIAPCost; - INT16 sPlannedTargetX; - INT16 sPlannedTargetY; + UINT8 ubPlannedUIAPCost; + INT16 sPlannedTargetX; + INT16 sPlannedTargetY; - INT32 sSpreadLocations[ MAX_BURST_SPREAD_TARGETS ]; - INT32 sStartGridNo; - INT32 sEndGridNo; - INT32 sForcastGridno; - INT16 sZLevelOverride; - INT8 bMovedPriorToInterrupt; - INT32 iEndofContractTime; // time, in global time(resolution, minutes) that merc will leave, or if its a M.E.R.C. merc it will be set to -1. -2 for NPC and player generated - INT32 iStartContractTime; - INT32 iTotalContractLength; // total time of AIM mercs contract or the time since last paid for a M.E.R.C. merc - INT32 iNextActionSpecialData; // AI special action data record for the next action - UINT8 ubWhatKindOfMercAmI; //Set to the type of character it is - INT8 bAssignment; // soldiers current assignment - INT8 bOldAssignment; // old assignment, for autosleep purposes - INT8 bTrainStat; // current stat soldier is training - INT16 sSectorX; // X position on the Stategic Map - INT16 sSectorY; // Y position on the Stategic Map - INT8 bSectorZ; // Z sector location - INT32 iVehicleId; // the id of the vehicle the char is in - PathStPtr pMercPath; //Path Structure - UINT16 usMedicalDeposit; // is there a medical deposit on merc - UINT16 usLifeInsurance; // is there life insurance taken out on merc + INT32 sSpreadLocations[ MAX_BURST_SPREAD_TARGETS ]; + INT32 sStartGridNo; + INT32 sEndGridNo; + INT32 sForcastGridno; + INT16 sZLevelOverride; + INT8 bMovedPriorToInterrupt; + INT32 iEndofContractTime; // time, in global time(resolution, minutes) that merc will leave, or if its a M.E.R.C. merc it will be set to -1. -2 for NPC and player generated + INT32 iStartContractTime; + INT32 iTotalContractLength; // total time of AIM mercs contract or the time since last paid for a M.E.R.C. merc + INT32 iNextActionSpecialData; // AI special action data record for the next action + UINT8 ubWhatKindOfMercAmI; //Set to the type of character it is + INT8 bAssignment; // soldiers current assignment + INT8 bOldAssignment; // old assignment, for autosleep purposes + INT8 bTrainStat; // current stat soldier is training + INT16 sSectorX; // X position on the Stategic Map + INT16 sSectorY; // Y position on the Stategic Map + INT8 bSectorZ; // Z sector location + INT32 iVehicleId; // the id of the vehicle the char is in + PathStPtr pMercPath; //Path Structure + UINT16 usMedicalDeposit; // is there a medical deposit on merc + UINT16 usLifeInsurance; // is there life insurance taken out on merc //DEF: Used for the communications - UINT32 uiStartMovementTime; // the time since the merc first started moving - UINT32 uiOptimumMovementTime; // everytime in ececute overhead the time for the current ani will be added to this total - UINT32 usLastUpdateTime ; // The last time the soldier was in ExecuteOverhead + UINT32 uiStartMovementTime; // the time since the merc first started moving + UINT32 uiOptimumMovementTime; // everytime in ececute overhead the time for the current ani will be added to this total + UINT32 usLastUpdateTime ; // The last time the soldier was in ExecuteOverhead - UINT32 uiSoldierUpdateNumber; - BYTE ubSoldierUpdateType; - INT32 sScheduledStop; //hayden, used for scheduling a grid to stop + UINT32 uiSoldierUpdateNumber; + BYTE ubSoldierUpdateType; + INT32 sScheduledStop; //hayden, used for scheduling a grid to stop //END - INT32 iStartOfInsuranceContract; - UINT32 uiLastAssignmentChangeMin; // timestamp of last assignment change in minutes - INT32 iTotalLengthOfInsuranceContract; + INT32 iStartOfInsuranceContract; + UINT32 uiLastAssignmentChangeMin; // timestamp of last assignment change in minutes + INT32 iTotalLengthOfInsuranceContract; - UINT8 ubSoldierClass; //admin, elite, troop (creature types?) Nav: 2 seems to mean elite, 3 troop so admin is 1 - UINT8 ubAPsLostToSuppression; - UINT16 ubSuppressorID; + UINT8 ubSoldierClass; //admin, elite, troop (creature types?) Nav: 2 seems to mean elite, 3 troop so admin is 1 + UINT8 ubAPsLostToSuppression; + UINT16 ubSuppressorID; //Squad merging vars - UINT8 ubDesiredSquadAssignment; - UINT8 ubNumTraversalsAllowedToMerge; + UINT8 ubDesiredSquadAssignment; + UINT8 ubNumTraversalsAllowedToMerge; - UINT16 usPendingAnimation2; - UINT8 ubCivilianGroup; + UINT16 usPendingAnimation2; + UINT8 ubCivilianGroup; - UINT32 uiUniqueSoldierIdValue; // the unique value every instance of a soldier gets - 1 is the first valid value + UINT32 uiUniqueSoldierIdValue; // the unique value every instance of a soldier gets - 1 is the first valid value - INT8 bEndDoorOpenCode; + INT8 bEndDoorOpenCode; - UINT8 ubScheduleID; - INT32 sEndDoorOpenCodeData;//dnl ch53 121009 - INT8 bBlockedByAnotherMercDirection; - UINT16 usAttackingWeapon; - INT8 bWeaponMode; - UINT16 ubTargetID; - INT8 bAIScheduleProgress; - INT32 sOffWorldGridNo; - struct TAG_anitile *pAniTile; - INT8 bCamo; - INT32 sAbsoluteFinalDestination; - UINT8 ubHiResDirection; - UINT8 ubHiResDesiredDirection; - UINT8 ubLastFootPrintSound; - INT8 bVehicleID; - INT8 bMovementDirection; - INT32 sOldGridNo; - UINT16 usDontUpdateNewGridNoOnMoveAnimChange; - INT16 sBoundingBoxWidth; - INT16 sBoundingBoxHeight; - INT16 sBoundingBoxOffsetX; - INT16 sBoundingBoxOffsetY; - UINT32 uiTimeSameBattleSndDone; - INT8 bOldBattleSnd; - INT32 iBurstSoundID; - INT8 bSlotItemTakenFrom; - UINT16 ubAutoBandagingMedic; - UINT16 ubRobotRemoteHolderID; - UINT32 uiTimeOfLastContractUpdate; - INT8 bTypeOfLastContract; - INT8 bTurnsCollapsed; - INT8 bSleepDrugCounter; - UINT8 ubMilitiaKills; + UINT8 ubScheduleID; + INT32 sEndDoorOpenCodeData;//dnl ch53 121009 + INT8 bBlockedByAnotherMercDirection; + UINT16 usAttackingWeapon; + INT8 bWeaponMode; + UINT16 ubTargetID; + INT8 bAIScheduleProgress; + INT32 sOffWorldGridNo; + struct TAG_anitile *pAniTile; + INT8 bCamo; + INT32 sAbsoluteFinalDestination; + UINT8 ubHiResDirection; + UINT8 ubHiResDesiredDirection; + UINT8 ubLastFootPrintSound; + INT8 bVehicleID; + INT8 bMovementDirection; + INT32 sOldGridNo; + UINT16 usDontUpdateNewGridNoOnMoveAnimChange; + INT16 sBoundingBoxWidth; + INT16 sBoundingBoxHeight; + INT16 sBoundingBoxOffsetX; + INT16 sBoundingBoxOffsetY; + UINT32 uiTimeSameBattleSndDone; + INT8 bOldBattleSnd; + INT32 iBurstSoundID; + INT8 bSlotItemTakenFrom; + UINT16 ubAutoBandagingMedic; + UINT16 ubRobotRemoteHolderID; + UINT32 uiTimeOfLastContractUpdate; + INT8 bTypeOfLastContract; + INT8 bTurnsCollapsed; + INT8 bSleepDrugCounter; + UINT8 ubMilitiaKills; - INT8 bBlindedCounter; + INT8 bBlindedCounter; - UINT8 ubHoursOnAssignment; // used for assignments handled only every X hours + UINT8 ubHoursOnAssignment; // used for assignments handled only every X hours - UINT8 ubMercJustFired; // the merc was just fired..there may be dialogue events occuring, this flag will prevent any interaction with contracts - // until after the merc leaves - UINT8 ubTurnsUntilCanSayHeardNoise; - UINT16 usQuoteSaidExtFlags; + UINT8 ubMercJustFired; // the merc was just fired..there may be dialogue events occuring, this flag will prevent any interaction with contracts + // until after the merc leaves + UINT8 ubTurnsUntilCanSayHeardNoise; + UINT16 usQuoteSaidExtFlags; - INT32 sContPathLocation;//dnl ch53 was UINT16 - INT8 bGoodContPath; - UINT8 ubPendingActionInterrupted; - INT8 bNoiseLevel; - INT8 bRegenerationCounter; // Flugente: not used anymore! - INT8 bRegenBoostersUsedToday; // Flugente: not used anymore! - INT8 bNumPelletsHitBy; - INT32 sSkillCheckGridNo; - UINT16 ubLastEnemyCycledID; + INT32 sContPathLocation;//dnl ch53 was UINT16 + INT8 bGoodContPath; + UINT8 ubPendingActionInterrupted; + INT8 bNoiseLevel; + INT8 bRegenerationCounter; // Flugente: not used anymore! + INT8 bRegenBoostersUsedToday; // Flugente: not used anymore! + INT8 bNumPelletsHitBy; + INT32 sSkillCheckGridNo; + UINT16 ubLastEnemyCycledID; - UINT8 ubPrevSectorID; - UINT8 ubNumTilesMovesSinceLastForget; - INT8 bTurningIncrement; - UINT32 uiBattleSoundID; + UINT8 ubPrevSectorID; + UINT8 ubNumTilesMovesSinceLastForget; + INT8 bTurningIncrement; + UINT32 uiBattleSoundID; - UINT16 usValueGoneUp; + UINT16 usValueGoneUp; - UINT8 ubNumLocateCycles; - UINT8 ubDelayedMovementFlags; - UINT16 ubCTGTTargetID; + UINT8 ubNumLocateCycles; + UINT8 ubDelayedMovementFlags; + UINT16 ubCTGTTargetID; - UINT32 uiMercChecksum; + UINT32 uiMercChecksum; - INT8 bCurrentCivQuote; - INT8 bCurrentCivQuoteDelta; - UINT8 ubMiscSoldierFlags; - UINT8 ubReasonCantFinishMove; + INT8 bCurrentCivQuote; + INT8 bCurrentCivQuoteDelta; + UINT8 ubMiscSoldierFlags; + UINT8 ubReasonCantFinishMove; - INT32 sLocationOfFadeStart; - UINT8 bUseExitGridForReentryDirection; + INT32 sLocationOfFadeStart; + UINT8 bUseExitGridForReentryDirection; - UINT32 uiTimeSinceLastSpoke; - UINT8 ubContractRenewalQuoteCode; - INT32 sPreTraversalGridNo; - UINT32 uiXRayActivatedTime; - INT8 bTurningFromUI; - INT8 bPendingActionData5; + UINT32 uiTimeSinceLastSpoke; + UINT8 ubContractRenewalQuoteCode; + INT32 sPreTraversalGridNo; + UINT32 uiXRayActivatedTime; + INT8 bTurningFromUI; + INT8 bPendingActionData5; - INT8 bDelayedStrategicMoraleMod; - UINT8 ubDoorOpeningNoise; + INT8 bDelayedStrategicMoraleMod; + UINT8 ubDoorOpeningNoise; - struct GROUP *pGroup; - UINT8 ubLeaveHistoryCode; - INT8 bOverrideMoveSpeed; + struct GROUP *pGroup; + UINT8 ubLeaveHistoryCode; + INT8 bOverrideMoveSpeed; - UINT32 uiTimeSoldierWillArrive; + UINT32 uiTimeSoldierWillArrive; - INT8 bVehicleUnderRepairID; - INT32 iTimeCanSignElsewhere; - INT8 bHospitalPriceModifier; - UINT32 uiStartTimeOfInsuranceContract; - INT8 bCorpseQuoteTolerance; - INT8 bDeafenedCounter; - INT32 iPositionSndID; - INT32 iTuringSoundID; - UINT8 ubLastDamageReason; - INT32 sLastTwoLocations[2]; - INT32 uiTimeSinceLastBleedGrunt; - UINT16 ubNextToPreviousAttackerID; - UINT8 bDoAutofire; - INT8 numFlanks; - INT32 lastFlankSpot; - INT8 sniper; - INT16 origDir; - INT8 wornCamo; + INT8 bVehicleUnderRepairID; + INT32 iTimeCanSignElsewhere; + INT8 bHospitalPriceModifier; + UINT32 uiStartTimeOfInsuranceContract; + INT8 bCorpseQuoteTolerance; + INT8 bDeafenedCounter; + INT32 iPositionSndID; + INT32 iTuringSoundID; + UINT8 ubLastDamageReason; + INT32 sLastTwoLocations[2]; + INT32 uiTimeSinceLastBleedGrunt; + UINT16 ubNextToPreviousAttackerID; + UINT8 bDoAutofire; + INT8 numFlanks; + INT32 lastFlankSpot; + INT8 sniper; + INT16 origDir; - INT8 urbanCamo; // Madd: new camo types - INT8 wornUrbanCamo; - - INT8 desertCamo; - INT8 wornDesertCamo; - - INT8 snowCamo; - INT8 wornSnowCamo; + INT8 wornCamo; + INT8 urbanCamo; // Madd: new camo types + INT8 wornUrbanCamo; + INT8 desertCamo; + INT8 wornDesertCamo; + INT8 snowCamo; + INT8 wornSnowCamo; // HEADROCK HAM 3.6: Added integer tracking the facility this character is using. - INT16 sFacilityTypeOperated; + INT16 sFacilityTypeOperated; // HEADROCK HAM 3.6: I'm removing this filler to make room for the above variable. I'm very worried though, // I don't know if this is a good idea at all... //INT16 filler; // Flugente: Is this the correct position? - INT8 bScopeMode; + INT8 bScopeMode; /////////////////////////////////////////////////////// // Flugente: this was the location of required variables required for the now removed poison feature. They can be used again - UINT8 ubMilitiaAssists; // Flugente: stores militia assists - INT8 sNonNPCTraderID; // Flugente: we can set up non-NPC soldiers to be merchants, we store their dealer id here (value > 0 means arms dealer entry x) - //INT8 bUnusedINT8_3; - UINT16 usDragPersonID; // Flugente: id of person we are dragging + UINT8 ubMilitiaAssists; // Flugente: stores militia assists + INT8 sNonNPCTraderID; // Flugente: we can set up non-NPC soldiers to be merchants, we store their dealer id here (value > 0 means arms dealer entry x) + //INT8 bUnusedINT8_3; + UINT16 usDragPersonID; // Flugente: id of person we are dragging - //INT16 bUnusedINT16_4; - INT16 sDragCorpseID; // Flugente: id of corpse we are dragging + //INT16 bUnusedINT16_4; + INT16 sDragCorpseID; // Flugente: id of corpse we are dragging SoldierID usChatPartnerID; // Flugente: the id of another merc we are 'chatting' with @@ -1557,7 +1545,7 @@ public: INT16 bExtraDexterity; // additional dexterity gained via drugs INT16 bExtraAgility; // additional agility gained via drugs INT16 bExtraWisdom; // additional wisdom gained via drugs - INT8 bExtraExpLevel; // corruption can temporarily alter our ExpLevel without messing up our stats this way + INT8 bExtraExpLevel; // corruption can temporarily alter our ExpLevel without messing up our stats this way UINT32 usSoldierFlagMask; // for various soldier-related flags (Illusion, Kill streak, etc.). Easier than adding 32 bool variables @@ -1614,11 +1602,11 @@ public: #ifdef JA2UB //ja25 - BOOLEAN fIgnoreGetupFromCollapseCheck; - TIMECOUNTER GetupFromJA25StartCounter; - BOOLEAN fWaitingToGetupFromJA25Start; + BOOLEAN fIgnoreGetupFromCollapseCheck; + TIMECOUNTER GetupFromJA25StartCounter; + BOOLEAN fWaitingToGetupFromJA25Start; - UINT8 ubPercentDamageInflictedByTeam[NUM_ASSIST_SLOTS]; //The percent of damage inflicted by the player team. Each element corresponds to the Soldier ID. Each element contains the percent damage inflicted by that merc + UINT8 ubPercentDamageInflictedByTeam[NUM_ASSIST_SLOTS]; //The percent of damage inflicted by the player team. Each element corresponds to the Soldier ID. Each element contains the percent damage inflicted by that merc #endif char endOfPOD; // marker for end of POD (plain old data) @@ -1629,20 +1617,20 @@ public: // properly until it is all fixed and the files updated. Inventory inv; - AI::tactical::Plan* ai_masterplan_; // Interface object for ModularizedTacticalAI + AI::tactical::Plan* ai_masterplan_; // Interface object for ModularizedTacticalAI //data from version 101 wrapped into structs - STRUCT_AIData aiData; - STRUCT_Flags flags; - STRUCT_TimeChanges timeChanges; - STRUCT_TimeCounters timeCounters; - //STRUCT_Drugs drugs; // Flugente: drug values are now in newdrugs - DRUGS newdrugs; - STRUCT_Statistics stats; - STRUCT_Pathing pathing; + STRUCT_AIData aiData; + STRUCT_Flags flags; + STRUCT_TimeChanges timeChanges; + STRUCT_TimeCounters timeCounters; + //STRUCT_Drugs drugs; // Flugente: drug values are now in newdrugs + DRUGS newdrugs; + STRUCT_Statistics stats; + STRUCT_Pathing pathing; // Debugging data - not saved - INT32 sPlotSrcGrid; + INT32 sPlotSrcGrid; //std::vector CTH; // sevenfm: remember suppression points, shock from last attack From ee429fd1f4cae02c1fe7eabb4fedbb618429c7c6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:51:48 +0200 Subject: [PATCH 069/571] Convert SOLDIERTYPE->ubAttackerID to SoldierID --- Multiplayer/client.cpp | 8 ++++---- Strategic/Strategic Merc Handler.cpp | 4 ++-- Strategic/Strategic Town Loyalty.cpp | 8 ++++---- Tactical/Overhead.cpp | 22 +++++++++++----------- Tactical/Rotting Corpses.cpp | 4 ++-- Tactical/Soldier Ani.cpp | 16 ++++++++-------- Tactical/Soldier Control.cpp | 6 +++--- Tactical/Soldier Control.h | 2 +- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 637f6df4..b8507358 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -3844,9 +3844,9 @@ void send_death( SOLDIERTYPE *pSoldier ) if(pSoldier->ubID<20)nDeath.soldier_id=nDeath.soldier_id+ubID_prefix; // if soldier died from bleeding - if(pSoldier->ubAttackerID==NULL || pSoldier->ubAttackerID == NOBODY) + if(pSoldier->ubAttackerID >= NOBODY) { - if (pSoldier->ubPreviousAttackerID != NOBODY && pSoldier->ubPreviousAttackerID != NULL) + if (pSoldier->ubPreviousAttackerID < NOBODY) nDeath.attacker_id = pSoldier->ubPreviousAttackerID; else if (pSoldier->ubNextToPreviousAttackerID != NOBODY && pSoldier->ubNextToPreviousAttackerID != NULL) nDeath.attacker_id = pSoldier->ubNextToPreviousAttackerID; @@ -3871,8 +3871,8 @@ void send_death( SOLDIERTYPE *pSoldier ) pAttacker=MercPtrs[ pSoldier->ubNextToPreviousAttackerID ]; // if its still a friendly, use the original attacker id...for posterity // guy must snore too loudly if all his mates wanna kill him :) - if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubAttackerID != NULL && pSoldier->ubAttackerID != NOBODY) - pAttacker = MercPtrs[ pSoldier->ubAttackerID ]; + if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubAttackerID != NOBODY) + pAttacker = pSoldier->ubAttackerID; nDeath.attacker_id = pAttacker->ubID; } diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index b3a21464..e6cae0b5 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -85,7 +85,7 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ) //add to the history log the fact that the merc died and the circumstances if( pSoldier->ubAttackerID != NOBODY ) { - pKiller = MercPtrs[ pSoldier->ubAttackerID ]; + pKiller = pSoldier->ubAttackerID; } // CJC Nov 11, 2002 @@ -141,7 +141,7 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ) gMercProfiles[ pSoldier->ubProfile ].ubSuspiciousDeath = VERY_SUSPICIOUS_DEATH; } // if killed by someone on our team, or while there weren't any opponents around - else if (Menptr[ pSoldier->ubAttackerID ].bTeam == OUR_TEAM || !gTacticalStatus.fEnemyInSector ) + else if (pSoldier->ubAttackerID->bTeam == OUR_TEAM || !gTacticalStatus.fEnemyInSector ) { // cause insurance company to suspect fraud and investigate this claim gMercProfiles[ pSoldier->ubProfile ].ubSuspiciousDeath = SUSPICIOUS_DEATH; diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 579155ab..44fc5f1f 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -740,13 +740,13 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) } */ // set killer team - bKillerTeam = Menptr[ pSoldier->ubAttackerID ].bTeam; + bKillerTeam = pSoldier->ubAttackerID->bTeam; // if the player did the killing if( bKillerTeam == OUR_TEAM ) { - SOLDIERTYPE *pKiller = MercPtrs[ pSoldier->ubAttackerID ]; + SOLDIERTYPE *pKiller = pSoldier->ubAttackerID; // apply morale penalty for killing a civilian! HandleMoraleEvent( pKiller, MORALE_KILLED_CIVILIAN, pKiller->sSectorX, pKiller->sSectorY, pKiller->bSectorZ ); @@ -800,7 +800,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) } // killer seen by civ? - if ( SoldierToSoldierLineOfSightTest( pCivSoldier, MercPtrs[ pSoldier->ubAttackerID ], TRUE, gGameExternalOptions.ubStraightSightRange ) != 0 ) + if ( SoldierToSoldierLineOfSightTest( pCivSoldier, pSoldier->ubAttackerID, TRUE, gGameExternalOptions.ubStraightSightRange ) != 0 ) { bSeenState |= 1; } @@ -908,7 +908,7 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) case CREATURE_TEAM: // killed by a monster - make sure it was one - if( ( Menptr[ pSoldier->ubAttackerID ].ubBodyType >= ADULTFEMALEMONSTER ) && ( Menptr[ pSoldier->ubAttackerID ].ubBodyType <= QUEENMONSTER ) ) + if( ( pSoldier->ubAttackerID->ubBodyType >= ADULTFEMALEMONSTER ) && ( pSoldier->ubAttackerID->ubBodyType <= QUEENMONSTER ) ) { // increase for the extreme horror of being killed by a monster iLoyaltyChange *= MULTIPLIER_FOR_MURDER_BY_MONSTER; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 3d10915f..f729d931 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -3796,7 +3796,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) { if ( pSoldierOld->ubAttackerID != NOBODY ) { - pKiller = MercPtrs[ pSoldierOld->ubAttackerID ]; + pKiller = pSoldierOld->ubAttackerID; } if( pKiller && pKiller->bTeam == OUR_TEAM ) { @@ -4016,7 +4016,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) { if ( pSoldierOld->ubAttackerID != NOBODY ) { - pKiller = MercPtrs[ pSoldierOld->ubAttackerID ]; + pKiller = pSoldierOld->ubAttackerID; } BeginHandleDeidrannaDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->pathing.bLevel ); @@ -4088,7 +4088,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) // If the militia's killer is known // silversurfer: did the player team kill the militia? If not, militia shouldn't become hostile towards the player. - if ( pSoldierOld->ubAttackerID != NOBODY && MercPtrs[ pSoldierOld->ubAttackerID ]->bTeam == OUR_TEAM ) + if ( pSoldierOld->ubAttackerID != NOBODY && pSoldierOld->ubAttackerID->bTeam == OUR_TEAM ) { // also treat this as murder - but player will never be blamed for militia death he didn't cause // HEADROCK HAM 3.6: Actually this function never runs for militia (see function for details) @@ -4118,7 +4118,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) if ( pSoldierOld->ubAttackerID != NOBODY ) { - pKiller = MercPtrs[ pSoldierOld->ubAttackerID ]; + pKiller = pSoldierOld->ubAttackerID; BeginHandleQueenBitchDeath( pKiller, pSoldierOld->sGridNo, pSoldierOld->pathing.bLevel ); } @@ -4130,9 +4130,9 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) TrackEnemiesKilled( ENEMY_KILLED_IN_TACTICAL, pSoldierOld->ubSoldierClass ); } // If enemy guy was killed by the player, give morale boost to player's team! - if (pSoldierOld->ubAttackerID != NOBODY && MercPtrs[ pSoldierOld->ubAttackerID ]->bTeam == gbPlayerNum ) + if (pSoldierOld->ubAttackerID != NOBODY && pSoldierOld->ubAttackerID->bTeam == gbPlayerNum ) { - HandleMoraleEvent( MercPtrs[pSoldierOld->ubAttackerID], MORALE_KILLED_ENEMY, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); + HandleMoraleEvent( pSoldierOld->ubAttackerID, MORALE_KILLED_ENEMY, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); } HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_ENEMY_KILLED, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); @@ -4176,7 +4176,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) UINT16 ubAssister = NOBODY; // if it was a kill by a player's merc - if (pSoldierOld->ubAttackerID != NOBODY && MercPtrs[ pSoldierOld->ubAttackerID ]->bTeam == gbPlayerNum ) + if (pSoldierOld->ubAttackerID != NOBODY && pSoldierOld->ubAttackerID->bTeam == gbPlayerNum ) { // SANDRO - for special NPCs, you gain more experiences UINT16 usNumExpChances = ( 10 * pSoldierOld->stats.bExpLevel ); // basic value @@ -4207,7 +4207,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) break; } // EXPERIENCE CLASS GAIN: Earned a kill - StatChange( MercPtrs[ pSoldierOld->ubAttackerID ], EXPERAMT, usNumExpChances, FALSE ); + StatChange( pSoldierOld->ubAttackerID, EXPERAMT, usNumExpChances, FALSE ); } // JA2 Gold: if previous and current attackers are the same, the next-to-previous attacker gets the assist @@ -4229,9 +4229,9 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) } } - if (pSoldierOld->ubAttackerID != NOBODY && MercPtrs[ pSoldierOld->ubAttackerID ]->bTeam == MILITIA_TEAM ) + if (pSoldierOld->ubAttackerID != NOBODY && pSoldierOld->ubAttackerID->bTeam == MILITIA_TEAM ) { - MercPtrs[pSoldierOld->ubAttackerID]->ubMilitiaAssists++; + pSoldierOld->ubAttackerID->ubMilitiaAssists++; } //if the NPC is a dealer, add the dealers items to the ground @@ -4567,7 +4567,7 @@ UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked ) // if in LOS of this guy's attacker if ( (pAttacked->ubAttackerID != NOBODY && pSoldier->aiData.bOppList[pAttacked->ubAttackerID] == SEEN_CURRENTLY) || ( PythSpacesAway( pSoldier->sGridNo, pAttacked->sGridNo ) < pAttacked->GetMaxDistanceVisible(pSoldier->sGridNo, pSoldier->pathing.bLevel) ) - || ( pAttacked->ubAttackerID != NOBODY && PythSpacesAway( pSoldier->sGridNo, MercPtrs[ pAttacked->ubAttackerID ]->sGridNo ) < pAttacked->GetMaxDistanceVisible(MercPtrs[ pAttacked->ubAttackerID ]->sGridNo, MercPtrs[ pAttacked->ubAttackerID ]->pathing.bLevel) ) ) + || ( pAttacked->ubAttackerID != NOBODY && PythSpacesAway( pSoldier->sGridNo, pAttacked->ubAttackerID->sGridNo ) < pAttacked->GetMaxDistanceVisible(pAttacked->ubAttackerID->sGridNo, pAttacked->ubAttackerID->pathing.bLevel) ) ) { MakeCivHostile(pSoldier); if ( pSoldier->aiData.bOppCnt > 0 ) diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index cee4fe75..b5346fb6 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1022,7 +1022,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE // HEADROCK HAM B2.8: Now also reveals equipment dropped by militia, if requirement is met. if( pSoldier->bTeam == ENEMY_TEAM || ( gGameExternalOptions.ubMilitiaDropEquipment == 2 && pSoldier->bTeam == MILITIA_TEAM ) || - ( gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && Menptr[ pSoldier->ubAttackerID ].bTeam != OUR_TEAM )) + ( gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && pSoldier->ubAttackerID->bTeam != OUR_TEAM )) { //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; @@ -1054,7 +1054,7 @@ BOOLEAN TurnSoldierIntoCorpse( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveMerc, BOOLE // HEADROCK HAM B2.8: Militia will drop items only if allowed. if (!(gGameExternalOptions.ubMilitiaDropEquipment == 0 && pSoldier->bTeam == MILITIA_TEAM ) && - !(gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && Menptr[ pSoldier->ubAttackerID ].bTeam == OUR_TEAM )) + !(gGameExternalOptions.ubMilitiaDropEquipment == 1 && pSoldier->bTeam == MILITIA_TEAM && pSoldier->ubAttackerID->bTeam == OUR_TEAM )) { AddItemToPool( pSoldier->sGridNo, pObj, bVisible , pSoldier->pathing.bLevel, usItemFlags, -1 ); } diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 1b86246b..92cf3377 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -3932,7 +3932,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) SOLDIERTYPE *pKillerSoldier = NULL; if(pSoldier->ubAttackerID != NOBODY) { - pKillerSoldier = MercPtrs[pSoldier->ubAttackerID]; + pKillerSoldier = pSoldier->ubAttackerID; } else if(pSoldier->ubPreviousAttackerID != NOBODY) { @@ -3995,8 +3995,8 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) { ////////////////////////////////////////////////////////////// // SANDRO - some changes here - UINT16 ubAttacker = pSoldier->ubAttackerID; - UINT16 ubAssister = pSoldier->ubPreviousAttackerID; + SoldierID ubAttacker = pSoldier->ubAttackerID; + SoldierID ubAssister = pSoldier->ubPreviousAttackerID; // If attacker is nobody, and we died, then set the last attacker(if exists) as our killer if ( ubAttacker == NOBODY ) { @@ -4024,9 +4024,9 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) { // anv: note that ubAttacker can be already different from pSoldier->ubAttackerID // IF this guy has an attacker and he's a good guy, play sound - if ( pSoldier->ubAttackerID != NOBODY ) + if ( pSoldier->ubAttackerID < NOBODY ) { - if ( MercPtrs[ pSoldier->ubAttackerID ] != NULL && MercPtrs[ pSoldier->ubAttackerID ]->bTeam == gbPlayerNum && gTacticalStatus.ubAttackBusyCount > 0 ) + if ( pSoldier->ubAttackerID->bTeam == gbPlayerNum && gTacticalStatus.ubAttackBusyCount > 0 ) { gTacticalStatus.fKilledEnemyOnAttack = TRUE; gTacticalStatus.ubEnemyKilledOnAttack = pSoldier->ubID; @@ -4110,7 +4110,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) } break; } - //gMercProfiles[ MercPtrs[ pSoldier->ubAttackerID ]->ubProfile ].usKills++; + //gMercProfiles[ pSoldier->ubAttackerID->ubProfile ].usKills++; ///////////////////////////////////////////////////////////////////////////////////// gStrategicStatus.usPlayerKills++; @@ -4456,7 +4456,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) // SANDRO - if Martial Artist took someone down, always fall back if possible (for the fun) if ( pSoldier->ubAttackerID != NOBODY && gGameOptions.fNewTraitSystem ) { - if ( HAS_SKILL_TRAIT( MercPtrs[ pSoldier->ubAttackerID ], MARTIAL_ARTS_NT ) && (!MercPtrs[ pSoldier->ubAttackerID ]->usAttackingWeapon || ItemIsBrassKnuckles(MercPtrs[ pSoldier->ubAttackerID ]->inv[HANDPOS].usItem)) ) + if ( HAS_SKILL_TRAIT( pSoldier->ubAttackerID, MARTIAL_ARTS_NT ) && (!pSoldier->ubAttackerID->usAttackingWeapon || ItemIsBrassKnuckles(pSoldier->ubAttackerID->inv[HANDPOS].usItem)) ) { fAlwaysFallBack = TRUE; } @@ -4468,7 +4468,7 @@ void CheckForAndHandleSoldierIncompacitated( SOLDIERTYPE *pSoldier ) if ( pSoldier->ubAttackerID != NOBODY ) { // Find direction! - bTestDirection = (INT8)GetDirectionFromGridNo( MercPtrs[ pSoldier->ubAttackerID ]->sGridNo, pSoldier ); + bTestDirection = (INT8)GetDirectionFromGridNo( pSoldier->ubAttackerID->sGridNo, pSoldier ); fForceDirection = TRUE; } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 78ba39b6..bb011c63 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -5732,9 +5732,9 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // handle morale for heavy damage attacks if ( sDamage > 25 ) { - if ( this->ubAttackerID != NOBODY && MercPtrs[this->ubAttackerID]->bTeam == gbPlayerNum ) + if ( this->ubAttackerID != NOBODY && this->ubAttackerID->bTeam == gbPlayerNum ) { - HandleMoraleEvent( MercPtrs[this->ubAttackerID], MORALE_DID_LOTS_OF_DAMAGE, MercPtrs[this->ubAttackerID]->sSectorX, MercPtrs[this->ubAttackerID]->sSectorY, MercPtrs[this->ubAttackerID]->bSectorZ ); + HandleMoraleEvent( this->ubAttackerID, MORALE_DID_LOTS_OF_DAMAGE, this->ubAttackerID->sSectorX, this->ubAttackerID->sSectorY, this->ubAttackerID->bSectorZ ); this->ubLastMoraleFromHit++; } if ( this->bTeam == gbPlayerNum ) @@ -10475,7 +10475,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr sTestOne = EffectiveStrength( this, FALSE ); sTestTwo = 2 * max(sLifeDeduct, (sBreathLoss / 100)); - if (this->ubAttackerID != NOBODY && MercPtrs[this->ubAttackerID]->ubBodyType == BLOODCAT) + if (this->ubAttackerID != NOBODY && this->ubAttackerID->ubBodyType == BLOODCAT) { // bloodcat boost, let them make people drop items more sTestTwo += 20; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 70a032d7..c092c3c2 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1187,8 +1187,8 @@ public: UINT32 uiAIDelay; INT16 sReloadDelay; - UINT16 ubAttackerID; UINT16 ubPreviousAttackerID; + SoldierID ubAttackerID; INT32 sInsertionGridNo; From 131172e41a2a43915ad69d6fcabe9db827c41a2b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:54:44 +0200 Subject: [PATCH 070/571] Convert SOLDIERTYPE->ubPreviousAttackerID to SoldierID --- Multiplayer/client.cpp | 4 ++-- Tactical/Dialogue Control.cpp | 4 ++-- Tactical/Soldier Ani.cpp | 2 +- Tactical/Soldier Control.h | 2 +- Tactical/SoldierTooltips.cpp | 6 +++--- TacticalAI/Attacks.cpp | 30 ++++++++++++------------------ 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index b8507358..b1100d17 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -3863,9 +3863,9 @@ void send_death( SOLDIERTYPE *pSoldier ) if(pAttacker) { // if attacker was one of our own mercs, use the last hostile attacker as the killer if there is one - if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubPreviousAttackerID != NULL && pSoldier->ubPreviousAttackerID != NOBODY) + if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubPreviousAttackerID < NOBODY) { - pAttacker=MercPtrs[ pSoldier->ubPreviousAttackerID ]; + pAttacker = pSoldier->ubPreviousAttackerID; // check if the new attacker was also a friendly... if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubNextToPreviousAttackerID != NULL && pSoldier->ubNextToPreviousAttackerID != NOBODY) pAttacker=MercPtrs[ pSoldier->ubNextToPreviousAttackerID ]; diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index cc8c8e67..4a2fc253 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -3117,8 +3117,8 @@ void HandleDialogueEnd( FACETYPE *pFace ) case QUOTE_CLOSE_CALL: case QUOTE_UNDER_HEAVY_FIRE: case QUOTE_TAKEN_A_BREATING: - if( pSoldier->ubPreviousAttackerID != NOBODY && !( MercPtrs[pSoldier->ubPreviousAttackerID]->bDeafenedCounter > 0 ) ) - PossiblyStartEnemyTaunt( MercPtrs[pSoldier->ubPreviousAttackerID], TAUNT_RIPOSTE, gTacticalStatus.ubLastQuoteProfileNUm ); + if( pSoldier->ubPreviousAttackerID != NOBODY && !( pSoldier->ubPreviousAttackerID->bDeafenedCounter > 0 ) ) + PossiblyStartEnemyTaunt( pSoldier->ubPreviousAttackerID, TAUNT_RIPOSTE, gTacticalStatus.ubLastQuoteProfileNUm ); break; default: // select random enemy, who we see, who sees us and isn't deaf diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 92cf3377..8f1e6191 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -3936,7 +3936,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) } else if(pSoldier->ubPreviousAttackerID != NOBODY) { - pKillerSoldier = MercPtrs[pSoldier->ubPreviousAttackerID]; + pKillerSoldier = pSoldier->ubPreviousAttackerID; } if(pKillerSoldier != NULL) { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index c092c3c2..858263d3 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1187,8 +1187,8 @@ public: UINT32 uiAIDelay; INT16 sReloadDelay; - UINT16 ubPreviousAttackerID; SoldierID ubAttackerID; + SoldierID ubPreviousAttackerID; INT32 sInsertionGridNo; diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index 0adebc5a..ceb58df0 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -261,13 +261,13 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) swprintf(pStrInfo, L"%s|Roaming |Range: %d\n", pStrInfo, RoamingRange(pSoldier, &usOrigin)); swprintf(pStrInfo, L"%s|Team |Aware: %d\n", pStrInfo, gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition); swprintf(pStrInfo, L"%s|Collapsed %d |BreathCollapsed %d\n", pStrInfo, pSoldier->bCollapsed, pSoldier->bBreathCollapsed); - if (pSoldier->ubPreviousAttackerID != NOBODY && MercPtrs[pSoldier->ubPreviousAttackerID]) + if (pSoldier->ubPreviousAttackerID < NOBODY) { - swprintf(pStrInfo, L"%s|Under |Fire %d AttackerID %d AttackerTarget %d\n", pStrInfo, pSoldier->aiData.bUnderFire, pSoldier->ubPreviousAttackerID, MercPtrs[pSoldier->ubPreviousAttackerID]->sLastTarget); + swprintf(pStrInfo, L"%s|Under |Fire %d AttackerID %d AttackerTarget %d\n", pStrInfo, pSoldier->aiData.bUnderFire, pSoldier->ubPreviousAttackerID.i, pSoldier->ubPreviousAttackerID->sLastTarget); } else { - swprintf(pStrInfo, L"%s|Under |Fire %d AttackerID %d\n", pStrInfo, pSoldier->aiData.bUnderFire, pSoldier->ubPreviousAttackerID); + swprintf(pStrInfo, L"%s|Under |Fire %d AttackerID %d\n", pStrInfo, pSoldier->aiData.bUnderFire, pSoldier->ubPreviousAttackerID.i); } swprintf(pStrInfo, L"%s|Visible %d |Moved %d\n", pStrInfo, pSoldier->bVisible, pSoldier->aiData.bMoved); diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index e47e0ca4..25ea052a 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -3788,21 +3788,19 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // if we can afford the minimum AP cost to throw this tossable item if (pSoldier->bActionPoints >= ubMinAPcost) { - INT32 sSpot = pSoldier->sGridNo; - INT8 bLevel = pSoldier->pathing.bLevel; + INT32 sSpot = pSoldier->sGridNo; + INT8 bLevel = pSoldier->pathing.bLevel; - INT32 sTargetSpot = NOWHERE; - INT8 bTargetLevel = bLevel; + INT32 sTargetSpot = NOWHERE; + INT8 bTargetLevel = bLevel; - INT32 sClosestThreat; - UINT16 ubClosestThreatID = pSoldier->ubPreviousAttackerID; + INT32 sClosestThreat; + SoldierID ubClosestThreatID = pSoldier->ubPreviousAttackerID; // try to find good spot for smoke - if (ubClosestThreatID != NOBODY && - MercPtrs[ubClosestThreatID] && - !TileIsOutOfBounds(MercPtrs[ubClosestThreatID]->sGridNo)) + if (ubClosestThreatID != NOBODY && !TileIsOutOfBounds(ubClosestThreatID->sGridNo)) { - sClosestThreat = MercPtrs[ubClosestThreatID]->sGridNo; + sClosestThreat = ubClosestThreatID->sGridNo; sTargetSpot = FindTossSpotInDirection(sSpot, bLevel, sClosestThreat, TRUE, TRUE); } @@ -3811,11 +3809,9 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { ubClosestThreatID = ClosestSeenThreatID(pSoldier, uiThreatCnt, SEEN_LAST_TURN); - if (ubClosestThreatID != NOBODY && - MercPtrs[ubClosestThreatID] && - !TileIsOutOfBounds(MercPtrs[ubClosestThreatID]->sGridNo)) + if (ubClosestThreatID != NOBODY && !TileIsOutOfBounds(ubClosestThreatID->sGridNo)) { - sClosestThreat = MercPtrs[ubClosestThreatID]->sGridNo; + sClosestThreat = ubClosestThreatID->sGridNo; sTargetSpot = FindTossSpotInDirection(sSpot, bLevel, sClosestThreat, TRUE, TRUE); } @@ -3825,11 +3821,9 @@ void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { ubClosestThreatID = ClosestKnownThreatID(pSoldier, uiThreatCnt); - if (ubClosestThreatID != NOBODY && - MercPtrs[ubClosestThreatID] && - !TileIsOutOfBounds(MercPtrs[ubClosestThreatID]->sGridNo)) + if (ubClosestThreatID != NOBODY && !TileIsOutOfBounds(ubClosestThreatID->sGridNo)) { - sClosestThreat = MercPtrs[ubClosestThreatID]->sGridNo; + sClosestThreat = ubClosestThreatID->sGridNo; sTargetSpot = FindTossSpotInDirection(sSpot, bLevel, sClosestThreat, TRUE, TRUE); } From 8346d5bfa1598507f4bac41d4dd538a852ffef6a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:58:25 +0200 Subject: [PATCH 071/571] Convert SOLDIERTYPE->ubNextToPreviousAttackerID to SoldierID --- Multiplayer/client.cpp | 6 +++--- Tactical/Soldier Control.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index b1100d17..f540d025 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -3848,7 +3848,7 @@ void send_death( SOLDIERTYPE *pSoldier ) { if (pSoldier->ubPreviousAttackerID < NOBODY) nDeath.attacker_id = pSoldier->ubPreviousAttackerID; - else if (pSoldier->ubNextToPreviousAttackerID != NOBODY && pSoldier->ubNextToPreviousAttackerID != NULL) + else if (pSoldier->ubNextToPreviousAttackerID < NOBODY) nDeath.attacker_id = pSoldier->ubNextToPreviousAttackerID; } @@ -3867,8 +3867,8 @@ void send_death( SOLDIERTYPE *pSoldier ) { pAttacker = pSoldier->ubPreviousAttackerID; // check if the new attacker was also a friendly... - if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubNextToPreviousAttackerID != NULL && pSoldier->ubNextToPreviousAttackerID != NOBODY) - pAttacker=MercPtrs[ pSoldier->ubNextToPreviousAttackerID ]; + if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubNextToPreviousAttackerID < NOBODY) + pAttacker = pSoldier->ubNextToPreviousAttackerID; // if its still a friendly, use the original attacker id...for posterity // guy must snore too loudly if all his mates wanna kill him :) if (pAttacker->bTeam == pSoldier->bTeam && pSoldier->ubAttackerID != NOBODY) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 858263d3..cd4e1ff2 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1504,7 +1504,7 @@ public: UINT8 ubLastDamageReason; INT32 sLastTwoLocations[2]; INT32 uiTimeSinceLastBleedGrunt; - UINT16 ubNextToPreviousAttackerID; + SoldierID ubNextToPreviousAttackerID; UINT8 bDoAutofire; INT8 numFlanks; INT32 lastFlankSpot; From 1a172427efbd20ff52d061a4a4088e4b3662ad96 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:01:52 +0200 Subject: [PATCH 072/571] Update Soldier Create.cpp --- Tactical/Soldier Create.cpp | 76 ++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 50cfbb23..a685dfc7 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -2085,57 +2085,57 @@ void InitSoldierStruct( SOLDIERTYPE *pSoldier ) pSoldier->initialize(); // Set default values - pSoldier->bVisible = -1; - pSoldier->iFaceIndex = -1; + pSoldier->bVisible = -1; + pSoldier->iFaceIndex = -1; // Set morale default - //pSoldier->aiData.bMorale = DEFAULT_MORALE; - pSoldier->aiData.bMorale = gMoraleSettings.ubDefaultMorale; + //pSoldier->aiData.bMorale = DEFAULT_MORALE; + pSoldier->aiData.bMorale = gMoraleSettings.ubDefaultMorale; - pSoldier->ubAttackerID = NOBODY; - pSoldier->ubPreviousAttackerID = NOBODY; - pSoldier->ubNextToPreviousAttackerID = NOBODY; + pSoldier->ubAttackerID = NOBODY; + pSoldier->ubPreviousAttackerID = NOBODY; + pSoldier->ubNextToPreviousAttackerID = NOBODY; //Set AI Delay! - pSoldier->uiAIDelay = 100; + pSoldier->uiAIDelay = 100; - pSoldier->iLight = -1; - pSoldier->iFaceIndex = -1; + pSoldier->iLight = -1; + pSoldier->iFaceIndex = -1; // Set update time to new speed - pSoldier->ubDesiredHeight = NO_DESIRED_HEIGHT; - pSoldier->bViewRange = NORMAL_VIEW_RANGE; - pSoldier->bInSector = FALSE; - pSoldier->sGridNo = NOWHERE; - pSoldier->iMuzFlash = -1; - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + pSoldier->ubDesiredHeight = NO_DESIRED_HEIGHT; + pSoldier->bViewRange = NORMAL_VIEW_RANGE; + pSoldier->bInSector = FALSE; + pSoldier->sGridNo = NOWHERE; + pSoldier->iMuzFlash = -1; + pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; pSoldier->usPendingAnimation2 = NO_PENDING_ANIMATION; - pSoldier->ubPendingStanceChange = NO_PENDING_STANCE; - pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; + pSoldier->ubPendingStanceChange = NO_PENDING_STANCE; + pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; pSoldier->bLastRenderVisibleValue = -1; - pSoldier->bBreath = 99; - pSoldier->bBreathMax = 100; - pSoldier->bActive = TRUE; - pSoldier->flags.fShowLocator = FALSE; - pSoldier->sLastTarget = NOWHERE; + pSoldier->bBreath = 99; + pSoldier->bBreathMax = 100; + pSoldier->bActive = TRUE; + pSoldier->flags.fShowLocator = FALSE; + pSoldier->sLastTarget = NOWHERE; pSoldier->sAbsoluteFinalDestination = NOWHERE; - pSoldier->sZLevelOverride = -1; - pSoldier->ubServicePartner = NOBODY; - pSoldier->ubAttackingHand = HANDPOS; - pSoldier->usAnimState = STANDING; - pSoldier->aiData.bInterruptDuelPts = NO_INTERRUPT; - pSoldier->aiData.bMoved = FALSE; + pSoldier->sZLevelOverride = -1; + pSoldier->ubServicePartner = NOBODY; + pSoldier->ubAttackingHand = HANDPOS; + pSoldier->usAnimState = STANDING; + pSoldier->aiData.bInterruptDuelPts = NO_INTERRUPT; + pSoldier->aiData.bMoved = FALSE; pSoldier->ubRobotRemoteHolderID = NOBODY; - pSoldier->aiData.sNoiseGridno = NOWHERE; - pSoldier->ubPrevSectorID = 255; - pSoldier->aiData.bNextPatrolPnt = 1; - pSoldier->bCurrentCivQuote = -1; + pSoldier->aiData.sNoiseGridno = NOWHERE; + pSoldier->ubPrevSectorID = 255; + pSoldier->aiData.bNextPatrolPnt = 1; + pSoldier->bCurrentCivQuote = -1; pSoldier->bCurrentCivQuoteDelta = 0; - pSoldier->uiBattleSoundID = NO_SAMPLE; - pSoldier->aiData.ubXRayedBy = NOBODY; - pSoldier->uiXRayActivatedTime = 0; - pSoldier->bBulletsLeft = 0; + pSoldier->uiBattleSoundID = NO_SAMPLE; + pSoldier->aiData.ubXRayedBy = NOBODY; + pSoldier->uiXRayActivatedTime = 0; + pSoldier->bBulletsLeft = 0; pSoldier->bVehicleUnderRepairID = -1; pSoldier->sFacilityTypeOperated = -1; // HEADROCK HAM 3.6: Facility Operated pSoldier->usChatPartnerID = NOBODY; From 5de6f77f2e4cacca2cb8d69cb3375899647b6220 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:26:22 +0200 Subject: [PATCH 073/571] Convert SOLDIERTYPE::ubOppNum to SoldierID --- Tactical/Soldier Control.h | 2 +- Tactical/Weapons.cpp | 52 +++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index cd4e1ff2..0a1c36d6 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1134,7 +1134,7 @@ public: UINT8 ubWaitActionToDo; INT8 ubInsertionDirection; INT8 bGunType; - UINT16 ubOppNum; + SoldierID ubOppNum; INT8 bLastRenderVisibleValue; UINT8 ubAttackingHand; INT16 sWeightCarriedAtTurnStart; diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 4e09c326..d87690f6 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -5635,13 +5635,13 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN if ( pAttacker->ubOppNum != NOBODY ) { // if it was another team shooting at someone under our control - if ( (pAttacker->bTeam != Menptr[ pAttacker->ubOppNum ].bTeam ) ) + if ( pAttacker->bTeam != pAttacker->ubOppNum->bTeam ) { // if OPPONENT is under our control - if (Menptr[ pAttacker->ubOppNum ].bTeam == gbPlayerNum ) + if ( pAttacker->ubOppNum->bTeam == gbPlayerNum ) { // AGILITY GAIN: Opponent "dodged" a bullet shot at him (it missed) - StatChange( MercPtrs[ pAttacker->ubOppNum ], AGILAMT, 5, FROM_FAILURE ); + StatChange( pAttacker->ubOppNum, AGILAMT, 5, FROM_FAILURE ); } } } @@ -6057,31 +6057,35 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN // anv: enemy taunt on miss if( pBullet->pFirer != NULL && pBullet->pFirer->ubOppNum != NOBODY ) { + SoldierID OpponentID = pBullet->pFirer->ubOppNum; + INT8 Team = OpponentID->bTeam; + SoldierID ShooterID = pBullet->pFirer->ubID; + if( Item[ pBullet->pFirer->usAttackingWeapon ].usItemClass & IC_GUN ) { if (gTauntsSettings.fTauntVoice) { // say taunt only to inform others - if (gbPublicOpplist[MercPtrs[pBullet->pFirer->ubOppNum]->bTeam][pBullet->pFirer->ubID] != SEEN_CURRENTLY && - gbPublicOpplist[MercPtrs[pBullet->pFirer->ubOppNum]->bTeam][pBullet->pFirer->ubID] != SEEN_THIS_TURN && - gTacticalStatus.Team[MercPtrs[pBullet->pFirer->ubOppNum]->bTeam].bMenInSector > 1) + if (gbPublicOpplist[Team][ShooterID] != SEEN_CURRENTLY && + gbPublicOpplist[Team][ShooterID] != SEEN_THIS_TURN && + gTacticalStatus.Team[Team].bMenInSector > 1) { - PossiblyStartEnemyTaunt(MercPtrs[pBullet->pFirer->ubOppNum], TAUNT_GOT_MISSED_GUNFIRE, pBullet->pFirer->ubID); + PossiblyStartEnemyTaunt(OpponentID, TAUNT_GOT_MISSED_GUNFIRE, ShooterID); } } - else if (MercPtrs[pBullet->pFirer->ubOppNum]->aiData.bOppList[pBullet->pFirer->ubID] == SEEN_CURRENTLY) + else if (OpponentID->aiData.bOppList[ShooterID] == SEEN_CURRENTLY) { - PossiblyStartEnemyTaunt(MercPtrs[pBullet->pFirer->ubOppNum], TAUNT_GOT_MISSED_GUNFIRE, pBullet->pFirer->ubID); + PossiblyStartEnemyTaunt(OpponentID, TAUNT_GOT_MISSED_GUNFIRE, ShooterID); } - PossiblyStartEnemyTaunt( pBullet->pFirer, TAUNT_MISS_GUNFIRE, pBullet->pFirer->ubOppNum ); + PossiblyStartEnemyTaunt( pBullet->pFirer, TAUNT_MISS_GUNFIRE, OpponentID); } else if( Item[ pBullet->pFirer->usAttackingWeapon ].usItemClass & IC_THROWING_KNIFE ) { - if( MercPtrs[ pBullet->pFirer->ubOppNum ]->aiData.bOppList[ pBullet->pFirer->ubID ] == SEEN_CURRENTLY ) - PossiblyStartEnemyTaunt( MercPtrs[ pBullet->pFirer->ubOppNum ], TAUNT_GOT_MISSED_THROWING_KNIFE, pBullet->pFirer->ubID ); + if( OpponentID->aiData.bOppList[ShooterID] == SEEN_CURRENTLY ) + PossiblyStartEnemyTaunt(OpponentID, TAUNT_GOT_MISSED_THROWING_KNIFE, ShooterID); - PossiblyStartEnemyTaunt( pBullet->pFirer, TAUNT_MISS_THROWING_KNIFE, pBullet->pFirer->ubOppNum ); + PossiblyStartEnemyTaunt( pBullet->pFirer, TAUNT_MISS_THROWING_KNIFE, OpponentID); } } } @@ -9060,7 +9064,7 @@ INT32 HTHImpact( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget, INT32 iHitBy, BO void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) { BOOLEAN fDoMissForGun = FALSE; - SOLDIERTYPE* pAttacker = NULL; + SOLDIERTYPE* pAttacker = NULL; BULLET* pBullet; if ( ubAttackerID == NOBODY ) @@ -9071,13 +9075,13 @@ void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) if ( pAttacker->ubOppNum != NOBODY ) { // if it was another team shooting at someone under our control - if ( (pAttacker->bTeam != Menptr[ pAttacker->ubOppNum ].bTeam ) ) + if ( (pAttacker->bTeam != pAttacker->ubOppNum->bTeam ) ) { // if OPPONENT is under our control - if (Menptr[ pAttacker->ubOppNum ].bTeam == gbPlayerNum ) + if (pAttacker->ubOppNum->bTeam == gbPlayerNum ) { // AGILITY GAIN: Opponent "dodged" a bullet shot at him (it missed) - StatChange( MercPtrs[ pAttacker->ubOppNum ], AGILAMT, 5, FROM_FAILURE ); + StatChange( pAttacker->ubOppNum, AGILAMT, 5, FROM_FAILURE ); } } } @@ -9161,17 +9165,19 @@ void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) // anv: enemy taunt on miss if ( pAttacker != NULL && pAttacker->ubOppNum != NOBODY ) { + SoldierID OpponentID = pAttacker->ubOppNum; + if( Item[ pAttacker->usAttackingWeapon ].usItemClass & IC_GUN ) { - if( MercPtrs[pAttacker->ubOppNum]->aiData.bOppList[ pAttacker->ubID ] == SEEN_CURRENTLY ) - PossiblyStartEnemyTaunt( MercPtrs[pAttacker->ubOppNum], TAUNT_GOT_MISSED_GUNFIRE, pAttacker->ubID ); - PossiblyStartEnemyTaunt( pAttacker, TAUNT_MISS_GUNFIRE, pAttacker->ubOppNum ); + if(OpponentID->aiData.bOppList[ pAttacker->ubID ] == SEEN_CURRENTLY ) + PossiblyStartEnemyTaunt( OpponentID, TAUNT_GOT_MISSED_GUNFIRE, pAttacker->ubID ); + PossiblyStartEnemyTaunt( pAttacker, TAUNT_MISS_GUNFIRE, OpponentID ); } else if( Item[ pAttacker->usAttackingWeapon ].usItemClass & IC_THROWING_KNIFE ) { - if( MercPtrs[pAttacker->ubOppNum]->aiData.bOppList[ pAttacker->ubID ] == SEEN_CURRENTLY ) - PossiblyStartEnemyTaunt( MercPtrs[pAttacker->ubOppNum], TAUNT_GOT_MISSED_THROWING_KNIFE, pAttacker->ubID ); - PossiblyStartEnemyTaunt( pAttacker, TAUNT_MISS_THROWING_KNIFE, pAttacker->ubOppNum ); + if( OpponentID->aiData.bOppList[ pAttacker->ubID ] == SEEN_CURRENTLY ) + PossiblyStartEnemyTaunt( OpponentID, TAUNT_GOT_MISSED_THROWING_KNIFE, pAttacker->ubID ); + PossiblyStartEnemyTaunt( pAttacker, TAUNT_MISS_THROWING_KNIFE, OpponentID ); } } } From f823cb97184c15be00e3b670dd2a2ffa0360a3a0 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:32:13 +0200 Subject: [PATCH 074/571] Update Soldier Control.h --- Tactical/Soldier Control.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 0a1c36d6..de9812a1 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1387,7 +1387,7 @@ public: UINT8 ubSoldierClass; //admin, elite, troop (creature types?) Nav: 2 seems to mean elite, 3 troop so admin is 1 UINT8 ubAPsLostToSuppression; - UINT16 ubSuppressorID; + SoldierID ubSuppressorID; //Squad merging vars UINT8 ubDesiredSquadAssignment; From 566ead5815ea994603c2903af3065ed83d93e04c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:46:15 +0200 Subject: [PATCH 075/571] Convert SOLDIERTYPE::ubTargetID to SoldierID --- Tactical/LOS.cpp | 6 +-- Tactical/Overhead.cpp | 2 +- Tactical/Soldier Ani.cpp | 74 ++++++++++++++++++------------------ Tactical/Soldier Control.cpp | 4 +- Tactical/Soldier Control.h | 2 +- Tactical/Soldier Profile.cpp | 2 +- Tactical/Weapons.cpp | 24 ++++++------ 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index d7ad5a97..7c607510 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -4907,7 +4907,7 @@ INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, ubImpact = (UINT8) (ubImpact * AmmoTypes[weapon->gun.ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[weapon->gun.ubGunAmmoType].multipleBulletDamageDivisor) ); if (pFirer->ubTargetID != NOBODY) { - MercPtrs[ pFirer->ubTargetID ]->bNumPelletsHitBy = 0; + pFirer->ubTargetID->bNumPelletsHitBy = 0; } } weapon=NULL; @@ -5435,7 +5435,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA ubImpact = (UINT8) (ubImpact * AmmoTypes[weapon->gun.ubGunAmmoType].multipleBulletDamageMultiplier / max(1,AmmoTypes[weapon->gun.ubGunAmmoType].multipleBulletDamageDivisor) ); if (pFirer->ubTargetID != NOBODY) { - MercPtrs[ pFirer->ubTargetID ]->bNumPelletsHitBy = 0; + pFirer->ubTargetID->bNumPelletsHitBy = 0; } } weapon=NULL; @@ -6951,7 +6951,7 @@ INT8 ChanceToGetThrough(SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dE // sevenfm: additionally initialize usAttackingWeapon, ubTargetID, bDoBurst and bDoAutofire which are used by FireBulletGivenTarget() UINT16 oldAttackingWeapon = pFirer->usAttackingWeapon; UINT8 oldAttackingHand = pFirer->ubAttackingHand; - UINT8 oldTargetID = pFirer->ubTargetID; + SoldierID oldTargetID = pFirer->ubTargetID; INT8 oldBurst = pFirer->bDoBurst; INT8 oldAutofire = pFirer->bDoAutofire; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index f729d931..eec87214 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -9676,7 +9676,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) pTarget = NULL; if (pSoldier->ubTargetID != NOBODY) { - pTarget = MercPtrs[ pSoldier->ubTargetID ]; + pTarget = pSoldier->ubTargetID; } // Flugente 18-07-22: commenting this out - it doesn't do harm in realtime, and is more realistic diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 8f1e6191..602800af 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -1557,7 +1557,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) if ( pSoldier->bTeam != gbPlayerNum ) { // only locate if the enemy is visible or he's aiming at a player - if ( pSoldier->bVisible != -1 || (pSoldier->ubTargetID != NOBODY && MercPtrs[ pSoldier->ubTargetID ]->bTeam == gbPlayerNum) ) + if ( pSoldier->bVisible != -1 || (pSoldier->ubTargetID != NOBODY && pSoldier->ubTargetID->bTeam == gbPlayerNum) ) { LocateGridNo( pSoldier->sTargetGridNo ); } @@ -4043,13 +4043,13 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) else if ( pSoldier->bVisible == TRUE ) { // We were a visible enemy, say laugh! - if ( Random(3) == 0 && !CREATURE_OR_BLOODCAT( MercPtrs[ ubAttacker ] ) ) + if ( Random(3) == 0 && !CREATURE_OR_BLOODCAT( ubAttacker ) ) { // if the attacker was from the same team, play a curse, otherwise play a laugh - if ( MercPtrs[ubAttacker]->bSide == pSoldier->bSide ) - MercPtrs[ubAttacker]->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); + if ( ubAttacker->bSide == pSoldier->bSide ) + ubAttacker->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); else - MercPtrs[ ubAttacker ]->DoMercBattleSound( BATTLE_SOUND_LAUGH1 ); + ubAttacker->DoMercBattleSound( BATTLE_SOUND_LAUGH1 ); } } } @@ -4061,7 +4061,7 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) // militia also now track kills... if ( ubAttacker != NOBODY ) { - if ( MercPtrs[ ubAttacker ]->bTeam == gbPlayerNum ) + if ( ubAttacker->bTeam == gbPlayerNum ) { // increment kills ///////////////////////////////////////////////////////////////////////////////////// @@ -4069,43 +4069,43 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) switch(pSoldier->ubSoldierClass) { case SOLDIER_CLASS_ROBOT: - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsOthers++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsOthers++; break; case SOLDIER_CLASS_ELITE : - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsElites++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsElites++; break; case SOLDIER_CLASS_ARMY : - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsRegulars++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsRegulars++; break; case SOLDIER_CLASS_ADMINISTRATOR : - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsAdmins++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsAdmins++; break; case SOLDIER_CLASS_CREATURE : - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsCreatures++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsCreatures++; break; case SOLDIER_CLASS_ZOMBIE : - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsZombies++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsZombies++; break; case SOLDIER_CLASS_BANDIT: - gMercProfiles[MercPtrs[ubAttacker]->ubProfile].records.usKillsOthers++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsOthers++; break; default : if ( CREATURE_OR_BLOODCAT( pSoldier ) ) - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsCreatures++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsCreatures++; else if ( ARMED_VEHICLE( pSoldier ) ) - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsTanks++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsTanks++; else if ( pSoldier->bTeam == CIV_TEAM && !pSoldier->aiData.bNeutral && pSoldier->bSide != gbPlayerNum ) - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsHostiles++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsHostiles++; else { - gMercProfiles[ MercPtrs[ ubAttacker ]->ubProfile ].records.usKillsOthers++; + gMercProfiles[ ubAttacker->ubProfile ].records.usKillsOthers++; // Flugente: dynamic opinions: if this guy is not hostile towards us, then some mercs will complain about killing civilians - if (gGameExternalOptions.fDynamicOpinions && pSoldier->bTeam != OUR_TEAM && (pSoldier->aiData.bNeutral || pSoldier->bSide == MercPtrs[ubAttacker]->bSide) ) + if (gGameExternalOptions.fDynamicOpinions && pSoldier->bTeam != OUR_TEAM && (pSoldier->aiData.bNeutral || pSoldier->bSide == ubAttacker->bSide) ) { // not for killing animals though... if ( pSoldier->ubBodyType != CROW && pSoldier->ubBodyType != COW ) - HandleDynamicOpinionChange( MercPtrs[ubAttacker], OPINIONEVENT_CIVKILLER, TRUE, TRUE ); + HandleDynamicOpinionChange( ubAttacker, OPINIONEVENT_CIVKILLER, TRUE, TRUE ); } } break; @@ -4117,61 +4117,61 @@ BOOLEAN HandleSoldierDeath( SOLDIERTYPE *pSoldier , BOOLEAN *pfMadeCorpse ) // Flugente: dynamic opinions: if this guy is not hostile towards us, then some mercs will complain about killing civilians if (gGameExternalOptions.fDynamicOpinions) { - if (pSoldier->bTeam != OUR_TEAM && (pSoldier->aiData.bNeutral || pSoldier->bSide == MercPtrs[ubAttacker]->bSide)) + if (pSoldier->bTeam != OUR_TEAM && (pSoldier->aiData.bNeutral || pSoldier->bSide == ubAttacker->bSide)) { // not for killing animals though... if (pSoldier->ubBodyType != CROW && pSoldier->ubBodyType != COW) - HandleDynamicOpinionChange(MercPtrs[ubAttacker], OPINIONEVENT_CIVKILLER, TRUE, TRUE); + HandleDynamicOpinionChange(ubAttacker, OPINIONEVENT_CIVKILLER, TRUE, TRUE); } else { // if this enemy was attacking a freshly wounded merc, it is likely they posed a real threat - the merc will be thankful for saving their life - if (pSoldier->ubTargetID != NOBODY && MercPtrs[pSoldier->ubTargetID]->bBleeding > 10) + if (pSoldier->ubTargetID != NOBODY && pSoldier->ubTargetID->bBleeding > 10) { - AddOpinionEvent(MercPtrs[pSoldier->ubTargetID]->ubProfile, MercPtrs[ubAttacker]->ubProfile, OPINIONEVENT_BATTLE_SAVIOUR); + AddOpinionEvent(pSoldier->ubTargetID->ubProfile, ubAttacker->ubProfile, OPINIONEVENT_BATTLE_SAVIOUR); } else { // complain about a fragthief, or thank for assistance - correct event is chosen internally - HandleDynamicOpinionChange(MercPtrs[ubAttacker], OPINIONEVENT_FRAGTHIEF, TRUE, TRUE); + HandleDynamicOpinionChange(ubAttacker, OPINIONEVENT_FRAGTHIEF, TRUE, TRUE); } } } } - else if ( MercPtrs[ ubAttacker ]->bTeam == MILITIA_TEAM ) + else if ( ubAttacker->bTeam == MILITIA_TEAM ) { // get a kill! 2 points! - MercPtrs[ ubAttacker ]->ubMilitiaKills += 1; + ubAttacker->ubMilitiaKills += 1; } } if ( ubAssister != NOBODY && ubAssister != ubAttacker ) { - if ( MercPtrs[ ubAssister ]->bTeam == gbPlayerNum ) + if ( ubAssister->bTeam == gbPlayerNum ) { ///////////////////////////////////////////////////////////////////////////////////// // SANDRO - new mercs' records - if( MercPtrs[ ubAttacker ] != NULL ) + if( ubAttacker != NOBODY ) { - if( MercPtrs[ ubAttacker ]->bTeam == gbPlayerNum ) - gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsMercs++; - else if ( MercPtrs[ ubAttacker ]->bTeam == MILITIA_TEAM ) - gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsMilitia++; + if( ubAttacker->bTeam == gbPlayerNum ) + gMercProfiles[ ubAssister->ubProfile ].records.usAssistsMercs++; + else if ( ubAttacker->bTeam == MILITIA_TEAM ) + gMercProfiles[ ubAssister->ubProfile ].records.usAssistsMilitia++; else - gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsOthers++; + gMercProfiles[ ubAssister->ubProfile ].records.usAssistsOthers++; } else { - gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].records.usAssistsOthers++; + gMercProfiles[ ubAssister->ubProfile ].records.usAssistsOthers++; } - //gMercProfiles[ MercPtrs[ ubAssister ]->ubProfile ].usAssists++; + //gMercProfiles[ ubAssister->ubProfile ].usAssists++; ///////////////////////////////////////////////////////////////////////////////////// } - else if ( MercPtrs[ ubAssister ]->bTeam == MILITIA_TEAM ) + else if ( ubAssister->bTeam == MILITIA_TEAM ) { // get an assist - 1 points - MercPtrs[ubAssister]->ubMilitiaAssists += 1; + ubAssister->ubMilitiaAssists += 1; } } /* diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index bb011c63..fbd3f15d 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -16044,12 +16044,12 @@ BOOLEAN SOLDIERTYPE::SeemsLegit( UINT16 ubObserverID ) if ( this->sSectorX == gWorldSectorX && this->sSectorY == gWorldSectorY && this->bSectorZ == gbWorldSectorZ ) { // are we targeting a buddy of our observer? - if ( this->ubTargetID != NOBODY && MercPtrs[this->ubTargetID] && MercPtrs[this->ubTargetID]->bTeam == pSoldier->bTeam ) + if ( this->ubTargetID < NOBODY && this->ubTargetID->bTeam == pSoldier->bTeam ) { // if we are aiming at a soldier, others will notice our intent... not covert! if ( WeaponReady( this ) ) { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_TARGETTING_SOLDIER], this->GetName(), MercPtrs[this->ubTargetID]->GetName() ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szCovertTextStr[STR_COVERT_TARGETTING_SOLDIER], this->GetName(), this->ubTargetID->GetName() ); return FALSE; } } diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index de9812a1..34f9a777 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1406,7 +1406,7 @@ public: INT8 bBlockedByAnotherMercDirection; UINT16 usAttackingWeapon; INT8 bWeaponMode; - UINT16 ubTargetID; + SoldierID ubTargetID; INT8 bAIScheduleProgress; INT32 sOffWorldGridNo; struct TAG_anitile *pAniTile; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 8c53299e..449277c2 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1713,7 +1713,7 @@ SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) // Set insertion gridNo - pNewSoldier->sInsertionGridNo = sOldGridNo; + pNewSoldier->sInsertionGridNo = sOldGridNo; if ( gfPotentialTeamChangeDuringDeath ) { diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index d87690f6..4b2653c3 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -2807,7 +2807,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // HEADROCK: Actually, it's 1 for the first shot. Works fine regardless though. // HEADROCK HAM 4: Extra experience gain now given when the target is hit. This part only gives basic points // for the attack (FAILURE type). - if ( PTR_OURTEAM && pSoldier->ubTargetID != NOBODY && (!pSoldier->bDoBurst || pSoldier->bDoBurst == 2 ) && (gTacticalStatus.uiFlags & INCOMBAT ) && ( SoldierToSoldierBodyPartChanceToGetThrough( pSoldier, MercPtrs[ pSoldier->ubTargetID ], pSoldier->bAimShotLocation ) > 0 ) ) + if ( PTR_OURTEAM && pSoldier->ubTargetID != NOBODY && (!pSoldier->bDoBurst || pSoldier->bDoBurst == 2 ) && (gTacticalStatus.uiFlags & INCOMBAT ) && ( SoldierToSoldierBodyPartChanceToGetThrough( pSoldier, pSoldier->ubTargetID, pSoldier->bAimShotLocation ) > 0 ) ) { // add base pts for taking a shot, whether it hits or misses dExpGain = 2.0f; @@ -2818,11 +2818,11 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) dExpGain = (dExpGain * 2) / 3; } - if ( MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == COW || MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == CROW ) + if ( pSoldier->ubTargetID->ubBodyType == COW || pSoldier->ubTargetID->ubBodyType == CROW ) { dExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( pSoldier->ubTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pSoldier->ubTargetID ) || TANK( pSoldier->ubTargetID ) ) { // no exp from shooting a vehicle that you can't damage and can't move! dExpGain = 0; @@ -2856,11 +2856,11 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // add base pts for taking a shot, whether it hits or misses dExpGain = 5.0f; - if ( MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == COW || MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == CROW ) + if ( pSoldier->ubTargetID->ubBodyType == COW || pSoldier->ubTargetID->ubBodyType == CROW ) { dExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( pSoldier->ubTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pSoldier->ubTargetID ) || TANK( pSoldier->ubTargetID ) ) { // no exp from shooting a vehicle that you can't damage and can't move! dExpGain = 0; @@ -3535,7 +3535,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) } // NB bDoBurst will be 2 at this point for the first shot since it was incremented // above - if ( PTR_OURTEAM && pSoldier->ubTargetID != NOBODY && (!pSoldier->bDoBurst || pSoldier->bDoBurst == 2 ) && (gTacticalStatus.uiFlags & INCOMBAT ) && ( SoldierToSoldierBodyPartChanceToGetThrough( pSoldier, MercPtrs[ pSoldier->ubTargetID ], pSoldier->bAimShotLocation ) > 0 ) ) + if ( PTR_OURTEAM && pSoldier->ubTargetID != NOBODY && (!pSoldier->bDoBurst || pSoldier->bDoBurst == 2 ) && (gTacticalStatus.uiFlags & INCOMBAT ) && ( SoldierToSoldierBodyPartChanceToGetThrough( pSoldier, pSoldier->ubTargetID, pSoldier->bAimShotLocation ) > 0 ) ) { if ( fGonnaHit ) { @@ -3562,11 +3562,11 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) usExpGain = (usExpGain * 2) / 3; } - if ( MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == COW || MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == CROW ) + if ( pSoldier->ubTargetID->ubBodyType == COW || pSoldier->ubTargetID->ubBodyType == CROW ) { usExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( pSoldier->ubTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pSoldier->ubTargetID ) || TANK( pSoldier->ubTargetID ) ) { // no exp from shooting a vehicle that you can't damage and can't move! usExpGain = 0; @@ -3632,11 +3632,11 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // add base pts for taking a shot, whether it hits or misses usExpGain += 10; - if ( MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == COW || MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == CROW ) + if ( pSoldier->ubTargetID->ubBodyType == COW || pSoldier->ubTargetID->ubBodyType == CROW ) { usExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( pSoldier->ubTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pSoldier->ubTargetID ) || TANK( pSoldier->ubTargetID ) ) { // no exp from shooting a vehicle that you can't damage and can't move! usExpGain = 0; @@ -4134,11 +4134,11 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // add base pts for taking a shot, whether it hits or misses usExpGain += 10; - if ( MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == COW || MercPtrs[ pSoldier->ubTargetID ]->ubBodyType == CROW ) + if ( pSoldier->ubTargetID->ubBodyType == COW || pSoldier->ubTargetID->ubBodyType == CROW ) { usExpGain /= 2; } - else if ( MercPtrs[ pSoldier->ubTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( MercPtrs[ pSoldier->ubTargetID ] ) || TANK( MercPtrs[ pSoldier->ubTargetID ] ) ) + else if ( pSoldier->ubTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE || AM_A_ROBOT( pSoldier->ubTargetID ) || TANK( pSoldier->ubTargetID ) ) { // no exp from shooting a vehicle that you can't damage and can't move! usExpGain = 0; From 75deccbc44d08a74122241dcfecc10f5e739654d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:56:26 +0200 Subject: [PATCH 076/571] Convert SOLDIERTYPE::ubRobotRemoteHolderID to SoldierID --- Strategic/Auto Resolve.cpp | 2 +- Tactical/Dialogue Control.cpp | 2 +- Tactical/Soldier Control.cpp | 6 ++---- Tactical/Soldier Control.h | 2 +- Tactical/TeamTurns.cpp | 4 ++-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 2d833ef6..6613354a 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -2835,7 +2835,7 @@ void RetreatButtonCallback( GUI_BUTTON *btn, INT32 reason ) if( gpAR->pRobotCell ) { //if robot is retreating, set the retreat time to be the same as the robot's controller. - UINT16 ubRobotControllerID; + SoldierID ubRobotControllerID; ubRobotControllerID = gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID; diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 4a2fc253..52d13596 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -1595,7 +1595,7 @@ BOOLEAN TacticalCharacterDialogue( SOLDIERTYPE *pSoldier, UINT16 usQuoteNum ) { if ( pSoldier->CanRobotBeControlled( ) ) { - return( TacticalCharacterDialogue( MercPtrs[ pSoldier->ubRobotRemoteHolderID ], usQuoteNum ) ); + return( TacticalCharacterDialogue( pSoldier->ubRobotRemoteHolderID, usQuoteNum ) ); } else { diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index fbd3f15d..35aeea8c 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -23549,8 +23549,6 @@ BOOLEAN SOLDIERTYPE::IsValidPistolFastShot( INT16 bAimTime, INT32 iTrgGridNo ) } BOOLEAN SOLDIERTYPE::CanRobotBeControlled( void ) { - SOLDIERTYPE *pController; - if ( !(this->flags.uiStatusFlags & SOLDIER_ROBOT) ) { return(FALSE); @@ -23561,7 +23559,7 @@ BOOLEAN SOLDIERTYPE::CanRobotBeControlled( void ) return(FALSE); } - pController = MercPtrs[this->ubRobotRemoteHolderID]; + SOLDIERTYPE* pController = this->ubRobotRemoteHolderID; if ( pController->bActive ) { @@ -23665,7 +23663,7 @@ SOLDIERTYPE *SOLDIERTYPE::GetRobotController( void ) } else { - return(MercPtrs[this->ubRobotRemoteHolderID]); + return(this->ubRobotRemoteHolderID); } } diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 34f9a777..51193c3a 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1428,7 +1428,7 @@ public: INT32 iBurstSoundID; INT8 bSlotItemTakenFrom; UINT16 ubAutoBandagingMedic; - UINT16 ubRobotRemoteHolderID; + SoldierID ubRobotRemoteHolderID; UINT32 uiTimeOfLastContractUpdate; INT8 bTypeOfLastContract; INT8 bTurnsCollapsed; diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index d3962619..0bc3e181 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -1825,8 +1825,8 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN { //iPoints = EffectiveExpLevel( MercPtrs[ pSoldier->ubRobotRemoteHolderID ] ) - 2; // Snap: (do some proper rounding here) - iPoints = ( 20*EffectiveExpLevel( MercPtrs[ pSoldier->ubRobotRemoteHolderID ] ) - + EffectiveAgility( MercPtrs[ pSoldier->ubRobotRemoteHolderID ], FALSE ) + 15 ) / 30 - 2; + iPoints = ( 20*EffectiveExpLevel( pSoldier->ubRobotRemoteHolderID ) + + EffectiveAgility( pSoldier->ubRobotRemoteHolderID, FALSE ) + 15 ) / 30 - 2; } else { From 153d4020656a19caa34830268a2adddf6c827ae7 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:58:28 +0200 Subject: [PATCH 077/571] Update Soldier Control.h --- Tactical/Soldier Control.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 51193c3a..e92bd051 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1464,7 +1464,7 @@ public: UINT8 ubNumLocateCycles; UINT8 ubDelayedMovementFlags; - UINT16 ubCTGTTargetID; + SoldierID ubCTGTTargetID; UINT32 uiMercChecksum; From 8ef7fb5ae45a87689569a7f985eb40c235264d31 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:09:48 +0200 Subject: [PATCH 078/571] Convert SOLDIERTYPE::usDragPersonID to SoldierID --- Tactical/Items.cpp | 2 +- Tactical/Soldier Control.cpp | 4 ++-- Tactical/Soldier Control.h | 6 +----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index c26144e5..cbcdfcd5 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -3167,7 +3167,7 @@ UINT32 CalculateCarriedWeight( SOLDIERTYPE * pSoldier, BOOLEAN fConsiderDragging { if (pSoldier->usDragPersonID != NOBODY) { - SOLDIERTYPE* pOtherSoldier = MercPtrs[pSoldier->usDragPersonID]; + SOLDIERTYPE* pOtherSoldier = pSoldier->usDragPersonID; uiTotalWeight += GetTotalWeight( pOtherSoldier ); uiTotalWeight += pOtherSoldier->GetBodyWeight(); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 35aeea8c..e9c55505 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -11529,7 +11529,7 @@ void SOLDIERTYPE::MoveMerc( FLOAT dMovementChange, FLOAT dAngle, BOOLEAN fCheckR if ( this->usDragPersonID != NOBODY ) { - SOLDIERTYPE* pSoldier = MercPtrs[this->usDragPersonID]; + SOLDIERTYPE* pSoldier = this->usDragPersonID; if ( pSoldier ) { @@ -20876,7 +20876,7 @@ void SOLDIERTYPE::CancelDrag() // if we are dragging a person, set them to the center of their gridno, otherwise their position might be off if (this->usDragPersonID != NOBODY) { - SOLDIERTYPE* pSoldier = MercPtrs[this->usDragPersonID]; + SOLDIERTYPE* pSoldier = this->usDragPersonID; if ( pSoldier && !TileIsOutOfBounds(pSoldier->sGridNo) ) { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index e92bd051..db866046 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1532,12 +1532,8 @@ public: // Flugente: this was the location of required variables required for the now removed poison feature. They can be used again UINT8 ubMilitiaAssists; // Flugente: stores militia assists INT8 sNonNPCTraderID; // Flugente: we can set up non-NPC soldiers to be merchants, we store their dealer id here (value > 0 means arms dealer entry x) - //INT8 bUnusedINT8_3; - UINT16 usDragPersonID; // Flugente: id of person we are dragging - - //INT16 bUnusedINT16_4; + SoldierID usDragPersonID; // Flugente: id of person we are dragging INT16 sDragCorpseID; // Flugente: id of corpse we are dragging - SoldierID usChatPartnerID; // Flugente: the id of another merc we are 'chatting' with // Flugente: new variables for extra stats From 419b0c794d7028c886612dbd893b019267051776 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:18:02 +0200 Subject: [PATCH 079/571] SOLDIERTYPE::CreateSoldierCommon to SoldierID --- Tactical/Animation Cache.cpp | 8 ++++---- Tactical/Animation Cache.h | 6 +++--- Tactical/Overhead.cpp | 6 +++--- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Control.h | 2 +- Tactical/Soldier Create.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Tactical/Animation Cache.cpp b/Tactical/Animation Cache.cpp index ec30ff95..3b320c60 100644 --- a/Tactical/Animation Cache.cpp +++ b/Tactical/Animation Cache.cpp @@ -20,16 +20,16 @@ void DetermineOptimumAnimationCacheSize( ) guiCacheSize = MIN_CACHE_SIZE; } -BOOLEAN InitAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ) +BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ) { UINT32 cnt; // Allocate entries - AnimDebugMsg( String( "*** Initializing anim cache surface for soldier %d", usSoldierID ) ); + AnimDebugMsg( String( "*** Initializing anim cache surface for soldier %d", usSoldierID.i ) ); pAnimCache->usCachedSurfaces = (UINT16 *) MemAlloc( sizeof( UINT16 ) * guiCacheSize ); CHECKF( pAnimCache->usCachedSurfaces!= NULL ); - AnimDebugMsg( String( "*** Initializing anim cache hit counter for soldier %d", usSoldierID ) ); + AnimDebugMsg( String( "*** Initializing anim cache hit counter for soldier %d", usSoldierID.i ) ); pAnimCache->sCacheHits = (INT16 *) MemAlloc( sizeof( UINT16) * guiCacheSize ); CHECKF( pAnimCache->sCacheHits!= NULL ); @@ -41,7 +41,7 @@ BOOLEAN InitAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnim } pAnimCache->ubCacheSize = 0; - // Zero surface databse history for this soldeir + // Zero surface database history for this soldier ClearAnimationSurfacesUsageHistory( usSoldierID ); return( TRUE ); diff --git a/Tactical/Animation Cache.h b/Tactical/Animation Cache.h index bf2753b8..a64063c9 100644 --- a/Tactical/Animation Cache.h +++ b/Tactical/Animation Cache.h @@ -1,7 +1,7 @@ #ifndef __ANIMATION_CACHE_H #define __ANIMATION_CACHE_H -#include "types.h" +#include "Overhead Types.h" #define MAX_CACHE_SIZE 20 //#define MIN_CACHE_SIZE 2 @@ -19,11 +19,11 @@ typedef struct extern UINT32 guiCacheSize; BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation ); -BOOLEAN InitAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ); +BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ); void DeleteAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ); void DetermineOptimumAnimationCacheSize( ); void UnLoadCachedAnimationSurfaces( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index eec87214..c4e2164e 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -3468,15 +3468,15 @@ void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceRese BOOLEAN ResetAllAnimationCache( ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; + UINT16 cnt; + SOLDIERTYPE *pSoldier; // Loop through all mercs and make go for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ ) { if ( pSoldier != NULL ) { - InitAnimationCache( (UINT16)cnt, &(pSoldier->AnimCache) ); + InitAnimationCache( cnt, &(pSoldier->AnimCache) ); } diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index e9c55505..cbb6ce03 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2413,7 +2413,7 @@ void SOLDIERTYPE::DoNinjaAttack( void ) } -BOOLEAN SOLDIERTYPE::CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID, UINT16 usState ) +BOOLEAN SOLDIERTYPE::CreateSoldierCommon( UINT8 ubBodyType, SoldierID usSoldierID, UINT16 usState ) { BOOLEAN fSuccess = FALSE; INT32 iCounter = 0; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index db866046..a3f90e4d 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1656,7 +1656,7 @@ public: BOOLEAN CreateSoldierLight( void ); BOOLEAN DeleteSoldierLight( void ); - BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID, UINT16 usState ); + BOOLEAN CreateSoldierCommon( UINT8 ubBodyType, SoldierID usSoldierID, UINT16 usState ); // Soldier Management functions, called by Event Pump.c diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index a685dfc7..f54fc3d5 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -1189,7 +1189,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 // Copy into merc struct *MercPtrs[ Soldier.ubID ] = Soldier; // Alrighty then, we are set to create the merc, stuff after here can fail! - CHECKF( MercPtrs[ Soldier.ubID ]->CreateSoldierCommon( Soldier.ubBodyType, Soldier.ubID, STANDING ) != FALSE ); + CHECKF( Soldier.ubID->CreateSoldierCommon( Soldier.ubBodyType, Soldier.ubID, STANDING ) != FALSE ); } } else From b112d39fe28608516667978b1da4afeb418f74c3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:34:19 +0200 Subject: [PATCH 080/571] Convert SOLDIERTYPE::EVENT_SoldierGotHit to SoldierID --- Tactical/Soldier Control.cpp | 42 ++++++++++++++++++------------------ Tactical/Soldier Control.h | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index cbb6ce03..617facce 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -5700,7 +5700,7 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL #pragma optimize("", off) // ATE: THIS FUNCTION IS USED FOR ALL SOLDIER TAKE DAMAGE FUNCTIONS! -void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGrid ) +void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGrid ) { UINT8 ubCombinedLoss, ubVolume, ubReason; // SOLDIERTYPE * pNewSoldier; @@ -5719,7 +5719,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // DO STUFF COMMON FOR ALL TYPES if ( ubAttackerID != NOBODY ) { - MercPtrs[ubAttackerID]->aiData.bLastAttackHit = TRUE; + ubAttackerID->aiData.bLastAttackHit = TRUE; } // Set attacker's ID @@ -5759,8 +5759,8 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 } // Flugente: check the ammo else if ( ubAttackerID != NOBODY - && MercPtrs[ubAttackerID]->inv[HANDPOS].exists() - && AmmoTypes[*&( MercPtrs[ubAttackerID]->inv[HANDPOS] )[0]->data.gun.ubGunAmmoType].ammoflag & AMMO_TRAIL_FIRE ) + && ubAttackerID->inv[HANDPOS].exists() + && AmmoTypes[*&( ubAttackerID->inv[HANDPOS] )[0]->data.gun.ubGunAmmoType].ammoflag & AMMO_TRAIL_FIRE ) { ubReason = TAKE_DAMAGE_GAS_FIRE; @@ -5780,7 +5780,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 } // callahan update end - else if ( Item[usWeaponIndex].usItemClass & (IC_GUN | IC_THROWING_KNIFE) && AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand][0]->data.gun.ubGunAmmoType].explosionSize <= 1 ) + else if ( Item[usWeaponIndex].usItemClass & (IC_GUN | IC_THROWING_KNIFE) && AmmoTypes[ ubAttackerID->inv[ ubAttackerID->ubAttackingHand ][0]->data.gun.ubGunAmmoType ].explosionSize <= 1 ) { if ( ubSpecial == FIRE_WEAPON_SLEEP_DART_SPECIAL ) { @@ -5848,16 +5848,16 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 ubReason = TAKE_DAMAGE_BLADE; // Flugente: check wether we can make this blade bloody - if ( ubAttackerID != NOBODY && MercPtrs[ubAttackerID]->inv[HANDPOS].exists( ) ) + if ( ubAttackerID != NOBODY && ubAttackerID->inv[HANDPOS].exists( ) ) { - if ( Item[MercPtrs[ubAttackerID]->inv[HANDPOS].usItem].bloodieditem > 0 ) + if ( Item[ ubAttackerID->inv[HANDPOS].usItem ].bloodieditem > 0 ) { // magic happens - MercPtrs[ubAttackerID]->inv[HANDPOS].usItem = Item[MercPtrs[ubAttackerID]->inv[HANDPOS].usItem].bloodieditem; + ubAttackerID->inv[HANDPOS].usItem = Item[ ubAttackerID->inv[HANDPOS].usItem ].bloodieditem; } // Flugente: if the blade is infected, infect the victim - if ( *&(MercPtrs[ubAttackerID]->inv[HANDPOS])[0]->data.sObjectFlag & INFECTED && gGameExternalOptions.fDiseaseContaminatesItems ) + if ( *&(ubAttackerID->inv[HANDPOS])[0]->data.sObjectFlag & INFECTED && gGameExternalOptions.fDiseaseContaminatesItems ) { // infect us with the first disease this->Infect( 0 ); @@ -5865,7 +5865,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // if this guy has the disease, infect the blade if ( this->sDiseasePoints[0] > 0 ) - *&(MercPtrs[ubAttackerID]->inv[HANDPOS])[0]->data.sObjectFlag |= INFECTED; + *&(ubAttackerID->inv[HANDPOS])[0]->data.sObjectFlag |= INFECTED; } } else if ( Item[usWeaponIndex].usItemClass & IC_PUNCH ) @@ -5877,7 +5877,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 { if ( ubAttackerID != NOBODY ) { - if ( !(MercPtrs[ubAttackerID]->inv[HANDPOS].exists( )) || ItemIsBrassKnuckles(MercPtrs[ubAttackerID]->inv[HANDPOS].usItem) ) + if ( !(ubAttackerID->inv[HANDPOS].exists( )) || ItemIsBrassKnuckles(ubAttackerID->inv[HANDPOS].usItem) ) { // with enhanced CCS, make the lost breath harder to regenerate, which makes CQC more usable if ( gGameExternalOptions.fEnhancedCloseCombatSystem ) @@ -5886,11 +5886,11 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 sBreathLoss = sDamage * (100 + gSkillTraitValues.bPercentModifierHtHBreathLoss); // 80% only for untrained mercs // martial arts bonus for breath damage - if ( HAS_SKILL_TRAIT( MercPtrs[ubAttackerID], MARTIAL_ARTS_NT ) ) + if ( HAS_SKILL_TRAIT( ubAttackerID, MARTIAL_ARTS_NT ) ) { - sBreathLoss += sDamage * gSkillTraitValues.ubMABonusBreathDamageHandToHand * NUM_SKILL_TRAITS( MercPtrs[ubAttackerID], MARTIAL_ARTS_NT ); + sBreathLoss += sDamage * gSkillTraitValues.ubMABonusBreathDamageHandToHand * NUM_SKILL_TRAITS( ubAttackerID, MARTIAL_ARTS_NT ); - sBreathRegainPenaltyMultiplier += (gSkillTraitValues.usMALostBreathRegainPenalty * NUM_SKILL_TRAITS( MercPtrs[ubAttackerID], MARTIAL_ARTS_NT )); + sBreathRegainPenaltyMultiplier += (gSkillTraitValues.usMALostBreathRegainPenalty * NUM_SKILL_TRAITS( ubAttackerID, MARTIAL_ARTS_NT )); } } else @@ -5947,7 +5947,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 if (ItemNeedsBatteries(usWeaponIndex)) { // check for batteries - OBJECTTYPE* pBatteries = FindAttachedBatteries( &(MercPtrs[ubAttackerID]->inv[HANDPOS]) ); + OBJECTTYPE* pBatteries = FindAttachedBatteries( &(ubAttackerID->inv[HANDPOS]) ); if ( pBatteries ) { sDamage = 0; @@ -5964,7 +5964,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // destroy batteries pBatteries->RemoveObjectsFromStack( 1 ); if ( pBatteries->exists( ) == false ) { - MercPtrs[ubAttackerID]->inv[HANDPOS].RemoveAttachment( pBatteries ); + ubAttackerID->inv[HANDPOS].RemoveAttachment( pBatteries ); } } @@ -5976,7 +5976,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 } // marke added one 'or' for explosive ammo. variation of: AmmoTypes[this->inv[this->ubAttackingHand ][0]->data.gun.ubGunAmmoType].explosionSize > 1 // extracting attacker�s ammo type - else if ( Item[usWeaponIndex].usItemClass & IC_EXPLOSV || AmmoTypes[MercPtrs[ubAttackerID]->inv[MercPtrs[ubAttackerID]->ubAttackingHand][0]->data.gun.ubGunAmmoType].explosionSize > 1 ) + else if ( Item[usWeaponIndex].usItemClass & IC_EXPLOSV || AmmoTypes[ubAttackerID->inv[ubAttackerID->ubAttackingHand][0]->data.gun.ubGunAmmoType].explosionSize > 1 ) { INT8 bDeafValue; @@ -6371,7 +6371,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_GUNFIRE, ubAttackerID ); if (ubAttackerID != NOBODY) { - PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_GUNFIRE, this->ubID ); + PossiblyStartEnemyTaunt( ubAttackerID, TAUNT_HIT_GUNFIRE, this->ubID ); } } else @@ -6379,7 +6379,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_THROWING_KNIFE, ubAttackerID ); if (ubAttackerID != NOBODY) { - PossiblyStartEnemyTaunt(MercPtrs[ubAttackerID], TAUNT_HIT_THROWING_KNIFE, this->ubID); + PossiblyStartEnemyTaunt(ubAttackerID, TAUNT_HIT_THROWING_KNIFE, this->ubID); } } } @@ -6395,12 +6395,12 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 if ( Item[usWeaponIndex].usItemClass & IC_EXPLOSV || ubReason == TAKE_DAMAGE_EXPLOSION ) { PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_EXPLOSION, ubAttackerID ); - //PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_EXPLOSION, this ); + //PossiblyStartEnemyTaunt( ubAttackerID, TAUNT_HIT_EXPLOSION, this ); } else if ( Item[usWeaponIndex].usItemClass & IC_TENTACLES ) { PossiblyStartEnemyTaunt( this, TAUNT_GOT_HIT_TENTACLES, ubAttackerID ); - //PossiblyStartEnemyTaunt( MercPtrs[ubAttackerID], TAUNT_HIT_TENTACLES, this ); + //PossiblyStartEnemyTaunt( ubAttackerID, TAUNT_HIT_TENTACLES, this ); } } if ( Item[usWeaponIndex].usItemClass & IC_PUNCH ) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index a3f90e4d..fa0da17b 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1670,7 +1670,7 @@ public: void EVENT_SetSoldierDirection( UINT16 usNewDirection ); void EVENT_SetSoldierDesiredDirection( UINT16 usNewDirection ); void EVENT_FireSoldierWeapon( INT32 sTargetGridNo ); - void EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGridNo ); + void EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 ubDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGridNo ); void EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirection ); void EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirection ); void EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection ); From 23af6b6f3f767eae05df1064efe8d75196110b14 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:47:14 +0200 Subject: [PATCH 081/571] SoldierTakeDamage & SoldierTakeDelayedDamage to SoldierID --- Tactical/Soldier Control.cpp | 46 ++++++++++++++++++------------------ Tactical/Soldier Control.h | 4 ++-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 617facce..a962a750 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -9968,12 +9968,12 @@ void HandleTakeDamageDeath( SOLDIERTYPE *pSoldier, UINT8 bOldLife, UINT8 ubReaso } -UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, UINT16 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ) +UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, SoldierID ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ) { #ifdef JA2BETAVERSION if ( is_networked ) { CHAR tmpMPDbgString[512]; - sprintf( tmpMPDbgString, "SoldierTakeDamage ( bHeight : %i , sLifeDeduct : %i , sBreathLoss : %i , ubReason : %i , ubAttacker : %i , sSourceGrid : %i , sSubsequent : %i , fShowDamage : %i )\n", bHeight, sLifeDeduct, sBreathLoss, ubReason, ubAttacker, sSourceGrid, sSubsequent, fShowDamage ); + sprintf( tmpMPDbgString, "SoldierTakeDamage ( bHeight : %i , sLifeDeduct : %i , sBreathLoss : %i , ubReason : %i , ubAttacker : %i , sSourceGrid : %i , sSubsequent : %i , fShowDamage : %i )\n", bHeight, sLifeDeduct, sBreathLoss, ubReason, ubAttacker.i, sSourceGrid, sSubsequent, fShowDamage ); MPDebugMsg( tmpMPDbgString ); } #endif @@ -9988,24 +9988,24 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr this->ubLastDamageReason = ubReason; // Flugente: dynamic opinions - if (ubAttacker != NOBODY && MercPtrs[ubAttacker] ) + if (ubAttacker < NOBODY) { if (gGameExternalOptions.fDynamicOpinions) { - AddOpinionEvent(this->ubProfile, MercPtrs[ubAttacker]->ubProfile, OPINIONEVENT_FRIENDLYFIRE); + AddOpinionEvent(this->ubProfile, ubAttacker->ubProfile, OPINIONEVENT_FRIENDLYFIRE); // if this is a civilian, other mercs can complain about mercs shooting innocents // Flugente: dynamic opinions: if this guy is not hostile towards us, then some mercs will complain about killing civilians - if ((this->bTeam != OUR_TEAM) && (this->aiData.bNeutral || this->bSide == MercPtrs[ubAttacker]->bSide)) + if ((this->bTeam != OUR_TEAM) && (this->aiData.bNeutral || this->bSide == ubAttacker->bSide)) { // not for killing animals though... if (this->ubBodyType != CROW && this->ubBodyType != COW) - HandleDynamicOpinionChange(MercPtrs[ubAttacker], OPINIONEVENT_CIV_ATTACKER, TRUE, TRUE); + HandleDynamicOpinionChange(ubAttacker, OPINIONEVENT_CIV_ATTACKER, TRUE, TRUE); } } // if we are a turncoat, lose the flag if we were attacked by player forces - if ( (this->usSoldierFlagMask2 & SOLDIER_TURNCOAT) && MercPtrs[ubAttacker]->bSide == 0 ) + if ( (this->usSoldierFlagMask2 & SOLDIER_TURNCOAT) && ubAttacker->bSide == 0 ) { this->usSoldierFlagMask2 &= ~SOLDIER_TURNCOAT; @@ -10049,9 +10049,9 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr // if we have equipped a riot shield and are being attacked in melee, ignore damage from some directions if ( ubReason == TAKE_DAMAGE_BLADE || ubReason == TAKE_DAMAGE_HANDTOHAND || ubReason == TAKE_DAMAGE_TENTACLES ) { - if ( ubAttacker != NOBODY && MercPtrs[ubAttacker] ) + if ( ubAttacker < NOBODY ) { - UINT8 attackdir_inverse = GetDirectionToGridNoFromGridNo( this->sGridNo, MercPtrs[ubAttacker]->sGridNo ); + UINT8 attackdir_inverse = GetDirectionToGridNoFromGridNo( this->sGridNo, ubAttacker->sGridNo ); // if the shield faces the direction of the attacker, we block the attack if ( attackdir_inverse == this->ubDirection || attackdir_inverse == gOneCCDirection[this->ubDirection] || attackdir_inverse == gOneCDirection[this->ubDirection] ) @@ -10107,8 +10107,8 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr HandleTakeDamageDeath( this, bOldLife, ubReason ); // add to our records. - if ( ubAttacker != NOBODY && MercPtrs[ubAttacker] && MercPtrs[ubAttacker]->ubProfile != NO_PROFILE ) - gMercProfiles[MercPtrs[ubAttacker]->ubProfile].records.usDamageDealt += sLifeDeduct; + if ( ubAttacker < NOBODY && ubAttacker->ubProfile != NO_PROFILE ) + gMercProfiles[ubAttacker->ubProfile].records.usDamageDealt += sLifeDeduct; if ( this->ubProfile != NO_PROFILE ) gMercProfiles[this->ubProfile].records.usDamageTaken += sLifeDeduct; @@ -10174,7 +10174,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr } else { - sReductionFactor = 4 + PythSpacesAway( MercPtrs[ubAttacker]->sGridNo, this->sGridNo ) / 2; + sReductionFactor = 4 + PythSpacesAway( ubAttacker->sGridNo, this->sGridNo ) / 2; } break; } @@ -10280,8 +10280,8 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr } // add to our records. - if ( ubAttacker != NOBODY && MercPtrs[ubAttacker] && MercPtrs[ubAttacker]->ubProfile != NO_PROFILE ) - gMercProfiles[MercPtrs[ubAttacker]->ubProfile].records.usDamageDealt += sLifeDeduct; + if ( ubAttacker < NOBODY && ubAttacker->ubProfile != NO_PROFILE ) + gMercProfiles[ubAttacker->ubProfile].records.usDamageDealt += sLifeDeduct; if ( this->ubProfile != NO_PROFILE ) gMercProfiles[this->ubProfile].records.usDamageTaken += sLifeDeduct; @@ -10304,8 +10304,8 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr // Flugente we might get a disease from this... if ( gGameExternalOptions.fDisease && sLifeDeduct > 0 ) { - if ( ubAttacker != NOBODY && MercPtrs[ubAttacker] && CREATURE_OR_BLOODCAT( MercPtrs[ubAttacker] ) ) - HandlePossibleInfection( this, MercPtrs[ubAttacker], INFECTION_TYPE_WOUND_ANIMAL ); + if ( ubAttacker < NOBODY && CREATURE_OR_BLOODCAT( ubAttacker ) ) + HandlePossibleInfection( this, ubAttacker, INFECTION_TYPE_WOUND_ANIMAL ); if ( ubReason == TAKE_DAMAGE_TENTACLES ) HandlePossibleInfection( this, NULL, INFECTION_TYPE_WOUND_ANIMAL ); @@ -10577,12 +10577,12 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr if ( ubAttacker != NOBODY ) { // don't give exp for hitting friends! - if ( (MercPtrs[ubAttacker]->bTeam == gbPlayerNum) && (this->bTeam != gbPlayerNum) ) + if ( (ubAttacker->bTeam == gbPlayerNum) && (this->bTeam != gbPlayerNum) ) { if ( ubReason == TAKE_DAMAGE_EXPLOSION ) { // EXPLOSIVES GAIN (combLoss): Causing wounds in battle - StatChange( MercPtrs[ubAttacker], EXPLODEAMT, (UINT16)(10 * ubCombinedLoss), FROM_FAILURE ); + StatChange( ubAttacker, EXPLODEAMT, (UINT16)(10 * ubCombinedLoss), FROM_FAILURE ); } /* else if ( ubReason == TAKE_DAMAGE_GUNFIRE ) @@ -10630,7 +10630,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr } } - if ( (ubAttacker != NOBODY) && (Menptr[ubAttacker].bTeam == OUR_TEAM) && (this->ubProfile != NO_PROFILE) && gMercProfiles[this->ubProfile].Type == PROFILETYPE_RPC || + if ( (ubAttacker != NOBODY) && (ubAttacker->bTeam == OUR_TEAM) && (this->ubProfile != NO_PROFILE) && gMercProfiles[this->ubProfile].Type == PROFILETYPE_RPC || gMercProfiles[this->ubProfile].Type == PROFILETYPE_NPC ) { gMercProfiles[this->ubProfile].ubMiscFlags |= PROFILE_MISC_FLAG_WOUNDEDBYPLAYER; @@ -10655,13 +10655,13 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr #ifdef JA2UB //if the attacker is MORRIS, AND he didnt kill the person - if ( Menptr[ubAttacker].ubProfile == MORRIS_UB ) //MORRIS + if ( ubAttacker->ubProfile == MORRIS_UB ) //MORRIS { //if the soldier is hurt, but not dead if ( this->stats.bLife < bOldLife && this->stats.bLife > 0 ) { //if he hasnt said his quote #1 before - if ( !(Menptr[ubAttacker].usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_THOUGHT_KILLED_YOU) ) + if ( !(ubAttacker->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_THOUGHT_KILLED_YOU) ) { //said a flag so morris can say this quote next turn gJa25SaveStruct.fMorrisToSayHurtPlayerQuoteNextTurn = TRUE; @@ -10675,7 +10675,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr else if ( gJa25SaveStruct.fMorrisToSayHurtPlayerQuoteNextTurn && gJa25SaveStruct.ubPlayerMorrisHurt == this->ubProfile && this->stats.bLife <= 0 && - !(Menptr[ubAttacker].usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_THOUGHT_KILLED_YOU) ) + !(ubAttacker->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_THOUGHT_KILLED_YOU) ) { //said a flag so morris can say this quote next turn gJa25SaveStruct.fMorrisToSayHurtPlayerQuoteNextTurn = FALSE; @@ -10705,7 +10705,7 @@ UINT8 SOLDIERTYPE::SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBr return(ubCombinedLoss); } -void SOLDIERTYPE::SoldierTakeDelayedDamage(INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, UINT8 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage) +void SOLDIERTYPE::SoldierTakeDelayedDamage(INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathLoss, UINT8 ubReason, SoldierID ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage) { delayedDamageFunction = [this, bHeight, sLifeDeduct, sBreathLoss, ubReason, ubAttacker, sSourceGrid, sSubsequent, fShowDamage]() { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index fa0da17b..f890d694 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1711,10 +1711,10 @@ public: void ChangeSoldierStance( UINT8 ubDesiredStance ); void StopSoldier( void ); void ReviveSoldier( void ); - UINT8 SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, UINT16 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ); + UINT8 SoldierTakeDamage( INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, SoldierID ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage ); // anv: resolve damage with delay, e.g. damage applied mid movement that would cause issues with world data if applied immediately - void SoldierTakeDelayedDamage(INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, UINT8 ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage); + void SoldierTakeDelayedDamage(INT8 bHeight, INT16 sLifeDeduct, INT16 sBreathDeduct, UINT8 ubReason, SoldierID ubAttacker, INT32 sSourceGrid, INT16 sSubsequent, BOOLEAN fShowDamage); void ResolveDelayedDamage(); // Palette functions for soldiers From 41fc407de698a2e3bc0011f6e252b4bba8a01cb5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:55:51 +0200 Subject: [PATCH 082/571] Convert TacticalRemoveSoldier to SoldierID --- Tactical/Soldier Create.cpp | 12 ++++-------- Tactical/Soldier Create.h | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index f54fc3d5..ae841fb4 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -2148,12 +2148,10 @@ void InitSoldierStruct( SOLDIERTYPE *pSoldier ) } -BOOLEAN InternalTacticalRemoveSoldier( UINT16 usSoldierIndex, BOOLEAN fRemoveVehicle ) +BOOLEAN InternalTacticalRemoveSoldier( SoldierID usSoldierIndex, BOOLEAN fRemoveVehicle ) { - SOLDIERTYPE * pSoldier; - // Check range of index given - if ( usSoldierIndex < 0 || usSoldierIndex > TOTAL_SOLDIERS-1 ) + if ( usSoldierIndex >= NOBODY ) { // Set debug message @@ -2171,9 +2169,7 @@ BOOLEAN InternalTacticalRemoveSoldier( UINT16 usSoldierIndex, BOOLEAN fRemoveVeh gfUISelectiveTargetFound = FALSE; } - pSoldier = MercPtrs[ usSoldierIndex ]; - - return TacticalRemoveSoldierPointer( pSoldier, fRemoveVehicle ); + return TacticalRemoveSoldierPointer(usSoldierIndex, fRemoveVehicle ); } BOOLEAN TacticalRemoveSoldierPointer( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveVehicle ) @@ -2244,7 +2240,7 @@ BOOLEAN TacticalRemoveSoldierPointer( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveVehi return( TRUE ); } -BOOLEAN TacticalRemoveSoldier( UINT16 usSoldierIndex ) +BOOLEAN TacticalRemoveSoldier( SoldierID usSoldierIndex ) { return( InternalTacticalRemoveSoldier( usSoldierIndex, TRUE ) ); } diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index d8791d30..03d42673 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -451,7 +451,7 @@ public: //Original functions currently used throughout the game. -BOOLEAN TacticalRemoveSoldier( UINT16 usSoldierIndex ); +BOOLEAN TacticalRemoveSoldier( SoldierID usSoldierIndex ); BOOLEAN TacticalRemoveSoldierPointer( SOLDIERTYPE *pSoldier, BOOLEAN fRemoveVehicle ); INT8 CalcDifficultyModifier( UINT8 ubSoldierClass ); @@ -562,7 +562,7 @@ void GeneratePaletteForSoldier( SOLDIERTYPE *pSoldier, UINT8 ubSoldierClass, UIN void QuickCreateProfileMerc( INT8 bTeam, UINT8 ubProfileID ); -BOOLEAN InternalTacticalRemoveSoldier( UINT16 usSoldierIndex, BOOLEAN fRemoveVehicle ); +BOOLEAN InternalTacticalRemoveSoldier( SoldierID usSoldierIndex, BOOLEAN fRemoveVehicle ); //SPECIAL! Certain events in the game can cause profiled NPCs to become enemies. The two cases are //adding Mike and Iggy. We will only add one NPC in any given combat and the conditions for setting @@ -600,4 +600,4 @@ INT32 ChooseHairColor( UINT8 usBodyType, INT32 skin ); // Flugente: set palettes for vest/shirt void SetClothes( SOLDIERTYPE* pSoldier, INT8 aVest, INT8 aPants, INT8 aHair = -1, INT8 aSkin = -1 ); -#endif \ No newline at end of file +#endif From 98c18495c6599783afb5c5494569b50d046d3b27 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:58:16 +0200 Subject: [PATCH 083/571] Update GENERAL_SAVE_INFO::sContractRehireSoldierID to SoldierID --- Ja2/SaveLoadGame.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 3d634441..ab84c449 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -296,12 +296,12 @@ typedef struct - BOOLEAN fSkyriderEmptyHelpGiven; - BOOLEAN fEnterMapDueToContract; + BOOLEAN fSkyriderEmptyHelpGiven; + BOOLEAN fEnterMapDueToContract; UINT8 ubHelicopterHitsTaken; UINT8 ubQuitType; - BOOLEAN fSkyriderSaidCongratsOnTakingSAM; - INT16 sContractRehireSoldierID; + BOOLEAN fSkyriderSaidCongratsOnTakingSAM; + SoldierID sContractRehireSoldierID; GAME_OPTIONS GameOptions; @@ -8505,7 +8505,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) if( pContractReHireSoldier != NULL ) sGeneralInfo.sContractRehireSoldierID = pContractReHireSoldier->ubID; else - sGeneralInfo.sContractRehireSoldierID = -1; + sGeneralInfo.sContractRehireSoldierID = NOBODY; memcpy( &sGeneralInfo.GameOptions, &gGameOptions, sizeof( GAME_OPTIONS ) ); #ifndef BMP_RANDOM//dnl ch55 111009 @@ -8784,7 +8784,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubHelicopterHitsTaken, sizeof(sGeneralInfo.ubHelicopterHitsTaken), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.ubQuitType, sizeof(sGeneralInfo.ubQuitType), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.fSkyriderSaidCongratsOnTakingSAM, sizeof(sGeneralInfo.fSkyriderSaidCongratsOnTakingSAM), sizeof(BOOLEAN), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sContractRehireSoldierID, sizeof(sGeneralInfo.sContractRehireSoldierID), sizeof(INT16), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.sContractRehireSoldierID, sizeof(sGeneralInfo.sContractRehireSoldierID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.GameOptions, sizeof(sGeneralInfo.GameOptions), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.uiSeedNumber, sizeof(sGeneralInfo.uiSeedNumber), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &sGeneralInfo.uiBaseJA2Clock, sizeof(sGeneralInfo.uiBaseJA2Clock), sizeof(UINT32), numBytesRead); @@ -9045,10 +9045,10 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) ubQuitType = sGeneralInfo.ubQuitType; //if the soldier id is valid - if( sGeneralInfo.sContractRehireSoldierID == -1 ) + if( sGeneralInfo.sContractRehireSoldierID == NOBODY ) pContractReHireSoldier = NULL; else - pContractReHireSoldier = &Menptr[ sGeneralInfo.sContractRehireSoldierID ]; + pContractReHireSoldier = sGeneralInfo.sContractRehireSoldierID; memcpy( &gGameOptions, &sGeneralInfo.GameOptions, sizeof( GAME_OPTIONS ) ); #ifndef BMP_RANDOM//dnl ch55 111009 From 3ff4cc0c19848ae9f05c61f6036362c247f09b21 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 01:22:20 +0200 Subject: [PATCH 084/571] GENERAL_SAVE_INFO members to SoldierID --- Ja2/SaveLoadGame.cpp | 18 +++++++++--------- Strategic/LuaInitNPCs.cpp | 2 +- Tactical/Boxing.cpp | 40 +++++++++++++++++++-------------------- Tactical/Boxing.h | 18 +++++++++--------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index ab84c449..9b626576 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -232,7 +232,7 @@ typedef struct BOOLEAN fHavePurchasedItemsFromTony; //The selected soldier in tactical - UINT16 usSelectedSoldier; + SoldierID usSelectedSoldier; // The x and y scroll position INT16 sRenderCenterX; @@ -313,7 +313,7 @@ typedef struct INT16 sCurInterfacePanel; - UINT16 ubSMCurrentMercID; + SoldierID ubSMCurrentMercID; BOOLEAN fFirstTimeInMapScreen; @@ -321,9 +321,9 @@ typedef struct BOOLEAN fDisableMapInterfaceDueToBattle; - INT32 sBoxerGridNo[ NUM_BOXERS ]; - UINT16 ubBoxerID[ NUM_BOXERS ]; - BOOLEAN fBoxerFought[ NUM_BOXERS ]; + INT32 sBoxerGridNo[ NUM_BOXERS ]; + SoldierID ubBoxerID[ NUM_BOXERS ]; + BOOLEAN fBoxerFought[ NUM_BOXERS ]; BOOLEAN fHelicopterDestroyed; //if the chopper is destroyed BOOLEAN fShowMapScreenHelpText; //If true, displays help in mapscreen @@ -341,8 +341,8 @@ typedef struct BOOLEAN ubPlayerProgressSkyriderLastCommentedOn; - BOOLEAN gfMeanwhileTryingToStart; - BOOLEAN gfInMeanwhile; + BOOLEAN gfMeanwhileTryingToStart; + BOOLEAN gfInMeanwhile; // list of dead guys for squads...in id values->-1 means no one home INT16 sDeadMercs[ NUMBER_OF_SQUADS ][ NUMBER_OF_SOLDIERS_PER_SQUAD ]; @@ -8536,7 +8536,7 @@ BOOLEAN SaveGeneralInfo( HWFILE hFile ) // Save boxing info memcpy( &sGeneralInfo.sBoxerGridNo, &gsBoxerGridNo, NUM_BOXERS * sizeof( INT32 ) ); - memcpy( &sGeneralInfo.ubBoxerID, &gubBoxerID, NUM_BOXERS * sizeof( INT8 ) ); + memcpy( &sGeneralInfo.ubBoxerID, &gubBoxerID, NUM_BOXERS * sizeof( UINT16 ) ); memcpy( &sGeneralInfo.fBoxerFought, &gfBoxerFought, NUM_BOXERS * sizeof( BOOLEAN ) ); //Save the helicopter status @@ -9068,7 +9068,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) if( sGeneralInfo.ubSMCurrentMercID == NOBODY) gpSMCurrentMerc = NULL; else - gpSMCurrentMerc = &Menptr[ sGeneralInfo.ubSMCurrentMercID ]; + gpSMCurrentMerc = sGeneralInfo.ubSMCurrentMercID; //Set the interface panel to the team panel ShutdownCurrentPanel( ); diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index e5634f6d..b7a002ab 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -3601,7 +3601,7 @@ static int l_gubBoxerID(lua_State *L) if ( n >= 2 ) { UINT8 val = lua_tointeger( L, 1 ); - UINT8 val2 = lua_tointeger( L, 2 ); + UINT16 val2 = lua_tointeger( L, 2 ); if (val <= 2) { diff --git a/Tactical/Boxing.cpp b/Tactical/Boxing.cpp index bb161ba6..b48a4447 100644 --- a/Tactical/Boxing.cpp +++ b/Tactical/Boxing.cpp @@ -23,13 +23,13 @@ #include "message.h" #include "GameSettings.h" // added by SANDRO -INT32 gsBoxerGridNo[ NUM_BOXERS ] = { 11393, 11233, 11073 }; -UINT16 gubBoxerID[ NUM_BOXERS ] = { NOBODY, NOBODY, NOBODY }; -BOOLEAN gfBoxerFought[ NUM_BOXERS ] = { FALSE, FALSE, FALSE }; -BOOLEAN gfLastBoxingMatchWonByPlayer = FALSE; -UINT8 gubBoxingMatchesWon = 0; -UINT8 gubBoxersRests = 0; -BOOLEAN gfBoxersResting = FALSE; +INT32 gsBoxerGridNo[ NUM_BOXERS ] = { 11393, 11233, 11073 }; +SoldierID gubBoxerID[ NUM_BOXERS ] = { NOBODY, NOBODY, NOBODY }; +BOOLEAN gfBoxerFought[ NUM_BOXERS ] = { FALSE, FALSE, FALSE }; +BOOLEAN gfLastBoxingMatchWonByPlayer = FALSE; +UINT8 gubBoxingMatchesWon = 0; +UINT8 gubBoxersRests = 0; +BOOLEAN gfBoxersResting = FALSE; extern void RecalculateOppCntsDueToBecomingNeutral( SOLDIERTYPE * pSoldier ); @@ -326,8 +326,8 @@ void CountPeopleInBoxingRingAndDoActions( void ) BOOLEAN CheckOnBoxers( void ) { - UINT32 uiLoop; - UINT16 ubID; + UINT32 uiLoop; + SoldierID ubID; // repick boxer IDs every time if ( gubBoxerID[0] == NOBODY ) @@ -337,15 +337,15 @@ BOOLEAN CheckOnBoxers( void ) { ubID = WhoIsThere2( gsBoxerGridNo[ uiLoop ], 0 ); - // WANNE: Safty check! + // WANNE: Safety check! if (ubID < TOTAL_SOLDIERS) { - if ( FindObjClass( MercPtrs[ ubID ], IC_WEAPON ) == NO_SLOT && - IS_MERC_BODY_TYPE( MercPtrs[ ubID ] ) ) + if ( FindObjClass( ubID, IC_WEAPON ) == NO_SLOT && + IS_MERC_BODY_TYPE( ubID ) ) { // no weapon and not a civilian so this guy is a boxer gubBoxerID[ uiLoop ] = ubID; - DebugQuestInfo(String("CheckOnBoxers: set gubBoxerID[%d] %d", ubID, gubBoxerID[uiLoop])); + DebugQuestInfo(String("CheckOnBoxers: set gubBoxerID[%d] to %d", uiLoop, ubID.i)); } } } @@ -375,8 +375,8 @@ BOOLEAN BoxerExists( void ) BOOLEAN PickABoxer( void ) { - UINT32 uiLoop; - SOLDIERTYPE* pBoxer; + UINT32 uiLoop; + SOLDIERTYPE *pBoxer; for( uiLoop = 0; uiLoop < NUM_BOXERS; ++uiLoop ) { @@ -385,11 +385,11 @@ BOOLEAN PickABoxer( void ) if ( gfBoxerFought[ uiLoop ] ) { // pathetic attempt to prevent multiple AI boxers - MercPtrs[ gubBoxerID[ uiLoop ] ]->DeleteBoxingFlag(); + gubBoxerID[ uiLoop ]->DeleteBoxingFlag(); } else { - pBoxer = MercPtrs[ gubBoxerID[ uiLoop ] ]; + pBoxer = gubBoxerID[ uiLoop ]; // pick this boxer! if ( pBoxer->bActive && pBoxer->bInSector && pBoxer->stats.bLife >= OKLIFE ) { @@ -446,7 +446,7 @@ BOOLEAN BoxerAvailable( void ) { if ( gubBoxerID[ ubLoop ] != NOBODY && !gfBoxerFought[ ubLoop ] ) { - if( MercPtrs[ gubBoxerID[ ubLoop ] ]->bActive && MercPtrs[ gubBoxerID[ ubLoop ] ]->bInSector && MercPtrs[ gubBoxerID[ ubLoop ] ]->stats.bLife >= OKLIFE ) + if( gubBoxerID[ ubLoop ]->bActive && gubBoxerID[ ubLoop ]->bInSector && gubBoxerID[ ubLoop ]->stats.bLife >= OKLIFE ) return( TRUE ); } } @@ -458,13 +458,13 @@ BOOLEAN BoxerAvailable( void ) // SEQUEL FIGHT. Maybe we could check Kingpin's location instead! UINT8 BoxersAvailable( void ) { - UINT8 ubCount = 0; + UINT8 ubCount = 0; for (UINT8 ubLoop = 0; ubLoop < NUM_BOXERS; ++ubLoop) { if ( gubBoxerID[ ubLoop ] != NOBODY && !gfBoxerFought[ ubLoop ] ) { - if( MercPtrs[ gubBoxerID[ ubLoop ] ]->bActive && MercPtrs[ gubBoxerID[ ubLoop ] ]->bInSector && MercPtrs[ gubBoxerID[ ubLoop ] ]->stats.bLife >= OKLIFE ) + if( gubBoxerID[ ubLoop ]->bActive && gubBoxerID[ ubLoop ]->bInSector && gubBoxerID[ ubLoop ]->stats.bLife >= OKLIFE ) ++ubCount; } } diff --git a/Tactical/Boxing.h b/Tactical/Boxing.h index 4d4abf6e..8f0dd5c5 100644 --- a/Tactical/Boxing.h +++ b/Tactical/Boxing.h @@ -19,14 +19,14 @@ enum DisqualificationReasons BAD_ATTACK } ; -extern INT32 gsBoxerGridNo[ NUM_BOXERS ]; -extern UINT16 gubBoxerID[ NUM_BOXERS ]; -extern BOOLEAN gfBoxerFought[ NUM_BOXERS ]; -extern INT8 gbBoxingState; -extern BOOLEAN gfLastBoxingMatchWonByPlayer; -extern UINT8 gubBoxingMatchesWon; -extern UINT8 gubBoxersRests; -extern BOOLEAN gfBoxersResting; +extern INT32 gsBoxerGridNo[ NUM_BOXERS ]; +extern SoldierID gubBoxerID[ NUM_BOXERS ]; +extern BOOLEAN gfBoxerFought[ NUM_BOXERS ]; +extern INT8 gbBoxingState; +extern BOOLEAN gfLastBoxingMatchWonByPlayer; +extern UINT8 gubBoxingMatchesWon; +extern UINT8 gubBoxersRests; +extern BOOLEAN gfBoxersResting; extern void BoxingPlayerDisqualified( SOLDIERTYPE * pOffender, INT8 bReason ); extern BOOLEAN PickABoxer( void ); @@ -43,4 +43,4 @@ extern BOOLEAN BoxerExists( void ); extern UINT8 CountPeopleInBoxingRing( void ); extern void ClearAllBoxerFlags( void ); -#endif \ No newline at end of file +#endif From e7fe1d1cda3b708b5d2eb87bce22384ce6125593 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 11:55:57 +0200 Subject: [PATCH 085/571] Update LaptopSave.h --- Laptop/LaptopSave.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Laptop/LaptopSave.h b/Laptop/LaptopSave.h index 4f555b96..0fed6ec9 100644 --- a/Laptop/LaptopSave.h +++ b/Laptop/LaptopSave.h @@ -25,8 +25,8 @@ class SOLDIERTYPE; typedef struct { - BOOLEAN fActive; - UINT16 ubSoldierID; + BOOLEAN fActive; + SoldierID ubSoldierID; UINT8 ubMercID; INT32 iPayOutPrice; } LIFE_INSURANCE_PAYOUT; From 1cd94cda23516df002d5dae06450b38890912825 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:05:14 +0200 Subject: [PATCH 086/571] Fix inventory cloning bug (#338) - If we have a sector already loaded (eg. Drassen airport) - Squad in a different sector encounters enemies and goes to autoresolve - After pressing DONE in autoresolve screen -> we miss calling the TrashWorld() function in CheckAndHandleUnloadingOfCurrentWorld() due to battle sector not being the same as loaded sector. - Selected sector gets reset from Drassen airport to invalid values by same function - Now we have the loaded sector's whole inventory existing in gWorldItems - Enter any other sector in tactical mode and the gWorldItems gets added into its sector inventory in EnterSector() Because the TrashItems() work in a way where it only sets gWorldItems elements to not existing if it finds them in a loaded map's structure data, we will pretty much always have that original bugged out set of items present in gWorlItems and they will constantly be added to sector inventories from then on once the bug has been triggered. --- Strategic/strategicmap.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 5708dfc7..801bda22 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -6665,18 +6665,16 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( ) if ( guiCurrentScreen == AUTORESOLVE_SCREEN ) { - if ( gWorldSectorX == sBattleSectorX && gWorldSectorY == sBattleSectorY && gbWorldSectorZ == sBattleSectorZ ) - { //Yes, this is and looks like a hack. The conditions of this if statement doesn't work inside - //TrashWorld() or more specifically, TacticalRemoveSoldier() from within TrashWorld(). Because - //we are in the autoresolve screen, soldiers are internally created different (from pointers instead of - //the MercPtrs[]). It keys on the fact that we are in the autoresolve screen. So, by switching the - //screen, it'll delete the soldiers in the loaded world properly, then later on, once autoresolve is - //complete, it'll delete the autoresolve soldiers properly. As you can now see, the above if conditions - //don't change throughout this whole process which makes it necessary to do it this way. - guiCurrentScreen = MAP_SCREEN; - TrashWorld( ); - guiCurrentScreen = AUTORESOLVE_SCREEN; - } + //Yes, this is and looks like a hack. The conditions of this if statement doesn't work inside + //TrashWorld() or more specifically, TacticalRemoveSoldier() from within TrashWorld(). Because + //we are in the autoresolve screen, soldiers are internally created different (from pointers instead of + //the MercPtrs[]). It keys on the fact that we are in the autoresolve screen. So, by switching the + //screen, it'll delete the soldiers in the loaded world properly, then later on, once autoresolve is + //complete, it'll delete the autoresolve soldiers properly. As you can now see, the above if conditions + //don't change throughout this whole process which makes it necessary to do it this way. + guiCurrentScreen = MAP_SCREEN; + TrashWorld( ); + guiCurrentScreen = AUTORESOLVE_SCREEN; } else { From edb26a68fe5663b04a35b45e7ebd67c555a802c5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:25:28 +0200 Subject: [PATCH 087/571] Guard against array out of bounds access --- Tactical/Soldier Control.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index a962a750..e3675f52 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -9105,7 +9105,10 @@ void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier ) if ( pSoldier->flags.fUseMoverrideMoveSpeed ) { - pStatsSoldier = MercPtrs[pSoldier->bOverrideMoveSpeed]; + if (pSoldier->bOverrideMoveSpeed >= 0 && pSoldier->bOverrideMoveSpeed < TOTAL_SOLDIERS) + { + pStatsSoldier = MercPtrs[pSoldier->bOverrideMoveSpeed]; + } } // Only calculate if set to zero From d28d46d9740b44a29910420b67c1ef76404d6242 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:28:48 +0200 Subject: [PATCH 088/571] SOLDIERTYPE::bOverrideMoveSpeed to SoldierID --- Ja2/SaveLoadGame.cpp | 2 +- Tactical/Soldier Control.cpp | 4 ++-- Tactical/Soldier Control.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 9b626576..9e43a098 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -2312,7 +2312,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) numBytesRead = ReadFieldByField(hFile, &this->ubDoorOpeningNoise, sizeof(ubDoorOpeningNoise), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->pGroup, sizeof(pGroup), 1, numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubLeaveHistoryCode, sizeof(ubLeaveHistoryCode), sizeof(UINT8), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &this->bOverrideMoveSpeed, sizeof(bOverrideMoveSpeed), sizeof(INT8), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &this->bOverrideMoveSpeed, sizeof(bOverrideMoveSpeed), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->uiTimeSoldierWillArrive, sizeof(uiTimeSoldierWillArrive), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->bVehicleUnderRepairID, sizeof(bVehicleUnderRepairID), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->iTimeCanSignElsewhere, sizeof(iTimeCanSignElsewhere), sizeof(INT32), numBytesRead); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index e3675f52..f7b40549 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -9105,9 +9105,9 @@ void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier ) if ( pSoldier->flags.fUseMoverrideMoveSpeed ) { - if (pSoldier->bOverrideMoveSpeed >= 0 && pSoldier->bOverrideMoveSpeed < TOTAL_SOLDIERS) + if (pSoldier->bOverrideMoveSpeed < NOBODY) { - pStatsSoldier = MercPtrs[pSoldier->bOverrideMoveSpeed]; + pStatsSoldier = pSoldier->bOverrideMoveSpeed; } } diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index f890d694..d4a5ccd6 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1488,7 +1488,7 @@ public: struct GROUP *pGroup; UINT8 ubLeaveHistoryCode; - INT8 bOverrideMoveSpeed; + SoldierID bOverrideMoveSpeed; UINT32 uiTimeSoldierWillArrive; From cd720a639acbeb2b68a8115123c98e31e1708621 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 19:25:44 +0200 Subject: [PATCH 089/571] Fix Dismiss Merc not working after selecting several soldiers --- Strategic/Map Screen Interface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index b606329e..102942fc 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -471,6 +471,7 @@ void ResetSelectedListForMapScreen( void ) // WDS - make number of mercenaries, etc. be configurable // set all the entries int he selected list to false memset( fSelectedListOfMercsForMapScreen, FALSE, sizeof(fSelectedListOfMercsForMapScreen) ); + gSelectedSoldiers.clear(); // if we still have a valid dude selected if ( ( bSelectedInfoChar != -1 ) && ( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) ) From 42d5ecb923d69a736bfcc0a69c64db33f31878bc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:09:14 +0200 Subject: [PATCH 090/571] HandleLeavingOfEquipmentInCurrentSector() to SoldierID --- Strategic/Map Screen Interface.cpp | 47 +++++++++++++++++------------- Strategic/Map Screen Interface.h | 2 +- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 102942fc..797b2cd7 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -1522,22 +1522,25 @@ void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString ) // NOTE: This doesn't use the "LeaveList" system at all! -void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ) +void HandleLeavingOfEquipmentInCurrentSector( SoldierID uiMercId ) { // just drop the stuff in the current sector //INT32 iCounter = 0; INT32 sGridNo, sTempGridNo; - INT8 sectorz = Menptr[uiMercId].bSectorZ; - if ( SPY_LOCATION( Menptr[uiMercId].bAssignment ) ) + INT8 sectorz = uiMercId->bSectorZ; + if ( SPY_LOCATION( uiMercId->bAssignment ) ) sectorz = max( 0, sectorz - 10 ); - - if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || sectorz != gbWorldSectorZ ) + + const auto x = uiMercId->sSectorX; + const auto y = uiMercId->sSectorY; + + if( x != gWorldSectorX || y != gWorldSectorY || sectorz != gbWorldSectorZ ) { // ATE: Use insertion gridno if not nowhere and insertion is gridno - if ( Menptr[ uiMercId ].ubStrategicInsertionCode == INSERTION_CODE_GRIDNO && !TileIsOutOfBounds(Menptr[ uiMercId ].usStrategicInsertionData) ) + if ( uiMercId->ubStrategicInsertionCode == INSERTION_CODE_GRIDNO && !TileIsOutOfBounds(uiMercId->usStrategicInsertionData) ) { - sGridNo = Menptr[ uiMercId ].usStrategicInsertionData; + sGridNo = uiMercId->usStrategicInsertionData; } else { @@ -1548,7 +1551,7 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ) else { // ATE: Mercs can have a gridno of NOWHERE..... - sGridNo = Menptr[ uiMercId ].sGridNo; + sGridNo = uiMercId->sGridNo; if (TileIsOutOfBounds(sGridNo)) { @@ -1565,36 +1568,38 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ) } } - UINT32 invsize = Menptr[ uiMercId ].inv.size(); - UINT32 uiFoundItems = 0; - Inventory invTemporaryBeforeDrop; + Inventory &inv = uiMercId->inv; + const UINT32 invsize = inv.size(); - if( Menptr[ uiMercId ].sSectorX != gWorldSectorX || Menptr[ uiMercId ].sSectorY != gWorldSectorY || sectorz != gbWorldSectorZ ) + if( x != gWorldSectorX || y != gWorldSectorY || sectorz != gbWorldSectorZ ) { - if (fShowMapInventoryPool && Menptr[uiMercId].sSectorX == sSelMapX && Menptr[uiMercId].sSectorY == sSelMapY && Menptr[uiMercId].bSectorZ == iCurrentMapSectorZ) + if (fShowMapInventoryPool && x == sSelMapX && y == sSelMapY && uiMercId->bSectorZ == iCurrentMapSectorZ) { for (UINT32 iCounter = 0; iCounter < invsize; ++iCounter) { - if (Menptr[uiMercId].inv[iCounter].exists()) + if (inv[iCounter].exists()) { - AutoPlaceObjectInInventoryStash(&Menptr[uiMercId].inv[iCounter], Menptr[uiMercId].sGridNo, Menptr[uiMercId].pathing.bLevel); + AutoPlaceObjectInInventoryStash(&( inv[iCounter] ), uiMercId->sGridNo, uiMercId->pathing.bLevel); } } } else { + Inventory invTemporaryBeforeDrop; + UINT32 uiFoundItems = 0; + for (UINT32 iCounter = 0; iCounter < invsize; ++iCounter) { // slot found, // check if actual item - if (Menptr[uiMercId].inv[iCounter].exists() == true) + if (inv[iCounter].exists() == true) { - invTemporaryBeforeDrop[uiFoundItems] = Menptr[uiMercId].inv[iCounter]; + invTemporaryBeforeDrop[uiFoundItems] = inv[iCounter]; uiFoundItems++; } } // anv: add all items at once (less file operations = less lag) - AddItemsToUnLoadedSector(Menptr[uiMercId].sSectorX, Menptr[uiMercId].sSectorY, sectorz, sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]), Menptr[uiMercId].pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE); + AddItemsToUnLoadedSector(x, y, sectorz, sGridNo, uiFoundItems, &(invTemporaryBeforeDrop[0]), uiMercId->pathing.bLevel, WOLRD_ITEM_FIND_SWEETSPOT_FROM_GRIDNO | WORLD_ITEM_REACHABLE, 0, 1, FALSE); } } else @@ -1603,14 +1608,14 @@ void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ) { // slot found, // check if actual item - if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) + if( inv[ iCounter ].exists() == true ) { - AddItemToPool( sGridNo, &( Menptr[ uiMercId ].inv[ iCounter ] ) , 1, Menptr[ uiMercId ].pathing.bLevel, WORLD_ITEM_REACHABLE, 0 ); + AddItemToPool( sGridNo, &( inv[ iCounter ] ) , 1, uiMercId->pathing.bLevel, WORLD_ITEM_REACHABLE, 0 ); } } } - DropKeysInKeyRing( MercPtrs[ uiMercId ], sGridNo, MercPtrs[ uiMercId ]->pathing.bLevel, 1, FALSE, 0, FALSE ); + DropKeysInKeyRing( uiMercId, sGridNo, uiMercId->pathing.bLevel, 1, FALSE, 0, FALSE ); } diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 7837887f..d29fb861 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -513,7 +513,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ); void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString ); // handle leaving of equipment in sector -void HandleLeavingOfEquipmentInCurrentSector( UINT32 uiMercId ); +void HandleLeavingOfEquipmentInCurrentSector( SoldierID uiMercId ); // set up a linked list of items being dropped and post an event to later drop them void HandleMercLeavingEquipmentInDrassen( UINT32 uiMercId ); From 2918801f754db5c38d494f98f01371e4863615d9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 16 Nov 2024 20:55:08 +0200 Subject: [PATCH 091/571] AddSoldierToSector & OBJECTTYPE::soldierID changed to SoldierID --- Editor/EditorMercs.cpp | 2 +- Strategic/Map Screen Interface Map Inventory.cpp | 16 ++++++++-------- Strategic/mapscreen.cpp | 2 +- Tactical/Handle Items.cpp | 8 ++++---- Tactical/Interface Items.cpp | 2 +- Tactical/Interface Panels.cpp | 4 ++-- Tactical/Inventory Choosing.cpp | 6 +++--- Tactical/Soldier Add.cpp | 15 +++++++-------- Tactical/Soldier Add.h | 2 +- Tactical/World Items.cpp | 6 +++--- Tactical/World Items.h | 2 +- TileEngine/Explosion Control.cpp | 6 +++--- 12 files changed, 35 insertions(+), 36 deletions(-) diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index 6fb9f5b2..d53bb201 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -162,7 +162,7 @@ void AddNewItemToSelectedMercsInventory( BOOLEAN fCreate ); void RenderMercInventoryPanel(); void SetDroppableCheckboxesBasedOnMercsInventory(); -extern BOOLEAN InternalAddSoldierToSector( UINT16 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); +extern BOOLEAN InternalAddSoldierToSector( SoldierID ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ); //array which keeps track of which item is in which slot. This is dependant on the selected merc, so //these temp values must be updated when different mercs are selected, and reset when a merc detailed diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index d7f8d043..a7fef9f1 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -201,7 +201,7 @@ INT32 iCurrentInventoryPoolPage = 0; INT32 iLastInventoryPoolPage = 0; INT32 sObjectSourceGridNo = -1;//shadooow: I don't see much of a sense in this, we have gpItemPointerSoldier and we can use gpItemPointerSoldier->sGridNo to do this, this is actually unused -INT16 sObjectSourseSoldierID = -1; +SoldierID sObjectSourseSoldierID = NOBODY; // number of unseen items in sector UINT32 uiNumberOfUnSeenItems = 0; @@ -2660,7 +2660,7 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt // anv: swap ownerships too if( pInventoryPoolList[ iSrcSlot ].soldierID == sObjectSourseSoldierID ) { - pInventoryPoolList[ iSrcSlot ].soldierID = (-1); + pInventoryPoolList[ iSrcSlot ].soldierID = NOBODY; } pInventoryPoolList[ iDestSlot ].soldierID = sObjectSourseSoldierID; } @@ -2674,10 +2674,10 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt // anv: disable soldier's ownership, as otherwise stacked backpacks would share it if( iDestSlot != (-1) && iSrcSlot != (-1) ) { - pInventoryPoolList[ iDestSlot ].soldierID = (-1); - pInventoryPoolList[ iSrcSlot ].soldierID = (-1); + pInventoryPoolList[ iDestSlot ].soldierID = NOBODY; + pInventoryPoolList[ iSrcSlot ].soldierID = NOBODY; iCurrentlyPickedUpItem = iDestSlot; - sObjectSourseSoldierID = (-1); + sObjectSourseSoldierID = NOBODY; } // stacking pInventorySlot->AddObjectsToStack(*pItemPtr); @@ -2689,9 +2689,9 @@ BOOLEAN PlaceObjectInInventoryStash( OBJECTTYPE *pInventorySlot, OBJECTTYPE *pIt // anv: swap ownerships too if( pInventoryPoolList[ iSrcSlot ].soldierID == sObjectSourseSoldierID ) { - pInventoryPoolList[ iSrcSlot ].soldierID = (-1); + pInventoryPoolList[ iSrcSlot ].soldierID = NOBODY; } - INT32 iTempSoldierID = pInventoryPoolList[ iDestSlot ].soldierID; + SoldierID iTempSoldierID = pInventoryPoolList[ iDestSlot ].soldierID; pInventoryPoolList[ iDestSlot ].soldierID = sObjectSourseSoldierID; sObjectSourseSoldierID = iTempSoldierID; iCurrentlyPickedUpItem = iDestSlot; @@ -5159,7 +5159,7 @@ void SortSectorInventoryStackAndMerge(bool ammoOnly ) for ( UINT32 uiLoop = 0; uiLoop < pInventoryPoolList.size(); uiLoop++ ) { // anv: disable soldier's ownership, as otherwise stacked backpacks would share it - pInventoryPoolList[ uiLoop ].soldierID = (-1); + pInventoryPoolList[ uiLoop ].soldierID = NOBODY; } // Run through sector inventory. diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 81a3e340..16c913bc 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -15770,7 +15770,7 @@ void ChangeSelectedInfoChar( INT16 bCharNumber, BOOLEAN fResetSelectedList ) fShowInventoryFlag = FALSE; } //shadooow: this resets the current highlight item selection to be redrawn again - HandleCompatibleAmmoUI(MercPtrs[gCharactersList[bCharNumber].usSolID], NO_SLOT, FALSE); + HandleCompatibleAmmoUI(gCharactersList[bCharNumber].usSolID, NO_SLOT, FALSE); if (gpItemPointer != NULL) { gfCheckForMouseOverItem = TRUE; diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 95917894..2a1a1ba5 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -4292,7 +4292,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pTempItemPool->iItemIndex].object.ubNumberOfObjects, MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else @@ -4303,7 +4303,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else @@ -4413,7 +4413,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].object.ubNumberOfObjects, MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else @@ -4424,7 +4424,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != -1 && + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); else diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 3cfe7e15..92ef5863 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -11478,7 +11478,7 @@ void RenderItemPickupMenu( ) !gfStealing && Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID != -1 && + gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID != NOBODY && MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]) //swprintf(pStr, L"%s (%s)", ShortItemNames[pObject->usItem], MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); swprintf(pStr, L"(%s)", MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index defdd7d7..a397d28d 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -4209,7 +4209,7 @@ BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) { if(gWorldItems[wi].soldierID == pSoldier->ubID) { - gWorldItems[wi].soldierID = -1; + gWorldItems[wi].soldierID = NOBODY; } } MoveItemToLBEItem( pSoldier, BPACKPOCKPOS ); @@ -4231,7 +4231,7 @@ BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) //CHRISL: There's the remote chance that a non-LBE item might get associated with a merc. If that happens, we can // have a CTD, so lets resolve that here. if(Item[gWorldItems[wi].object.usItem].usItemClass != IC_LBEGEAR) - gWorldItems[wi].soldierID = -1; + gWorldItems[wi].soldierID = NOBODY; if(gWorldItems[wi].soldierID == pSoldier->ubID && gWorldItems[wi].fExists == TRUE && Item[gWorldItems[wi].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[wi].object.usItem].ubClassIndex].lbeClass == BACKPACK) { for (int x = 0; x < gWorldItems[wi].object.ubNumberOfObjects; ++x) { diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index 4bab504f..eee44c60 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -3901,7 +3901,7 @@ void MoveOneMilitiaEquipmentSet(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, pWorldItem_tmp[uiCount].usFlags = WORLD_ITEM_REACHABLE; pWorldItem_tmp[uiCount].bVisible = 1; pWorldItem_tmp[uiCount].bRenderZHeightAboveLevel = 0; - pWorldItem_tmp[uiCount].soldierID = -1; + pWorldItem_tmp[uiCount].soldierID = NOBODY; pWorldItem_tmp[uiCount].object = tmp.Inv[ i ]; } } @@ -4647,7 +4647,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI pWorldItem[uiCount].usFlags = WORLD_ITEM_REACHABLE; pWorldItem[uiCount].bVisible = 1; pWorldItem[uiCount].bRenderZHeightAboveLevel = 0; - pWorldItem[uiCount].soldierID = -1; + pWorldItem[uiCount].soldierID = NOBODY; pWorldItem[uiCount].object = newAmmoObj; fNewMagCreated = FALSE; @@ -4686,7 +4686,7 @@ void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDI pWorldItem_tmp[uiCount].usFlags = WORLD_ITEM_REACHABLE; pWorldItem_tmp[uiCount].bVisible = 1; pWorldItem_tmp[uiCount].bRenderZHeightAboveLevel = 0; - pWorldItem_tmp[uiCount].soldierID = -1; + pWorldItem_tmp[uiCount].soldierID = NOBODY; pWorldItem_tmp[uiCount].object = newAmmoObj; fNewMagCreated = FALSE; diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index e5c9ec68..ef769a86 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1135,17 +1135,16 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U return(sGridNo); } -BOOLEAN InternalAddSoldierToSector(UINT16 ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ) +BOOLEAN InternalAddSoldierToSector(SoldierID ubID, BOOLEAN fCalculateDirection, BOOLEAN fUseAnimation, UINT16 usAnimState, UINT16 usAnimCode ) { - UINT8 ubDirection = 0; - UINT8 ubCalculatedDirection = 0; - SOLDIERTYPE *pSoldier = 0; - INT32 sGridNo = NOWHERE; - INT32 sExitGridNo = NOWHERE; + UINT8 ubDirection = 0; + UINT8 ubCalculatedDirection = 0; + INT32 sGridNo = NOWHERE; + INT32 sExitGridNo = NOWHERE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("InternalAddSoldierToSector")); - pSoldier = MercPtrs[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; if ( pSoldier->bActive ) { @@ -1332,7 +1331,7 @@ BOOLEAN InternalAddSoldierToSector(UINT16 ubID, BOOLEAN fCalculateDirection, BOO return( FALSE ); } -BOOLEAN AddSoldierToSector( UINT16 ubID ) +BOOLEAN AddSoldierToSector( SoldierID ubID ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddSoldierToSector")); return( InternalAddSoldierToSector( ubID, TRUE, FALSE, 0 , 0) ); diff --git a/Tactical/Soldier Add.h b/Tactical/Soldier Add.h index 4d4ba01b..32aa90dd 100644 --- a/Tactical/Soldier Add.h +++ b/Tactical/Soldier Add.h @@ -30,7 +30,7 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U // Adds a soldier ( already created in mercptrs[] array )! // Finds a good placement based on data in the loaded sector and if they are enemy's or not, etc... -BOOLEAN AddSoldierToSector( UINT16 ubID ); +BOOLEAN AddSoldierToSector( SoldierID ubID ); BOOLEAN AddSoldierToSectorNoCalculateDirection( UINT16 ubID ); diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index f2bac848..adcb9671 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -256,7 +256,7 @@ void WORLDITEM::initialize() this->bRenderZHeightAboveLevel = 0; this->bVisible = 0; this->ubNonExistChance = 0; - this->soldierID = -1; + this->soldierID = NOBODY; this->object.initialize(); } @@ -270,7 +270,7 @@ WORLDITEM& WORLDITEM::operator=(OLD_WORLDITEM_101& src) this->bRenderZHeightAboveLevel = src.bRenderZHeightAboveLevel; this->bVisible = src.bVisible; this->ubNonExistChance = src.ubNonExistChance; - this->soldierID = -1; + this->soldierID = NOBODY; //convert the OBJECTTYPE this->object = src.oldObject; @@ -288,7 +288,7 @@ WORLDITEM& WORLDITEM::operator=(_OLD_WORLDITEM& src)//dnl ch42 280909 bRenderZHeightAboveLevel = src.bRenderZHeightAboveLevel; bVisible = src.bVisible; ubNonExistChance = src.ubNonExistChance; - soldierID = -1; + soldierID = NOBODY; object = src.object; } return(*this); diff --git a/Tactical/World Items.h b/Tactical/World Items.h index 04a07697..cd3ae1ee 100644 --- a/Tactical/World Items.h +++ b/Tactical/World Items.h @@ -72,7 +72,7 @@ public: //Because this value is zero in the saved maps, we can't change it to 100, hence the reversal method. //This check is only performed the first time a map is loaded. Later, it is entirely skipped. UINT8 ubNonExistChance; - INT16 soldierID; + SoldierID soldierID; char endOfPod; OBJECTTYPE object; }; diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 6d3c28b2..74e67f99 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -3796,11 +3796,11 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemo WORLDITEM wi = gWorldItems[iWorldIndex]; if (wi.fExists) { - INT16 soldierID = wi.soldierID; // bomb's owner - if (soldierID == -1) + SoldierID soldierID = wi.soldierID; // bomb's owner + if (soldierID == NOBODY) soldierID = wi.object[0]->data.misc.ubBombOwner - 2; // undo the hack - if (IsOurSoldier(gubPersonToSetOffExplosions) || IsOurSoldier(soldierID)) + if (IsOurSoldier(gubPersonToSetOffExplosions) || IsOurSoldier((SOLDIERTYPE*)soldierID)) { // we set off the bomb (could be failed disarm) or we own it, tell the other clients we are setting it off send_detonate_explosive(iWorldIndex,gubPersonToSetOffExplosions); From c475f9e4e6fd2407383e6ca1722e3e5b73d441ba Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:25:00 +0200 Subject: [PATCH 092/571] Convert MapScreenCharacterSt::usSolID to SoldierID --- Strategic/Assignments.cpp | 35 +- Strategic/Facilities.cpp | 12 +- .../Map Screen Interface Map Inventory.cpp | 92 +++-- Strategic/Map Screen Interface Map.cpp | 6 +- Strategic/Map Screen Interface.cpp | 53 +-- Strategic/Meanwhile.cpp | 2 +- Strategic/Town Militia.cpp | 4 +- Strategic/mapscreen.cpp | 375 +++++++++--------- Strategic/mapscreen.h | 4 +- Tactical/Interface Items.cpp | 42 +- Tactical/Interface Panels.cpp | 6 +- Tactical/Item Types.cpp | 14 +- Tactical/Merc Hiring.cpp | 2 +- Tactical/SkillMenu.cpp | 2 +- 14 files changed, 331 insertions(+), 318 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 75de1b8e..2a4aaec5 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -632,7 +632,7 @@ BOOLEAN ValidTrainingPartnerInSameSectorOnAssignmentFound( SOLDIERTYPE *pSoldier extern void AddSectorForSoldierToListOfSectorsThatCompletedMilitiaTraining( SOLDIERTYPE *pSoldier ); -extern BOOLEAN CanChangeSleepStatusForCharSlot( INT8 bCharNumber ); +extern BOOLEAN CanChangeSleepStatusForCharSlot( INT16 bCharNumber ); // only 2 trainers are allowed per sector, so this function counts the # in a guy's sector // HEADROCK HAM 3.6: Now takes an extra argument for Militia Type @@ -3106,7 +3106,7 @@ void VerifyTownTrainingIsPaidFor( void ) continue; } - pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if( pSoldier->bActive && ( pSoldier->bAssignment == TRAIN_TOWN ) ) { @@ -9643,7 +9643,8 @@ void CreateDestroyMouseRegionsForAssignmentMenu( void ) return; } - if( ( Menptr[gCharactersList[bSelectedAssignChar].usSolID].stats.bLife == 0 ) || ( Menptr[gCharactersList[bSelectedAssignChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) + + if( ( gCharactersList[bSelectedAssignChar].usSolID->stats.bLife == 0 ) || ( gCharactersList[bSelectedAssignChar].usSolID->bAssignment == ASSIGNMENT_POW ) ) { // dead guy handle menu stuff fShowRemoveMenu = fShowAssignmentMenu | fShowContractMenu; @@ -11114,7 +11115,7 @@ void DetermineWhichAssignmentMenusCanBeShown( void ) CreateDestroyMouseRegionForFacilityMenu(); CreateDestroyMouseRegionsForFacilityAssignmentMenu(); - if( ( ( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife == 0 )||( Menptr[gCharactersList[bSelectedInfoChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) && ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) ) + if( ( ( gCharactersList[ bSelectedInfoChar ].usSolID->stats.bLife == 0 )||( gCharactersList[bSelectedInfoChar].usSolID->bAssignment == ASSIGNMENT_POW ) ) && ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) ) { // show basic assignment menu ShowBox( ghRemoveMercAssignBox ); @@ -11596,7 +11597,7 @@ void CreateDestroyMouseRegionsForContractMenu( void ) return; } - if( Menptr[gCharactersList[bSelectedContractChar].usSolID].stats.bLife == 0 ) + if( gCharactersList[bSelectedContractChar].usSolID->stats.bLife == 0 ) { // dead guy handle menu stuff @@ -12825,7 +12826,7 @@ void ContractMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( (guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { - pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; } else { @@ -18406,7 +18407,7 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn if( gCharactersList[ iCounter ].fValid ) { // get the soldier pointer - pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if( pSoldier->bActive == FALSE ) { @@ -18807,7 +18808,7 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) { if( gCharactersList[ bSelectedAssignChar ].fValid == TRUE ) { - pSelectedSoldier = &Menptr[ gCharactersList[ bSelectedAssignChar ].usSolID ]; + pSelectedSoldier = gCharactersList[ bSelectedAssignChar ].usSolID; } } @@ -18819,9 +18820,9 @@ void SetAssignmentForList( INT8 bAssignment, INT8 bParam ) if( ( gCharactersList[ iCounter ].fValid ) && ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) && ( iCounter != bSelectedAssignChar ) && - !(Menptr[ gCharactersList[ iCounter ].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + !(gCharactersList[ iCounter ].usSolID->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // assume it's NOT gonna work fItWorked = FALSE; @@ -19616,13 +19617,13 @@ SOLDIERTYPE *GetSelectedAssignSoldier( BOOLEAN fNullOK, BOOLEAN fReturnVehicleDr if( ( bSelectedAssignChar >= 0 ) && ( bSelectedAssignChar < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) && ( gCharactersList[ bSelectedAssignChar ].fValid ) ) { - pSoldier = &Menptr[ gCharactersList[ bSelectedAssignChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedAssignChar ].usSolID; } } else { // tactical version - pSoldier = &Menptr[ gusUIFullTargetID ]; + pSoldier = gusUIFullTargetID; } if ( !fNullOK ) @@ -20079,7 +20080,7 @@ BOOLEAN FindAnyAwakeTrainers( SOLDIERTYPE *pTrainee ) while(gCharactersList[ubCounter].fValid) { - pTrainer = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pTrainer = gCharactersList[ ubCounter ].usSolID; // Is trainer awake? if (pTrainer->bAssignment == TRAIN_TEAMMATE && pTrainer->bTrainStat == pTrainee->bTrainStat && @@ -20115,7 +20116,7 @@ BOOLEAN FindAnyAwakeTrainees( SOLDIERTYPE *pTrainer ) while(gCharactersList[ubCounter].fValid) { - pTrainee = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pTrainee = gCharactersList[ ubCounter ].usSolID; // Is trainee awake? if (pTrainee->bAssignment == TRAIN_BY_OTHER && pTrainee->bTrainStat == pTrainer->bTrainStat && @@ -21058,7 +21059,7 @@ INT8 CountFreeFacilitySlots( UINT8 sMapX, UINT8 sMapY, UINT8 ubFacilityType ) // Count number of people doing anything at this facility. while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character operating this facility? if( (UINT8)pSoldier->sFacilityTypeOperated == ubFacilityType && @@ -21101,7 +21102,7 @@ INT8 CountFreeFacilityAssignmentSlots( UINT8 sMapX, UINT8 sMapY, UINT8 ubFacilit // Count number of people doing this assignment at this facility. while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character operating this facility? if( (UINT8)pSoldier->sFacilityTypeOperated == ubFacilityType && @@ -21527,7 +21528,7 @@ void ResetAllExpensiveFacilityAssignments() while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character doing facility work? INT8 ubAssignmentIndex = GetSoldierFacilityAssignmentIndex( pSoldier ); diff --git a/Strategic/Facilities.cpp b/Strategic/Facilities.cpp index 52975d1a..9be31cf9 100644 --- a/Strategic/Facilities.cpp +++ b/Strategic/Facilities.cpp @@ -357,7 +357,7 @@ void UpdateStrategicDetectionLevel( ) // Run through list of player-characters while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character truly valid? if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && @@ -499,7 +499,7 @@ void UpdateSkyriderCostModifier() while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character truly valid? if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && @@ -562,7 +562,7 @@ void UpdateFacilityUsageCosts( ) while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character truly valid? if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && @@ -704,7 +704,7 @@ INT32 MineIncomeModifierFromFacility( UINT8 ubMine ) UINT8 ubCounter = 0; while (gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character truly valid? if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && @@ -1112,7 +1112,7 @@ void HandleHourlyRisks() while (gCharactersList[iCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // Is character truly valid? if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && @@ -1994,7 +1994,7 @@ INT32 GetTotalFacilityHourlyCosts( BOOLEAN fPositive ) // Run through list of player-characters while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // Is character truly valid? if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index a7fef9f1..cdfe41bd 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -683,9 +683,9 @@ BOOLEAN RenderItemInPoolSlot( INT32 iCurrentSlot, INT32 iFirstSlotOnPage ) // if the item is not reachable, or if the selected merc is not in the current sector // if( !( pInventoryPoolList[ iCurrentSlot + iFirstSlotOnPage ].usFlags & WORLD_ITEM_REACHABLE ) || - !(( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX == sSelMapX ) && - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY == sSelMapY ) && - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ == iCurrentMapSectorZ ) + !(( gCharactersList[ bSelectedInfoChar ].usSolID->sSectorX == sSelMapX ) && + ( gCharactersList[ bSelectedInfoChar ].usSolID->sSectorY == sSelMapY ) && + ( gCharactersList[ bSelectedInfoChar ].usSolID->bSectorZ == iCurrentMapSectorZ ) ) ) { //Shade the item, but only if it is an active item! @@ -1351,7 +1351,6 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) UINT16 usOldItemIndex, usNewItemIndex; INT32 iOldNumberOfObjects = 0; INT16 sDistanceFromObject = 0; - SOLDIERTYPE *pSoldier = NULL; CHAR16 sString[ 128 ]; extern OBJECTTYPE *gpItemDescObject; @@ -1370,11 +1369,16 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) { //CHRISL: Make it possible to right click and pull up stack popup and/or item description boxes WORLDITEM * twItem = &(pInventoryPoolList[ ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) + iCounter ]); - bool fValidPointer = false; + bool fValidPointer = false; + //CHRISL: Try to update InSector value so we don't have to "activate" a sector - if(MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->sSectorX == sSelMapX && MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->sSectorY == sSelMapY && MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->bSectorZ == iCurrentMapSectorZ && !MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->flags.fBetweenSectors) + SOLDIERTYPE* pSelectedSoldier = gCharactersList[bSelectedInfoChar].usSolID; + const auto x = pSelectedSoldier->sSectorX; + const auto y = pSelectedSoldier->sSectorY; + const auto z = pSelectedSoldier->bSectorZ; + if(x == sSelMapX && y == sSelMapY && z == iCurrentMapSectorZ && !pSelectedSoldier->flags.fBetweenSectors) { - MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->bInSector=TRUE; + pSelectedSoldier->bInSector = TRUE; } else { @@ -1388,7 +1392,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) } if ( !InSectorStackPopup( ) && !InItemStackPopup( ) /*&& !InItemDescriptionBox( ) */ && !InKeyRingPopup( ) && twItem->object.exists() == true && (bSelectedInfoChar != -1 && gCharactersList[bSelectedInfoChar].fValid) ) { - if(OK_CONTROL_MERC( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] )) + if(OK_CONTROL_MERC( pSelectedSoldier )) { //CHRISL: The old setup had a flaw I didn't consider. if, for some reason, the ItemSlotLimit = 0 // nothing might happen. Now we setup a flag to determine if our cursor is value for the item we're @@ -1474,7 +1478,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) } // HEADROCK HAM 5: Sector Inventory Item Desc Box no longer accessible during combat. - if( !CanPlayerUseSectorInventory( &(Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]) ) ) + if( !CanPlayerUseSectorInventory(pSelectedSoldier) ) { DoScreenIndependantMessageBox( New113HAMMessage[ 22 ], MSG_BOX_FLAG_OK, NULL ); return; @@ -1484,23 +1488,23 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) if ( _KeyDown(SHIFT) && gpItemPointer == NULL && Item[twItem->object.usItem].usItemClass == IC_GUN && (twItem->object)[0]->data.gun.ubGunShotsLeft && !ItemIsSingleShotRocketLauncher(twItem->object.usItem)) { EmptyWeaponMagazine( &twItem->object, &gItemPointer ); - InternalMAPBeginItemPointer( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] ); + InternalMAPBeginItemPointer( pSelectedSoldier ); } else - MAPInternalInitItemDescriptionBox( &twItem->object, 0, MercPtrs[gCharactersList[bSelectedInfoChar].usSolID] ); + MAPInternalInitItemDescriptionBox( &twItem->object, 0, pSelectedSoldier ); } } else if(fValidPointer) { // Sector Inventory Stack Popup no longer accessible during combat. - if( !CanPlayerUseSectorInventory( &(Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]) ) ) + if( !CanPlayerUseSectorInventory(pSelectedSoldier) ) { DoScreenIndependantMessageBox( New113HAMMessage[ 22 ], MSG_BOX_FLAG_OK, NULL ); return; } else { - InitSectorStackPopup( MercPtrs[gCharactersList[bSelectedInfoChar].usSolID], twItem, iCounter, xResOffset, yResOffset - 10, 261, ( SCREEN_HEIGHT - PLAYER_INFO_Y ) ); + InitSectorStackPopup( pSelectedSoldier, twItem, iCounter, xResOffset, yResOffset - 10, 261, ( SCREEN_HEIGHT - PLAYER_INFO_Y ) ); fTeamPanelDirty=TRUE; fInterfacePanelDirty = DIRTYLEVEL2; } @@ -1597,11 +1601,13 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) //if( fShowInventoryFlag ) { + SOLDIERTYPE* pSelectedSoldier = gCharactersList[bSelectedInfoChar].usSolID; + // not in sector? - if( ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX != sSelMapX ) || - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY != sSelMapY ) || - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ != iCurrentMapSectorZ ) || - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].flags.fBetweenSectors ) ) + if( ( pSelectedSoldier->sSectorX != sSelMapX ) || + ( pSelectedSoldier->sSectorY != sSelMapY ) || + ( pSelectedSoldier->bSectorZ != iCurrentMapSectorZ ) || + ( pSelectedSoldier->flags.fBetweenSectors ) ) { if ( gpItemPointer == NULL ) { @@ -1633,13 +1639,13 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) } else { - swprintf( sString, pMapInventoryErrorString[ 2 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name ); + swprintf( sString, pMapInventoryErrorString[ 2 ], pSelectedSoldier->name ); DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); } } else { - swprintf( sString, pMapInventoryErrorString[ 5 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name ); + swprintf( sString, pMapInventoryErrorString[ 5 ], pSelectedSoldier->name ); DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); } return; @@ -1650,6 +1656,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) // If we do not have an item in hand, start moving it if ( gpItemPointer == NULL ) { + SOLDIERTYPE* pSelectedSoldier = gCharactersList[bSelectedInfoChar].usSolID; // Return if empty @@ -1658,7 +1665,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) // if in battle inform player they will have to do this in tactical // if( ( ( gTacticalStatus.fEnemyInSector ) ||( ( sSelMapX == gWorldSectorX ) && ( sSelMapY == gWorldSectorY ) && ( iCurrentMapSectorZ == gbWorldSectorZ ) && ( gTacticalStatus.uiFlags & INCOMBAT ) ) ) ) - if( !CanPlayerUseSectorInventory( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ) ) + if( !CanPlayerUseSectorInventory(pSelectedSoldier) ) { DoMapMessageBox( MSG_BOX_BASIC_STYLE, pMapInventoryErrorString[ 3 ], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); return; @@ -1673,14 +1680,13 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) if( ( sSelMapX == gWorldSectorX )&&( gWorldSectorY == sSelMapY ) &&(gbWorldSectorZ == iCurrentMapSectorZ ) ) { // notify - pSoldier = &( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ); - sDistanceFromObject = PythSpacesAway( sObjectSourceGridNo, pSoldier->sGridNo); + sDistanceFromObject = PythSpacesAway( sObjectSourceGridNo, pSelectedSoldier->sGridNo); /* if( sDistanceFromObject > MAX_DISTANCE_TO_PICKUP_ITEM ) { // see for the loaded sector if the merc is cloase enough? - swprintf( sString, pMapInventoryErrorString[ 0 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name ); + swprintf( sString, pMapInventoryErrorString[ 0 ], pSelectedSoldier->name ); DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); return; } @@ -1718,10 +1724,11 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) } else {//we have an item on cursor + SOLDIERTYPE* pSelectedSoldier = gCharactersList[bSelectedInfoChar].usSolID; // if in battle inform player they will have to do this in tactical // if( ( gTacticalStatus.fEnemyInSector ) ||( ( sSelMapX == gWorldSectorX ) && ( sSelMapY == gWorldSectorY ) && ( iCurrentMapSectorZ == gbWorldSectorZ ) && ( gTacticalStatus.uiFlags & INCOMBAT ) ) ) - if( !CanPlayerUseSectorInventory( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ) ) + if( !CanPlayerUseSectorInventory(pSelectedSoldier) ) { DoMapMessageBox( MSG_BOX_BASIC_STYLE, pMapInventoryErrorString[ 4 ], MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); return; @@ -1795,7 +1802,7 @@ void MapInvenPoolSlots(MOUSE_REGION * pRegion, INT32 iReason ) /* if ( fShowInventoryFlag && bSelectedInfoChar >= 0 ) { - ReevaluateItemHatches( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ], FALSE ); + ReevaluateItemHatches( gCharactersList[ bSelectedInfoChar ].usSolID, FALSE ); } */ } @@ -2471,7 +2478,7 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ) if ( _KeyDown ( CTRL ))//MM: Pass item to selected merc. Delete if none selected. { - SOLDIERTYPE *pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; bool placedAllObjects = false; if(pSoldier->exists() == true) @@ -2575,7 +2582,7 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ) if ( fShowInventoryFlag && bSelectedInfoChar >= 0 ) { - ReevaluateItemHatches( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ], FALSE ); + ReevaluateItemHatches( gCharactersList[ bSelectedInfoChar ].usSolID, FALSE ); fTeamPanelDirty = TRUE; } } @@ -2643,7 +2650,7 @@ void BeginInventoryPoolPtr( OBJECTTYPE *pInventorySlot ) if ( fShowInventoryFlag && bSelectedInfoChar >= 0 ) { - ReevaluateItemHatches( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ], FALSE ); + ReevaluateItemHatches( gCharactersList[ bSelectedInfoChar ].usSolID, FALSE ); fTeamPanelDirty = TRUE; } } @@ -3015,7 +3022,7 @@ void TemplateNameInputCallBack(UINT8 ubResult) { if (ubResult == MSG_BOX_RETURN_OK && wcscmp(gszMsgBoxInputString, L"") > 0) { - SOLDIERTYPE* pSoldier = &Menptr[gCharactersList[bSelectedInfoChar].usSolID]; + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; if (pSoldier) { WriteEquipmentTemplate(pSoldier, gszMsgBoxInputString); @@ -3047,7 +3054,7 @@ void MapInventoryWriteEquipmentTemplate(GUI_BUTTON *btn, INT32 reason) { if ( btn->uiFlags & (BUTTON_CLICKED_ON) ) { - SOLDIERTYPE* pSoldier = &Menptr[gCharactersList[bSelectedInfoChar].usSolID]; + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; if ( pSoldier ) { DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, szGearTemplateText[0], guiCurrentScreen, MSG_BOX_FLAG_INPUTBOX, TemplateNameInputCallBack, NULL ); @@ -3072,7 +3079,7 @@ void MapInventoryReadEquipmentTemplate(GUI_BUTTON *btn, INT32 reason) { if ( btn->uiFlags & (BUTTON_CLICKED_ON) ) { - SOLDIERTYPE* pSoldier = &Menptr[gCharactersList[bSelectedInfoChar].usSolID]; + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; if ( pSoldier && pSoldier->sSectorX == sSelMapX && pSoldier->sSectorY == sSelMapY && pSoldier->bSectorZ == iCurrentMapSectorZ && !pSoldier->flags.fBetweenSectors ) @@ -3525,11 +3532,12 @@ void HandleButtonStatesWhileMapInventoryActive( void ) } // Selected Merc is in sector? Or is in combat? - if(MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->sSectorX != sSelMapX || - MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->sSectorY != sSelMapY || - MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->bSectorZ != iCurrentMapSectorZ || - MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]->flags.fBetweenSectors || - !CanPlayerUseSectorInventory( &(Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]) ) ) + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; + if( pSoldier->sSectorX != sSelMapX || + pSoldier->sSectorY != sSelMapY || + pSoldier->bSectorZ != iCurrentMapSectorZ || + pSoldier->flags.fBetweenSectors || + !CanPlayerUseSectorInventory( pSoldier ) ) { DisableButton( guiMapInvenSortButton[ 0 ] ); DisableButton( guiMapInvenSortButton[ 1 ] ); @@ -3640,7 +3648,7 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot ) if( fShowInventoryFlag ) { //Soldier inventory is shown, highlight those items - pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; if( pSoldier ) { if( HandleCompatibleAmmoUIForMapScreen( pSoldier, iCurrentSlot + ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ), TRUE, FALSE ) ) @@ -4815,7 +4823,7 @@ void SortSectorInventoryAmmo(bool useBoxes) OBJECTTYPE newCrate; int loopCount = 0; - SOLDIERTYPE * pSoldier = &(Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]); + SOLDIERTYPE * pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; AssertMsg( pSoldier != NULL, "Sector Inventory: Attempting ammo sort without valid selected soldier?" ); @@ -4957,7 +4965,7 @@ void SortSectorInventoryEjectAmmo() { OBJECTTYPE gTempObject; - SOLDIERTYPE * pSoldier = &(Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]); + SOLDIERTYPE * pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; for ( UINT32 uiLoop = 0; uiLoop < pInventoryPoolList.size(); uiLoop++ ) //for all items in sector { @@ -5006,7 +5014,7 @@ void SortSectorInventoryEmptyLBE() { // current item WORLDITEM * pInventoryItem = NULL; - SOLDIERTYPE * pSoldier = &(Menptr[gCharactersList[bSelectedInfoChar].usSolID]); + SOLDIERTYPE * pSoldier = gCharactersList[bSelectedInfoChar].usSolID; for (UINT32 uiLoop = 0; uiLoop < pInventoryPoolList.size(); uiLoop++) //for all items in sector { @@ -5081,7 +5089,7 @@ void SortSectorInventorySeparateAttachments() WORLDITEM * pInventoryItem = NULL; - SOLDIERTYPE * pSoldier = &(Menptr[gCharactersList[bSelectedInfoChar].usSolID]); + SOLDIERTYPE * pSoldier = gCharactersList[bSelectedInfoChar].usSolID; for (UINT32 uiLoop = 0; uiLoop < pInventoryPoolList.size(); uiLoop++) //for all items in sector { @@ -5154,7 +5162,7 @@ void SortSectorInventoryStackAndMerge(bool ammoOnly ) { OBJECTTYPE * StackObject; - SOLDIERTYPE * pSoldier = &(Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]); + SOLDIERTYPE * pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; for ( UINT32 uiLoop = 0; uiLoop < pInventoryPoolList.size(); uiLoop++ ) { diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 31c577e9..41e11cda 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -1298,7 +1298,7 @@ INT32 ShowOnDutyTeam( INT16 sMapX, INT16 sMapY ) // run through list while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; if( !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->sSectorX == sMapX) && @@ -1350,7 +1350,7 @@ INT32 ShowAssignedTeam(INT16 sMapX, INT16 sMapY, INT32 iCount) while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // given number of on duty members, find number of assigned chars // start at beginning of list, look for people who are in sector and assigned @@ -7126,7 +7126,7 @@ UINT8 NumActiveCharactersInSector( INT16 sSectorX, INT16 sSectorY, INT16 bSector { if( gCharactersList[ iCounter ].fValid ) { - pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + pSoldier = gCharactersList[ iCounter ].usSolID; if( pSoldier->bActive && ( pSoldier->stats.bLife > 0 ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != IN_TRANSIT ) ) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 797b2cd7..eadc70bb 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -552,7 +552,7 @@ void ResetAssignmentsForMercsTrainingUnpaidSectorsInSelectedList( UINT8 ubMiliti continue; } - pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if( pSoldier->bActive == FALSE ) { @@ -586,7 +586,7 @@ void ResetAssignmentOfMercsThatWereTrainingMilitiaInThisSector( INT16 sSectorX, continue; } - pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if( pSoldier->bActive == FALSE ) { @@ -618,7 +618,7 @@ void DeselectSelectedListMercsWhoCantMoveWithThisGuy( SOLDIERTYPE *pSoldier ) { if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) { - pSoldier2 = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + pSoldier2 = gCharactersList[ iCounter ].usSolID; // skip the guy we are if ( pSoldier == pSoldier2 ) @@ -707,7 +707,7 @@ void SelectUnselectedMercsWhoMustMoveWithThisGuy( void ) // if not already selected if( fSelectedListOfMercsForMapScreen[ iCounter ] == FALSE ) { - pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + pSoldier = gCharactersList[ iCounter ].usSolID; // if on a squad or in a vehicle if ( ( pSoldier->bAssignment < ON_DUTY ) || ( pSoldier->bAssignment == VEHICLE ) ) @@ -735,7 +735,7 @@ BOOLEAN AnyMercInSameSquadOrVehicleIsSelected( SOLDIERTYPE *pSoldier ) // if selected if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) { - pSoldier2 = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + pSoldier2 = gCharactersList[ iCounter ].usSolID; // if they have the same assignment if( pSoldier->bAssignment == pSoldier2->bAssignment ) @@ -1295,10 +1295,10 @@ void CheckAndUpdateBasedOnContractTimes( void ) if( gCharactersList[iCounter].fValid == TRUE ) { // what kind of merc - if(Menptr[gCharactersList[iCounter].usSolID].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + if(gCharactersList[iCounter].usSolID->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) { // amount of time left on contract - iTimeRemaining=Menptr[gCharactersList[iCounter].usSolID].iEndofContractTime-GetWorldTotalMin(); + iTimeRemaining = gCharactersList[iCounter].usSolID->iEndofContractTime - GetWorldTotalMin(); if(iTimeRemaining >60*24) { // more than a day, display in green @@ -1329,9 +1329,9 @@ void CheckAndUpdateBasedOnContractTimes( void ) } } } - else if( Menptr[gCharactersList[iCounter].usSolID].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) + else if( gCharactersList[iCounter].usSolID->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { - iTimeRemaining = Menptr[gCharactersList[iCounter].usSolID].iTotalContractLength; + iTimeRemaining = gCharactersList[iCounter].usSolID->iTotalContractLength; if( iTimeRemaining != iOldContractTimes[ iCounter ]) { @@ -1395,7 +1395,7 @@ void HandleDisplayOfSelectedMercArrows( void ) if( gCharactersList[ ubCount + FIRSTmercTOdisplay ].fValid == TRUE ) { // are they in the selected list or int he same mvt group as this guy - if( ( IsEntryInSelectedListSet( ubCount + FIRSTmercTOdisplay ) == TRUE ) || ( ( GetSelectedDestChar() != - 1 ) ? ( ( Menptr[ gCharactersList[ ubCount + FIRSTmercTOdisplay ].usSolID ].ubGroupID != 0 ) ? ( Menptr[ gCharactersList[GetSelectedDestChar()].usSolID ].ubGroupID == Menptr[ gCharactersList[ ubCount + FIRSTmercTOdisplay ].usSolID ].ubGroupID ) : FALSE ) : FALSE ) ) + if( ( IsEntryInSelectedListSet( ubCount + FIRSTmercTOdisplay ) == TRUE ) || ( ( GetSelectedDestChar() != - 1 ) ? ( ( gCharactersList[ ubCount + FIRSTmercTOdisplay ].usSolID->ubGroupID != 0 ) ? ( gCharactersList[GetSelectedDestChar()].usSolID->ubGroupID == gCharactersList[ ubCount + FIRSTmercTOdisplay ].usSolID->ubGroupID ) : FALSE ) : FALSE ) ) { sYPosition = y + ( ubCount * ( Y_SIZE + 2) ) - 1; @@ -1426,10 +1426,15 @@ void HandleDisplayOfItemPopUpForSector( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].sSectorX == sMapX ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].sSectorY == sMapY ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].bSectorZ == sMapZ ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].bActive ) && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife >= OKLIFE ) ) + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; + if( ( pSoldier->sSectorX == sMapX ) && + ( pSoldier->sSectorY == sMapY ) && + ( pSoldier->bSectorZ == sMapZ ) && + ( pSoldier->bActive ) && + ( pSoldier->stats.bLife >= OKLIFE ) ) { // valid character - InitializeItemPickupMenu( &( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID] ), NOWHERE , pItemPool, MAP_INVEN_POOL_X, MAP_INVEN_POOL_Y, -1 ); + InitializeItemPickupMenu( pSoldier, NOWHERE , pItemPool, MAP_INVEN_POOL_X, MAP_INVEN_POOL_Y, -1 ); fWasInited = TRUE; CreateScreenMaskForInventoryPoolPopUp( ); @@ -1937,19 +1942,19 @@ void UpdateCharRegionHelpText( void ) if( ( bSelectedInfoChar != -1 ) && ( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) ) { // valid soldier selected - pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; // health/energy/morale if( pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND ) { if ( pSoldier->stats.bLife != 0 ) { - if ( AM_A_ROBOT( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ] ) ) + if ( AM_A_ROBOT(pSoldier) ) { // robot (condition only) swprintf( sString, L"%s: %d/%d", pMapScreenStatusStrings[ 3 ], pSoldier->stats.bLife, pSoldier->stats.bLifeMax ); } - else if ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) + else if (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle (condition/fuel) swprintf( sString, L"%s: %d/%d, %s: %d/%d", @@ -2491,7 +2496,7 @@ BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot ) } - pNewSoldier = MercPtrs[ gCharactersList[ iNewCharSlot ].usSolID ]; + pNewSoldier = gCharactersList[ iNewCharSlot ].usSolID; // if in a hostile sector, disallow if (gTacticalStatus.fEnemyInSector && pNewSoldier->bInSector) @@ -2531,7 +2536,7 @@ BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot ) } else { - pOldSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pOldSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; } } @@ -3633,7 +3638,7 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) { if( gCharactersList[ iCounter ].fValid ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if( ( pSoldier->bActive ) && ( pSoldier->bAssignment != IN_TRANSIT ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && !SPY_LOCATION( pSoldier->bAssignment ) && ( pSoldier->bAssignment != ASSIGNMENT_MINIEVENT ) && ( pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND ) && @@ -4584,7 +4589,7 @@ void HandleSettingTheSelectedListOfMercs( void ) // is the current guy a valid character? if( gCharactersList[ iCounter ].fValid == TRUE ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { @@ -4620,7 +4625,7 @@ void HandleSettingTheSelectedListOfMercs( void ) if( GetSelectedDestChar() != -1 ) { INT8 pbErrorNumber = -1; - pSoldier = MercPtrs[gCharactersList[GetSelectedDestChar()].usSolID]; + pSoldier = gCharactersList[GetSelectedDestChar()].usSolID; INT8 bSquadValue = pSoldier->bAssignment; if (bSquadValue == VEHICLE) { @@ -5679,7 +5684,7 @@ void UpdateHelpTextForMapScreenMercIcons( void ) else { // if merc is an AIM merc - if( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) + if( gCharactersList[ bSelectedInfoChar ].usSolID->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) { SetRegionFastHelpText( &(gContractIconRegion), zMarksMapScreenText[ 22 ] ); } @@ -5689,7 +5694,7 @@ void UpdateHelpTextForMapScreenMercIcons( void ) } // if merc has life insurance - if( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].usLifeInsurance > 0 ) + if( gCharactersList[ bSelectedInfoChar ].usSolID->usLifeInsurance > 0 ) { SetRegionFastHelpText( &(gInsuranceIconRegion), zMarksMapScreenText[ 3 ] ); } @@ -5699,7 +5704,7 @@ void UpdateHelpTextForMapScreenMercIcons( void ) } // if merc has a medical deposit - if( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].usMedicalDeposit > 0 ) + if( gCharactersList[ bSelectedInfoChar ].usSolID->usMedicalDeposit > 0 ) { SetRegionFastHelpText( &(gDepositIconRegion), zMarksMapScreenText[ 12 ] ); } @@ -6310,7 +6315,7 @@ BOOLEAN CanEntireMovementGroupMercIsInMove( SOLDIERTYPE *pSoldier, INT8 *pbError if( gCharactersList[ iCounter ].fValid == TRUE ) { // get soldier - pCurrentSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + pCurrentSoldier = gCharactersList[ iCounter ].usSolID; // skip inactive grunts if( pCurrentSoldier->bActive == FALSE ) diff --git a/Strategic/Meanwhile.cpp b/Strategic/Meanwhile.cpp index ad9cdb8a..82ec3e04 100644 --- a/Strategic/Meanwhile.cpp +++ b/Strategic/Meanwhile.cpp @@ -418,7 +418,7 @@ void CheckForMeanwhileOKStart( ) SOLDIERTYPE *pSoldier; BOOLEAN fFoundSoldierToInterrogate = FALSE; UINT32 uiCount = 0; - for (pSoldier = MercPtrs[gCharactersList[uiCount].usSolID]; gCharactersList[uiCount].fValid; uiCount++, pSoldier++) + for (pSoldier = gCharactersList[uiCount].usSolID; gCharactersList[uiCount].fValid; uiCount++, pSoldier++) { if (pSoldier->sSectorX == gModSettings.ubMeanwhileInterrogatePOWSectorX && pSoldier->sSectorY == gModSettings.ubMeanwhileInterrogatePOWSectorY && pSoldier->bSectorZ == 0 && pSoldier->bAssignment == ASSIGNMENT_POW && pSoldier->stats.bLife > 0 && gMercProfiles[pSoldier->ubProfile].bMercStatus != MERC_FIRED_AS_A_POW) diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index 976b9545..82c3e7df 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -1379,7 +1379,7 @@ void HandleCompletionOfTownTrainingByGroupWithTrainer( SOLDIERTYPE *pTrainer, UI continue; } - pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // valid soldier? if( pSoldier->bActive == FALSE ) @@ -1532,7 +1532,7 @@ void BuildListOfUnpaidTrainableSectors( UINT8 ubMilitiaType ) // selected? if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) || ( iCounter == bSelectedAssignChar ) ) { - pSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // HEADROCK HAM 3.6: Two different conditions depending on the type of militia being trained. if( ubMilitiaType == TOWN_MILITIA ) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 16c913bc..3fd0fa4e 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -808,7 +808,7 @@ void HandleShadingOfLinesForContractMenu( void ); void UpdateStatusOfMapSortButtons( void ); void DisplayIconsForMercsAsleep( void ); -BOOLEAN CharacterIsInLoadedSectorAndWantsToMoveInventoryButIsNotAllowed( INT8 bCharId ); +BOOLEAN CharacterIsInLoadedSectorAndWantsToMoveInventoryButIsNotAllowed( INT16 bCharId ); void HandlePostAutoresolveMessages(); @@ -946,7 +946,7 @@ BOOLEAN AnyMovableCharsInOrBetweenThisSector( INT16 sSectorX, INT16 sSectorY, IN void SwapCharactersInList( INT32 iCharA, INT32 iCharB ); -BOOLEAN CanChangeDestinationForCharSlot( INT8 bCharNumber, BOOLEAN fShowErrorMessage ); +BOOLEAN CanChangeDestinationForCharSlot( INT16 bCharNumber, BOOLEAN fShowErrorMessage ); BOOLEAN RequestGiveSkyriderNewDestination( void ); void ExplainWhySkyriderCantFly( void ); @@ -2313,21 +2313,21 @@ void RenderIconsForUpperLeftCornerPiece( INT8 bCharNumber ) GetVideoObject(&hHandle, guiULICONS); // if merc is an AIM merc - if( Menptr[ gCharactersList[ bCharNumber ].usSolID ].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) + if( gCharactersList[ bCharNumber ].usSolID->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) { // finite contract length icon BltVideoObject( guiSAVEBUFFER, hHandle, 0, x, y, VO_BLT_SRCTRANSPARENCY, NULL ); } // if merc has life insurance - if( Menptr[ gCharactersList[ bCharNumber ].usSolID ].usLifeInsurance > 0 ) + if( gCharactersList[ bCharNumber ].usSolID->usLifeInsurance > 0 ) { // draw life insurance icon BltVideoObject( guiSAVEBUFFER, hHandle, 2, x, y + spacing, VO_BLT_SRCTRANSPARENCY, NULL ); } // if merc has a medical deposit - if( Menptr[ gCharactersList[ bCharNumber ].usSolID ].usMedicalDeposit > 0 ) + if( gCharactersList[ bCharNumber ].usSolID->usMedicalDeposit > 0 ) { // draw medical deposit icon BltVideoObject( guiSAVEBUFFER, hHandle, 1, x, y + ( 2 * spacing), VO_BLT_SRCTRANSPARENCY, NULL ); @@ -2341,11 +2341,11 @@ void DrawPay(INT16 sCharNumber) INT32 uiSalary; CHAR16 sString[7]; INT16 usX, usY; - INT16 usMercProfileID; + UINT8 usMercProfileID; // get merc id - usMercProfileID = MercPtrs[ gCharactersList[ sCharNumber ].usSolID ]->ubProfile; + usMercProfileID = gCharactersList[ sCharNumber ].usSolID->ubProfile; // grab salary uiSalary=( ( UINT32 ) gMercProfiles[ usMercProfileID ].sSalary ); @@ -2371,7 +2371,7 @@ void DrawPay(INT16 sCharNumber) void DrawCharBars( void ) { - UINT16 usSoldierID; + SoldierID usSoldierID; SOLDIERTYPE *pSoldier; // will draw the heath, morale and breath bars for a character being displayed in the upper left hand corner @@ -2386,11 +2386,11 @@ void DrawCharBars( void ) // valid character if( bSelectedInfoChar != -1 ) { - usSoldierID=gCharactersList[ bSelectedInfoChar ].usSolID; + usSoldierID = gCharactersList[ bSelectedInfoChar ].usSolID; } else { - usSoldierID=gCharactersList[GetSelectedDestChar()].usSolID; + usSoldierID = gCharactersList[GetSelectedDestChar()].usSolID; } // grab soldier's id number @@ -2443,7 +2443,7 @@ void DrawCharStats( INT16 sCharNum ) //HVOBJECT hCrossHandle; SOLDIERTYPE *pSoldier = NULL; - pSoldier = &Menptr[gCharactersList[sCharNum].usSolID]; + pSoldier = gCharactersList[sCharNum].usSolID; // set up font SetFont(CHAR_FONT); @@ -2823,7 +2823,7 @@ void DrawCharHealth( INT16 sCharNum ) const auto width = UI_CHARPANEL.Text.CurrentHitpoints.width; const auto height = UI_CHARPANEL.Text.CurrentHitpoints.height; - pSoldier = &Menptr[gCharactersList[sCharNum].usSolID]; + pSoldier = gCharactersList[sCharNum].usSolID; if( pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND ) { @@ -2935,7 +2935,7 @@ void DrawCharacterInfo(INT16 sCharNumber) return; } - pSoldier = MercPtrs[ gCharactersList[sCharNumber].usSolID ]; + pSoldier = gCharactersList[sCharNumber].usSolID; if( pSoldier->ubProfile == NO_PROFILE ) { @@ -3248,9 +3248,9 @@ void DrawCharacterInfo(INT16 sCharNumber) } // medical deposit - if( gMercProfiles[ Menptr[ gCharactersList[ sCharNumber ].usSolID ].ubProfile ].sMedicalDepositAmount > 0 ) + if( gMercProfiles[ gCharactersList[ sCharNumber ].usSolID->ubProfile ].sMedicalDepositAmount > 0 ) { - swprintf(sString, L"%d", gMercProfiles[ Menptr[ gCharactersList[ sCharNumber ].usSolID ].ubProfile ].sMedicalDepositAmount ); + swprintf(sString, L"%d", gMercProfiles[ gCharactersList[ sCharNumber ].usSolID->ubProfile ].sMedicalDepositAmount ); // insert commas and dollar sign InsertCommasForDollarFigure( sString ); @@ -3279,7 +3279,7 @@ void DrawCharacterInfo(INT16 sCharNumber) { if ( pSoldier->stats.bLife != 0 ) { - GetMoraleString( MercPtrs[gCharactersList[sCharNumber].usSolID], sString ); + GetMoraleString( gCharactersList[sCharNumber].usSolID, sString ); } else { @@ -3324,7 +3324,7 @@ BOOLEAN CharacterIsInTransitAndHasItemPickedUp( INT8 bCharacterNumber ) } // character in transit? - if( Menptr[ gCharactersList[ bCharacterNumber ].usSolID ].bAssignment != IN_TRANSIT ) + if( gCharactersList[ bCharacterNumber ].usSolID->bAssignment != IN_TRANSIT ) { // nope return( FALSE ); @@ -3354,7 +3354,7 @@ void DisplayCharacterInfo( void ) // This section draws STRATEGIC info pages. Another section is in Interface Panels.cpp and draws TACTICAL info pages. // The feature is toggled by Options-Menu switch, and its color is determined in the INI files. { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[bSelectedInfoChar].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[bSelectedInfoChar].usSolID; UINT8 *pDestBuf; UINT32 uiDestPitchBYTES = 0; @@ -3580,39 +3580,41 @@ INT32 GetPathTravelTimeDuringPlotting( PathStPtr pPath ) else { // plotting for a character... - if( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].bAssignment == VEHICLE ) + SOLDIERTYPE* pSoldier = gCharactersList[GetSelectedDestChar()].usSolID; + + if( pSoldier->bAssignment == VEHICLE ) { - ubGroupId = pVehicleList[ Menptr[gCharactersList[GetSelectedDestChar()].usSolID].iVehicleId ].ubMovementGroup; + ubGroupId = pVehicleList[ pSoldier->iVehicleId ].ubMovementGroup; pGroup = GetGroup( ubGroupId ); if( pGroup == NULL ) { - SetUpMvtGroupForVehicle( &( Menptr[gCharactersList[GetSelectedDestChar()].usSolID] ) ); + SetUpMvtGroupForVehicle( pSoldier ); // get vehicle id - ubGroupId = pVehicleList[ Menptr[gCharactersList[GetSelectedDestChar()].usSolID].iVehicleId ].ubMovementGroup; + ubGroupId = pVehicleList[ pSoldier->iVehicleId ].ubMovementGroup; pGroup = GetGroup( ubGroupId ); AssertNotNIL(pGroup); } } - else if( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) + else if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - ubGroupId = pVehicleList[ Menptr[gCharactersList[GetSelectedDestChar()].usSolID].bVehicleID ].ubMovementGroup; + ubGroupId = pVehicleList[ pSoldier->bVehicleID ].ubMovementGroup; pGroup = GetGroup( ubGroupId ); if( pGroup == NULL ) { - SetUpMvtGroupForVehicle( &( Menptr[gCharactersList[GetSelectedDestChar()].usSolID] ) ); + SetUpMvtGroupForVehicle( pSoldier ); // get vehicle id - ubGroupId = pVehicleList[ Menptr[gCharactersList[GetSelectedDestChar()].usSolID].bVehicleID ].ubMovementGroup; + ubGroupId = pVehicleList[ pSoldier->bVehicleID ].ubMovementGroup; pGroup = GetGroup( ubGroupId ); AssertNotNIL(pGroup); } } else { - ubGroupId = Menptr[gCharactersList[GetSelectedDestChar()].usSolID].ubGroupID; + ubGroupId = pSoldier->ubGroupID; pGroup = GetGroup( ( UINT8 )( ubGroupId ) ); AssertNotNIL(pGroup); } @@ -4059,6 +4061,7 @@ void LoadCharacters( void ) void DisplayCharacterList() { + SOLDIERTYPE *pSoldier; INT16 sCount=0; UINT8 ubForegroundColor = 0; @@ -4084,12 +4087,14 @@ void DisplayCharacterList() // skip invalid characters if ( gCharactersList[( sCount + FIRSTmercTOdisplay )].fValid == TRUE ) { + pSoldier = gCharactersList[(sCount + FIRSTmercTOdisplay)].usSolID; + if( sCount == ( INT16 ) giHighLine ) { ubForegroundColor = FONT_WHITE; } // check to see if character is still alive - else if( Menptr[gCharactersList[(sCount + FIRSTmercTOdisplay)].usSolID].stats.bLife == 0 ) + else if(pSoldier->stats.bLife == 0 ) { ubForegroundColor = FONT_METALGRAY; } @@ -4098,13 +4103,11 @@ void DisplayCharacterList() ubForegroundColor = FONT_LTBLUE; } // in current sector? - else if( ( Menptr[gCharactersList[( sCount + FIRSTmercTOdisplay )].usSolID].sSectorX == sSelMapX ) && - ( Menptr[gCharactersList[( sCount + FIRSTmercTOdisplay )].usSolID].sSectorY == sSelMapY ) && - ( Menptr[gCharactersList[( sCount + FIRSTmercTOdisplay )].usSolID].bSectorZ == iCurrentMapSectorZ ) ) + else if ( pSoldier->sSectorX == sSelMapX && pSoldier->sSectorY == sSelMapY && pSoldier->bSectorZ == iCurrentMapSectorZ ) { // mobile ? - if( ( Menptr[gCharactersList[( sCount + FIRSTmercTOdisplay )].usSolID].bAssignment < ON_DUTY ) || - ( Menptr[gCharactersList[( sCount + FIRSTmercTOdisplay )].usSolID].bAssignment == VEHICLE ) ) + if( ( pSoldier->bAssignment < ON_DUTY ) || + ( pSoldier->bAssignment == VEHICLE ) ) ubForegroundColor = FONT_YELLOW; else ubForegroundColor = FONT_MAP_DKYELLOW; @@ -4117,7 +4120,7 @@ void DisplayCharacterList() SetFontForeground( ubForegroundColor ); - DrawName( Menptr[gCharactersList[( sCount + FIRSTmercTOdisplay )].usSolID].name, sCount, MAP_SCREEN_FONT); + DrawName( pSoldier->name, sCount, MAP_SCREEN_FONT); DrawLocation( sCount + FIRSTmercTOdisplay , sCount, MAP_SCREEN_FONT); DrawDestination( sCount + FIRSTmercTOdisplay, sCount, MAP_SCREEN_FONT); DrawAssignment( sCount + FIRSTmercTOdisplay, sCount, MAP_SCREEN_FONT); @@ -6281,17 +6284,17 @@ void DrawAssignment(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) INT16 usX=0; INT16 usY=0; CHAR16 sString[32]; + SOLDIERTYPE* pSoldier = gCharactersList[sCharNumber].usSolID; - GetMapscreenMercAssignmentString( MercPtrs[ gCharactersList[ sCharNumber ].usSolID ], sString ); + GetMapscreenMercAssignmentString( pSoldier, sString ); FindFontCenterCoordinates((short)UI_CHARLIST.xAssignment + 1, (short)(UI_CHARLIST.y + (sRowIndex*Y_SIZE)), (short)UI_CHARLIST.widthAssignment, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ sCharNumber ].usSolID ]; if( fFlashAssignDone == TRUE ) { - if( Menptr[gCharactersList[sCharNumber].usSolID].flags.fDoneAssignmentAndNothingToDoFlag ) + if( pSoldier->flags.fDoneAssignmentAndNothingToDoFlag ) { SetFontForeground( FONT_RED ); } @@ -6328,8 +6331,7 @@ void DrawAssignment(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) ubProgress = SectorInfo[SECTOR(sMapX, sMapY)].ubMilitiaTrainingPercentDone; usMaxProgress = 100; } - else if ( pSoldier->bAssignment == TRAIN_SELF || - pSoldier->bAssignment == TRAIN_BY_OTHER ) + else if ( pSoldier->bAssignment == TRAIN_SELF || pSoldier->bAssignment == TRAIN_BY_OTHER ) { switch (pSoldier->bTrainStat) { @@ -6393,7 +6395,7 @@ void DrawLocation(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) INT16 usY=0; CHAR16 sString[32]; - GetMapscreenMercLocationString( MercPtrs[ gCharactersList[ sCharNumber ].usSolID ], sString ); + GetMapscreenMercLocationString( gCharactersList[ sCharNumber ].usSolID, sString ); FindFontCenterCoordinates((short)UI_CHARLIST.xLocation + 1, (short)(UI_CHARLIST.y + (sRowIndex*Y_SIZE)), (short)UI_CHARLIST.widthLocation, (short)Y_SIZE, sString, (long)iFont, &usX, &usY); @@ -6408,7 +6410,7 @@ void DrawDestination(INT16 sCharNumber, INT16 sRowIndex, INT32 iFont) INT16 usY=0; CHAR16 sString[32]; - GetMapscreenMercDestinationString( MercPtrs[ gCharactersList[ sCharNumber ].usSolID ], sString ); + GetMapscreenMercDestinationString( gCharactersList[ sCharNumber ].usSolID, sString ); if ( wcslen( sString ) == 0 ) { @@ -6428,7 +6430,7 @@ void DrawTimeRemaining( INT16 sCharNumber, INT32 iFont, UINT8 ubFontColor ) CHAR16 sString[32]; // marke strogg more mercs MUST override pointer into array by number of skipped mercs - GetMapscreenMercDepartureString( MercPtrs[ gCharactersList[ sCharNumber + FIRSTmercTOdisplay ].usSolID ], sString, &ubFontColor ); + GetMapscreenMercDepartureString( gCharactersList[ sCharNumber + FIRSTmercTOdisplay ].usSolID, sString, &ubFontColor ); // if merc is highlighted, override the color decided above with bright white if( sCharNumber == ( INT16 ) giHighLine ) @@ -6647,10 +6649,10 @@ UINT32 HandleMapUI( ) break; // check if last sector in character's path is same as where mouse is - if( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[GetSelectedDestChar()].usSolID] ) != CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) ) + if( GetLastSectorIdInCharactersPath( gCharactersList[GetSelectedDestChar()].usSolID ) != CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) ) { - sX = ( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[GetSelectedDestChar()].usSolID] ) % MAP_WORLD_X ); - sY = ( GetLastSectorIdInCharactersPath( &Menptr[gCharactersList[GetSelectedDestChar()].usSolID] ) / MAP_WORLD_X ); + sX = ( GetLastSectorIdInCharactersPath( gCharactersList[GetSelectedDestChar()].usSolID ) % MAP_WORLD_X ); + sY = ( GetLastSectorIdInCharactersPath( gCharactersList[GetSelectedDestChar()].usSolID ) / MAP_WORLD_X ); GetCursorPos(&MousePos); ScreenToClient(ghWindow, &MousePos); // In window coords! RestoreBackgroundForMapGrid( sX, sY ); @@ -6665,10 +6667,10 @@ UINT32 HandleMapUI( ) // Can we get go there? (NULL temp character path) if ( GetLengthOfPath( pTempCharacterPath ) > 0 ) { - PlotPathForCharacter( &Menptr[gCharactersList[GetSelectedDestChar()].usSolID], sMapX, sMapY, FALSE ); + PlotPathForCharacter( gCharactersList[GetSelectedDestChar()].usSolID, sMapX, sMapY, FALSE ); // copy the path to every other selected character - CopyPathToAllSelectedCharacters( GetSoldierMercPathPtr( MercPtrs[ gCharactersList[GetSelectedDestChar()].usSolID ] ) ); + CopyPathToAllSelectedCharacters( GetSoldierMercPathPtr( gCharactersList[GetSelectedDestChar()].usSolID ) ); StartConfirmMapMoveMode( sMapY ); fMapPanelDirty = TRUE; @@ -6693,9 +6695,9 @@ UINT32 HandleMapUI( ) case MAP_EVENT_SELECT_SECTOR: // will select the sector the selected merc is in - sMapX=Menptr[gCharactersList[bSelectedInfoChar].usSolID].sSectorX; - sMapY=Menptr[gCharactersList[bSelectedInfoChar].usSolID].sSectorY; - bMapZ=Menptr[gCharactersList[bSelectedInfoChar].usSolID].bSectorZ; + sMapX=gCharactersList[bSelectedInfoChar].usSolID.sSectorX; + sMapY=gCharactersList[bSelectedInfoChar].usSolID.sSectorY; + bMapZ=gCharactersList[bSelectedInfoChar].usSolID.bSectorZ; if( ( sSelMapX != sMapX || sSelMapY != sMapY || iCurrentMapSectorZ != bMapZ ) && ( gTacticalStatus.fDidGameJustStart == FALSE ) && ( gfPreBattleInterfaceActive == FALSE ) ) @@ -7348,7 +7350,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if ( bSelectedInfoChar != -1 ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; if ( pSoldier->inv[ HANDPOS ].exists() == true ) { pSoldier->inv[ HANDPOS ][0]->data.objectStatus = 2; @@ -7359,7 +7361,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if ( bSelectedInfoChar != -1 ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; if ( pSoldier->inv[ HANDPOS ].exists() == true ) { pSoldier->inv[ HANDPOS ].usItem = GUN_BARREL_EXTENDER; @@ -7401,7 +7403,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) if ( bSelectedInfoChar != -1 ) { // ALT-F10: force selected character asleep (ignores breathmax) - PutMercInAsleepState( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ] ); + PutMercInAsleepState( gCharactersList[ bSelectedInfoChar ].usSolID ); } } #endif @@ -7447,7 +7449,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if( bSelectedInfoChar != -1 ) { - TownMilitiaTrainingCompleted( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ], sSelMapX, sSelMapY ); + TownMilitiaTrainingCompleted( gCharactersList[ bSelectedInfoChar ].usSolID, sSelMapX, sSelMapY ); } } #endif @@ -7515,7 +7517,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if( bSelectedInfoChar != -1 ) { - StatChange( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ], EXPERAMT, 1000, FROM_SUCCESS ); + StatChange( gCharactersList[ bSelectedInfoChar ].usSolID, EXPERAMT, 1000, FROM_SUCCESS ); } } #endif @@ -7788,7 +7790,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case 'E': if(bSelectedInfoChar != -1) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; pSoldier->bInSector = FALSE; //CHRISL: Try to update InSector value so we don't have to "activate" a sector @@ -7915,7 +7917,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) // CTRL-F: Refuel vehicle if( ( fCtrl ) && ( bSelectedInfoChar != -1 ) ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { @@ -7987,9 +7989,9 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) break; case 'H': // swap primary & secondary hand - if ( bSelectedInfoChar != -1 && fShowInventoryFlag && !AM_A_ROBOT( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ] )) + if ( bSelectedInfoChar != -1 && fShowInventoryFlag && !AM_A_ROBOT( gCharactersList[ bSelectedInfoChar ].usSolID )) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; UINT16 usOldHandItem = pSoldier->inv[HANDPOS].usItem; SwapHandItems( pSoldier ); @@ -8025,7 +8027,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) //CHRISL: Swap gunsling if ( bSelectedInfoChar != -1 && fShowInventoryFlag && UsingNewInventorySystem() == true ) { - SOLDIERTYPE *pSoldier = MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]; + SOLDIERTYPE *pSoldier = gCharactersList[bSelectedInfoChar].usSolID; if (fAlt) // switch to knife, or from knife to gun pSoldier->SwitchWeapons(TRUE); @@ -8109,7 +8111,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { static UINT16 gQuoteNum = 0; // Get Soldier - TacticalCharacterDialogue( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ], gQuoteNum ); + TacticalCharacterDialogue( gCharactersList[ bSelectedInfoChar ].usSolID, gQuoteNum ); gQuoteNum++; } else if( fCtrl ) @@ -8118,7 +8120,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) // Get Soldier if ( giHighLine != -1 ) { - TacticalCharacterDialogue( MercPtrs[ gCharactersList[ giHighLine ].usSolID ], gQuoteNum ); + TacticalCharacterDialogue( gCharactersList[ giHighLine ].usSolID, gQuoteNum ); gQuoteNum++; } } @@ -8127,7 +8129,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) case 'N': if ( bSelectedInfoChar != -1 && fShowInventoryFlag ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; SwapGoggles(pSoldier); } break; @@ -8167,7 +8169,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) // ALT-P: Make the selected character a POW! if( ( fAlt ) && ( bSelectedInfoChar != -1 ) ) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; EnemyCapturesPlayerSoldier( pSoldier ); @@ -8302,7 +8304,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { INT16 sDeltaX, sDeltaY; INT16 sPrevX = 0, sPrevY = 0; - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[GetSelectedDestChar()].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[GetSelectedDestChar()].usSolID; // can't teleport to where we already are if ( ( sMapX == pSoldier->sSectorX ) && ( sMapY == pSoldier->sSectorY ) ) @@ -8466,7 +8468,7 @@ void GetMapKeyboardInput( UINT32 *puiNewEvent ) { if(bSelectedInfoChar != -1) { - SOLDIERTYPE *pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + SOLDIERTYPE *pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; //CHRISL: Try to update InSector value so we don't have to "activate" a sector if (pSoldier->sSectorX == sSelMapX && pSoldier->sSectorY == sSelMapY && pSoldier->bSectorZ == iCurrentMapSectorZ && !pSoldier->flags.fBetweenSectors) @@ -9471,7 +9473,7 @@ void CreateDestroyMapInvButton() if (bSelectedInfoChar != -1 && gCharactersList[bSelectedInfoChar].fValid) { - SOLDIERTYPE* pSoldier = MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]; + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; if (!(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT(pSoldier)) { InitInvSlotInterface(gMapScreenInvPocketXY, &gSCamoXY, MAPInvMoveCallback, MAPInvClickCallback, MAPInvMoveCamoCallback, MAPInvClickCamoCallback, FALSE); @@ -9931,7 +9933,7 @@ void HandleCursorOverRifleAmmo( ) if ( gfCheckForMouseOverItem ) { - if ( HandleCompatibleAmmoUI( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ], (INT8)gbCheckForMouseOverItemPos, TRUE ) ) + if ( HandleCompatibleAmmoUI( gCharactersList[ bSelectedInfoChar ].usSolID, (INT8)gbCheckForMouseOverItemPos, TRUE ) ) { if ( ( GetJA2Clock( ) - guiMouseOverItemTime ) > 100 ) { @@ -9955,7 +9957,7 @@ void MAPInvClickCamoCallback( MOUSE_REGION *pRegion, INT32 iReason ) SOLDIERTYPE* pSoldier = NULL; if( (bSelectedInfoChar != -1) && (gCharactersList[bSelectedInfoChar].fValid == TRUE) ) { - pSoldier = MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]; + pSoldier = gCharactersList[bSelectedInfoChar].usSolID; } if ( gpItemPointer && pSoldier ) @@ -10564,7 +10566,7 @@ void MAPBeginItemPointer( SOLDIERTYPE *pSoldier, UINT8 ubHandPos ) if ( _KeyDown(CTRL) ) { // if in battle inform player they will have to do this in tactical - if( !CanPlayerUseSectorInventory( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ) ) + if( !CanPlayerUseSectorInventory( gCharactersList[ bSelectedInfoChar ].usSolID ) ) { // return item to original slot PlaceObject( pSoldier, ubHandPos, &gItemPointer ); @@ -10630,7 +10632,7 @@ void MAPEndItemPointer( ) if ( fShowInventoryFlag && bSelectedInfoChar >= 0 ) { - ReevaluateItemHatches( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ], FALSE ); + ReevaluateItemHatches( gCharactersList[ bSelectedInfoChar ].usSolID, FALSE ); } } } @@ -10653,7 +10655,7 @@ void RenderAttributeStringsForUpperLeftHandCorner( UINT32 uiBufferToRenderTo ) if ( ( bSelectedInfoChar != - 1) && ( gCharactersList[ bSelectedInfoChar ].fValid ) ) { - pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; } SetFont( CHAR_FONT ); @@ -10772,7 +10774,8 @@ void SetUpCursorForStrategicMap( void ) else // yes - by character { // set cursor based on foot or vehicle - if( ( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].bAssignment != VEHICLE ) && !( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + SOLDIERTYPE* pSoldier = gCharactersList[GetSelectedDestChar()].usSolID; + if( ( pSoldier->bAssignment != VEHICLE ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { ChangeMapScreenMaskCursor( CURSOR_STRATEGIC_FOOT ); } @@ -11336,7 +11339,7 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) ChangeSelectedInfoChar( iValue+ FIRSTmercTOdisplay, TRUE ); - pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID ]; + pSoldier = gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID; // highlight giDestHighLine = -1; @@ -11384,7 +11387,7 @@ void TeamListInfoRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) if( gCharactersList[ iValue + FIRSTmercTOdisplay].fValid == TRUE ) { - pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID ]; + pSoldier = gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID; // select this character ChangeSelectedInfoChar( iValue+ FIRSTmercTOdisplay, TRUE ); @@ -11492,7 +11495,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // reset list if the clicked character isn't also selected ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( iValue + FIRSTmercTOdisplay) == FALSE ) ); - pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID ]; + pSoldier = gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID; // if alive (dead guys keep going, use remove menu instead), // and it's between sectors and it can be reassigned (non-vehicles) @@ -11573,7 +11576,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) { ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, TRUE ); - pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID ]; + pSoldier = gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID; // highlight giDestHighLine = -1; @@ -11603,7 +11606,7 @@ void TeamListAssignmentRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) // if not already selected if( fSelectedListOfMercsForMapScreen[ iCounter ] == FALSE ) { - pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + pSoldier = gCharactersList[ iCounter ].usSolID; // if on a squad or in a vehicle if ( ( pSoldier->bAssignment < ON_DUTY ) || ( pSoldier->bAssignment == VEHICLE ) ) @@ -11659,7 +11662,7 @@ void TeamListAssignmentRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) { giHighLine = iValue; - if( !( Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + if( !( gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { giAssignHighLine = iValue; } @@ -11690,7 +11693,7 @@ void TeamListAssignmentRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { if( ( gCharactersList[ iValue + FIRSTmercTOdisplay ].fValid == TRUE ) && - !( Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + !( gCharactersList[ iValue + FIRSTmercTOdisplay].usSolID->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // play click PlayGlowRegionSound( ); @@ -11732,23 +11735,23 @@ void TeamListDestinationRegionBtnCallBack(MOUSE_REGION *pRegion, INT32 iReason ) ChangeSelectedInfoChar( iValue + FIRSTmercTOdisplay, ( BOOLEAN )( IsEntryInSelectedListSet( iValue + FIRSTmercTOdisplay ) == FALSE ) ); // deselect any characters/vehicles that can't accompany the clicked merc - DeselectSelectedListMercsWhoCantMoveWithThisGuy( &( Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID ] ) ); + DeselectSelectedListMercsWhoCantMoveWithThisGuy( gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID ); // select all characters/vehicles that MUST accompany the clicked merc (same squad/vehicle) SelectUnselectedMercsWhoMustMoveWithThisGuy( ); // Find out if this guy and everyone travelling with him is allowed to move strategically // NOTE: errors are reported within... - if ( CanChangeDestinationForCharSlot( ( INT8 ) iValue + FIRSTmercTOdisplay, TRUE ) ) + if ( CanChangeDestinationForCharSlot( ( INT16 ) iValue + FIRSTmercTOdisplay, TRUE ) ) { // turn off sector inventory, turn on show teams filter, etc. MakeMapModesSuitableForDestPlotting( ( INT8 ) iValue + FIRSTmercTOdisplay ); // check if person is in a vehicle - if( Menptr[gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID].bAssignment == VEHICLE ) + if( gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID->bAssignment == VEHICLE ) { // if he's in the helicopter - if( Menptr[gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID].iVehicleId == iHelicopterVehicleId ) + if( gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID->iVehicleId == iHelicopterVehicleId ) { TurnOnAirSpaceMode( ); if( RequestGiveSkyriderNewDestination( ) == FALSE ) @@ -11911,7 +11914,7 @@ void TeamListSleepRegionBtnCallBack( MOUSE_REGION *pRegion, INT32 iReason ) // if this slot's sleep status can be changed if ( CanChangeSleepStatusForCharSlot( (INT8) iValue + FIRSTmercTOdisplay ) ) { - pSoldier = &Menptr[ gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID ]; + pSoldier = gCharactersList[ iValue + FIRSTmercTOdisplay ].usSolID; if( pSoldier->flags.fMercAsleep == TRUE ) { @@ -12035,7 +12038,7 @@ static void HandleSelectedMercsContract() if (gCharactersList[iCounter].fValid) { // get the soldier pointer - pSoldier = &Menptr[gCharactersList[iCounter].usSolID]; + pSoldier = gCharactersList[iCounter].usSolID; if (pSoldier->bActive == FALSE) { @@ -12047,7 +12050,7 @@ static void HandleSelectedMercsContract() continue; } - if (CanExtendContractForCharSlot((INT8)iCounter)) + if (CanExtendContractForCharSlot(iCounter)) { // up the total number of soldiers gSelectedSoldiers.push_back(pSoldier); @@ -12162,7 +12165,7 @@ void TeamListContractRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) { giHighLine = iValue; - if( CanExtendContractForCharSlot( (INT8) iValue + FIRSTmercTOdisplay ) ) + if( CanExtendContractForCharSlot( iValue + FIRSTmercTOdisplay ) ) { giContractHighLine = iValue; } @@ -12193,7 +12196,7 @@ void TeamListContractRegionMvtCallBack(MOUSE_REGION *pRegion, INT32 iReason ) } else if( iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { - if( CanExtendContractForCharSlot( (INT8) iValue + FIRSTmercTOdisplay ) ) + if( CanExtendContractForCharSlot( iValue + FIRSTmercTOdisplay ) ) { // play click PlayGlowRegionSound( ); @@ -12216,7 +12219,7 @@ INT32 GetIndexForthis( SOLDIERTYPE *pSoldier ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { - if( ( &Menptr[ gCharactersList[ iCounter ].usSolID ] ) == pSoldier ) + if( gCharactersList[ iCounter ].usSolID == pSoldier->ubID ) { iIndex = iCounter; iCounter = iLastGuy; @@ -12288,7 +12291,7 @@ void PlotPermanentPaths( void ) } else if( GetSelectedDestChar() != -1 ) { - DisplaySoldierPath( &Menptr[ gCharactersList[GetSelectedDestChar()].usSolID ] ); + DisplaySoldierPath( gCharactersList[GetSelectedDestChar()].usSolID ); } } @@ -12343,7 +12346,7 @@ void PlotTemporaryPaths( void ) // dest char has been selected, else if( GetSelectedDestChar() != -1 ) { - PlotATemporaryPathForCharacter( &Menptr[ gCharactersList[GetSelectedDestChar()].usSolID ], sMapX, sMapY ); + PlotATemporaryPathForCharacter( gCharactersList[GetSelectedDestChar()].usSolID, sMapX, sMapY ); // check to see if we are drawing path DisplayThePotentialPathForCurrentDestinationCharacterForMapScreenInterface( sMapX, sMapY ); @@ -12354,7 +12357,7 @@ void PlotTemporaryPaths( void ) // clip region ClipBlitsToMapViewRegion( ); // blit - DisplaySoldierTempPath( &Menptr[ gCharactersList[GetSelectedDestChar()].usSolID ] ); + DisplaySoldierTempPath( gCharactersList[GetSelectedDestChar()].usSolID ); // restore RestoreClipRegionToFullScreen( ); } @@ -12596,7 +12599,7 @@ void DetermineIfContractMenuCanBeShown( void ) // determine which lines selectable HandleShadingOfLinesForContractMenu( ); - if( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife == 0 ) + if( gCharactersList[ bSelectedInfoChar ].usSolID->stats.bLife == 0 ) { // show basic assignment menu ShowBox( ghRemoveMercAssignBox ); @@ -12664,7 +12667,7 @@ void ContractRegionBtnCallback( MOUSE_REGION *pRegion, INT32 iReason ) if( CanExtendContractForCharSlot( bSelectedInfoChar ) ) { - pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; // create RebuildContractBoxForMerc( pSoldier ); @@ -12771,7 +12774,7 @@ void HandleShadingOfLinesForContractMenu( void ) Assert( CanExtendContractForCharSlot( bSelectedContractChar ) ); // grab the character - pSoldier = &Menptr[ gCharactersList[ bSelectedContractChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedContractChar ].usSolID; // is guy in AIM? and well enough to talk and make such decisions? @@ -12858,7 +12861,7 @@ void ReBuildCharactersList( void ) { // clear this slot gCharactersList[ sCount ].fValid = FALSE; - gCharactersList[ sCount ].usSolID = 0; + gCharactersList[ sCount ].usSolID = NOBODY; } // fills array with pressence of player controlled characters @@ -12977,7 +12980,7 @@ void EnableDisableTeamListRegionsAndHelpText( void ) MSYS_EnableRegion( &gTeamListLocationRegion[ bCharNum ] ); // valid character. If it's a vehicle, however - if ( Menptr[ gCharactersList[ bCharNum + FIRSTmercTOdisplay].usSolID ].flags.uiStatusFlags & SOLDIER_VEHICLE ) + if ( gCharactersList[ bCharNum + FIRSTmercTOdisplay].usSolID->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Can't change assignment for vehicles MSYS_DisableRegion( &gTeamListAssignmentRegion[ bCharNum ] ); @@ -12987,8 +12990,8 @@ void EnableDisableTeamListRegionsAndHelpText( void ) MSYS_EnableRegion( &gTeamListAssignmentRegion[ bCharNum ] ); // POW or dead ? - if ( ( Menptr[ gCharactersList[ bCharNum + FIRSTmercTOdisplay].usSolID ].bAssignment == ASSIGNMENT_POW ) || - ( Menptr[ gCharactersList[ bCharNum + FIRSTmercTOdisplay].usSolID ].stats.bLife == 0 ) ) + if ( ( gCharactersList[ bCharNum + FIRSTmercTOdisplay].usSolID->bAssignment == ASSIGNMENT_POW ) || + ( gCharactersList[ bCharNum + FIRSTmercTOdisplay].usSolID->stats.bLife == 0 ) ) { // "Remove Merc" SetRegionFastHelpText( &gTeamListAssignmentRegion[ bCharNum ], pRemoveMercStrings[ 0 ] ); @@ -13128,7 +13131,7 @@ BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone ) { ChangeSelectedInfoChar( bOldSelectedInfoChar, TRUE ); - SetAutoFaceInActive( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]->iFaceIndex ); + SetAutoFaceInActive( gCharactersList[ bSelectedInfoChar ].usSolID->iFaceIndex ); } */ @@ -13150,7 +13153,7 @@ BOOLEAN ContinueDialogue(SOLDIERTYPE *pSoldier, BOOLEAN fDone ) { if( gCharactersList[bCounter].fValid == TRUE ) { - if( ( &Menptr[gCharactersList[bCounter].usSolID]) == pSoldier ) + if( gCharactersList[bCounter].usSolID == pSoldier->ubID ) { if( bSelectedInfoChar != bCounter ) { @@ -13174,7 +13177,7 @@ void HandleSpontanousTalking( ) { if( ( bSelectedInfoChar != -1 ) && ( bSelectedInfoChar < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS ) ) { - ContinueDialogue( ( &Menptr[gCharactersList[bSelectedInfoChar].usSolID] ), TRUE ); + ContinueDialogue( gCharactersList[bSelectedInfoChar].usSolID, TRUE ); } } } @@ -13254,22 +13257,24 @@ BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY ) return( FALSE ); } - if ( CALCULATE_STRATEGIC_INDEX( sX, sY ) == GetLastSectorIdInCharactersPath( ( &Menptr[ gCharactersList[GetSelectedDestChar()].usSolID ] ) ) ) + SOLDIERTYPE* pSoldier = gCharactersList[GetSelectedDestChar()].usSolID; + + if ( CALCULATE_STRATEGIC_INDEX( sX, sY ) == GetLastSectorIdInCharactersPath( pSoldier ) ) { // clicked on last sector, reset plotting mode // if he's IN a vehicle or IS a vehicle - if( ( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].bAssignment == VEHICLE ) || ( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + if( ( pSoldier->bAssignment == VEHICLE ) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { - if( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].bAssignment == VEHICLE ) + if( pSoldier->bAssignment == VEHICLE ) { // IN a vehicle - iVehicleId = Menptr[gCharactersList[GetSelectedDestChar()].usSolID].iVehicleId; + iVehicleId = pSoldier->iVehicleId; } else { // IS a vehicle - iVehicleId = Menptr[gCharactersList[GetSelectedDestChar()].usSolID].bVehicleID; + iVehicleId = pSoldier->bVehicleID; } // rebuild waypoints - vehicles @@ -13278,7 +13283,7 @@ BOOLEAN CheckIfClickOnLastSectorInPath( INT16 sX, INT16 sY ) else { // rebuild waypoints - mercs on foot - ppMovePath = &( Menptr[gCharactersList[GetSelectedDestChar()].usSolID].pMercPath ); + ppMovePath = &( pSoldier->pMercPath ); } RebuildWayPointsForAllSelectedCharsGroups( ); @@ -13339,7 +13344,7 @@ void RebuildWayPointsForAllSelectedCharsGroups( void ) { if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // if he's IN a vehicle or IS a vehicle @@ -13443,7 +13448,7 @@ void UpdateCursorIfInLastSector( void ) if ( GetSelectedDestChar() != -1 ) { //c heck if we are in the last sector of the characters path? - if ( CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) == GetLastSectorIdInCharactersPath( (&Menptr[gCharactersList[GetSelectedDestChar()].usSolID]) ) ) + if ( CALCULATE_STRATEGIC_INDEX( sMapX, sMapY ) == GetLastSectorIdInCharactersPath( gCharactersList[GetSelectedDestChar()].usSolID ) ) { // set cursor to checkmark ChangeMapScreenMaskCursor( CURSOR_CHECKMARK ); @@ -13623,7 +13628,7 @@ void UpDateStatusOfContractBox( void ) { ForceUpDateOfBox( ghContractBox ); - if( ( Menptr[gCharactersList[ bSelectedInfoChar ].usSolID].stats.bLife == 0 )||( Menptr[gCharactersList[bSelectedInfoChar].usSolID].bAssignment == ASSIGNMENT_POW ) ) + if( ( gCharactersList[ bSelectedInfoChar ].usSolID->stats.bLife == 0 )||( gCharactersList[bSelectedInfoChar].usSolID->bAssignment == ASSIGNMENT_POW ) ) { ForceUpDateOfBox( ghRemoveMercAssignBox ); } @@ -13774,17 +13779,21 @@ void UpdateStatusOfMapSortButtons( void ) INT16 GetLastValidCharacterInTeamPanelList( void ) { INT16 iCounter = 0, iValue = 0; + SOLDIERTYPE* pSoldier; + SOLDIERTYPE* pSelectedSoldier = gCharactersList[bSelectedInfoChar].usSolID; // run through the list and find the last valid guy in the list for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { - if(( Menptr[ gCharactersList[ iCounter ].usSolID ].stats.bLife >= OKLIFE ) ) + pSoldier = gCharactersList[iCounter].usSolID; + + if(pSoldier->stats.bLife >= OKLIFE ) { if( fShowMapInventoryPool ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == sSelMapX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == sSelMapY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) + if( pSoldier->sSectorX == sSelMapX && pSoldier->sSectorY == sSelMapY && pSoldier->bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) { iValue = iCounter; } @@ -13797,7 +13806,7 @@ INT16 GetLastValidCharacterInTeamPanelList( void ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) + if( pSoldier->sSectorX == pSelectedSoldier->sSectorX && pSoldier->sSectorY == pSelectedSoldier->sSectorY && pSoldier->bSectorZ == pSelectedSoldier->bSectorZ ) { iValue = iCounter; } @@ -13828,11 +13837,11 @@ INT8 GetPrevValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { - if( ( Menptr[ gCharactersList[ iCounter ].usSolID ].bLife >= OKLIFE ) ) + if( ( gCharactersList[ iCounter ].usSolID->bLife >= OKLIFE ) ) { if( fShowMapInventoryPool ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == sSelMapX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == sSelMapY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) + if( gCharactersList[ iCounter ].usSolID->sSectorX == sSelMapX && gCharactersList[ iCounter ].usSolID->sSectorY == sSelMapY && gCharactersList[ iCounter ].usSolID->bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) { iValue = iCounter; } @@ -13845,7 +13854,7 @@ INT8 GetPrevValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) + if( gCharactersList[ iCounter ].usSolID->sSectorX == gCharactersList[ bSelectedInfoChar ].usSolID->sSectorX && gCharactersList[ iCounter ].usSolID->sSectorY == gCharactersList[ bSelectedInfoChar ].usSolID->sSectorY && gCharactersList[ iCounter ].usSolID->bSectorZ ==gCharactersList[ bSelectedInfoChar ].usSolID->bSectorZ ) { iValue = iCounter; iCounter = 0; @@ -13875,11 +13884,11 @@ INT8 GetNextValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { - if( ( Menptr[ gCharactersList[ iCounter ].usSolID ].bLife >= OKLIFE ) ) + if( ( gCharactersList[ iCounter ].usSolID->bLife >= OKLIFE ) ) { if( fShowMapInventoryPool ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == sSelMapX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == sSelMapY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) + if( gCharactersList[ iCounter ].usSolID->sSectorX == sSelMapX && gCharactersList[ iCounter ].usSolID->sSectorY == sSelMapY && gCharactersList[ iCounter ].usSolID->bSectorZ == ( INT8 )( iCurrentMapSectorZ ) ) { iValue = iCounter; } @@ -13892,7 +13901,7 @@ INT8 GetNextValidCharacterInTeamPanelList( INT8 bCurrentIndex ) { if( gCharactersList[ bSelectedInfoChar ].fValid == TRUE ) { - if( Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorX == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX && Menptr[ gCharactersList[ iCounter ].usSolID ].sSectorY == Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY && Menptr[ gCharactersList[ iCounter ].usSolID ].bSectorZ ==Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ ) + if( gCharactersList[ iCounter ].usSolID->sSectorX == gCharactersList[ bSelectedInfoChar ].usSolID->sSectorX && gCharactersList[ iCounter ].usSolID->sSectorY == gCharactersList[ bSelectedInfoChar ].usSolID->sSectorY && gCharactersList[ iCounter ].usSolID->bSectorZ ==gCharactersList[ bSelectedInfoChar ].usSolID->bSectorZ ) { iValue = iCounter; } @@ -14122,7 +14131,7 @@ void UpdateBadAssignments( void ) { if( gCharactersList[ iCounter ].fValid == TRUE ) { - CheckIfSoldierUnassigned( &Menptr[ gCharactersList[ iCounter ].usSolID ] ); + CheckIfSoldierUnassigned( gCharactersList[ iCounter ].usSolID ); } } @@ -14180,7 +14189,7 @@ BOOLEAN AnyMercsLeavingRealSoon() { if( gCharactersList[ uiCounter ].fValid == TRUE ) { - if( ( Menptr[gCharactersList[uiCounter].usSolID].iEndofContractTime - uiTimeInMin ) <= MINS_TO_FLASH_CONTRACT_TIME ) + if( ( gCharactersList[uiCounter].usSolID->iEndofContractTime - uiTimeInMin ) <= MINS_TO_FLASH_CONTRACT_TIME ) { fFoundOne = TRUE; break; @@ -14263,10 +14272,8 @@ void HandleRemovalOfPreLoadedMapGraphics( void ) } -BOOLEAN CharacterIsInLoadedSectorAndWantsToMoveInventoryButIsNotAllowed( INT8 bCharId ) +BOOLEAN CharacterIsInLoadedSectorAndWantsToMoveInventoryButIsNotAllowed( INT16 bCharId ) { - UINT16 usSoldierId = 0; - // invalid char id if( bCharId == -1 ) { @@ -14280,10 +14287,10 @@ BOOLEAN CharacterIsInLoadedSectorAndWantsToMoveInventoryButIsNotAllowed( INT8 bC } // get the soldier id - usSoldierId = gCharactersList[ bCharId ].usSolID; + SoldierID usSoldierId = gCharactersList[ bCharId ].usSolID; // char is in loaded sector - if( Menptr[ usSoldierId ].sSectorX != gWorldSectorX || Menptr[ usSoldierId ].sSectorY != gWorldSectorY || Menptr[ usSoldierId ].bSectorZ != gbWorldSectorZ ) + if( usSoldierId->sSectorX != gWorldSectorX || usSoldierId->sSectorY != gWorldSectorY || usSoldierId->bSectorZ != gbWorldSectorZ ) { return( FALSE ); } @@ -14660,7 +14667,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse // if we have anyone valid selected if ( ( bSelectedInfoChar != -1 ) && ( gCharactersList[ bSelectedInfoChar ].fValid ) ) { - pPreviousSelectedInfoChar = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pPreviousSelectedInfoChar = gCharactersList[ bSelectedInfoChar ].usSolID; } @@ -14677,7 +14684,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse } // get soldier assoc. with entry - pCurrentSoldier = &Menptr[ gCharactersList[ iCounter ].usSolID ]; + pCurrentSoldier = gCharactersList[ iCounter ].usSolID; // check if soldier is active if( pCurrentSoldier->bActive == FALSE ) @@ -14715,11 +14722,12 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse break; } - //if( ( wcscmp( Menptr[ gCharactersList[ iCounterA ].usSolID ].name, Menptr[ gCharactersList[ iCounter ].usSolID ].name ) > 0 ) && ( iCounterA < iCounter ) ) + //if( ( wcscmp( gCharactersList[ iCounterA ].usSolID->name, gCharactersList[ iCounter ].usSolID->name ) > 0 ) && ( iCounterA < iCounter ) ) if( iCounterA < iCounter ) { - if((fReverse && ( wcscmp( Menptr[ gCharactersList[ iCounterA ].usSolID ].name, Menptr[ gCharactersList[ iCounter ].usSolID ].name ) < 0 )) || - (!fReverse && ( wcscmp( Menptr[ gCharactersList[ iCounterA ].usSolID ].name, Menptr[ gCharactersList[ iCounter ].usSolID ].name ) > 0 ))) + + if((fReverse && ( wcscmp( gCharactersList[ iCounterA ].usSolID->name, gCharactersList[ iCounter ].usSolID->name ) < 0 )) || + (!fReverse && ( wcscmp( gCharactersList[ iCounterA ].usSolID->name, gCharactersList[ iCounter ].usSolID->name ) > 0 ))) SwapCharactersInList( iCounter, iCounterA ); } } @@ -14734,23 +14742,23 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse break; } - if( !fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].bAssignment > Menptr[ gCharactersList[ iCounter ].usSolID ].bAssignment ) && ( iCounterA < iCounter ) ) + if( !fReverse && ( gCharactersList[ iCounterA ].usSolID->bAssignment > gCharactersList[ iCounter ].usSolID->bAssignment ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } - else if( fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].bAssignment < Menptr[ gCharactersList[ iCounter ].usSolID ].bAssignment ) && ( iCounterA < iCounter ) ) + else if( fReverse && ( gCharactersList[ iCounterA ].usSolID->bAssignment < gCharactersList[ iCounter ].usSolID->bAssignment ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } - else if( ( Menptr[ gCharactersList[ iCounterA ].usSolID ].bAssignment == Menptr[ gCharactersList[ iCounter ].usSolID ].bAssignment ) && ( iCounterA < iCounter ) ) + else if( ( gCharactersList[ iCounterA ].usSolID->bAssignment == gCharactersList[ iCounter ].usSolID->bAssignment ) && ( iCounterA < iCounter ) ) { // same assignment // if it's in a vehicle - if( Menptr[ gCharactersList[ iCounterA ].usSolID ].bAssignment == VEHICLE ) + if( gCharactersList[ iCounterA ].usSolID->bAssignment == VEHICLE ) { // then also compare vehicle IDs - if( ( Menptr[ gCharactersList[ iCounterA ].usSolID ].iVehicleId > Menptr[ gCharactersList[ iCounter ].usSolID ].iVehicleId ) && ( iCounterA < iCounter ) ) + if( ( gCharactersList[ iCounterA ].usSolID->iVehicleId > gCharactersList[ iCounter ].usSolID->iVehicleId ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } @@ -14768,11 +14776,11 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse break; } - if( !fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].flags.fMercAsleep == TRUE ) && ( Menptr[ gCharactersList[ iCounter ].usSolID ].flags.fMercAsleep == FALSE ) && ( iCounterA < iCounter ) ) + if( !fReverse && ( gCharactersList[ iCounterA ].usSolID->flags.fMercAsleep == TRUE ) && ( gCharactersList[ iCounter ].usSolID->flags.fMercAsleep == FALSE ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } - else if( fReverse && ( Menptr[ gCharactersList[ iCounterA ].usSolID ].flags.fMercAsleep == FALSE ) && ( Menptr[ gCharactersList[ iCounter ].usSolID ].flags.fMercAsleep == TRUE ) && ( iCounterA < iCounter ) ) + else if( fReverse && ( gCharactersList[ iCounterA ].usSolID->flags.fMercAsleep == FALSE ) && ( gCharactersList[ iCounter ].usSolID->flags.fMercAsleep == TRUE ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); } @@ -14806,13 +14814,13 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse case( 4 ): // by destination sector - if( GetLengthOfMercPath( MercPtrs[ gCharactersList[ iCounter ].usSolID ] ) == 0 ) + if( GetLengthOfMercPath( gCharactersList[ iCounter ].usSolID ) == 0 ) { sEndSectorA = 9999; } else { - sEndSectorA = GetLastSectorIdInCharactersPath( &Menptr[ gCharactersList[ iCounter ].usSolID ] ); + sEndSectorA = GetLastSectorIdInCharactersPath( gCharactersList[ iCounter ].usSolID ); } for( iCounterA = 0; iCounterA < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterA++ ) @@ -14822,13 +14830,13 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse break; } - if( GetLengthOfMercPath( MercPtrs[ gCharactersList[ iCounterA ].usSolID ] ) == 0 ) + if( GetLengthOfMercPath( gCharactersList[ iCounterA ].usSolID ) == 0 ) { sEndSectorB = 9999; } else { - sEndSectorB = GetLastSectorIdInCharactersPath( &Menptr[ gCharactersList[ iCounterA ].usSolID ] ); + sEndSectorB = GetLastSectorIdInCharactersPath( gCharactersList[ iCounterA ].usSolID ); } if( !fReverse && ( sEndSectorB > sEndSectorA ) && ( iCounterA < iCounter ) ) @@ -14843,7 +14851,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse break; case( 5 ): - iExpiryTime = GetContractExpiryTime( &( Menptr[ gCharactersList[ iCounter ].usSolID ] ) ); + iExpiryTime = GetContractExpiryTime( gCharactersList[ iCounter ].usSolID ); //by contract expiry for( iCounterA = 0; iCounterA < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterA++ ) @@ -14853,7 +14861,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse break; } - iExpiryTimeA = GetContractExpiryTime( &( Menptr[ gCharactersList[ iCounterA ].usSolID ] ) ); + iExpiryTimeA = GetContractExpiryTime( gCharactersList[ iCounterA ].usSolID ); if( !fReverse && ( iExpiryTimeA > iExpiryTime ) && ( iCounterA < iCounter ) ) { @@ -14867,7 +14875,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse break; case( 6 ): - uiID = Menptr[ gCharactersList[ iCounter ].usSolID ].ubID; + uiID = gCharactersList[ iCounter ].usSolID->ubID; //by ubID for( iCounterA = 0; iCounterA < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounterA++ ) { @@ -14875,7 +14883,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse { break; } - uiIDA = Menptr[ gCharactersList[ iCounterA ].usSolID ].ubID; + uiIDA = gCharactersList[ iCounterA ].usSolID->ubID; if( !fReverse && ( uiIDA > uiID ) && ( iCounterA < iCounter ) ) { SwapCharactersInList( iCounter, iCounterA ); @@ -14914,7 +14922,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse } // grab current soldier - pCurrentSoldier = &Menptr[ gCharactersList[ iCounterA ].usSolID ]; + pCurrentSoldier = gCharactersList[ iCounterA ].usSolID; // check if soldier is active if( pCurrentSoldier->bActive == FALSE ) @@ -14956,10 +14964,8 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse void SwapCharactersInList( INT32 iCharA, INT32 iCharB ) { - UINT16 usTempSoldID; - // swap - usTempSoldID = gCharactersList[ iCharA ].usSolID; + SoldierID usTempSoldID = gCharactersList[ iCharA ].usSolID; gCharactersList[ iCharA ].usSolID = gCharactersList[ iCharB ].usSolID; gCharactersList[ iCharB ].usSolID = usTempSoldID; } @@ -15055,7 +15061,7 @@ void HandleAssignmentsDoneAndAwaitingFurtherOrders( void ) break; } - pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + pSoldier = gCharactersList[ iCounter ].usSolID; // toggle and redraw if flash was left ON even though the flag is OFF if( pSoldier->flags.fDoneAssignmentAndNothingToDoFlag || fFlashAssignDone ) @@ -15090,7 +15096,7 @@ void DisplayIconsForMercsAsleep( void ) { if( gCharactersList[ iCounter + FIRSTmercTOdisplay ].fValid == TRUE ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter + FIRSTmercTOdisplay ].usSolID ]; + pSoldier = gCharactersList[ iCounter + FIRSTmercTOdisplay ].usSolID; if( pSoldier->bActive && pSoldier->flags.fMercAsleep && CanChangeSleepStatusForSoldier( pSoldier ) ) { BltVideoObject( guiSAVEBUFFER , hHandle, 0, UI_CHARLIST.xSleep + 2, ( INT16 )(UI_CHARLIST.y + (iCounter * ( Y_SIZE + 2 ) ) ) , VO_BLT_SRCTRANSPARENCY,NULL ); @@ -15175,7 +15181,7 @@ BOOLEAN CanToggleSelectedCharInventory( void ) return(FALSE); } - pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; // if not in inventory, and holding an item from sector inventory if( !fShowInventoryFlag && @@ -15216,7 +15222,7 @@ BOOLEAN MapCharacterHasAccessibleInventory( INT16 bCharNumber ) return(FALSE); } - pSoldier = MercPtrs[ gCharactersList[ bCharNumber ].usSolID ]; + pSoldier = gCharactersList[ bCharNumber ].usSolID; if( ( pSoldier->bAssignment == IN_TRANSIT ) || ( pSoldier->bAssignment == ASSIGNMENT_POW ) || @@ -15307,9 +15313,8 @@ void ChangeSelectedMapSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) fTeamPanelDirty = TRUE; } -BOOLEAN CanChangeDestinationForCharSlot( INT8 bCharNumber, BOOLEAN fShowErrorMessage ) +BOOLEAN CanChangeDestinationForCharSlot( INT16 bCharNumber, BOOLEAN fShowErrorMessage ) { - SOLDIERTYPE *pSoldier = NULL; INT8 bErrorNumber = -1; @@ -15319,7 +15324,7 @@ BOOLEAN CanChangeDestinationForCharSlot( INT8 bCharNumber, BOOLEAN fShowErrorMes if ( gCharactersList[ bCharNumber ].fValid == FALSE ) return (FALSE); - pSoldier = MercPtrs[ gCharactersList[ bCharNumber ].usSolID ]; + SOLDIERTYPE* pSoldier = gCharactersList[ bCharNumber ].usSolID; // valid soldier? Assert( pSoldier ); @@ -15344,18 +15349,15 @@ BOOLEAN CanChangeDestinationForCharSlot( INT8 bCharNumber, BOOLEAN fShowErrorMes -BOOLEAN CanExtendContractForCharSlot( INT8 bCharNumber ) +BOOLEAN CanExtendContractForCharSlot( INT16 bCharNumber ) { - SOLDIERTYPE *pSoldier = NULL; - - if ( bCharNumber == -1 ) return( FALSE ); if ( gCharactersList[ bCharNumber ].fValid == FALSE ) return (FALSE); - pSoldier = MercPtrs[ gCharactersList[ bCharNumber ].usSolID ]; + SOLDIERTYPE* pSoldier = gCharactersList[ bCharNumber ].usSolID; // valid soldier? Assert( pSoldier ); @@ -15385,20 +15387,15 @@ BOOLEAN CanExtendContractForCharSlot( INT8 bCharNumber ) } -BOOLEAN CanChangeSleepStatusForCharSlot( INT8 bCharNumber ) +BOOLEAN CanChangeSleepStatusForCharSlot( INT16 bCharNumber ) { - SOLDIERTYPE *pSoldier = NULL; - if ( bCharNumber == -1 ) return( FALSE ); if ( gCharactersList[ bCharNumber ].fValid == FALSE ) return (FALSE); - - pSoldier = MercPtrs[ gCharactersList[ bCharNumber ].usSolID ]; - - return( CanChangeSleepStatusForSoldier( pSoldier ) ); + return( CanChangeSleepStatusForSoldier(gCharactersList[bCharNumber].usSolID) ); } @@ -15503,7 +15500,7 @@ void CancelOrShortenPlottedPath( void ) return; // try to delete portion of path AFTER the current sector for the helicopter - uiReturnValue = ClearPathAfterThisSectorForCharacter( &Menptr[gCharactersList[GetSelectedDestChar()].usSolID], sMapX, sMapY ); + uiReturnValue = ClearPathAfterThisSectorForCharacter( gCharactersList[GetSelectedDestChar()].usSolID, sMapX, sMapY ); } switch ( uiReturnValue ) @@ -15557,8 +15554,8 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT16 bCharNumber, BOOLEAN fFromRightClick // if not already selected if( fSelectedListOfMercsForMapScreen[ iCounter ] == FALSE ) { - SOLDIERTYPE * pSelected = &( Menptr[ gCharactersList[ bCharNumber ].usSolID ] ); - SOLDIERTYPE * pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + SOLDIERTYPE * pSelected = gCharactersList[ bCharNumber ].usSolID; + SOLDIERTYPE * pSoldier = gCharactersList[ iCounter ].usSolID; // if on a squad, or in a vehicle, or IS a vehicle if ( pSoldier->bAssignment == VEHICLE ) @@ -15612,8 +15609,8 @@ BOOLEAN HandleCtrlOrShiftInTeamPanel( INT16 bCharNumber, BOOLEAN fFromRightClick // if not already selected if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) { - SOLDIERTYPE * pSelected = &( Menptr[ gCharactersList[ bCharNumber ].usSolID ] ); - SOLDIERTYPE * pSoldier = &( Menptr[ gCharactersList[ iCounter ].usSolID ] ); + SOLDIERTYPE * pSelected = gCharactersList[ bCharNumber ].usSolID; + SOLDIERTYPE * pSoldier = gCharactersList[ iCounter ].usSolID; // if on a squad, or in a vehicle, or IS a vehicle if ( pSoldier->bAssignment == VEHICLE ) @@ -15824,7 +15821,7 @@ void CopyPathToAllSelectedCharacters( PathStPtr pPath ) { if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // skip itself! if ( GetSoldierMercPathPtr( pSoldier ) != pPath ) @@ -15933,7 +15930,7 @@ INT32 GetGroundTravelTimeOfCharacter( INT8 bCharNumber ) iTravelTime = GetPathTravelTimeDuringPlotting( pTempCharacterPath ); // add travel time for any prior path segments (stored in the selected character's mercpath, but waypoints aren't built) - iTravelTime += GetPathTravelTimeDuringPlotting( GetSoldierMercPathPtr( MercPtrs[ gCharactersList[ bCharNumber ].usSolID ] ) ); + iTravelTime += GetPathTravelTimeDuringPlotting( GetSoldierMercPathPtr( gCharactersList[ bCharNumber ].usSolID ) ); return( iTravelTime ); } @@ -15961,7 +15958,7 @@ INT16 CalcLocationValueForChar( INT32 iCounter ) if( gCharactersList[ iCounter ].fValid == FALSE ) return( sLocValue ); - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // don't reveal location of POWs! if( pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND ) @@ -15996,7 +15993,7 @@ void MakeMapModesSuitableForDestPlotting( INT8 bCharNumber ) if( gCharactersList[ bCharNumber ].fValid == TRUE ) { - pSoldier = MercPtrs[ gCharactersList[ bCharNumber ].usSolID ]; + pSoldier = gCharactersList[ bCharNumber ].usSolID; CancelSectorInventoryDisplayIfOn( FALSE ); @@ -16296,7 +16293,7 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) { if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if ( pSoldier->stats.bLife >= OKLIFE && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) && !pSoldier->flags.fMercAsleep ) @@ -16557,7 +16554,7 @@ void WakeUpAnySleepingSelectedMercsOnFootOrDriving( void ) { if( ( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // if asleep if ( pSoldier->flags.fMercAsleep ) @@ -16850,10 +16847,10 @@ void RememberPreviousPathForAllSelectedChars( void ) { if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; // remember his previous path by copying it to his slot in the array kept for that purpose - gpCharacterPreviousMercPath[ iCounter ] = CopyPaths( GetSoldierMercPathPtr( MercPtrs[ gCharactersList[ iCounter ].usSolID ] ), gpCharacterPreviousMercPath[ iCounter ] ); + gpCharacterPreviousMercPath[ iCounter ] = CopyPaths( GetSoldierMercPathPtr( gCharactersList[ iCounter ].usSolID ), gpCharacterPreviousMercPath[ iCounter ] ); } } } @@ -16967,7 +16964,7 @@ void RestorePreviousPaths( void ) // if selected if( fSelectedListOfMercsForMapScreen[ iCounter ] == TRUE ) { - pSoldier = MercPtrs[ gCharactersList[ iCounter ].usSolID ]; + pSoldier = gCharactersList[ iCounter ].usSolID; if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { @@ -17068,7 +17065,7 @@ void SelectAllCharactersInSquad( INT8 bSquadNumber ) // is this entry is valid if( gCharactersList[ bCounter ].fValid == TRUE ) { - pSoldier = MercPtrs[ gCharactersList[ bCounter ].usSolID ]; + pSoldier = gCharactersList[ bCounter ].usSolID; // if this guy is on that squad or in a vehicle which is assigned to that squad // NOTE: There's no way to select everyone aboard Skyrider with this function... @@ -17198,7 +17195,7 @@ void RequestContractMenu( void ) if ( CanExtendContractForCharSlot( bSelectedInfoChar ) ) { // create - RebuildContractBoxForMerc( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ); + RebuildContractBoxForMerc( gCharactersList[ bSelectedInfoChar ].usSolID ); // reset selected characters ResetAllSelectedCharacterModes( ); @@ -17207,7 +17204,7 @@ void RequestContractMenu( void ) giContractHighLine = bSelectedContractChar; // if not triggered internally - if ( CheckIfSalaryIncreasedAndSayQuote( MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ], TRUE ) == FALSE ) + if ( CheckIfSalaryIncreasedAndSayQuote( gCharactersList[ bSelectedInfoChar ].usSolID, TRUE ) == FALSE ) { // show contract box fShowContractMenu = TRUE; @@ -17300,7 +17297,7 @@ INT32 GetTotalContractExpenses ( void ) while(gCharactersList[ubCounter].fValid) { - pSoldier = MercPtrs[ gCharactersList[ ubCounter ].usSolID ]; + pSoldier = gCharactersList[ ubCounter ].usSolID; // salary if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) { diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index e17da45b..ac0b53e5 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -150,7 +150,7 @@ void ChangeSelectedMapSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); BOOLEAN CanToggleSelectedCharInventory( void ); -BOOLEAN CanExtendContractForCharSlot( INT8 bCharNumber ); +BOOLEAN CanExtendContractForCharSlot( INT16 bCharNumber ); void TellPlayerWhyHeCantCompressTime( void ); @@ -168,7 +168,7 @@ void CancelChangeArrivalSectorMode( void ); void ExplainWhySkyriderCantFly( void ); -BOOLEAN CanChangeSleepStatusForCharSlot( INT8 bCharNumber ); +BOOLEAN CanChangeSleepStatusForCharSlot( INT16 bCharNumber ); BOOLEAN CanChangeSleepStatusForSoldier( SOLDIERTYPE *pSoldier ); BOOLEAN MapCharacterHasAccessibleInventory( INT16 bCharNumber ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 92ef5863..ab4a8cb0 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -2362,16 +2362,17 @@ void addAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup ) } POPUP * createPopupForPocket( SOLDIERTYPE *pSoldier, INT16 sPocket ){ + SOLDIERTYPE* pSelectedSoldier = gCharactersList[bSelectedInfoChar].usSolID; if( !( guiCurrentItemDescriptionScreen == MAP_SCREEN - && fShowMapInventoryPool - && ( ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX == sSelMapX ) - && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY == sSelMapY ) - && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ == iCurrentMapSectorZ ) + && fShowMapInventoryPool + && ( ( pSelectedSoldier->sSectorX == sSelMapX ) + && ( pSelectedSoldier->sSectorY == sSelMapY ) + && ( pSelectedSoldier->bSectorZ == iCurrentMapSectorZ ) ) - && CanPlayerUseSectorInventory( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ) - ) ) + && CanPlayerUseSectorInventory( pSelectedSoldier ) + ) ) { return NULL; } @@ -5853,13 +5854,14 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex) } } BOOLEAN showAttachmentPopups = FALSE; + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; if( guiCurrentItemDescriptionScreen == MAP_SCREEN && fShowMapInventoryPool - && ( (Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX == sSelMapX ) - && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY == sSelMapY ) - && ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ == iCurrentMapSectorZ ) ) - && CanPlayerUseSectorInventory( &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ) + && ( (pSoldier->sSectorX == sSelMapX ) + && ( pSoldier->sSectorY == sSelMapY ) + && ( pSoldier->bSectorZ == iCurrentMapSectorZ ) ) + && CanPlayerUseSectorInventory( pSoldier ) && attachList.size()>0 ) // silversurfer: no need to show popups if we have nothing to display { showAttachmentPopups = TRUE; @@ -10546,18 +10548,20 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN) { - if( ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorX != sSelMapX ) || - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].sSectorY != sSelMapY ) || - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].bSectorZ != iCurrentMapSectorZ ) || - ( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].flags.fBetweenSectors ) ) + SOLDIERTYPE* pSelected = gCharactersList[bSelectedInfoChar].usSolID; + + if( ( pSelected->sSectorX != sSelMapX ) || + ( pSelected->sSectorY != sSelMapY ) || + ( pSelected->bSectorZ != iCurrentMapSectorZ ) || + ( pSelected->flags.fBetweenSectors ) ) { if ( gpItemPointer == NULL ) { - swprintf( sString, pMapInventoryErrorString[ 2 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name ); + swprintf( sString, pMapInventoryErrorString[ 2 ], pSelected->name ); } else { - swprintf( sString, pMapInventoryErrorString[ 5 ], Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ].name ); + swprintf( sString, pMapInventoryErrorString[ 5 ], pSelected->name ); } DoMapMessageBox( MSG_BOX_BASIC_STYLE, sString, MAP_SCREEN, MSG_BOX_FLAG_OK, NULL ); return; @@ -12824,7 +12828,7 @@ void UpdateItemHatches() { if ( fShowInventoryFlag && bSelectedInfoChar >= 0 ) { - pSoldier = MercPtrs[ gCharactersList[ bSelectedInfoChar ].usSolID ]; + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; } } else @@ -14539,7 +14543,7 @@ void UpdateMercBodyRegionHelpText( ) wcscpy( sString, L"" ); // valid soldier selected - pSoldier = MercPtrs[gCharactersList[bSelectedInfoChar].usSolID]; + pSoldier = gCharactersList[bSelectedInfoChar].usSolID; // health/energy/morale if ( pSoldier->bAssignment != ASSIGNMENT_POW ) @@ -14551,7 +14555,7 @@ void UpdateMercBodyRegionHelpText( ) // robot (condition only) swprintf( sString, L"%s: %d/%d", pMapScreenStatusStrings[3], pSoldier->stats.bLife, pSoldier->stats.bLifeMax ); } - else if ( Menptr[gCharactersList[bSelectedInfoChar].usSolID].flags.uiStatusFlags & SOLDIER_VEHICLE ) + else if (pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // vehicle (condition/fuel) swprintf( sString, L"%s: %d/%d, %s: %d/%d", diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index a397d28d..fee3becd 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -7320,9 +7320,7 @@ void KeyRingItemPanelButtonCallback( MOUSE_REGION * pRegion, INT32 iReason ) } - - - pSoldier = &( Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ] ); + pSoldier = gCharactersList[ bSelectedInfoChar ].usSolID; sStartYPosition = MAP_START_KEYRING_Y; sWidth = 261; sHeight = ( 359 - 107 ); @@ -7457,7 +7455,7 @@ void KeyRingSlotInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else { - UINT16 ubSrcID, ubDestID; + SoldierID ubSrcID, ubDestID; BOOLEAN fOKToGo = FALSE; BOOLEAN fDeductPoints = FALSE; diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 324cde2e..7409cc2f 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -51,24 +51,24 @@ bool checkLBEArrayIntegrity(bool verbose) { if (!gCharactersList[i].fValid || gCharactersList[i].usSolID >= NOBODY) continue; SoldierID id = gCharactersList[i].usSolID; - SOLDIERTYPE soldier = Menptr[id]; + SOLDIERTYPE *soldier = id; - if (verbose)ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"LBENODE integrity check start: checking soldier items (%s)...", soldier.name); + if (verbose)ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"LBENODE integrity check start: checking soldier items (%s)...", soldier->name); - for (int j = 0; j < soldier.inv.size(); j++) { - OBJECTTYPE * object = &(soldier.inv[j]); + for (int j = 0; j < soldier->inv.size(); j++) { + OBJECTTYPE * object = &(soldier->inv[j]); if (object->HasAnyActiveLBEs()) { if (!checkObjectLBEIntegrity(object)) { - ScreenMsg(FONT_MCOLOR_LTRED, MSG_INTERFACE, L"> LBENODE missing: %s -> %s!", soldier.name, Item[object->usItem].szItemName); + ScreenMsg(FONT_MCOLOR_LTRED, MSG_INTERFACE, L"> LBENODE missing: %s -> %s!", soldier->name, Item[object->usItem].szItemName); integrityCheck = false; } else { - if (verbose)ScreenMsg(FONT_MCOLOR_LTGREEN, MSG_INTERFACE, L"> OK: %s -> %s", soldier.name, Item[object->usItem].szItemName); + if (verbose)ScreenMsg(FONT_MCOLOR_LTGREEN, MSG_INTERFACE, L"> OK: %s -> %s", soldier->name, Item[object->usItem].szItemName); } } else { - if (verbose)ScreenMsg(FONT_MCOLOR_LTGRAY, MSG_INTERFACE, L"> SKIP: %s -> %s", soldier.name, Item[object->usItem].szItemName); + if (verbose)ScreenMsg(FONT_MCOLOR_LTGRAY, MSG_INTERFACE, L"> SKIP: %s -> %s", soldier->name, Item[object->usItem].szItemName); } } } diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 341f77c5..5df4fed2 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -502,7 +502,7 @@ void MercArrivesCallback( UINT16 ubSoldierID ) { if (gCharactersList[cnt].fValid) { - pTeamSoldier = &Menptr[gCharactersList[cnt].usSolID]; + pTeamSoldier = gCharactersList[cnt].usSolID; if (pTeamSoldier != pSoldier && pTeamSoldier->bAssignment != ASSIGNMENT_DEAD && pTeamSoldier->bAssignment != ASSIGNMENT_POW && pTeamSoldier->bAssignment != IN_TRANSIT && pSoldier->ubStrategicInsertionCode != INSERTION_CODE_CHOPPER) { force_helidrop = false; diff --git a/Tactical/SkillMenu.cpp b/Tactical/SkillMenu.cpp index 7965c62e..0b4cdaf7 100644 --- a/Tactical/SkillMenu.cpp +++ b/Tactical/SkillMenu.cpp @@ -1096,7 +1096,7 @@ EquipmentSelection::Functions(UINT32 aVal) } else if ( aVal < gTemplateVector.size( ) ) { - SOLDIERTYPE* pSoldier = &Menptr[gCharactersList[bSelectedInfoChar].usSolID]; + SOLDIERTYPE* pSoldier = gCharactersList[bSelectedInfoChar].usSolID; if ( pSoldier ) { std::string name = gTemplateVector[aVal]; From 61c5a41beaefe38cbcbd16ec6788f9777b1c7683 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:35:49 +0200 Subject: [PATCH 093/571] LocateSoldier() & HandleMercLeavingEquipmentInDrassen() & HandleMercLeavingEquipmentInOmerta() --- Strategic/Map Screen Interface.cpp | 18 +++++++++--------- Strategic/Map Screen Interface.h | 6 +++--- Tactical/Overhead.cpp | 4 ++-- Tactical/Overhead.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index eadc70bb..d23f06c1 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -1625,7 +1625,7 @@ void HandleLeavingOfEquipmentInCurrentSector( SoldierID uiMercId ) -void HandleMercLeavingEquipmentInOmerta( UINT32 uiMercId ) +void HandleMercLeavingEquipmentInOmerta( SoldierID uiMercId ) { INT32 iSlotIndex = 0; @@ -1643,7 +1643,7 @@ void HandleMercLeavingEquipmentInOmerta( UINT32 uiMercId ) } -void HandleMercLeavingEquipmentInDrassen( UINT32 uiMercId ) +void HandleMercLeavingEquipmentInDrassen( SoldierID uiMercId ) { INT32 iSlotIndex = 0; @@ -1856,7 +1856,7 @@ INT32 FindFreeSlotInLeaveList( void ) } -INT32 SetUpDropItemListForMerc( UINT32 uiMercId ) +INT32 SetUpDropItemListForMerc( SoldierID uiMercId ) { // will set up a drop list for this grunt, remove items from inventory, and profile INT32 iSlotIndex = -1; @@ -1867,27 +1867,27 @@ INT32 SetUpDropItemListForMerc( UINT32 uiMercId ) return( -1 ); } - UINT32 invsize = Menptr[ uiMercId ].inv.size(); + UINT32 invsize = uiMercId->inv.size(); for( UINT32 iCounter = 0; iCounter < invsize; ++iCounter ) { // slot found, // check if actual item - if( Menptr[ uiMercId ].inv[ iCounter ].exists() == true ) + if( uiMercId->inv[ iCounter ].exists() == true ) { // make a linked list of the items left behind, with the ptr to its head in this free slot - AddItemToLeaveIndex( &( Menptr[ uiMercId ].inv[ iCounter ] ), iSlotIndex ); + AddItemToLeaveIndex( &( uiMercId->inv[ iCounter ] ), iSlotIndex ); // store owner's profile id for the items added to this leave slot index - SetUpMercAboutToLeaveEquipment( Menptr[ uiMercId ].ubProfile, iSlotIndex ); + SetUpMercAboutToLeaveEquipment( uiMercId->ubProfile, iSlotIndex ); } } // ATE: Added this to drop keyring keys - the 2nd last paramter says to add it to a leave list... // the gridno, level and visiblity are ignored - DropKeysInKeyRing( MercPtrs[ uiMercId ], NOWHERE, 0, 0, TRUE, iSlotIndex, FALSE ); + DropKeysInKeyRing( uiMercId, NOWHERE, 0, 0, TRUE, iSlotIndex, FALSE ); // zero out profiles - gMercProfiles[ Menptr[ uiMercId ].ubProfile ].clearInventory(); + gMercProfiles[ uiMercId->ubProfile ].clearInventory(); return( iSlotIndex ); } diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index d29fb861..0120c7d0 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -516,8 +516,8 @@ void GetMoraleString( SOLDIERTYPE *pSoldier, STR16 sString ); void HandleLeavingOfEquipmentInCurrentSector( SoldierID uiMercId ); // set up a linked list of items being dropped and post an event to later drop them -void HandleMercLeavingEquipmentInDrassen( UINT32 uiMercId ); -void HandleMercLeavingEquipmentInOmerta( UINT32 uiMercId ); +void HandleMercLeavingEquipmentInDrassen( SoldierID uiMercId ); +void HandleMercLeavingEquipmentInOmerta( SoldierID uiMercId ); // actually drop the stored list of items void HandleEquipmentLeftInOmerta( UINT32 uiSlotIndex ); @@ -537,7 +537,7 @@ void FreeLeaveListSlot( UINT32 uiSlotIndex ); INT32 FindFreeSlotInLeaveList( void ); // set up drop list -INT32 SetUpDropItemListForMerc( UINT32 uiMercId ); +INT32 SetUpDropItemListForMerc( SoldierID uiMercId ); // store owner's profile id for the items added to this leave slot index void SetUpMercAboutToLeaveEquipment( UINT32 ubProfileId, UINT32 uiSlotIndex ); diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index c4e2164e..3676eeb7 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -3488,7 +3488,7 @@ BOOLEAN ResetAllAnimationCache( ) -void LocateSoldier( UINT16 usID, BOOLEAN fSetLocator) +void LocateSoldier( SoldierID usID, BOOLEAN fSetLocator) { SOLDIERTYPE *pSoldier; INT16 sNewCenterWorldX, sNewCenterWorldY; @@ -3501,7 +3501,7 @@ void LocateSoldier( UINT16 usID, BOOLEAN fSetLocator) if (!SoldierOnScreen(usID) || fSetLocator == 10 ) { // Get pointer of soldier - pSoldier = MercPtrs[ usID ]; + pSoldier = usID; // Center on guy sNewCenterWorldX = (INT16)pSoldier->dXPos; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 5ed891e3..11e0dc00 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -231,7 +231,7 @@ void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceRese void RevealAllDroppedEnemyItems(); void LocateGridNo( INT32 sGridNo ); -void LocateSoldier( UINT16 usID, BOOLEAN fSetLocator); +void LocateSoldier( SoldierID usID, BOOLEAN fSetLocator); void BeginTeamTurn( UINT8 ubTeam ); void SlideTo(INT32 sGridNo, UINT16 usSoldierID , UINT16 usReasonID, BOOLEAN fSetLocator) ; From f0be44bb42b9e04465fa557b599275608ae82d03 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:23:01 +0200 Subject: [PATCH 094/571] Convert to SoldierID TacticalStatusType::ubEnemySightingOnTheirTurnEnemyID TacticalStatusType::ubEnemySightingOnTheirTurnPlayerID TacticalTeamType::ubLastMercToRadio --- Ja2/gamescreen.cpp | 4 +- Tactical/Overhead.h | 6 +- Tactical/opplist.cpp | 533 +++++++++++++++++++------------------------ Tactical/opplist.h | 6 +- 4 files changed, 249 insertions(+), 300 deletions(-) diff --git a/Ja2/gamescreen.cpp b/Ja2/gamescreen.cpp index d1f48eb4..d95c5266 100644 --- a/Ja2/gamescreen.cpp +++ b/Ja2/gamescreen.cpp @@ -580,9 +580,9 @@ UINT32 MainGameScreenHandle(void) { if ( gTacticalStatus.ubCurrentTeam != gbPlayerNum ) { - MercPtrs[ gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID ]->AdjustNoAPToFinishMove( FALSE ); + gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID->AdjustNoAPToFinishMove( FALSE ); } - MercPtrs[ gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID ]->flags.fPauseAllAnimation = FALSE; + gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID->flags.fPauseAllAnimation = FALSE; gTacticalStatus.fEnemySightingOnTheirTurn = FALSE; } diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 11e0dc00..b083cda3 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -28,7 +28,7 @@ typedef struct COLORVAL RadarColor; INT8 bSide; INT16 bMenInSector; - UINT16 ubLastMercToRadio; + SoldierID ubLastMercToRadio; INT8 bTeamActive; INT8 bAwareOfOpposition; INT8 bHuman; @@ -89,8 +89,8 @@ struct TacticalStatusType INT8 bRealtimeSpeed; UINT8 ubEnemyIntention; UINT8 ubEnemyIntendedRetreatDirection; - UINT16 ubEnemySightingOnTheirTurnEnemyID; - UINT16 ubEnemySightingOnTheirTurnPlayerID; + SoldierID ubEnemySightingOnTheirTurnEnemyID; + SoldierID ubEnemySightingOnTheirTurnPlayerID; BOOLEAN fEnemySightingOnTheirTurn; BOOLEAN fAutoBandageMode; UINT8 ubAttackBusyCount; diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 39b72bfa..46cbd3b4 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -3043,30 +3043,25 @@ void RemoveOneOpponent(SOLDIERTYPE *pSoldier) void RemoveManAsTarget(SOLDIERTYPE *pSoldier) { + SOLDIERTYPE *pOpponent; + UINT8 ubLoop; + SoldierID ubTarget = pSoldier->ubID; - SOLDIERTYPE *pOpponent; - UINT16 ubTarget,ubLoop; - - - ubTarget = pSoldier->ubID; - - // clean up the public opponent lists and locations - for (ubLoop = 0; ubLoop < MAXTEAMS; ubLoop++) - { // never causes any additional looks - UpdatePublic(ubLoop, ubTarget, NOT_HEARD_OR_SEEN, NOWHERE, 0); - } -/* - - -IAN COMMENTED THIS OUT MAY 1997 - DO WE NEED THIS? - - // make sure this guy is no longer a possible target for anyone - for (cnt = 0, pOpponent = Menptr; cnt < MAXMERCS; cnt++,pOpponent++) - { - if (pOpponent->bOppNum == ubTarget) - pOpponent->bOppNum = NOBODY; + // clean up the public opponent lists and locations + for (ubLoop = 0; ubLoop < MAXTEAMS; ubLoop++) + { // never causes any additional looks + UpdatePublic(ubLoop, ubTarget, NOT_HEARD_OR_SEEN, NOWHERE, 0); } + /* + IAN COMMENTED THIS OUT MAY 1997 - DO WE NEED THIS? + + // make sure this guy is no longer a possible target for anyone + for (cnt = 0, pOpponent = Menptr; cnt < MAXMERCS; cnt++,pOpponent++) + { + if (pOpponent->bOppNum == ubTarget) + pOpponent->bOppNum = NOBODY; + } */ @@ -3086,74 +3081,65 @@ IAN COMMENTED THIS OUT MAY 1997 - DO WE NEED THIS? if ( ( !CONSIDERED_NEUTRAL( pOpponent, pSoldier ) || pSoldier->usSoldierFlagMask & SOLDIER_POW ) && pOpponent->RecognizeAsCombatant(pSoldier->ubID) ) RemoveOneOpponent(pOpponent); } - UpdatePersonal(pOpponent,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); + UpdatePersonal(pOpponent, ubTarget, NOT_HEARD_OR_SEEN, NOWHERE, 0); gbSeenOpponents[ubLoop][ubTarget] = FALSE; } } -/* + /* + for (ubLoop = 0,pOpponent = Menptr; ubLoop < MAXMERCS; ubLoop++,pOpponent++) + { + // if the target is a true opponent and currently seen by this merc + if (!pSoldier->aiData.bNeutral && !pSoldier->aiData.bNeutral && + (pOpponent->aiData.bOppList[ubTarget] == SEEN_CURRENTLY) - for (ubLoop = 0,pOpponent = Menptr; ubLoop < MAXMERCS; ubLoop++,pOpponent++) - { - // if the target is a true opponent and currently seen by this merc - if (!pSoldier->aiData.bNeutral && !pSoldier->aiData.bNeutral && - (pOpponent->aiData.bOppList[ubTarget] == SEEN_CURRENTLY) + ) + ///*** UNTIL ANDREW GETS THE SIDE PARAMETERS WORKING + // && (pSoldier->side != pOpponent->side)) + { + RemoveOneOpponent(pOpponent); + } - ) - ///*** UNTIL ANDREW GETS THE SIDE PARAMETERS WORKING - // && (pSoldier->side != pOpponent->side)) - { - RemoveOneOpponent(pOpponent); - } + UpdatePersonal(pOpponent,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); - UpdatePersonal(pOpponent,ubTarget,NOT_HEARD_OR_SEEN,NOWHERE,0); - - gbSeenOpponents[ubLoop][ubTarget] = FALSE; - } -*/ - - ResetLastKnownLocs(pSoldier); - - if (gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio == ubTarget) - gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio = NOBODY; + gbSeenOpponents[ubLoop][ubTarget] = FALSE; + } + */ + ResetLastKnownLocs(pSoldier); + if (gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio == ubTarget) + gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio = NOBODY; } - - - -void UpdatePublic(UINT8 ubTeam, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) +void UpdatePublic(UINT8 ubTeam, SoldierID ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) { - INT32 cnt; - INT8 *pbPublOL; - UINT8 ubTeamMustLookAgain = FALSE, ubMadeDifference = FALSE; - SOLDIERTYPE *pSoldier; + INT32 cnt; + UINT8 ubTeamMustLookAgain = FALSE, ubMadeDifference = FALSE; + SOLDIERTYPE *pSoldier; + INT8* pbPublOL = &(gbPublicOpplist[ubTeam][ubID]); - - pbPublOL = &(gbPublicOpplist[ubTeam][ubID]); - - // if new opplist is more up-to-date, or we are just wiping it for some reason - if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][bNewOpplist - OLDEST_HEARD_VALUE] > 0) || - (bNewOpplist == NOT_HEARD_OR_SEEN)) + // if new opplist is more up-to-date, or we are just wiping it for some reason + if ((gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][bNewOpplist - OLDEST_HEARD_VALUE] > 0) || + (bNewOpplist == NOT_HEARD_OR_SEEN)) { - // if this team is becoming aware of a soldier it wasn't previously aware of - if ((bNewOpplist != NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) - ubTeamMustLookAgain = TRUE; + // if this team is becoming aware of a soldier it wasn't previously aware of + if ((bNewOpplist != NOT_HEARD_OR_SEEN) && (*pbPublOL == NOT_HEARD_OR_SEEN)) + ubTeamMustLookAgain = TRUE; - // change the public opplist *BEFORE* anyone looks again or we'll recurse! - *pbPublOL = bNewOpplist; + // change the public opplist *BEFORE* anyone looks again or we'll recurse! + *pbPublOL = bNewOpplist; } - // always update the gridno, no matter what - gsPublicLastKnownOppLoc[ubTeam][ubID] = sGridNo; - gbPublicLastKnownOppLevel[ubTeam][ubID] = bLevel; + // always update the gridno, no matter what + gsPublicLastKnownOppLoc[ubTeam][ubID] = sGridNo; + gbPublicLastKnownOppLevel[ubTeam][ubID] = bLevel; - // if team has been told about a guy the team was completely unaware of - if (ubTeamMustLookAgain) + // if team has been told about a guy the team was completely unaware of + if (ubTeamMustLookAgain) { // then everyone on team who's not aware of guynum must look for him cnt = gTacticalStatus.Team[ubTeam].bFirstID; @@ -3162,10 +3148,10 @@ void UpdatePublic(UINT8 ubTeam, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, IN { // if this soldier is active, in this sector, and well enough to look if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) ) - { - // if soldier isn't aware of guynum, give him another chance to see - if (pSoldier->aiData.bOppList[ubID] == NOT_HEARD_OR_SEEN) { + // if soldier isn't aware of guynum, give him another chance to see + if (pSoldier->aiData.bOppList[ubID] == NOT_HEARD_OR_SEEN) + { if (ManLooksForMan(pSoldier,MercPtrs[ubID],UPDATEPUBLIC)) // then he actually saw guynum because of our new public knowledge ubMadeDifference = TRUE; @@ -3176,17 +3162,16 @@ void UpdatePublic(UINT8 ubTeam, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, IN // if "Show only enemies seen" option is ON and it's this guy looking //if (pSoldier->ubID == ShowOnlySeenPerson) - // NewShowOnlySeenPerson(pSoldier); // update the string + // NewShowOnlySeenPerson(pSoldier); // update the string + } } } } - } } - -void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) +void UpdatePersonal(SOLDIERTYPE *pSoldier, SoldierID ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) { /* #ifdef RECORDOPPLIST @@ -3207,43 +3192,40 @@ void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT16 ubID, INT8 bNewOpplist, INT32 - - INT8 OurMaxPublicOpplist() { - UINT32 uiLoop; - INT8 bHighestOpplist = 0; - UINT8 ubOppValue,ubHighestValue = 0; - SOLDIERTYPE * pSoldier; + UINT32 uiLoop; + INT8 bHighestOpplist = 0; + UINT8 ubOppValue,ubHighestValue = 0; + SOLDIERTYPE * pSoldier; - for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) + for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { - pSoldier = MercSlots[ uiLoop ]; + pSoldier = MercSlots[ uiLoop ]; - // if this merc is inactive, at base, on assignment, or dead - if (!pSoldier || !pSoldier->stats.bLife) - continue; // next merc + // if this merc is inactive, at base, on assignment, or dead + if (!pSoldier || !pSoldier->stats.bLife) + continue; // next merc - // if this man is NEUTRAL / on our side, he's not an opponent - if (pSoldier->aiData.bNeutral || (gTacticalStatus.Team[gbPlayerNum].bSide == Menptr[pSoldier->ubID].bSide)) - continue; // next merc + // if this man is NEUTRAL / on our side, he's not an opponent + if (pSoldier->aiData.bNeutral || (gTacticalStatus.Team[gbPlayerNum].bSide == pSoldier->ubID->bSide)) + continue; // next merc - // opponent, check our public opplist value for him - ubOppValue = gubKnowledgeValue[0 - OLDEST_HEARD_VALUE][gbPublicOpplist[gbPlayerNum][pSoldier->ubID] - OLDEST_HEARD_VALUE]; + // opponent, check our public opplist value for him + ubOppValue = gubKnowledgeValue[0 - OLDEST_HEARD_VALUE][gbPublicOpplist[gbPlayerNum][pSoldier->ubID] - OLDEST_HEARD_VALUE]; - if (ubOppValue > ubHighestValue) - { - ubHighestValue = ubOppValue; - bHighestOpplist = gbPublicOpplist[gbPlayerNum][pSoldier->ubID]; - } + if (ubOppValue > ubHighestValue) + { + ubHighestValue = ubOppValue; + bHighestOpplist = gbPublicOpplist[gbPlayerNum][pSoldier->ubID]; + } } - return(bHighestOpplist); + return(bHighestOpplist); } - /* BOOLEAN VisibleAnywhere(SOLDIERTYPE *pSoldier) { @@ -3668,53 +3650,46 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN void RadioSightings(SOLDIERTYPE *pSoldier, UINT16 ubAbout, UINT8 ubTeamToRadioTo ) { - SOLDIERTYPE *pOpponent; - INT32 iLoop; - UINT16 start,end,revealedEnemies = 0,unknownEnemies = 0,stillUnseen=TRUE; - UINT16 scrollToGuynum = NOBODY,sightedHatedOpponent = FALSE; - //UINT8 oppIsCivilian; - INT8 *pPersOL,*pbPublOL; //,dayQuote; - BOOLEAN fContactSeen; - BOOLEAN fSawCreatureForFirstTime = FALSE; - + SOLDIERTYPE *pOpponent; + INT32 iLoop; + UINT16 start, end, revealedEnemies = 0, unknownEnemies = 0, stillUnseen = TRUE; + BOOLEAN sightedHatedOpponent = FALSE; + //UINT8 oppIsCivilian; + INT8 *pPersOL,*pbPublOL; //,dayQuote; + BOOLEAN fContactSeen; + BOOLEAN fSawCreatureForFirstTime = FALSE; #ifdef TESTOPPLIST -DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("RADIO SIGHTINGS: for %d about %d",pSoldier->ubID,ubAbout) ); #endif - - #ifdef RECORDNET - if (!ptr->human) - fprintf(NetDebugFile,"\tNPC %d(%s) radios his sightings to his team\n",ptr->guynum,ExtMen[ptr->guynum].name); + if (!ptr->human) + fprintf(NetDebugFile,"\tNPC %d(%s) radios his sightings to his team\n",ptr->guynum,ExtMen[ptr->guynum].name); #endif - gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio = pSoldier->ubID; + gTacticalStatus.Team[pSoldier->bTeam].ubLastMercToRadio = pSoldier->ubID; - - - - - // who are we radioing about? - if (ubAbout == EVERYBODY) + // who are we radioing about? + if (ubAbout == EVERYBODY) { - start = 0; - end = MAXMERCS; + start = 0; + end = MAXMERCS; } - else + else { - start = ubAbout; - end = ubAbout + 1; + start = ubAbout; + end = ubAbout + 1; } - // hang a pointer to the start of our this guy's personal opplist - pPersOL = &(pSoldier->aiData.bOppList[start]); + // hang a pointer to the start of our this guy's personal opplist + pPersOL = &(pSoldier->aiData.bOppList[start]); - // hang a pointer to the start of this guy's opponents in the public opplist - pbPublOL = &(gbPublicOpplist[ubTeamToRadioTo][start]); + // hang a pointer to the start of this guy's opponents in the public opplist + pbPublOL = &(gbPublicOpplist[ubTeamToRadioTo][start]); pOpponent = MercPtrs[start]; @@ -3724,82 +3699,72 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, fContactSeen = FALSE; #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("RS: checking %d",pOpponent->ubID) ); #endif - // make sure this merc is active, here & still alive (unconscious OK) - if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->stats.bLife) - { -#ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: inactive/notInSector/life %d",pOpponent->ubID) ); -#endif - - - continue; // skip to the next merc - } - - // if these two mercs are on the same SIDE, then they're NOT opponents - // NEW: Apr. 21 '96: must allow ALL non-humans to get radioed about - if ((pSoldier->bSide == pOpponent->bSide) && (pOpponent->flags.uiStatusFlags & SOLDIER_PC)) - { + // make sure this merc is active, here & still alive (unconscious OK) + if (!pOpponent->bActive || !pOpponent->bInSector || !pOpponent->stats.bLife) + { #ifdef TESTOPPLIST DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: same side %d",pSoldier->bSide) ); -#endif - - continue; // skip to the next merc - } - - // determine whether we think we're still unseen or if "our cover's blown" - // if we know about this opponent's location for any reason - if ((pOpponent->bVisible >= 0) || gbShowEnemies) - { - // and he can see us, then gotta figure we KNOW that he can see us - if (pOpponent->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY) - stillUnseen = FALSE; - } - - - // if we personally don't know a thing about this opponent - if (*pPersOL == NOT_HEARD_OR_SEEN) - { -#ifdef RECORDOPPLIST - //fprintf(OpplistFile,"not heard or seen\n"); + String("RS: inactive/notInSector/life %d",pOpponent->ubID) ); #endif + continue; // skip to the next merc + } + // if these two mercs are on the same SIDE, then they're NOT opponents + // NEW: Apr. 21 '96: must allow ALL non-humans to get radioed about + if ((pSoldier->bSide == pOpponent->bSide) && (pOpponent->flags.uiStatusFlags & SOLDIER_PC)) + { #ifdef TESTOPPLIST DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: not heard or seen") ); + String("RS: same side %d",pSoldier->bSide) ); #endif + continue; // skip to the next merc + } - continue; // skip to the next opponent - } + // determine whether we think we're still unseen or if "our cover's blown" + // if we know about this opponent's location for any reason + if ((pOpponent->bVisible >= 0) || gbShowEnemies) + { + // and he can see us, then gotta figure we KNOW that he can see us + if (pOpponent->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY) + stillUnseen = FALSE; + } - // if personal knowledge is NOT more up to date and NOT the same as public - if ((!gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pPersOL - OLDEST_HEARD_VALUE]) && - (*pbPublOL != *pPersOL)) - { + + // if we personally don't know a thing about this opponent + if (*pPersOL == NOT_HEARD_OR_SEEN) + { #ifdef RECORDOPPLIST - //fprintf(OpplistFile,"no new knowledge (per %d, pub %d)\n",*pPersOL,*pbPublOL); + //fprintf(OpplistFile,"not heard or seen\n"); #endif - #ifdef TESTOPPLIST DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - String("RS: no new knowledge per %d pub %d",*pPersOL,*pbPublOL) ); + String("RS: not heard or seen") ); #endif + continue; // skip to the next opponent + } - - - continue; // skip to the next opponent - } + // if personal knowledge is NOT more up to date and NOT the same as public + if ((!gubKnowledgeValue[*pbPublOL - OLDEST_HEARD_VALUE][*pPersOL - OLDEST_HEARD_VALUE]) && + (*pbPublOL != *pPersOL)) + { +#ifdef RECORDOPPLIST + //fprintf(OpplistFile,"no new knowledge (per %d, pub %d)\n",*pPersOL,*pbPublOL); +#endif +#ifdef TESTOPPLIST + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + String("RS: no new knowledge per %d pub %d",*pPersOL,*pbPublOL) ); +#endif + continue; // skip to the next opponent + } #ifdef RECORDOPPLIST - //fprintf(OpplistFile,"made it!\n"); + //fprintf(OpplistFile,"made it!\n"); #endif - #ifdef TESTOPPLIST DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("RS: made it!") ); @@ -3807,160 +3772,145 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, - // if it's our merc, and he currently sees this opponent - if (PTR_OURTEAM && (*pPersOL == SEEN_CURRENTLY) && !(( pOpponent->bSide == pSoldier->bSide) || pOpponent->aiData.bNeutral)) - { - // used by QueueDayMessage() to scroll to one of the new enemies - // scroll to the last guy seen, unless we see a hated guy, then use him! - if (!sightedHatedOpponent) - scrollToGuynum = pOpponent->ubID; - - // don't care whether and how many new enemies are seen if everyone visible - // and he's healthy enough to be a threat (so is worth talking about) - - // do the following if we're radioing to our own team; if radioing to militia - // then alert them instead - if ( ubTeamToRadioTo != MILITIA_TEAM ) + // if it's our merc, and he currently sees this opponent + if (PTR_OURTEAM && (*pPersOL == SEEN_CURRENTLY) && !(( pOpponent->bSide == pSoldier->bSide) || pOpponent->aiData.bNeutral)) { - if (!gbShowEnemies && (pOpponent->stats.bLife >= OKLIFE)) - { - // if this enemy has not been publicly seen or heard recently - if (*pbPublOL == NOT_HEARD_OR_SEEN) - { - // chalk up another "unknown" enemy - unknownEnemies++; + // don't care whether and how many new enemies are seen if everyone visible + // and he's healthy enough to be a threat (so is worth talking about) - fContactSeen = TRUE; - // if this enemy is hated by the merc doing the sighting - //if (MercHated(Proptr[ptr->characternum].p_bias,oppPtr->characternum)) - //sightedHatedOpponent = TRUE; - - // now the important part: does this enemy see him/her back? - if (pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY) - { - // EXPERIENCE GAIN (10): Discovered a new enemy without being seen - StatChange(pSoldier,EXPERAMT,10,FALSE); - } - } - else + // do the following if we're radioing to our own team; if radioing to militia + // then alert them instead + if ( ubTeamToRadioTo != MILITIA_TEAM ) { + if (!gbShowEnemies && (pOpponent->stats.bLife >= OKLIFE)) + { + // if this enemy has not been publicly seen or heard recently + if (*pbPublOL == NOT_HEARD_OR_SEEN) + { + // chalk up another "unknown" enemy + unknownEnemies++; - // if he has publicly not been seen now, or anytime during this turn - if ((*pbPublOL != SEEN_CURRENTLY) && (*pbPublOL != SEEN_THIS_TURN)) + fContactSeen = TRUE; + // if this enemy is hated by the merc doing the sighting + //if (MercHated(Proptr[ptr->characternum].p_bias,oppPtr->characternum)) + //sightedHatedOpponent = TRUE; + + // now the important part: does this enemy see him/her back? + if (pOpponent->aiData.bOppList[pSoldier->ubID] != SEEN_CURRENTLY) + { + // EXPERIENCE GAIN (10): Discovered a new enemy without being seen + StatChange(pSoldier,EXPERAMT,10,FALSE); + } + } + else + { + // if he has publicly not been seen now, or anytime during this turn + if ((*pbPublOL != SEEN_CURRENTLY) && (*pbPublOL != SEEN_THIS_TURN)) { // chalk up another "revealed" enemy ++revealedEnemies; fContactSeen = TRUE; } - else - { - if ( MercPtrs[0]->stats.bLife < 10 ) + else { - //int breakpoint = 0; + if ( MercPtrs[0]->stats.bLife < 10 ) + { + //int breakpoint = 0; + } } } - } - if ( fContactSeen ) - { - if ( pSoldier->bTeam == gbPlayerNum ) + if ( fContactSeen ) { - if ( gTacticalStatus.ubCurrentTeam != gbPlayerNum ) + if ( pSoldier->bTeam == gbPlayerNum ) { - // Save some stuff! - if (gTacticalStatus.fEnemySightingOnTheirTurn) + if ( gTacticalStatus.ubCurrentTeam != gbPlayerNum ) { - // this has already come up so turn OFF the pause-all-anims flag for the previous - // person and set it for this next person - MercPtrs[gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID]->flags.fPauseAllAnimation = FALSE; - } - else - { - gTacticalStatus.fEnemySightingOnTheirTurn = TRUE; - } - gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID = pOpponent->ubID; - gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID = pSoldier->ubID; - gTacticalStatus.uiTimeSinceDemoOn = GetJA2Clock( ); + // Save some stuff! + if (gTacticalStatus.fEnemySightingOnTheirTurn) + { + // this has already come up so turn OFF the pause-all-anims flag for the previous + // person and set it for this next person + gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID->flags.fPauseAllAnimation = FALSE; + } + else + { + gTacticalStatus.fEnemySightingOnTheirTurn = TRUE; + } + gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID = pOpponent->ubID; + gTacticalStatus.ubEnemySightingOnTheirTurnPlayerID = pSoldier->ubID; + gTacticalStatus.uiTimeSinceDemoOn = GetJA2Clock( ); - pOpponent->flags.fPauseAllAnimation = TRUE; + pOpponent->flags.fPauseAllAnimation = TRUE; + } + } + if ( pOpponent->flags.uiStatusFlags & SOLDIER_MONSTER ) + { + gfPlayerTeamSawCreatures = TRUE; + } + + // ATE: Added for bloodcat... + if ( pOpponent->ubBodyType == BLOODCAT ) + { + // 2 is for bloodcat + gfPlayerTeamSawCreatures = 2; } } if ( pOpponent->flags.uiStatusFlags & SOLDIER_MONSTER ) { - gfPlayerTeamSawCreatures = TRUE; - } - - // ATE: Added for bloodcat... - if ( pOpponent->ubBodyType == BLOODCAT ) - { - // 2 is for bloodcat - gfPlayerTeamSawCreatures = 2; - } - - } - - if ( pOpponent->flags.uiStatusFlags & SOLDIER_MONSTER ) - { - if ( !(gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags & PROFILE_MISC_FLAG_HAVESEENCREATURE) ) - { - fSawCreatureForFirstTime = TRUE; + if ( !(gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags & PROFILE_MISC_FLAG_HAVESEENCREATURE) ) + { + fSawCreatureForFirstTime = TRUE; + } } } - } - } - else - { - // radioing to militia that we saw someone! alert them! - if ( gTacticalStatus.Team[ MILITIA_TEAM ].bTeamActive && !gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) + else { - HandleInitialRedAlert( MILITIA_TEAM, FALSE ); + // radioing to militia that we saw someone! alert them! + if ( gTacticalStatus.Team[ MILITIA_TEAM ].bTeamActive && !gTacticalStatus.Team[ MILITIA_TEAM ].bAwareOfOpposition ) + { + HandleInitialRedAlert( MILITIA_TEAM, FALSE ); + } } - } - } // end of our team's merc sees new opponent + } // end of our team's merc sees new opponent - // IF WE'RE HERE, OUR PERSONAL INFORMATION IS AT LEAST AS UP-TO-DATE - // AS THE PUBLIC KNOWLEDGE, SO WE WILL REPLACE THE PUBLIC KNOWLEDGE + // IF WE'RE HERE, OUR PERSONAL INFORMATION IS AT LEAST AS UP-TO-DATE + // AS THE PUBLIC KNOWLEDGE, SO WE WILL REPLACE THE PUBLIC KNOWLEDGE #ifdef RECORDOPPLIST - fprintf(OpplistFile,"UpdatePublic (RadioSightings) for team %d about %d\n",ptr->team,oppPtr->guynum); + fprintf(OpplistFile,"UpdatePublic (RadioSightings) for team %d about %d\n",ptr->team,oppPtr->guynum); #endif - - #ifdef TESTOPPLIST - DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, + DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String("...............UPDATE PUBLIC: soldier %d SEEING soldier %d",pSoldier->ubID,pOpponent->ubID) ); #endif - - - - UpdatePublic(ubTeamToRadioTo,pOpponent->ubID,*pPersOL,gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID],gbLastKnownOppLevel[pSoldier->ubID][pOpponent->ubID]); + UpdatePublic(ubTeamToRadioTo,pOpponent->ubID,*pPersOL,gsLastKnownOppLoc[pSoldier->ubID][pOpponent->ubID],gbLastKnownOppLevel[pSoldier->ubID][pOpponent->ubID]); } - // if soldier heard a misc noise more important that his team's public one - if (pSoldier->aiData.ubNoiseVolume > gubPublicNoiseVolume[ubTeamToRadioTo]) + // if soldier heard a misc noise more important that his team's public one + if (pSoldier->aiData.ubNoiseVolume > gubPublicNoiseVolume[ubTeamToRadioTo]) { - // replace the soldier's team's public noise with his - gsPublicNoiseGridNo[ubTeamToRadioTo] = pSoldier->aiData.sNoiseGridno; - gbPublicNoiseLevel[ubTeamToRadioTo] = pSoldier->bNoiseLevel; - gubPublicNoiseVolume[ubTeamToRadioTo] = pSoldier->aiData.ubNoiseVolume; + // replace the soldier's team's public noise with his + gsPublicNoiseGridNo[ubTeamToRadioTo] = pSoldier->aiData.sNoiseGridno; + gbPublicNoiseLevel[ubTeamToRadioTo] = pSoldier->bNoiseLevel; + gubPublicNoiseVolume[ubTeamToRadioTo] = pSoldier->aiData.ubNoiseVolume; } - // if this soldier is on the local team + // if this soldier is on the local team if (PTR_OURTEAM) { - // don't trigger sighting quotes or stop merc's movement if everyone visible - //if (!(gTacticalStatus.uiFlags & SHOW_ALL_MERCS)) - { - // if we've revealed any enemies, or seen any previously unknown enemies - if (revealedEnemies || unknownEnemies) + // don't trigger sighting quotes or stop merc's movement if everyone visible + //if (!(gTacticalStatus.uiFlags & SHOW_ALL_MERCS)) { + // if we've revealed any enemies, or seen any previously unknown enemies + if (revealedEnemies || unknownEnemies) + { // First check for a virgin map and set to false if we see our first guy.... // Only if this guy is an ememy! - OurTeamSeesSomeone( pSoldier, revealedEnemies, unknownEnemies ); } else if (fSawCreatureForFirstTime) @@ -3968,8 +3918,7 @@ DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags |= PROFILE_MISC_FLAG_HAVESEENCREATURE; TacticalCharacterDialogue( pSoldier, QUOTE_FIRSTTIME_GAME_SEE_CREATURE ); } - - } + } } } diff --git a/Tactical/opplist.h b/Tactical/opplist.h index b8791758..381d8f65 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -117,7 +117,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT32 sOppGridNo, void DecideTrueVisibility(SOLDIERTYPE *pSoldier, UINT8 ubLocate); void AddOneOpponent(SOLDIERTYPE *pSoldier); void RemoveOneOpponent(SOLDIERTYPE *pSoldier); -void UpdatePersonal(SOLDIERTYPE *pSoldier, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel); +void UpdatePersonal(SOLDIERTYPE *pSoldier, SoldierID ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel); INT16 MaxNormalDistanceVisible( void ); INT16 DistanceVisible( SOLDIERTYPE *pSoldier, INT8 bFacingDir, INT8 bSubjectDir, INT32 sSubjectGridNo, INT8 bLevel, const BOOLEAN& isCowering, const UINT8& tunnelVision); void ResetLastKnownLocs(SOLDIERTYPE *ptr); @@ -129,7 +129,7 @@ void InitOpponentKnowledgeSystem(void); void InitSoldierOppList(SOLDIERTYPE *pSoldier); void BetweenTurnsVisibilityAdjustments(void); void RemoveManAsTarget(SOLDIERTYPE *pSoldier); -void UpdatePublic(UINT8 ubTeam, UINT16 ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel ); +void UpdatePublic(UINT8 ubTeam, SoldierID ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel ); void RadioSightings(SOLDIERTYPE *pSoldier, UINT16 ubAbout, UINT8 ubTeamToRadioTo ); void OurTeamRadiosRandomlyAbout(UINT16 ubAbout); void DebugSoldierPage1( ); @@ -177,4 +177,4 @@ INT32 MaxDistanceVisible( void ); // HEADROCK HAM 3.6: Moved here from cpp void MakeBloodcatsHostile( void ); -#endif \ No newline at end of file +#endif From cbf53f8848a44e9fafacff59eb4d5d05476bb190 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:26:01 +0200 Subject: [PATCH 095/571] TacticalStatusType::ubLastRequesterSurgeryTargetID to SoldierID --- Tactical/Overhead.cpp | 10 +++++----- Tactical/Overhead.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 3676eeb7..6b5223ab 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -783,15 +783,15 @@ BOOLEAN InitOverhead( ) gTacticalStatus.uiTimeOfLastInput = GetJA2Clock(); gTacticalStatus.uiTimeSinceDemoOn = GetJA2Clock(); gTacticalStatus.uiCountdownToRestart = GetJA2Clock(); - gTacticalStatus.fGoingToEnterDemo = FALSE; - gTacticalStatus.fNOTDOLASTDEMO = FALSE; + gTacticalStatus.fGoingToEnterDemo = FALSE; + gTacticalStatus.fNOTDOLASTDEMO = FALSE; if (is_networked) - gTacticalStatus.fDidGameJustStart = FALSE; + gTacticalStatus.fDidGameJustStart = FALSE; else - gTacticalStatus.fDidGameJustStart = TRUE; + gTacticalStatus.fDidGameJustStart = TRUE; - gTacticalStatus.ubLastRequesterTargetID = NO_PROFILE; + gTacticalStatus.ubLastRequesterTargetID = NO_PROFILE; gTacticalStatus.ubLastRequesterSurgeryTargetID = NOBODY; // SANDRO - reset surgery requester too for ( cnt = 0; cnt < NUM_PANIC_TRIGGERS; cnt++ ) diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index b083cda3..027a65b2 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -158,7 +158,7 @@ struct TacticalStatusType UINT16 sCreatureTenseQuoteDelay; UINT32 uiCreatureTenseQuoteLastUpdate; // SANDRO - added these - UINT16 ubLastRequesterSurgeryTargetID; + SoldierID ubLastRequesterSurgeryTargetID; UINT8 ubInterruptPending; // sevenfm: Ctrl+D disable interrupts BOOLEAN ubDisablePlayerInterrupts; From 3e1c87f53c293f21cf861a0275b52a1f145845a1 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:27:42 +0200 Subject: [PATCH 096/571] Remove unused global gusOldSelectedSoldier --- Tactical/Interface.cpp | 2 -- Tactical/Overhead.h | 1 - TileEngine/worlddef.cpp | 2 -- 3 files changed, 5 deletions(-) diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 8ba363ec..6c4aba41 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -164,8 +164,6 @@ MOUSE_REGION gMenuOverlayRegion; MOUSE_REGION gBottomPanalRegion; -UINT16 gusOldSelectedSoldier = NOBODY; - // OVerlay ID INT32 giPopupSlideMessageOverlay = -1; UINT16 gusOverlayPopupBoxWidth, gusOverlayPopupBoxHeight; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 027a65b2..0b7808fa 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -171,7 +171,6 @@ extern UINT8 gbPlayerNum; extern INT8 gbShowEnemies; extern SoldierID gusSelectedSoldier; -extern UINT16 gusOldSelectedSoldier; extern CHAR8 gzAlertStr[][ 30 ]; extern CHAR8 gzActionStr[][ 30 ]; diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 6265f093..2b78ad20 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -3327,8 +3327,6 @@ BOOLEAN NewWorld( INT32 nMapRows, INT32 nMapCols ) UINT16 NewIndex; INT32 cnt; - gusSelectedSoldier = gusOldSelectedSoldier = NOBODY; - AdjustSoldierCreationStartValues( ); TrashWorld(); From 3fe6e4f3d89ab884df623bfb96b14214e30af559 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:33:29 +0200 Subject: [PATCH 097/571] GetSoldier() to SoldierID --- Tactical/Handle UI Plan.cpp | 2 +- Tactical/Overhead.cpp | 8 ++++---- Tactical/Overhead.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Tactical/Handle UI Plan.cpp b/Tactical/Handle UI Plan.cpp index 0669e172..de94ba0a 100644 --- a/Tactical/Handle UI Plan.cpp +++ b/Tactical/Handle UI Plan.cpp @@ -79,7 +79,7 @@ BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) if ( TacticalCreateSoldier( &MercCreateStruct, &ubNewIndex ) ) { // Get pointer to soldier - GetSoldier( &pPlanSoldier, (UINT16)ubNewIndex ); + GetSoldier( &pPlanSoldier, ubNewIndex ); pPlanSoldier->sPlannedTargetX = -1; pPlanSoldier->sPlannedTargetY = -1; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 6b5223ab..cadb4815 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -832,21 +832,21 @@ BOOLEAN ShutdownOverhead( ) return( TRUE ); } -BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex ) +BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, SoldierID usSoldierIndex ) { // Check range of index given *ppSoldier = NULL; - if ( usSoldierIndex < 0 || usSoldierIndex > TOTAL_SOLDIERS-1 ) + if ( usSoldierIndex >= NOBODY ) { // Set debug message return( FALSE ); } // Check if a guy exists here // Does another soldier exist here? - if ( MercPtrs[ usSoldierIndex ]->bActive ) + if ( usSoldierIndex->bActive ) { // Set Existing guy - *ppSoldier = MercPtrs[ usSoldierIndex ]; + *ppSoldier = usSoldierIndex; return( TRUE); } else diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 0b7808fa..b5e15019 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -203,7 +203,7 @@ void ShutdownTacticalEngine( ); BOOLEAN InitOverhead( ); BOOLEAN ShutdownOverhead( ); -BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex ); +BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, SoldierID usSoldierIndex ); UINT32 CountNonVehiclesOnPlayerTeam( ); From ab94d33bec1e29d1f210633e89cccba5a737b744 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 10:36:10 +0200 Subject: [PATCH 098/571] PlaySoldierJA2Sample() to SoldierID --- Utils/Sound Control.cpp | 13 ++++++------- Utils/Sound Control.h | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index 2598dc28..f51b6347 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -575,16 +575,15 @@ UINT32 PlayJA2AmbientRandom( UINT32 usNum, UINT32 uiTimeMin, UINT32 uiTimeMax) -UINT32 PlaySoldierJA2Sample( UINT16 usID, UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan, BOOLEAN fCheck ) +UINT32 PlaySoldierJA2Sample( SoldierID usID, UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan, BOOLEAN fCheck ) { - if( !( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - // CHECK IF GUY IS ON SCREEN BEFORE PLAYING! - if ( ( MercPtrs[ usID ]->bVisible != -1 ) || !fCheck ) - { - return( PlayJA2Sample( usNum, usRate, CalculateSoundEffectsVolume( ubVolume ), ubLoops, uiPan ) ); - } + // CHECK IF GUY IS ON SCREEN BEFORE PLAYING! + if ( ( usID->bVisible != -1 ) || !fCheck ) + { + return( PlayJA2Sample( usNum, usRate, CalculateSoundEffectsVolume( ubVolume ), ubLoops, uiPan ) ); + } } return( 0 ); diff --git a/Utils/Sound Control.h b/Utils/Sound Control.h index 51a31a9b..64efce99 100644 --- a/Utils/Sound Control.h +++ b/Utils/Sound Control.h @@ -5,6 +5,8 @@ #ifndef SOUND_CONTROL_H #define SOUND_CONTROL_H +#include "Overhead Types.h" + // == Lesh modifications ====== #define FARLEFT 0 #define LEFTSIDE 96 @@ -423,7 +425,7 @@ UINT32 PlayJA2StreamingSampleFromFile( STR8 szFileName, UINT32 usRate, UINT32 ub UINT32 PlayJA2Ambient( UINT32 usNum, UINT32 ubVolume, UINT32 ubLoops); UINT32 PlayJA2AmbientRandom(UINT32 usNum, UINT32 uiTimeMin, UINT32 uiTimeMax); -UINT32 PlaySoldierJA2Sample( UINT16 usID, UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan, BOOLEAN fCheck ); +UINT32 PlaySoldierJA2Sample( SoldierID usID, UINT32 usNum, UINT32 usRate, UINT32 ubVolume, UINT32 ubLoops, UINT32 uiPan, BOOLEAN fCheck ); @@ -465,4 +467,4 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ); -#endif \ No newline at end of file +#endif From 30e6b9008c84e3c1f188503b1b95bbf96bec719a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:15:39 +0200 Subject: [PATCH 099/571] SetUIBusy() & UnSetUIBusy() to SoldierID --- Tactical/Handle UI.cpp | 4 ++-- Tactical/Handle UI.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 92eeec76..cb1f7bf8 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -6708,7 +6708,7 @@ BOOLEAN HandleTalkInit( ) -void SetUIBusy( UINT16 ubID ) +void SetUIBusy( SoldierID ubID ) { if ( (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) && ( gTacticalStatus.ubCurrentTeam == gbPlayerNum ) ) { @@ -6720,7 +6720,7 @@ void SetUIBusy( UINT16 ubID ) } } -void UnSetUIBusy( UINT16 ubID ) +void UnSetUIBusy( SoldierID ubID ) { if ( gfUserTurnRegionActive && (gTacticalStatus.uiFlags & INCOMBAT ) && ( gTacticalStatus.uiFlags & TURNBASED ) && ( gTacticalStatus.ubCurrentTeam == gbPlayerNum ) ) { diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index 5109cc85..b72930ae 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -341,8 +341,8 @@ BOOLEAN HandleTalkInit( ); BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustForConfirm ); -void SetUIBusy( UINT16 ubID ); -void UnSetUIBusy( UINT16 ubID ); +void SetUIBusy( SoldierID ubID ); +void UnSetUIBusy( SoldierID ubID ); UINT32 UIHandleLUIEndLock( UI_EVENT *pUIEvent ); From f58cf588a67866485acf19c2a6360e14a1abead6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 14:20:37 +0200 Subject: [PATCH 100/571] Mark TacticalStatusType::sSlideReason as _UNUSED Removed from function call parameters at the same time. It was supplied to SlideTo, SlideToLocation and SoldierLocationRelativeToScreen but was never used. --- Ja2/SaveLoadGame.cpp | 2 +- Tactical/Dialogue Control.cpp | 2 +- Tactical/Interface Panels.cpp | 6 +++--- Tactical/Interface.cpp | 1 - Tactical/Overhead.cpp | 24 ++++++++++-------------- Tactical/Overhead.h | 6 +++--- Tactical/Rotting Corpses.cpp | 2 +- Tactical/Soldier Find.cpp | 2 +- Tactical/Soldier Find.h | 2 +- Tactical/TeamTurns.cpp | 8 ++++---- Tactical/fov.cpp | 2 +- Tactical/opplist.cpp | 6 +++--- TileEngine/renderworld.cpp | 2 +- 13 files changed, 30 insertions(+), 35 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 9e43a098..a85ad173 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -7661,7 +7661,7 @@ BOOLEAN LoadTacticalStatusFromSavedGame( HWFILE hFile ) numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.Team, sizeof(gTacticalStatus.Team), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.ubCurrentTeam, sizeof(gTacticalStatus.ubCurrentTeam), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sSlideTarget, sizeof(gTacticalStatus.sSlideTarget), sizeof(INT32), numBytesRead); - numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sSlideReason, sizeof(gTacticalStatus.sSlideReason), sizeof(INT16), numBytesRead); + numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sSlideReason_UNUSED, sizeof(gTacticalStatus.sSlideReason_UNUSED), sizeof(INT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.uiTimeSinceMercAIStart, sizeof(gTacticalStatus.uiTimeSinceMercAIStart), sizeof(UINT32), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.fPanicFlags, sizeof(gTacticalStatus.fPanicFlags), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField(hFile, &gTacticalStatus.sPanicTriggerGridNoUnused, sizeof(gTacticalStatus.sPanicTriggerGridNoUnused), sizeof(INT32), numBytesRead); diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 52d13596..75e5244a 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -977,7 +977,7 @@ void HandleDialogue( ) gTacticalStatus.fLockItemLocators = FALSE; // Slide to location! - SlideToLocation( 0, QItem.uiSpecialEventData ); + SlideToLocation( QItem.uiSpecialEventData ); // Flugente: only set up face if we can access correctly if ( QItem.iFaceIndex >= 0 ) diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index fee3becd..99e7d55d 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -6307,7 +6307,7 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) // If we are currently selected, slide to location if ( ubID == gusSelectedSoldier ) { - SlideTo( NOWHERE, gusSelectedSoldier, NOBODY ,SETLOCATOR); + SlideTo(gusSelectedSoldier, SETLOCATOR); } else { @@ -6318,7 +6318,7 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) { if ( ubID == gusSelectedSoldier ) { - SlideTo( NOWHERE, gusSelectedSoldier, NOBODY ,SETLOCATOR ); + SlideTo(gusSelectedSoldier, SETLOCATOR ); } else { @@ -6334,7 +6334,7 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) // If we are currently selected, slide to location if ( ubID == gusSelectedSoldier ) { - SlideTo( NOWHERE, gusSelectedSoldier, NOBODY ,DONTSETLOCATOR); + SlideTo(gusSelectedSoldier, DONTSETLOCATOR); } else { diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 6c4aba41..34ebaff3 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -5712,7 +5712,6 @@ void BeginMultiPurposeLocator( INT32 sGridNo, INT8 bLevel, BOOLEAN fSlideTo ) // sGridNo here for DG compatibility gTacticalStatus.sSlideTarget = sGridNo; - gTacticalStatus.sSlideReason = NOBODY; // Plot new path! gfPlotNewMovement = TRUE; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index cadb4815..7c06c46d 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -3551,11 +3551,8 @@ void LocateGridNo( INT32 sGridNo ) -void SlideTo(INT32 sGridNo, UINT16 usSoldierID , UINT16 usReasonID, BOOLEAN fSetLocator) +void SlideTo(SoldierID usSoldierID, BOOLEAN fSetLocator) { - INT32 cnt; - - if ( usSoldierID == NOBODY ) { return; @@ -3563,7 +3560,7 @@ void SlideTo(INT32 sGridNo, UINT16 usSoldierID , UINT16 usReasonID, BOOLEAN fSet if ( fSetLocator == SETANDREMOVEPREVIOUSLOCATOR ) { - for ( cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) + for (INT32 cnt = 0; cnt < TOTAL_SOLDIERS; cnt++ ) { if ( MercPtrs[ cnt ]->bActive && MercPtrs[ cnt ]->bInSector ) { @@ -3592,7 +3589,7 @@ void SlideTo(INT32 sGridNo, UINT16 usSoldierID , UINT16 usReasonID, BOOLEAN fSet } -void SlideToLocation( UINT16 usReasonID, INT32 sDestGridNo ) +void SlideToLocation( INT32 sDestGridNo ) { if (TileIsOutOfBounds(sDestGridNo)) { @@ -3607,7 +3604,6 @@ void SlideToLocation( UINT16 usReasonID, INT32 sDestGridNo ) // sGridNo here for DG compatibility gTacticalStatus.sSlideTarget = sDestGridNo; - gTacticalStatus.sSlideReason = usReasonID; // Plot new path! gfPlotNewMovement = TRUE; @@ -8014,7 +8010,7 @@ void CycleThroughKnownEnemies( BOOLEAN backward ) //LocateSoldier( pSoldier->ubID, 1 ); //ATE: Change to Slide To... - SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); return; } else @@ -8043,7 +8039,7 @@ void CycleThroughKnownEnemies( BOOLEAN backward ) //LocateSoldier( pSoldier->ubID, 1 ); //ATE: Change to Slide To... - SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); return; } else @@ -8100,7 +8096,7 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... - SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); ChangeInterfaceLevel( pSoldier->pathing.bLevel ); return; @@ -8128,7 +8124,7 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... - SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); ChangeInterfaceLevel( pSoldier->pathing.bLevel ); return; @@ -8163,7 +8159,7 @@ void CycleVisibleEnemiesBackward( SOLDIERTYPE *pSrcSoldier ) pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... - SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); ChangeInterfaceLevel( pSoldier->pathing.bLevel ); return; @@ -8192,7 +8188,7 @@ void CycleVisibleEnemiesBackward( SOLDIERTYPE *pSrcSoldier ) pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; //ATE: Change to Slide To... - SlideTo( 0, pSoldier->ubID, 0, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); ChangeInterfaceLevel( pSoldier->pathing.bLevel ); return; @@ -9884,7 +9880,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) // Turn off item lock for locators... gTacticalStatus.fLockItemLocators = FALSE; // Slide to location! - SlideToLocation( 0, gTacticalStatus.usItemsSeenOnAttackGridNo ); + SlideToLocation( gTacticalStatus.usItemsSeenOnAttackGridNo ); } } diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index b5e15019..20c03e26 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -64,7 +64,7 @@ struct TacticalStatusType TacticalTeamType Team[ MAXTEAMS ]; UINT8 ubCurrentTeam; INT32 sSlideTarget; - INT16 sSlideReason; + INT16 sSlideReason_UNUSED; UINT32 uiTimeSinceMercAIStart; INT8 fPanicFlags; INT32 sPanicTriggerGridNoUnused; @@ -233,8 +233,8 @@ void LocateGridNo( INT32 sGridNo ); void LocateSoldier( SoldierID usID, BOOLEAN fSetLocator); void BeginTeamTurn( UINT8 ubTeam ); -void SlideTo(INT32 sGridNo, UINT16 usSoldierID , UINT16 usReasonID, BOOLEAN fSetLocator) ; -void SlideToLocation( UINT16 usReasonID, INT32 sDestGridNo ); +void SlideTo(SoldierID usSoldierID, BOOLEAN fSetLocator) ; +void SlideToLocation( INT32 sDestGridNo ); void RebuildAllSoldierShadeTables( ); void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index b5346fb6..0ca90c94 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1436,7 +1436,7 @@ void MercLooksForCorpses( SOLDIERTYPE *pSoldier ) BeginMultiPurposeLocator( sGridNo, pCorpse->def.bLevel, FALSE ); // Slide to... - SlideToLocation( 0, sGridNo ); + SlideToLocation( sGridNo ); return; } diff --git a/Tactical/Soldier Find.cpp b/Tactical/Soldier Find.cpp index 718cf8ee..50e6b05e 100644 --- a/Tactical/Soldier Find.cpp +++ b/Tactical/Soldier Find.cpp @@ -798,7 +798,7 @@ BOOLEAN SoldierOnVisibleWorldTile( SOLDIERTYPE *pSoldier ) -BOOLEAN SoldierLocationRelativeToScreen( INT32 sGridNo, UINT16 usReasonID, INT8 *pbDirection, UINT32 *puiScrollFlags ) +BOOLEAN SoldierLocationRelativeToScreen( INT32 sGridNo, INT8 *pbDirection, UINT32 *puiScrollFlags ) { INT16 sWorldX; INT16 sWorldY; diff --git a/Tactical/Soldier Find.h b/Tactical/Soldier Find.h index e35fc20a..f57b7c39 100644 --- a/Tactical/Soldier Find.h +++ b/Tactical/Soldier Find.h @@ -40,7 +40,7 @@ BOOLEAN CycleSoldierFindStack( INT32 usMapPos ); BOOLEAN GridNoOnScreen( INT32 sGridNo ); BOOLEAN SoldierOnScreen( SoldierID usID ); -BOOLEAN SoldierLocationRelativeToScreen( INT32 sGridNo, UINT16 usReasonID, INT8 *pbDirection, UINT32 *puiScrollFlags ); +BOOLEAN SoldierLocationRelativeToScreen( INT32 sGridNo, INT8 *pbDirection, UINT32 *puiScrollFlags ); void GetSoldierScreenPos( SOLDIERTYPE *pSoldier, INT16 *psScreenX, INT16 *psScreenY ); void GetSoldierAnimDims( SOLDIERTYPE *pSoldier, INT16 *psHeight, INT16 *psWidth ); void GetSoldierAnimOffsets( SOLDIERTYPE *pSoldier, INT16 *sOffsetX, INT16 *sOffsetY ); diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 0bc3e181..fd496bd5 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -225,7 +225,7 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // Slide to selected guy... if ( gusSelectedSoldier != NOBODY ) { - SlideTo( NOWHERE, gusSelectedSoldier, NOBODY ,SETLOCATOR); + SlideTo(gusSelectedSoldier, SETLOCATOR); if ( fDoBattleSnd ) { @@ -688,7 +688,7 @@ void DisplayHiddenInterrupt( SOLDIERTYPE * pSoldier ) if (pSoldier->bVisible != -1 ) { - SlideTo( NOWHERE, pSoldier->ubID, NOBODY ,SETLOCATOR); + SlideTo( pSoldier->ubID, SETLOCATOR); } if(is_client) @@ -961,7 +961,7 @@ void StartInterrupt( void ) SelectSoldier( ubFirstInterrupter, TRUE, TRUE ); // ATE; Slide to guy who got interrupted! - SlideTo( NOWHERE, gubLastInterruptedGuy, NOBODY, SETLOCATOR); + SlideTo( gubLastInterruptedGuy, SETLOCATOR); // Dirty panel interface! fInterfacePanelDirty = DIRTYLEVEL2; @@ -1329,7 +1329,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) if ( gusSelectedSoldier != NOBODY ) { - SlideTo( NOWHERE, gusSelectedSoldier, NOBODY ,SETLOCATOR); + SlideTo( gusSelectedSoldier, SETLOCATOR); // Say ATTENTION SOUND... gusSelectedSoldier->DoMercBattleSound( BATTLE_SOUND_ATTN1 ); diff --git a/Tactical/fov.cpp b/Tactical/fov.cpp index ea893476..eaf173a2 100644 --- a/Tactical/fov.cpp +++ b/Tactical/fov.cpp @@ -765,7 +765,7 @@ void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLo // Turn off item lock for locators... gTacticalStatus.fLockItemLocators = FALSE; // Slide to location! - SlideToLocation( 0, marker ); + SlideToLocation( marker ); } } diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 46cbd3b4..d2649faf 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -2798,7 +2798,7 @@ if(SEE_MENT) { //SlideTo(0,pOpponent->ubID, pSoldier->ubID, SETLOCATOR); //rain - SlideTo(0,pOpponent->ubID, pSoldier->ubID, SETLOCATORFAST); + SlideTo(pOpponent->ubID, SETLOCATORFAST); //end rain } } @@ -2857,7 +2857,7 @@ void DecideTrueVisibility(SOLDIERTYPE *pSoldier, UINT8 ubLocate) //if (Status.stopSlidingAt == NOBODY) if (gTacticalStatus.uiFlags & TURNBASED && ( gTacticalStatus.uiFlags & INCOMBAT ) ) //LocateSoldier(pSoldier->ubID,DONTSETLOCATOR); - SlideTo(0,pSoldier->ubID, NOBODY, DONTSETLOCATOR); + SlideTo(pSoldier->ubID, DONTSETLOCATOR); // follow his movement on our screen as he moves around... //LocateMember(ptr->guynum,DONTSETLOCATOR); @@ -3618,7 +3618,7 @@ void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumN LocateSoldier( pSoldier->ubID, SETLOCATOR ); // Now slide to other guy.... - SlideTo( NOWHERE, gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID, NOBODY ,SETLOCATOR); + SlideTo(gTacticalStatus.ubEnemySightingOnTheirTurnEnemyID, SETLOCATOR); } diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index 2a93d397..52a575d8 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -4133,7 +4133,7 @@ void ScrollWorld( ) ScrollFlags = 0; fDoScroll = FALSE; // - if ( SoldierLocationRelativeToScreen( gTacticalStatus.sSlideTarget, gTacticalStatus.sSlideReason, &bDirection, &ScrollFlags ) && GridNoOnVisibleWorldTile( gTacticalStatus.sSlideTarget ) ) + if ( SoldierLocationRelativeToScreen( gTacticalStatus.sSlideTarget, &bDirection, &ScrollFlags ) && GridNoOnVisibleWorldTile( gTacticalStatus.sSlideTarget ) ) { ScrollFlags = gScrollDirectionFlags[ bDirection ]; fDoScroll = TRUE; From 34f0b40f93f53f0a3393d6712e62da4c333f36bd Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 14:53:52 +0200 Subject: [PATCH 101/571] Convert functions and globals to SoldierID --- Multiplayer/client.cpp | 2 +- Multiplayer/connect.h | 2 +- Strategic/LuaInitNPCs.cpp | 2 +- Tactical/Arms Dealer Init.cpp | 4 +- Tactical/Arms Dealer Init.h | 4 +- Tactical/Faces.cpp | 10 ++-- Tactical/Handle UI.cpp | 5 +- Tactical/Interface Items.cpp | 10 ++-- Tactical/Interface Panels.cpp | 78 +++++++++++++-------------- Tactical/Interface Panels.h | 8 +-- Tactical/Interface.cpp | 8 +-- Tactical/Interface.h | 4 +- Tactical/Overhead.cpp | 62 +++++++++++---------- Tactical/Overhead.h | 8 +-- Tactical/Real Time Input.cpp | 76 +++++++++++++------------- Tactical/ShopKeeper Interface.cpp | 25 ++++----- Tactical/Soldier Ani.cpp | 2 +- Tactical/Squads.cpp | 4 +- Tactical/opplist.cpp | 89 +++++++++++++++---------------- Tactical/opplist.h | 4 +- TacticalAI/PanicButtons.cpp | 14 ++--- TileEngine/Explosion Control.cpp | 56 +++++++++---------- TileEngine/Explosion Control.h | 12 ++--- 23 files changed, 240 insertions(+), 249 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index f540d025..e4d40437 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -3612,7 +3612,7 @@ void recieveNEWSMOKEEFFECT (RPCParameters *rpcParameters) } } -void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner ) +void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, SoldierID ubOwner ) { explosiondamage_struct exp; exp.ubDamageFunc = 1; diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index 5984c5fa..e0975256 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -117,7 +117,7 @@ void send_plant_explosive (UINT16 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 u void send_detonate_explosive (UINT32 uiWorldIndex, UINT16 ubID); void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ); void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, INT32 iSmokeEffectID); -void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner ); +void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, SoldierID ubOwner ); void send_explosivedamage( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ); void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldIndex, UINT16 ubID); diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index b7a002ab..84c9a86f 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -7400,7 +7400,7 @@ static int l_SetOffBombsByFrequency (lua_State *L) if ( lua_gettop(L) >= 2 ) { INT8 ACTION = lua_tointeger(L,1); - UINT8 ID = lua_tointeger(L,2); + SoldierID ID = lua_tointeger(L,2); if (ACTION >= 1 || ACTION <=4) diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index cfca4120..977701bf 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -1699,7 +1699,7 @@ void RemoveRandomItemFromArmsDealerInventory( UINT8 ubArmsDealer, UINT16 usItemI } -BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT16 aMercID ) +BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, SoldierID aMercID ) { //Get Dealer ID from from merc Id INT8 bArmsDealer = GetArmsDealerIDFromMercID( usProfileID ); @@ -1710,7 +1710,7 @@ BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT16 aMercID ) // not if this isn't a proper profile if ( usProfileID == NO_PROFILE ) { - pSoldier = MercPtrs[aMercID]; + pSoldier = aMercID; if ( pSoldier && pSoldier->sNonNPCTraderID > 0 ) bArmsDealer = pSoldier->sNonNPCTraderID; diff --git a/Tactical/Arms Dealer Init.h b/Tactical/Arms Dealer Init.h index 1212f9c7..e32b3b8d 100644 --- a/Tactical/Arms Dealer Init.h +++ b/Tactical/Arms Dealer Init.h @@ -366,7 +366,7 @@ UINT32 GetTimeToFixItemBeingRepaired( UINT8 ubArmsDealer, UINT16 usItemIndex, UI BOOLEAN CanDealerTransactItem( UINT8 ubArmsDealer, UINT16 usItemIndex, BOOLEAN fPurchaseFromPlayer ); BOOLEAN CanDealerRepairItem( UINT8 ubArmsDealer, UINT16 usItemIndex ); -BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, UINT16 aMercID ); +BOOLEAN AddDeadArmsDealerItemsToWorld( UINT8 usProfileID, SoldierID aMercID ); void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE *pObject ); void CreateObjectForDealer( int usItem, int status, int numObjects, OBJECTTYPE *pObject ); @@ -393,4 +393,4 @@ extern void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemInd extern void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index f01c9f8d..dadad4d6 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -72,11 +72,11 @@ CAMO_FACE gCamoFace[NUM_PROFILES]; FACE_GEAR_VALUES zNewFaceGear[MAXITEMS]; FACE_GEAR_VALUES zNewFaceGearIMP[MAXITEMS]; -extern BOOLEAN gfSMDisableForItems; -extern INT16 gsCurInterfacePanel; -extern UINT16 gusSMCurrentMerc; -extern BOOLEAN gfRerenderInterfaceFromHelpText; -extern BOOLEAN gfInItemPickupMenu; +extern BOOLEAN gfSMDisableForItems; +extern INT16 gsCurInterfacePanel; +extern SoldierID gusSMCurrentMerc; +extern BOOLEAN gfRerenderInterfaceFromHelpText; +extern BOOLEAN gfInItemPickupMenu; BOOLEAN FaceRestoreSavedBackgroundRect( INT32 iFaceIndex, INT16 sDestLeft, INT16 sDestTop, INT16 sSrcLeft, INT16 sSrcTop, INT16 sWidth, INT16 sHeight ); void SetupFinalTalkingDelay( FACETYPE *pFace ); diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index cb1f7bf8..cca15ed9 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -1551,7 +1551,7 @@ UINT32 UIHandleChangeLevel( UI_EVENT *pUIEvent ) } -extern void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ); +extern void InternalSelectSoldier( SoldierID usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ); UINT32 UIHandleSelectMerc( UI_EVENT *pUIEvent ) { @@ -1715,12 +1715,11 @@ UINT32 UIHandleMOnTerrain( UI_EVENT *pUIEvent ) // THIS IS JUST A CRUDE TEST FOR NOW if ( pSoldier->stats.bLife < OKLIFE ) { - UINT16 ubID; // Show reg. cursor // GO INTO IDLE MODE // guiPendingOverrideEvent = I_CHANGE_TO_IDLE; // gusSelectedSoldier = NOBODY; - ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); + SoldierID ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); if ( ubID != NOBODY ) { diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index ab4a8cb0..c6235487 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -230,12 +230,12 @@ enum MOUSE_REGION gInvRegions[ NUM_INV_SLOTS ]; extern MOUSE_REGION gMPanelRegion; -extern BOOLEAN fMapInventoryItem; -extern BOOLEAN gfAddingMoneyToMercFromPlayersAccount; -extern SOLDIERTYPE *gpSMCurrentMerc; -extern UINT16 gubSelectSMPanelToMerc; +extern BOOLEAN fMapInventoryItem; +extern BOOLEAN gfAddingMoneyToMercFromPlayersAccount; +extern SOLDIERTYPE *gpSMCurrentMerc; +extern SoldierID gubSelectSMPanelToMerc; extern MOUSE_REGION gSM_SELMERCMoneyRegion; -extern UINT32 guiMapInvSecondHandBlockout; +extern UINT32 guiMapInvSecondHandBlockout; //jackaians: global variables added for the stealing pickup menu BOOLEAN gfStealing = FALSE; diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 99e7d55d..b0bd1677 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -399,9 +399,9 @@ BOOLEAN gfDisableTacticalPanelButtons = FALSE; BOOLEAN gfAddingMoneyToMercFromPlayersAccount = FALSE; BOOLEAN gfCheckForMouseOverItem = FALSE; -UINT32 guiMouseOverItemTime = 0; -INT8 gbCheckForMouseOverItemPos = 0; -UINT16 gubSelectSMPanelToMerc = NOBODY; +UINT32 guiMouseOverItemTime = 0; +INT8 gbCheckForMouseOverItemPos = 0; +SoldierID gubSelectSMPanelToMerc = NOBODY; BOOLEAN gfReEvaluateDisabledINVPanelButtons = FALSE; UINT32 guiBrownBackgroundForTeamPanel; @@ -478,8 +478,8 @@ void HelpTextDoneCallback( void ); // Globals - for one - the current merc here INT8 gbSMCurStanceObj; -UINT16 gusSMCurrentMerc = 0; -SOLDIERTYPE *gpSMCurrentMerc = NULL; +SoldierID gusSMCurrentMerc = NOBODY; +SOLDIERTYPE *gpSMCurrentMerc = NULL; // CHRISL: extern INT8 gbCompatibleApplyItem; extern SOLDIERTYPE *gpItemPopupSoldier; @@ -589,11 +589,11 @@ INT16 GetUIApsToDisplay( SOLDIERTYPE *pSoldier ) void CheckForDisabledForGiveItem( ) { INT16 sDist; - INT32 sDestGridNo; - INT8 bDestLevel; + INT32 sDestGridNo; + INT8 bDestLevel; INT32 cnt; SOLDIERTYPE *pSoldier; - UINT16 ubSrcSoldier; + SoldierID ubSrcSoldier; // CHRISL: If Merc hasn't been set, default to first merc if(gpSMCurrentMerc==NULL) @@ -646,17 +646,17 @@ void CheckForDisabledForGiveItem( ) { if ( gusSMCurrentMerc != ubSrcSoldier ) { - sDestGridNo = MercPtrs[ gusSMCurrentMerc ]->sGridNo; - bDestLevel = MercPtrs[ gusSMCurrentMerc ]->pathing.bLevel; + sDestGridNo = gusSMCurrentMerc->sGridNo; + bDestLevel = gusSMCurrentMerc->pathing.bLevel; // Get distance.... - sDist = PythSpacesAway( MercPtrs[ ubSrcSoldier ]->sGridNo, sDestGridNo ); + sDist = PythSpacesAway( ubSrcSoldier->sGridNo, sDestGridNo ); // Check LOS.... - if ( SoldierTo3DLocationLineOfSightTest( MercPtrs[ ubSrcSoldier ], sDestGridNo, bDestLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) + if ( SoldierTo3DLocationLineOfSightTest( ubSrcSoldier, sDestGridNo, bDestLevel, 3, TRUE, CALC_FROM_ALL_DIRS ) ) { // UNCONSCIOUS GUYS ONLY 1 tile AWAY - if ( MercPtrs[ gusSMCurrentMerc ]->stats.bLife < CONSCIOUSNESS ) + if ( gusSMCurrentMerc->stats.bLife < CONSCIOUSNESS ) { if ( sDist <= PASSING_ITEM_DISTANCE_NOTOKLIFE ) { @@ -669,7 +669,7 @@ void CheckForDisabledForGiveItem( ) } } // anv: passengers in the same vehicle can pass items freely - else if ( MercPtrs[ ubSrcSoldier ]->iVehicleId != -1 && MercPtrs[ ubSrcSoldier ]->iVehicleId == MercPtrs[ gusSMCurrentMerc ]->iVehicleId ) + else if ( ubSrcSoldier->iVehicleId != -1 && ubSrcSoldier->iVehicleId == gusSMCurrentMerc->iVehicleId ) { gfSMDisableForItems = FALSE; } @@ -686,13 +686,13 @@ void CheckForDisabledForGiveItem( ) } } -void SetSMPanelCurrentMerc( UINT16 ubNewID ) +void SetSMPanelCurrentMerc( SoldierID ubNewID ) { gubSelectSMPanelToMerc = NOBODY; gusSMCurrentMerc = ubNewID; - gpSMCurrentMerc = MercPtrs[ ubNewID ]; + gpSMCurrentMerc = ubNewID; // Set to current guy's interface level //if ( gsInterfaceLevel != gpSMCurrentMerc->bUIInterfaceLevel ) @@ -1384,7 +1384,7 @@ void EnableSMPanelButtons( BOOLEAN fEnable , BOOLEAN fFromItemPickup ) } } -UINT16 GetSMPanelCurrentMerc( ) +SoldierID GetSMPanelCurrentMerc( ) { return( gusSMCurrentMerc ); } @@ -4798,8 +4798,6 @@ void BtnMuteCallback(GUI_BUTTON *btn,INT32 reason) void BtnPrevMercCallback(GUI_BUTTON *btn,INT32 reason) { - INT16 sID; - if (!(btn->uiFlags & BUTTON_ENABLED)) return; @@ -4811,9 +4809,9 @@ void BtnPrevMercCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); - sID = FindPrevActiveAndAliveMerc( gpSMCurrentMerc, TRUE, TRUE ); + SoldierID sID = FindPrevActiveAndAliveMerc( gpSMCurrentMerc, TRUE, TRUE ); - gubSelectSMPanelToMerc = (UINT16)sID; + gubSelectSMPanelToMerc = sID; if ( !gfInItemPickupMenu ) { @@ -4846,8 +4844,6 @@ void BtnPrevMercCallback(GUI_BUTTON *btn,INT32 reason) void BtnNextMercCallback(GUI_BUTTON *btn,INT32 reason) { - INT16 sID; - if (!(btn->uiFlags & BUTTON_ENABLED)) return; @@ -4859,10 +4855,10 @@ void BtnNextMercCallback(GUI_BUTTON *btn,INT32 reason) { btn->uiFlags &= (~BUTTON_CLICKED_ON ); - sID = FindNextActiveAndAliveMerc( gpSMCurrentMerc, TRUE, TRUE ); + SoldierID sID = FindNextActiveAndAliveMerc( gpSMCurrentMerc, TRUE, TRUE ); // Give him the panel! - gubSelectSMPanelToMerc = (UINT16)sID; + gubSelectSMPanelToMerc = sID; if ( !gfInItemPickupMenu ) { @@ -6251,13 +6247,13 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) } -extern void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ); +extern void InternalSelectSoldier( SoldierID usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ); -void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) +void HandleLocateSelectMerc( SoldierID ubID, INT8 bFlag ) { BOOLEAN fSelect = FALSE; - if( !MercPtrs[ ubID ]->bActive ) + if( !ubID->bActive ) { return; } @@ -6270,14 +6266,14 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) // ATE: No matter what we do... if below OKLIFE, just locate.... - if ( MercPtrs[ ubID ]->stats.bLife < OKLIFE ) + if ( ubID->stats.bLife < OKLIFE ) { LocateSoldier( ubID, SETLOCATOR ); return; } // Flugente: frozen soldiers can't be selected - if ( MercPtrs[ubID]->usSkillCooldown[SOLDIER_COOLDOWN_CRYO] ) + if ( ubID->usSkillCooldown[SOLDIER_COOLDOWN_CRYO] ) { LocateSoldier( ubID, SETLOCATOR ); return; @@ -6289,7 +6285,7 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) { // Select merc InternalSelectSoldier( ubID, TRUE, FALSE, TRUE); - MercPtrs[ ubID ]->flags.fFlashLocator = FALSE; + ubID->flags.fFlashLocator = FALSE; ResetMultiSelection( ); } else @@ -6300,7 +6296,7 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) } else { - if ( MercPtrs[ ubID ]->flags.fFlashLocator == FALSE ) + if ( ubID->flags.fFlashLocator == FALSE ) { if ( gGameSettings.fOptions[ TOPTION_OLD_SELECTION_METHOD ] ) { @@ -6364,7 +6360,7 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) if ( fSelect ) { // Select merc, only if alive! - if ( !( MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( ubID->flags.uiStatusFlags & SOLDIER_DEAD ) ) { InternalSelectSoldier( ubID, TRUE, FALSE, TRUE ); } @@ -6374,36 +6370,36 @@ void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ) ResetMultiSelection( ); // Handle locate select merc.... - HandleMouseOverSoldierFaceForContMove( MercPtrs[ ubID ], TRUE ); + HandleMouseOverSoldierFaceForContMove( ubID, TRUE ); } -void ShowRadioLocator( UINT16 ubID, UINT8 ubLocatorSpeed ) +void ShowRadioLocator( SoldierID ubID, UINT8 ubLocatorSpeed ) { - RESETTIMECOUNTER( MercPtrs[ ubID ]->timeCounters.FlashSelCounter, FLASH_SELECTOR_DELAY ); + RESETTIMECOUNTER( ubID->timeCounters.FlashSelCounter, FLASH_SELECTOR_DELAY ); //LocateSoldier( ubID, FALSE ); // IC - this is already being done outside of this function :) - MercPtrs[ ubID ]->flags.fFlashLocator = TRUE; + ubID->flags.fFlashLocator = TRUE; //gbPanelSelectedGuy = ubID; IC - had to move this outside to make this function versatile - MercPtrs[ ubID ]->sLocatorFrame = 0; + ubID->sLocatorFrame = 0; if ( ubLocatorSpeed == SHOW_LOCATOR_NORMAL ) { // If we are an AI guy, and we have the baton, make lower... - // ( MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL && MercPtrs[ ubID ]->bTeam != gbPlayerNum ) + // ( ubID->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL && ubID->bTeam != gbPlayerNum ) // //ercPtrs[ ubID ]->ubNumLocateCycles = 3; // //se // - MercPtrs[ ubID ]->ubNumLocateCycles = 5; + ubID->ubNumLocateCycles = 5; // } else { - MercPtrs[ ubID ]->ubNumLocateCycles = 3; + ubID->ubNumLocateCycles = 3; } } diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 0e1bd050..e109ace3 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -77,9 +77,9 @@ void UpdateTEAMPanel( ); */ BOOLEAN InitializeTEAMPanelCoords( ); -void SetSMPanelCurrentMerc( UINT16 ubNewID ); +void SetSMPanelCurrentMerc( SoldierID ubNewID ); void SetTEAMPanelCurrentMerc( UINT16 ubNewID ); -UINT16 GetSMPanelCurrentMerc( ); +SoldierID GetSMPanelCurrentMerc( ); void UpdateSMPanel( ); BOOLEAN InitTEAMSlots( ); @@ -107,7 +107,7 @@ extern INT8 gbNewItem[ NUM_INV_SLOTS ]; extern INT8 gbNewItemCycle[ NUM_INV_SLOTS ]; extern UINT8 gubNewItemMerc; -void ShowRadioLocator( UINT16 ubID, UINT8 ubLocatorSpeed ); +void ShowRadioLocator( SoldierID ubID, UINT8 ubLocatorSpeed ); void EndRadioLocator( UINT16 ubID ); @@ -168,4 +168,4 @@ extern UINT8 gubDescBoxTotalAdvLines; // Jenilee: determine the cost of moving this item around in our inventory UINT16 GetInvMovementCost(OBJECTTYPE* pObj, INT16 old_pos, INT16 new_pos); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 34ebaff3..01dcc0a0 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -185,9 +185,9 @@ BOOLEAN gfPanelAllocated = FALSE; extern MOUSE_REGION gDisableRegion; extern MOUSE_REGION gUserTurnRegion; -extern BOOLEAN gfUserTurnRegionActive; -extern UINT16 gubSelectSMPanelToMerc; -extern BOOLEAN gfIgnoreOnSelectedGuy; +extern BOOLEAN gfUserTurnRegionActive; +extern SoldierID gubSelectSMPanelToMerc; +extern BOOLEAN gfIgnoreOnSelectedGuy; enum { @@ -4216,7 +4216,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_OPEN_DOOR], APBPConstants[BP_OPEN_DOOR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); if ( gOpenDoorMenu.fClosingDoor ) { diff --git a/Tactical/Interface.h b/Tactical/Interface.h index e4d592a7..07aa6068 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -482,7 +482,7 @@ void HandleUpDownArrowBackgrounds( ); void EndDeadlockMsg( ); -void HandleLocateSelectMerc( UINT16 ubID, INT8 bFlag ); +void HandleLocateSelectMerc( SoldierID ubID, INT8 bFlag ); void DirtyMercPanelInterface( SOLDIERTYPE *pSoldier, UINT8 ubDirtyLevel ); @@ -581,4 +581,4 @@ void NCTHShowMounted( SOLDIERTYPE* pSoldier, UINT16* ptrBuf, UINT32 uiPitch, INT BOOLEAN HasBackgroundFlag( UINT8 usProfile, UINT64 aFlag ); INT16 GetBackgroundValue( UINT8 usProfile, UINT16 aNr ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 7c06c46d..2a6bd403 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -3287,9 +3287,9 @@ void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ) -void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ) +void InternalSelectSoldier( SoldierID usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect, BOOLEAN fFromUI ) { - SOLDIERTYPE *pSoldier, *pOldSoldier; + SOLDIERTYPE *pSoldier, *pOldSoldier; // ARM: can't call SelectSoldier() in mapscreen, that will initialize interface panels!!! // ATE: Adjusted conditions a bit ( sometimes were not getting selected ) @@ -3312,7 +3312,7 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF // Get guy - pSoldier = MercPtrs[ usSoldierID ]; + pSoldier = usSoldierID; if( ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { @@ -3460,7 +3460,7 @@ void InternalSelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fF } -void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect ) +void SelectSoldier( SoldierID usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect ) { InternalSelectSoldier( usSoldierID, fAcknowledge, fForceReselect, FALSE ); } @@ -3575,14 +3575,13 @@ void SlideTo(SoldierID usSoldierID, BOOLEAN fSetLocator) ShowRadioLocator( usSoldierID, SHOW_LOCATOR_NORMAL ); // FIRST CHECK IF WE ARE ON SCREEN - if ( GridNoOnScreen( MercPtrs[ usSoldierID ]->sGridNo ) ) + if ( GridNoOnScreen( usSoldierID->sGridNo ) ) { return; } // sGridNo here for DG compatibility - gTacticalStatus.sSlideTarget = MercPtrs[ usSoldierID ]->sGridNo; - gTacticalStatus.sSlideReason = usReasonID; + gTacticalStatus.sSlideTarget = usSoldierID->sGridNo; // Plot new path! gfPlotNewMovement = TRUE; @@ -3612,8 +3611,8 @@ void SlideToLocation( INT32 sDestGridNo ) void RebuildAllSoldierShadeTables( ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; + UINT32 cnt; + SOLDIERTYPE *pSoldier; // Loop through all mercs and make go for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ ) @@ -3628,11 +3627,11 @@ void RebuildAllSoldierShadeTables( ) void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) { - INT32 cnt; - INT32 iNewSelectedSoldier = -1; - SOLDIERTYPE *pTeamSoldier; - BOOLEAN fMissionFailed = TRUE; - INT8 bBuddyIndex; + INT32 cnt; + INT32 iNewSelectedSoldier = -1; + SOLDIERTYPE *pTeamSoldier; + BOOLEAN fMissionFailed = TRUE; + INT8 bBuddyIndex; VerifyPublicOpplistDueToDeath( pSoldier ); @@ -4169,7 +4168,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) // killing crows/cows is not worth any experience! if ( ( pSoldierOld->ubBodyType != CROW ) && ( pSoldierOld->ubBodyType != COW ) ) //&& pSoldierOld->ubLastDamageReason != TAKE_DAMAGE_BLOODLOSS ) // SANDRO - why not give exp for bleeding out? { - UINT16 ubAssister = NOBODY; + SoldierID ubAssister = NOBODY; // if it was a kill by a player's merc if (pSoldierOld->ubAttackerID != NOBODY && pSoldierOld->ubAttackerID->bTeam == gbPlayerNum ) @@ -4218,10 +4217,10 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) } // if it was assisted by a player's merc - if (ubAssister != NOBODY && MercPtrs[ ubAssister ]->bTeam == gbPlayerNum ) + if (ubAssister != NOBODY && ubAssister->bTeam == gbPlayerNum ) { // EXPERIENCE CLASS GAIN: Earned an assist - StatChange( MercPtrs[ ubAssister ], EXPERAMT, (UINT16)( 5 * pSoldierOld->stats.bExpLevel ), FALSE ); + StatChange( ubAssister, EXPERAMT, (UINT16)( 5 * pSoldierOld->stats.bExpLevel ), FALSE ); } } @@ -4252,7 +4251,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) if( Get3RandomQualifiedMercs( &SoldierId1, &SoldierId2, NULL ) != 0 ) { //Say the "he blew himself up quote" - TacticalCharacterDialogue( &Menptr[SoldierId1], QUOTE_GREETING ); + TacticalCharacterDialogue( SoldierId1, QUOTE_GREETING ); //if there isnt a second soldier if( SoldierId2 == NOBODY ) @@ -4261,7 +4260,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) } //say the "darn he took the inventoruy with him" - TacticalCharacterDialogue( &Menptr[SoldierId2], QUOTE_SMALL_TALK ); + TacticalCharacterDialogue( SoldierId2, QUOTE_SMALL_TALK ); } } #endif @@ -4272,7 +4271,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) UINT16 LastActiveTeamMember( UINT16 ubTeam ) { INT32 cnt; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; cnt = gTacticalStatus.Team[ ubTeam ].bLastID; @@ -4682,8 +4681,8 @@ SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked ) void CivilianGroupChangesSides( UINT8 ubCivilianGroup ) { // change civ group side due to external event (wall blowing up) - INT32 cnt; - SOLDIERTYPE * pSoldier; + INT32 cnt; + SOLDIERTYPE *pSoldier; gTacticalStatus.fCivGroupHostile[ ubCivilianGroup ] = CIV_GROUP_HOSTILE; @@ -4741,9 +4740,8 @@ void HickCowAttacked( SOLDIERTYPE * pNastyGuy, SOLDIERTYPE * pTarget ) void MilitiaChangesSides( ) { // make all the militia change sides - - INT32 cnt; - SOLDIERTYPE * pSoldier; + INT32 cnt; + SOLDIERTYPE *pSoldier; if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 ) { @@ -4783,7 +4781,7 @@ gTacticalStatus.fCivGroupHostile[ ubLoop ] = CIV_GROUP_HOSTILE; UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) { INT32 cnt; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; UINT16 ubCount = 0; cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; @@ -4801,11 +4799,11 @@ UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) } -UINT16 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) +SoldierID FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { UINT16 bLastTeamID; UINT16 cnt; - SOLDIERTYPE *pTeamSoldier; + SOLDIERTYPE *pTeamSoldier; cnt = pSoldier->ubID + 1; bLastTeamID = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; @@ -4915,11 +4913,11 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier ) } -UINT16 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) +SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { - UINT16 bLastTeamID; - INT32 cnt; - SOLDIERTYPE *pTeamSoldier; + UINT16 bLastTeamID; + INT32 cnt; + SOLDIERTYPE *pTeamSoldier; // loop back diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 20c03e26..ff6543e4 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -70,7 +70,7 @@ struct TacticalStatusType INT32 sPanicTriggerGridNoUnused; INT16 sHandGrid; UINT16 ubSpottersCalledForBy; - UINT16 ubTheChosenOne; + SoldierID ubTheChosenOne; UINT32 uiTimeOfLastInput; UINT32 uiTimeSinceDemoOn; UINT32 uiCountdownToRestart; @@ -224,7 +224,7 @@ void EndTurn( UINT8 ubNextTeam ); void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ); void EndTacticalDemo( ); -void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect ); +void SelectSoldier( SoldierID usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect ); //Kaiden: Function declaration from UB to reveal all items after combat. void RevealAllDroppedEnemyItems(); @@ -241,8 +241,8 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ); UINT16 LastActiveTeamMember( UINT16 ubTeam ); BOOLEAN SoldierOnVisibleWorldTile( SOLDIERTYPE *pSoldier ); -UINT16 FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); -UINT16 FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); +SoldierID FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); +SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); BOOLEAN CheckForPlayerTeamInMissionExit( ); void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index ab0797f7..9ba02699 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -2021,51 +2021,53 @@ void HandleAltMouseRTX2Button(UINT32 *puiNewEvent) // sevenfm: original mouse commands functionality void HandleMouseRTWheel( void ) { - UINT16 bID; - // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel - if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && - ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ NEXTMERC_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) - { - if ( gViewportRegion.WheelState > 0 ) //wheel up - { - //change stance ->DOWN - if ( _KeyDown( ALT ) ) + SoldierID bID; + // nothing in hand and either not in SM panel, or the matching button is enabled if we are in SM panel + if ( !( gTacticalStatus.uiFlags & ENGAGED_IN_CONV ) && + ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ NEXTMERC_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) + { + if ( gViewportRegion.WheelState > 0 ) //wheel up + { + //change stance ->DOWN + if ( _KeyDown( ALT ) ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoLowerStance(gusSelectedSoldier); + GotoLowerStance(gusSelectedSoldier); return; - } + } - if ( gusSelectedSoldier != NOBODY ) - { //Select prev merc - bID = FindPrevActiveAndAliveMerc( gusSelectedSoldier, TRUE, TRUE ); - HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); - // Center to guy.... - LocateSoldier( gusSelectedSoldier, SETLOCATOR ); - } - } - else - { - //change stance ->UP - if ( _KeyDown( ALT ) ) + if ( gusSelectedSoldier != NOBODY ) + { //Select prev merc + bID = FindPrevActiveAndAliveMerc( gusSelectedSoldier, TRUE, TRUE ); + HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); + // Center to guy.... + LocateSoldier( gusSelectedSoldier, SETLOCATOR ); + } + } + else + { + //change stance ->UP + if ( _KeyDown( ALT ) ) { if ( (gusSelectedSoldier != NOBODY) && ( gpItemPointer == NULL ) ) - GotoHeigherStance( gusSelectedSoldier ); + GotoHeigherStance( gusSelectedSoldier ); return; - } + } - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"wheel %d", gViewportRegion.WheelState); - if ( gusSelectedSoldier != NOBODY ) - { //Select next merc - bID = FindNextMercInTeamPanel( gusSelectedSoldier, FALSE, FALSE ); - HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); - // Center to guy.... - LocateSoldier( gusSelectedSoldier, SETLOCATOR ); - } - } - //*puiNewEvent = M_ON_TERRAIN; ???????????????? - } + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"wheel %d", gViewportRegion.WheelState); + if ( gusSelectedSoldier != NOBODY ) + { //Select next merc + bID = FindNextMercInTeamPanel( gusSelectedSoldier, FALSE, FALSE ); + HandleLocateSelectMerc( bID, LOCATEANDSELECT_MERC ); + // Center to guy.... + LocateSoldier( gusSelectedSoldier, SETLOCATOR ); + } + } + //*puiNewEvent = M_ON_TERRAIN; ???????????????? + } } + + void HandleMouseRTMButton( UINT32 *puiNewEvent ) { if ( _KeyDown( ALT ) ) @@ -2078,6 +2080,8 @@ void HandleMouseRTMButton( UINT32 *puiNewEvent ) else *puiNewEvent = LC_LOOK; } + + void HandleMouseRTX1Button( UINT32 *puiNewEvent ) { if ( !_KeyDown( ALT ) && !_KeyDown( SHIFT )) diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index a09f5020..5e7b5ca6 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -379,17 +379,17 @@ BOOLEAN gfPerformTransactionInProgress = FALSE; BOOLEAN gfCommonQuoteUsedThisSession[ NUM_COMMON_SK_QUOTES ]; -extern SOLDIERTYPE *gpSMCurrentMerc; -extern SOLDIERTYPE *gpItemDescSoldier; +extern SOLDIERTYPE *gpSMCurrentMerc; +extern SOLDIERTYPE *gpItemDescSoldier; extern MOUSE_REGION gItemDescAttachmentRegions[MAX_ATTACHMENTS]; extern MOUSE_REGION gInvDesc; -extern BOOLEAN gfSMDisableForItems; -extern OBJECTTYPE *gpItemDescObject; -extern OBJECTTYPE *gpItemDescPrevObject; -extern OBJECTTYPE *gpItemDescPrevObject; -extern void HandleShortCutExitState( void ); -extern UINT16 gubSelectSMPanelToMerc; -extern INT32 giItemDescAmmoButton; +extern BOOLEAN gfSMDisableForItems; +extern OBJECTTYPE *gpItemDescObject; +extern OBJECTTYPE *gpItemDescPrevObject; +extern OBJECTTYPE *gpItemDescPrevObject; +extern void HandleShortCutExitState( void ); +extern SoldierID gubSelectSMPanelToMerc; +extern INT32 giItemDescAmmoButton; extern BOOLEAN BltVSurfaceUsingDD( HVSURFACE hDestVSurface, HVSURFACE hSrcVSurface, UINT32 fBltFlags, INT32 iDestX, INT32 iDestY, RECT *SrcRect ); @@ -1686,16 +1686,13 @@ void GetShopKeeperInterfaceUserInput() case SPACE: { - UINT8 ubID; - DeleteItemDescriptionBox( ); // skip Robot and EPCs - ubID = FindNextActiveAndAliveMerc( gpSMCurrentMerc, FALSE, TRUE ); - + SoldierID ubID = FindNextActiveAndAliveMerc( gpSMCurrentMerc, FALSE, TRUE ); gubSelectSMPanelToMerc = ubID; - LocateSoldier( ubID, DONTSETLOCATOR ); + // refresh background for player slots (in case item values change due to Flo's discount) gubSkiDirtyLevel = SKI_DIRTY_LEVEL2; } diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 602800af..51a097d5 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -107,7 +107,7 @@ extern void PlaySoldierFootstepSound( SOLDIERTYPE *pSoldier ); extern UINT16 NumCapableEnemyInSector( ); extern BOOLEAN gfKillingGuysForLosingBattle; -extern UINT16 gubInterruptProvoker; +extern SoldierID gubInterruptProvoker; extern UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOLEAN fHipStance ); diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index 26d7f5c3..fe88875d 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -1327,8 +1327,6 @@ void RebuildSquad( INT8 bSquadValue ) void UpdateCurrentlySelectedMerc( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) { - UINT16 ubID; - // if this squad is the current one and and the psoldier is the currently selected soldier, get rid of 'em if( bSquadValue != iCurrentTacticalSquad ) { @@ -1338,7 +1336,7 @@ void UpdateCurrentlySelectedMerc( SOLDIERTYPE *pSoldier, INT8 bSquadValue ) // Are we the selected guy? if( gusSelectedSoldier == pSoldier->ubID ) { - ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); + SoldierID ubID = FindNextActiveAndAliveMerc( pSoldier, FALSE, FALSE ); if ( ubID != NOBODY && ubID != gusSelectedSoldier ) { diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index d2649faf..63be9d2e 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -87,7 +87,7 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT // The_Bob - real time sneaking code 01/06/09 extern void CancelItemPointer(void); extern BOOLEAN NobodyAlerted(void); -extern void ShowRadioLocator( UINT16 ubID, UINT8 ubLocatorSpeed ); +extern void ShowRadioLocator( SoldierID ubID, UINT8 ubLocatorSpeed ); //#define TESTOPPLIST // for ManSeesMan() @@ -116,7 +116,7 @@ BOOLEAN gfMikeShouldSayHi = FALSE; BOOLEAN gfMorrisShouldSayHi = FALSE; #endif -UINT16 gubBestToMakeSighting[BEST_SIGHTING_ARRAY_SIZE]; +SoldierID gubBestToMakeSighting[BEST_SIGHTING_ARRAY_SIZE]; UINT8 gubBestToMakeSightingSize = 0; //BOOLEAN gfHumanSawSomeoneInRealtime; @@ -124,11 +124,11 @@ BOOLEAN gfDelayResolvingBestSightingDueToDoor = FALSE; #define SHOULD_BECOME_HOSTILE_SIZE 32 -UINT16 gubShouldBecomeHostileOrSayQuote[ SHOULD_BECOME_HOSTILE_SIZE ]; +SoldierID gubShouldBecomeHostileOrSayQuote[ SHOULD_BECOME_HOSTILE_SIZE ]; UINT8 gubNumShouldBecomeHostileOrSayQuote; // NB this ID is set for someone opening a door -UINT16 gubInterruptProvoker = NOBODY; +SoldierID gubInterruptProvoker = NOBODY; INT8 gbPublicOpplist[MAXTEAMS][TOTAL_SOLDIERS]; INT8 gbSeenOpponents[TOTAL_SOLDIERS][TOTAL_SOLDIERS]; @@ -356,9 +356,8 @@ INT16 AdjustMaxSightRangeForEnvEffects( SOLDIERTYPE *pSoldier, INT8 bLightLevel, void SwapBestSightingPositions( INT8 bPos1, INT8 bPos2 ) { - UINT16 ubTemp; + SoldierID ubTemp = gubBestToMakeSighting[ bPos1 ]; - ubTemp = gubBestToMakeSighting[ bPos1 ]; gubBestToMakeSighting[ bPos1 ] = gubBestToMakeSighting[ bPos2 ]; gubBestToMakeSighting[ bPos2 ] = ubTemp; } @@ -406,7 +405,7 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel // must percolate him down for ( ubLoop2 = ubLoop + 1; ubLoop2 < gubBestToMakeSightingSize; ubLoop2++ ) { - if ( gubBestToMakeSighting[ ubLoop2 ] != NOBODY && MercPtrs[ gubBestToMakeSighting[ ubLoop2 - 1 ] ]->aiData.bInterruptDuelPts < MercPtrs[ gubBestToMakeSighting[ ubLoop2 ] ]->aiData.bInterruptDuelPts ) + if ( gubBestToMakeSighting[ ubLoop2 ] != NOBODY && gubBestToMakeSighting[ ubLoop2 - 1 ]->aiData.bInterruptDuelPts < gubBestToMakeSighting[ ubLoop2 ]->aiData.bInterruptDuelPts ) { SwapBestSightingPositions( (UINT8) (ubLoop2 - 1), ubLoop2 ); } @@ -439,11 +438,11 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel { for ( ubLoop = 0; ubLoop < gubBestToMakeSightingSize; ubLoop++ ) { - if ( pSoldier->RecognizeAsCombatant(gubBestToMakeSighting[ ubLoop ]) && (gubBestToMakeSighting[ ubLoop ] == NOBODY) || ( gubBestToMakeSighting[ ubLoop ] != NOBODY && bInterruptDuelPts > MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->aiData.bInterruptDuelPts ) ) + if ( pSoldier->RecognizeAsCombatant(gubBestToMakeSighting[ ubLoop ]) && (gubBestToMakeSighting[ ubLoop ] == NOBODY) || ( gubBestToMakeSighting[ ubLoop ] != NOBODY && bInterruptDuelPts > gubBestToMakeSighting[ ubLoop ]->aiData.bInterruptDuelPts ) ) { if ( gubBestToMakeSighting[ gubBestToMakeSightingSize - 1 ] != NOBODY ) { - MercPtrs[ gubBestToMakeSighting[ gubBestToMakeSightingSize - 1 ] ]->aiData.bInterruptDuelPts = NO_INTERRUPT; + gubBestToMakeSighting[ gubBestToMakeSightingSize - 1 ]->aiData.bInterruptDuelPts = NO_INTERRUPT; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: resetting points for %d to zilch", pSoldier->ubID ) ); } @@ -468,7 +467,7 @@ void ReevaluateBestSightingPosition( SOLDIERTYPE * pSoldier, INT8 bInterruptDuel { if ( (gubBestToMakeSighting[ ubLoop ] != NOBODY) ) { - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP entry %d: %d (%d pts)", ubLoop, gubBestToMakeSighting[ ubLoop ], MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->aiData.bInterruptDuelPts ) ); + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP entry %d: %d (%d pts)", ubLoop, gubBestToMakeSighting[ ubLoop ], gubBestToMakeSighting[ ubLoop ]->aiData.bInterruptDuelPts ) ); } } @@ -503,52 +502,51 @@ void HandleBestSightingPositionInRealtime( void ) { // The_Bob - real time sneaking code 01/06/09 // if real time sneaking conditions are met... // this is now in the preferences window - SANDRO - if (gGameSettings.fOptions[TOPTION_ALLOW_REAL_TIME_SNEAK] && MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam == OUR_TEAM && NobodyAlerted() ) + if (gGameSettings.fOptions[TOPTION_ALLOW_REAL_TIME_SNEAK] && gubBestToMakeSighting[ 0 ]->bTeam == OUR_TEAM && NobodyAlerted() ) { // get rid of the item under cursor (we gotta react FAST) CancelItemPointer(); // select (and center screen on) the merc who saw the enemy // HEADROCK HAM 3.6: A much-requested toggle. - if (gusSelectedSoldier != MercPtrs[gubBestToMakeSighting[ 0 ]]->ubID && - !gGameExternalOptions.fNoAutoFocusChangeInRealtimeSneak) - SelectSoldier (MercPtrs[gubBestToMakeSighting[ 0 ]]->ubID, false, true); + if (gusSelectedSoldier != gubBestToMakeSighting[ 0 ]->ubID && !gGameExternalOptions.fNoAutoFocusChangeInRealtimeSneak) + SelectSoldier(gubBestToMakeSighting[ 0 ]->ubID, false, true); // if not quiet, emit a message warning the player if (!gGameExternalOptions.fQuietRealTimeSneak) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_RTM_ENEMIES_SPOOTED]); return; // and do nothing } - else if ( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam != OUR_TEAM && MercPtrs[gubBestToMakeSighting[ 0 ]]->aiData.bOppCnt > 0 ) + else if ( gubBestToMakeSighting[ 0 ]->bTeam != OUR_TEAM && gubBestToMakeSighting[ 0 ]->aiData.bOppCnt > 0 ) { // otherwise, simply award the turn to the team that saw the enemy first - EnterCombatMode( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam ); + EnterCombatMode( gubBestToMakeSighting[ 0 ]->bTeam ); } else // otherwise, simply award the turn to the team that saw the enemy first - EnterCombatMode( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam ); + EnterCombatMode( gubBestToMakeSighting[ 0 ]->bTeam ); } else { // if 1st and 2nd on same team, or 1st and 3rd on same team, or there IS no 3rd, award turn to 1st - if ( /*MercPtrs[gubBestToMakeSighting[ 0 ]]->aiData.bOppCnt > 0 &&*/ ( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam == MercPtrs[gubBestToMakeSighting[ 1 ]]->bTeam ) || - ( (gubBestToMakeSighting[ 2 ] == NOBODY) || ( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam == MercPtrs[gubBestToMakeSighting[ 2 ]]->bTeam ) ) + if ( /*gubBestToMakeSighting[ 0 ]->aiData.bOppCnt > 0 &&*/ ( gubBestToMakeSighting[ 0 ]->bTeam == gubBestToMakeSighting[ 1 ]->bTeam ) || + ( (gubBestToMakeSighting[ 2 ] == NOBODY) || ( gubBestToMakeSighting[ 0 ]->bTeam == gubBestToMakeSighting[ 2 ]->bTeam ) ) ) { - EnterCombatMode( MercPtrs[gubBestToMakeSighting[ 0 ]]->bTeam ); + EnterCombatMode( gubBestToMakeSighting[ 0 ]->bTeam ); } - else //if ( MercPtrs[gubBestToMakeSighting[ 1 ]]->aiData.bOppCnt > 0 ) // give turn to 2nd best but interrupt to 1st + else //if ( gubBestToMakeSighting[ 1 ]->aiData.bOppCnt > 0 ) // give turn to 2nd best but interrupt to 1st { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Entering combat mode: turn for 2nd best, int for best" ); - EnterCombatMode( MercPtrs[gubBestToMakeSighting[ 1 ]]->bTeam ); + EnterCombatMode( gubBestToMakeSighting[ 1 ]->bTeam ); // 2nd guy loses control AddToIntList( gubBestToMakeSighting[ 1 ], FALSE, TRUE); // 1st guy gains control AddToIntList( gubBestToMakeSighting[ 0 ], TRUE, TRUE); // done - DoneAddingToIntList( MercPtrs[gubBestToMakeSighting[ 0 ]], TRUE, SIGHTINTERRUPT ); + DoneAddingToIntList( gubBestToMakeSighting[ 0 ], TRUE, SIGHTINTERRUPT ); } } } @@ -557,8 +555,8 @@ void HandleBestSightingPositionInRealtime( void ) { if ( gubBestToMakeSighting[ ubLoop ] != NOBODY ) { - MercPtrs[ gubBestToMakeSighting[ ubLoop ]]->aiData.bInterruptDuelPts = NO_INTERRUPT; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: done, resetting points for %d to zilch", MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->ubID ) ); + gubBestToMakeSighting[ ubLoop ]->aiData.bInterruptDuelPts = NO_INTERRUPT; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP: done, resetting points for %d to zilch", gubBestToMakeSighting[ ubLoop ]->ubID ) ); } } @@ -583,7 +581,7 @@ void HandleBestSightingPositionInTurnbased( void ) if ( gubBestToMakeSighting[ 0 ] != NOBODY ) { - if ( MercPtrs[ gubBestToMakeSighting[ 0 ] ]->bTeam != gTacticalStatus.ubCurrentTeam ) + if ( gubBestToMakeSighting[ 0 ]->bTeam != gTacticalStatus.ubCurrentTeam ) { // interrupt! @@ -605,7 +603,7 @@ void HandleBestSightingPositionInTurnbased( void ) } } - else if ( MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->bTeam == gTacticalStatus.ubCurrentTeam ) + else if ( gubBestToMakeSighting[ ubLoop ]->bTeam == gTacticalStatus.ubCurrentTeam ) { fOk = TRUE; break; @@ -621,7 +619,7 @@ void HandleBestSightingPositionInTurnbased( void ) AddToIntList( gubBestToMakeSighting[ ubLoop2 ], TRUE, TRUE); } // done - DoneAddingToIntList( MercPtrs[ gubBestToMakeSighting[ ubLoop ] ], TRUE, SIGHTINTERRUPT ); + DoneAddingToIntList( gubBestToMakeSighting[ ubLoop ], TRUE, SIGHTINTERRUPT ); } } @@ -629,8 +627,8 @@ void HandleBestSightingPositionInTurnbased( void ) { if ( gubBestToMakeSighting[ ubLoop ] != NOBODY ) { - MercPtrs[ gubBestToMakeSighting[ ubLoop ]]->aiData.bInterruptDuelPts = NO_INTERRUPT; - DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP (TB): done, resetting points for %d to zilch", MercPtrs[ gubBestToMakeSighting[ ubLoop ] ]->ubID ) ); + gubBestToMakeSighting[ ubLoop ]->aiData.bInterruptDuelPts = NO_INTERRUPT; + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "RBSP (TB): done, resetting points for %d to zilch", gubBestToMakeSighting[ ubLoop ]->ubID ) ); } } @@ -672,13 +670,13 @@ void InitSightArrays( void ) } } -void AddToShouldBecomeHostileOrSayQuoteList( UINT16 ubID ) +void AddToShouldBecomeHostileOrSayQuoteList( SoldierID ubID ) { UINT16 ubLoop; Assert( gubNumShouldBecomeHostileOrSayQuote < SHOULD_BECOME_HOSTILE_SIZE ); - if ( MercPtrs[ ubID ]->stats.bLife < OKLIFE ) + if ( ubID->stats.bLife < OKLIFE ) { return; } @@ -696,15 +694,15 @@ void AddToShouldBecomeHostileOrSayQuoteList( UINT16 ubID ) gubNumShouldBecomeHostileOrSayQuote++; } -UINT16 SelectSpeakerFromHostileOrSayQuoteList( void ) +SoldierID SelectSpeakerFromHostileOrSayQuoteList( void ) { - UINT16 ubProfileList[ SHOULD_BECOME_HOSTILE_SIZE ]; // NB list of merc IDs, not profiles! + SoldierID IDList[ SHOULD_BECOME_HOSTILE_SIZE ]; UINT8 ubLoop, ubNumProfiles = 0; SOLDIERTYPE * pSoldier; for ( ubLoop = 0; ubLoop < gubNumShouldBecomeHostileOrSayQuote; ubLoop++ ) { - pSoldier = MercPtrs[ gubShouldBecomeHostileOrSayQuote[ ubLoop ] ]; + pSoldier = gubShouldBecomeHostileOrSayQuote[ ubLoop ]; if ( pSoldier->ubProfile != NO_PROFILE ) { @@ -713,7 +711,7 @@ UINT16 SelectSpeakerFromHostileOrSayQuoteList( void ) if ( NPCHasUnusedHostileRecord( pSoldier->ubProfile, APPROACH_DECLARATION_OF_HOSTILITY ) ) { - ubProfileList[ ubNumProfiles ] = gubShouldBecomeHostileOrSayQuote[ ubLoop ]; + IDList[ ubNumProfiles ] = gubShouldBecomeHostileOrSayQuote[ ubLoop ]; ubNumProfiles++; } else @@ -731,7 +729,7 @@ UINT16 SelectSpeakerFromHostileOrSayQuoteList( void ) } else { - return( ubProfileList[ Random( ubNumProfiles ) ] ); + return(IDList[ Random( ubNumProfiles ) ] ); } } @@ -745,7 +743,8 @@ void CheckHostileOrSayQuoteList( void ) } else { - UINT16 ubSpeaker, ubLoop; + SoldierID ubSpeaker; + UINT16 ubLoop; SOLDIERTYPE * pSoldier; ubSpeaker = SelectSpeakerFromHostileOrSayQuoteList(); @@ -754,7 +753,7 @@ void CheckHostileOrSayQuoteList( void ) // make sure everyone on this list is hostile for ( ubLoop = 0; ubLoop < gubNumShouldBecomeHostileOrSayQuote; ubLoop++ ) { - pSoldier = MercPtrs[ gubShouldBecomeHostileOrSayQuote[ ubLoop ] ]; + pSoldier = gubShouldBecomeHostileOrSayQuote[ ubLoop ]; if ( pSoldier->aiData.bNeutral ) { MakeCivHostile(pSoldier); @@ -789,13 +788,13 @@ void CheckHostileOrSayQuoteList( void ) // stop everyone? // We want to make this guy visible to the player. - if ( MercPtrs[ ubSpeaker ]->bVisible != TRUE ) + if ( ubSpeaker->bVisible != TRUE ) { gbPublicOpplist[ gbPlayerNum ][ ubSpeaker ] = HEARD_THIS_TURN; - HandleSight( MercPtrs[ ubSpeaker ], SIGHT_LOOK | SIGHT_RADIO ); + HandleSight( ubSpeaker, SIGHT_LOOK | SIGHT_RADIO ); } // trigger hater - TriggerNPCWithIHateYouQuote( MercPtrs[ ubSpeaker ]->ubProfile ); + TriggerNPCWithIHateYouQuote( ubSpeaker->ubProfile ); } } } @@ -1743,8 +1742,8 @@ void AllTeamsLookForAll(UINT8 ubAllowInterrupts) InterruptsAllowed = TRUE; */ - // reset interrupt only guynum which may have been used - gubInterruptProvoker = NOBODY; + // reset interrupt only guynum which may have been used + gubInterruptProvoker = NOBODY; } @@ -5528,7 +5527,7 @@ UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier ) return( ubDoorNoise ); } -void MakeNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) +void MakeNoise(SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { EV_S_NOISE SNoise; diff --git a/Tactical/opplist.h b/Tactical/opplist.h index 381d8f65..c49a8eab 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -139,7 +139,7 @@ void DebugSoldierPage4( ); UINT8 MovementNoise( SOLDIERTYPE *pSoldier ); UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier ); -void MakeNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void MakeNoise(SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType); @@ -164,7 +164,7 @@ void CheckHostileOrSayQuoteList( void ); void InitOpplistForDoorOpening( void ); UINT8 DoorOpeningNoise( SOLDIERTYPE * pSoldier ); -void AddToShouldBecomeHostileOrSayQuoteList( UINT16 ubID ); +void AddToShouldBecomeHostileOrSayQuoteList( SoldierID ubID ); //extern INT8 gbLightSighting[1][16]; diff --git a/TacticalAI/PanicButtons.cpp b/TacticalAI/PanicButtons.cpp index dd64b504..61e8608f 100644 --- a/TacticalAI/PanicButtons.cpp +++ b/TacticalAI/PanicButtons.cpp @@ -13,13 +13,13 @@ void MakeClosestEnemyChosenOne() { - UINT32 cnt; - INT16 sPathCost, sShortestPath = 1000; - INT8 bOldKeys = -1; - UINT16 ubClosestEnemy = NOBODY; + UINT32 cnt; + INT16 sPathCost, sShortestPath = 1000; + INT8 bOldKeys = -1; + SoldierID ubClosestEnemy = NOBODY; SOLDIERTYPE * pSoldier; - INT8 bPanicTrigger; - INT32 sPanicTriggerGridNo; + INT8 bPanicTrigger; + INT32 sPanicTriggerGridNo; if ( ! (gTacticalStatus.fPanicFlags & PANIC_TRIGGERS_HERE) ) { @@ -162,7 +162,7 @@ void MakeClosestEnemyChosenOne() NumMessage("TEST MSG: The chosen one is ",TheChosenOne); #endif - pSoldier = MercPtrs[gTacticalStatus.ubTheChosenOne]; + pSoldier = gTacticalStatus.ubTheChosenOne; if ( pSoldier->aiData.bAlertStatus < STATUS_RED ) { pSoldier->aiData.bAlertStatus = STATUS_RED; diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 74e67f99..7e1e1f4f 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -172,15 +172,15 @@ EXPLOSION_DATA gExpAniData[ NUM_EXP_TYPES ] = #define MAX_BOMB_QUEUE 40 ExplosionQueueElement gExplosionQueue[MAX_BOMB_QUEUE]; -UINT8 gubElementsOnExplosionQueue = 0; -BOOLEAN gfExplosionQueueActive = FALSE; +UINT8 gubElementsOnExplosionQueue = 0; +BOOLEAN gfExplosionQueueActive = FALSE; -BOOLEAN gfExplosionQueueMayHaveChangedSight = FALSE; -UINT16 gubPersonToSetOffExplosions = NOBODY; +BOOLEAN gfExplosionQueueMayHaveChangedSight = FALSE; +SoldierID gubPersonToSetOffExplosions = NOBODY; INT32 gsTempActionGridNo = NOWHERE; -extern UINT16 gubInterruptProvoker; +extern SoldierID gubInterruptProvoker; #define NUM_EXPLOSION_SLOTS 100 @@ -245,7 +245,7 @@ void RecountExplosions( void ) extern void HandleLoyaltyForDemolitionOfBuilding( SOLDIERTYPE *pSoldier, INT16 sPointsDmg ); // GENERATE EXPLOSION -void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) +void InternalIgniteExplosion( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) { #ifdef JA2BETAVERSION if (is_networked) { @@ -273,7 +273,7 @@ void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT3 // Let's check for the attacker first. if ( ubOwner != NOBODY ) { - OBJECTTYPE* pUsedGun = MercPtrs[ ubOwner ]->GetUsedWeapon( &MercPtrs [ ubOwner ]->inv[MercPtrs[ubOwner]->ubAttackingHand] ); + OBJECTTYPE* pUsedGun = ubOwner->GetUsedWeapon( &( ubOwner->inv[ ubOwner->ubAttackingHand ] ) ); ammotype = (*pUsedGun)[0]->data.gun.ubGunAmmoType; @@ -283,7 +283,7 @@ void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT3 } // Flugente: campaign stats - if ( MercPtrs[ ubOwner ]->bTeam == OUR_TEAM ) + if ( ubOwner->bTeam == OUR_TEAM ) { if ( Item[ usItem ].usItemClass & IC_EXPLOSV ) gCampaignStats.AddConsumption(CAMPAIGN_CONSUMED_EXPLOSIVES, (FLOAT)(Item[usItem].ubWeight) ); @@ -344,7 +344,7 @@ void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT3 UINT16 tmp; if ( Item[ usItem ].usItemClass & IC_EXPLOSV && ubOwner != NOBODY && ubOwner < NUM_PROFILES && InARoom( sGridNo, &tmp ) ) { - HandleLoyaltyForDemolitionOfBuilding( MercPtrs[ubOwner], Explosive[ Item[ usItem ].ubClassIndex ].ubDamage ); + HandleLoyaltyForDemolitionOfBuilding( ubOwner, Explosive[ Item[ usItem ].ubClassIndex ].ubDamage ); // Flugente: campaign stats gCurrentIncident.usIncidentFlags |= INCIDENT_BUILDINGS_DAMAGED; @@ -386,7 +386,7 @@ void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT3 } -void IgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) +void IgniteExplosion( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ) { InternalIgniteExplosion( ubOwner, sX, sY, sZ, sGridNo, usItem, TRUE, bLevel, ubDirection, pObj ); } @@ -1898,7 +1898,7 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid return( TRUE ); } -BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner, BOOL fFromRemoteClient ) +BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, SoldierID ubOwner, BOOL fFromRemoteClient ) { // OJW - 20091028 if (is_networked && is_client) @@ -1916,7 +1916,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN } #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"DishOutGasDamage ( ubSoldierID : %i , ubExplosiveType : %i , sSubsequent : %i , recompileMoveCosts : %i , sWoundAmt : %i , sBreathAmt : %i , ubOwner : %i , fRemote : %i)\n", pSoldier->ubID , pExplosive->ubType , sSubsequent , fRecompileMovementCosts , sWoundAmt , sBreathAmt , ubOwner , fFromRemoteClient ); + sprintf(tmpMPDbgString,"DishOutGasDamage ( ubSoldierID : %i , ubExplosiveType : %i , sSubsequent : %i , recompileMoveCosts : %i , sWoundAmt : %i , sBreathAmt : %i , ubOwner : %i , fRemote : %i)\n", pSoldier->ubID.i , pExplosive->ubType , sSubsequent , fRecompileMovementCosts , sWoundAmt , sBreathAmt , ubOwner.i , fFromRemoteClient ); MPDebugMsg(tmpMPDbgString); #endif } @@ -2155,9 +2155,9 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN pSoldier->DoMercBattleSound( BATTLE_SOUND_HIT1 ); } - if ( ubOwner != NOBODY && MercPtrs[ ubOwner ]->bTeam == gbPlayerNum && pSoldier->bTeam != gbPlayerNum ) + if ( ubOwner != NOBODY && ubOwner->bTeam == gbPlayerNum && pSoldier->bTeam != gbPlayerNum ) { - ProcessImplicationsOfPCAttack( MercPtrs[ ubOwner ], &pSoldier, REASON_EXPLOSION ); + ProcessImplicationsOfPCAttack( ubOwner, &pSoldier, REASON_EXPLOSION ); } } return( fRecompileMovementCosts ); @@ -3800,7 +3800,7 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemo if (soldierID == NOBODY) soldierID = wi.object[0]->data.misc.ubBombOwner - 2; // undo the hack - if (IsOurSoldier(gubPersonToSetOffExplosions) || IsOurSoldier((SOLDIERTYPE*)soldierID)) + if (IsOurSoldier((SOLDIERTYPE*)gubPersonToSetOffExplosions) || IsOurSoldier((SOLDIERTYPE*)soldierID)) { // we set off the bomb (could be failed disarm) or we own it, tell the other clients we are setting it off send_detonate_explosive(iWorldIndex,gubPersonToSetOffExplosions); @@ -3827,7 +3827,7 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemo } // Flugente: activate everything connected to a tripwire in the surrounding if sGridNo on level bLevel with regard to the tripwire netwrok and hierarchy determined by ubFlag -BOOLEAN ActivateSurroundingTripwire( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ) +BOOLEAN ActivateSurroundingTripwire( SoldierID ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ) { UINT32 uiTimeStamp= GetJA2Clock(); BOOLEAN fFoundMine = FALSE; @@ -4285,9 +4285,9 @@ void HandleExplosionQueue( void ) // re-enable sight gTacticalStatus.uiFlags &= (~DISALLOW_SIGHT); - if ( gubPersonToSetOffExplosions != NOBODY && !(MercPtrs[ gubPersonToSetOffExplosions ]->flags.uiStatusFlags & SOLDIER_PC) ) + if ( gubPersonToSetOffExplosions != NOBODY && !(gubPersonToSetOffExplosions->flags.uiStatusFlags & SOLDIER_PC) ) { - FreeUpNPCFromPendingAction( MercPtrs[ gubPersonToSetOffExplosions ] ); + FreeUpNPCFromPendingAction( gubPersonToSetOffExplosions ); } if (gfExplosionQueueMayHaveChangedSight) @@ -4588,11 +4588,11 @@ void DecayBombTimers( void ) // ATE: CC black magic.... if ( (*pObj)[0]->data.misc.ubBombOwner > 1 ) { - gubPersonToSetOffExplosions = (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2); + gubPersonToSetOffExplosions = ((*pObj)[0]->data.misc.ubBombOwner - 2); // SANDRO - merc records - detonating explosives - if ( MercPtrs[ gubPersonToSetOffExplosions ]->ubProfile != NO_PROFILE && MercPtrs[ gubPersonToSetOffExplosions ]->bTeam == gbPlayerNum ) + if ( gubPersonToSetOffExplosions->ubProfile != NO_PROFILE && gubPersonToSetOffExplosions->bTeam == gbPlayerNum ) { - gMercProfiles[ MercPtrs[ gubPersonToSetOffExplosions ]->ubProfile ].records.usExpDetonated++; + gMercProfiles[ gubPersonToSetOffExplosions->ubProfile ].records.usExpDetonated++; } } else @@ -4642,11 +4642,11 @@ void DecayBombTimers( void ) // ATE: CC black magic.... if ( (*pObj)[0]->data.misc.ubBombOwner > 1 ) { - gubPersonToSetOffExplosions = (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2); + gubPersonToSetOffExplosions = ((*pObj)[0]->data.misc.ubBombOwner - 2); // SANDRO - merc records - detonating explosives - if ( MercPtrs[ gubPersonToSetOffExplosions ]->ubProfile != NO_PROFILE && MercPtrs[ gubPersonToSetOffExplosions ]->bTeam == gbPlayerNum ) + if ( gubPersonToSetOffExplosions->ubProfile != NO_PROFILE && gubPersonToSetOffExplosions->bTeam == gbPlayerNum ) { - gMercProfiles[ MercPtrs[ gubPersonToSetOffExplosions ]->ubProfile ].records.usExpDetonated++; + gMercProfiles[ gubPersonToSetOffExplosions->ubProfile ].records.usExpDetonated++; } } else @@ -4667,7 +4667,7 @@ void DecayBombTimers( void ) } } -void SetOffBombsByFrequency( UINT16 ubID, INT8 bFrequency ) +void SetOffBombsByFrequency( SoldierID ubID, INT8 bFrequency ) { UINT32 uiWorldBombIndex; UINT32 uiTimeStamp; @@ -4893,7 +4893,7 @@ void SetOffPanicBombs( UINT16 ubID, INT8 bPanicTrigger ) } } -BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ) +BOOLEAN SetOffBombsInGridNo( SoldierID ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ) { UINT32 uiWorldBombIndex; UINT32 uiTimeStamp; @@ -4916,7 +4916,7 @@ BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 if ( !fAllBombs && ubID != NOBODY && ItemIsATMine(pObj->usItem)) { // if this is not a vehicle, not a robot and not a tank, don't activate - if ( !(MercPtrs[ubID]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ubID] ) && !ARMED_VEHICLE( MercPtrs[ubID] ) && !ENEMYROBOT( MercPtrs[ubID] ) ) + if ( !(ubID->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( ubID ) && !ARMED_VEHICLE( ubID ) && !ENEMYROBOT( ubID ) ) continue; } @@ -4977,7 +4977,7 @@ BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 // SANDRO - merc records // only if we blew up somebody not in our team(no achievement for blowing our guys :)), only if owner exists and have profile - if ( (MercPtrs[ubID]->bTeam != gbPlayerNum) && ((*pObj)[0]->data.misc.ubBombOwner > 1) ) + if ( (ubID->bTeam != gbPlayerNum) && ((*pObj)[0]->data.misc.ubBombOwner > 1) ) { if ( MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->ubProfile != NO_PROFILE && MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->bTeam == gbPlayerNum ) gMercProfiles[ MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->ubProfile ].records.usExpDetonated++; diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index b668dd86..dd6b3747 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -100,8 +100,8 @@ extern EXPLOSIONTYPE gExplosionData[ NUM_EXPLOSION_SLOTS ]; extern UINT8 gubElementsOnExplosionQueue; extern BOOLEAN gfExplosionQueueActive; -void IgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); -void InternalIgniteExplosion( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); +void IgniteExplosion( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); +void InternalIgniteExplosion( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection = DIRECTION_IRRELEVANT, OBJECTTYPE * pObj =NULL ); void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ); @@ -110,8 +110,8 @@ void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ); void HandleExplosionWarningAnimations( ); void DecayBombTimers( void ); -void SetOffBombsByFrequency( UINT16 ubID, INT8 bFrequency ); -BOOLEAN SetOffBombsInGridNo( UINT16 ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ); +void SetOffBombsByFrequency( SoldierID ubID, INT8 bFrequency ); +BOOLEAN SetOffBombsInGridNo( SoldierID ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ); void ActivateSwitchInGridNo( UINT16 ubID, INT32 sGridNo ); void SetOffPanicBombs( UINT16 ubID, INT8 bPanicTrigger ); @@ -137,12 +137,12 @@ void RemoveActiveExplosionMarkers(); // OJW - 20091028 - Explosion damage sync BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent, BOOL fFromRemoteClient = FALSE ); -BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT16 ubOwner, BOOL fFromRemoteClient = FALSE ); +BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, SoldierID ubOwner, BOOL fFromRemoteClient = FALSE ); void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectNum, BOOL fFromRemoteClient = FALSE, BOOL fNewSmokeEffect = FALSE ); void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemoteClient = FALSE ); // Flugente: activate everything connected to a tripwire in the surrounding if sGridNo on level bLevel with regard to the tripwire netwrok and hierarchy determined by ubFlag -BOOLEAN ActivateSurroundingTripwire( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ); +BOOLEAN ActivateSurroundingTripwire( SoldierID ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ); // Flugente: A special function for tripwire gun traps. Search if pObj has a gun attached. If so, fire a shot from that gun in a specific direction. Afterwards place the gun on the ground void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT16 ubId, UINT8 ubDirection ); From 274be524e678e679d8ceb2144cac26015843148f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:25:12 +0200 Subject: [PATCH 102/571] More functions converted to SoldierID --- Tactical/Animation Data.cpp | 20 ++++++------ Tactical/Animation Data.h | 10 +++--- Tactical/Interface Panels.cpp | 2 +- Tactical/Interface.cpp | 10 ++---- Tactical/Interface.h | 8 ++--- Tactical/Overhead.cpp | 24 +++++++------- Tactical/Overhead.h | 2 +- Tactical/opplist.cpp | 2 +- TileEngine/Explosion Control.cpp | 48 ++++++++++++++-------------- TileEngine/Explosion Control.h | 38 ++++++++++------------ TileEngine/structure.cpp | 54 ++++++++++++++++---------------- TileEngine/structure.h | 4 +-- 12 files changed, 107 insertions(+), 115 deletions(-) diff --git a/Tactical/Animation Data.cpp b/Tactical/Animation Data.cpp index 0a582d63..b50989f6 100644 --- a/Tactical/Animation Data.cpp +++ b/Tactical/Animation Data.cpp @@ -913,7 +913,7 @@ BOOLEAN DeInitAnimationSystem( ) -STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState, BOOLEAN fUseAbsolute ) +STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( SoldierID usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState, BOOLEAN fUseAbsolute ) { INT8 bStructDataType; @@ -935,26 +935,26 @@ STRUCTURE_FILE_REF *InternalGetAnimationStructureRef( UINT16 usSoldierID, UINT16 if ( ( usAnimState == FALLFORWARD_FROMHIT_STAND || usAnimState == GENERIC_HIT_STAND || usAnimState == FALLFORWARD_FROMHIT_CROUCH || usAnimState == STANDING_BURST_HIT ) && !fUseAbsolute ) { - return( gAnimStructureDatabase[ MercPtrs[ usSoldierID ]->ubBodyType ][ S_STRUCT ].pStructureFileRef ); + return( gAnimStructureDatabase[ usSoldierID->ubBodyType ][ S_STRUCT ].pStructureFileRef ); } - return( gAnimStructureDatabase[ MercPtrs[ usSoldierID ]->ubBodyType ][ bStructDataType ].pStructureFileRef ); + return( gAnimStructureDatabase[ usSoldierID->ubBodyType ][ bStructDataType ].pStructureFileRef ); } -STRUCTURE_FILE_REF *GetAnimationStructureRef( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ) +STRUCTURE_FILE_REF *GetAnimationStructureRef( SoldierID usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ) { return( InternalGetAnimationStructureRef( usSoldierID, usSurfaceIndex, usAnimState, FALSE ) ); } -STRUCTURE_FILE_REF *GetDefaultStructureRef( UINT16 usSoldierID ) +STRUCTURE_FILE_REF *GetDefaultStructureRef( SoldierID usSoldierID ) { - return( gAnimStructureDatabase[ MercPtrs[ usSoldierID ]->ubBodyType ][ DEFAULT_STRUCT ].pStructureFileRef ); + return( gAnimStructureDatabase[ usSoldierID->ubBodyType ][ DEFAULT_STRUCT ].pStructureFileRef ); } -// Surface mamagement functions -BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ) +// Surface management functions +BOOLEAN LoadAnimationSurface( SoldierID usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ) { AuxObjectData *pAuxData; @@ -1075,7 +1075,7 @@ BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 } -BOOLEAN UnLoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex ) +BOOLEAN UnLoadAnimationSurface( SoldierID usSoldierID, UINT16 usSurfaceIndex ) { // Decrement usage flag, only if this soldier has it currently tagged if ( gbAnimUsageHistory[ usSurfaceIndex ][ usSoldierID ] > 0 ) @@ -1120,7 +1120,7 @@ BOOLEAN UnLoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex ) } -void ClearAnimationSurfacesUsageHistory( UINT16 usSoldierID ) +void ClearAnimationSurfacesUsageHistory( SoldierID usSoldierID ) { UINT32 cnt; diff --git a/Tactical/Animation Data.h b/Tactical/Animation Data.h index 9d6dc7e7..79349537 100644 --- a/Tactical/Animation Data.h +++ b/Tactical/Animation Data.h @@ -688,16 +688,16 @@ extern AnimationStructureType gAnimStructureDatabase[ TOTALBODYTYPES ][ NUM_STRU // Functions BOOLEAN InitAnimationSystem( ); BOOLEAN DeInitAnimationSystem( ); -BOOLEAN LoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); -BOOLEAN UnLoadAnimationSurface( UINT16 usSoldierID, UINT16 usSurfaceIndex ); -void ClearAnimationSurfacesUsageHistory( UINT16 usSoldierID ); +BOOLEAN LoadAnimationSurface( SoldierID usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); +BOOLEAN UnLoadAnimationSurface( SoldierID usSoldierID, UINT16 usSurfaceIndex ); +void ClearAnimationSurfacesUsageHistory( SoldierID usSoldierID ); void DeleteAnimationProfiles( ); BOOLEAN LoadAnimationProfiles( ); -STRUCTURE_FILE_REF *GetAnimationStructureRef( UINT16 usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); -STRUCTURE_FILE_REF *GetDefaultStructureRef( UINT16 usSoldierID ); +STRUCTURE_FILE_REF *GetAnimationStructureRef( SoldierID usSoldierID, UINT16 usSurfaceIndex, UINT16 usAnimState ); +STRUCTURE_FILE_REF *GetDefaultStructureRef( SoldierID usSoldierID ); // Profile data extern ANIM_PROF *gpAnimProfiles; diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index b0bd1677..e5663769 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -390,7 +390,7 @@ INT32 giSMZipperButton = -1; BOOLEAN gfSwitchPanel = FALSE; UINT8 gbNewPanel = SM_PANEL; -UINT16 gubNewPanelParam = 0; +SoldierID gubNewPanelParam = NOBODY; BOOLEAN gfUIStanceDifferent = FALSE; BOOLEAN gfAllDisabled = FALSE; diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 01dcc0a0..11f920fd 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -661,10 +661,7 @@ void ShutdownCurrentPanel( ) - - - -void SetCurrentTacticalPanelCurrentMerc( UINT16 ubID ) +void SetCurrentTacticalPanelCurrentMerc( SoldierID ubID ) { SOLDIERTYPE *pSoldier; @@ -674,7 +671,7 @@ void SetCurrentTacticalPanelCurrentMerc( UINT16 ubID ) if ( gsCurInterfacePanel == SM_PANEL ) { // If we are not of merc bodytype, or am an epc, and going into inv, goto another.... - pSoldier = MercPtrs[ ubID ]; + pSoldier = ubID; if ( !IS_MERC_BODY_TYPE( pSoldier ) || AM_AN_EPC( pSoldier ) ) { @@ -693,10 +690,9 @@ void SetCurrentTacticalPanelCurrentMerc( UINT16 ubID ) SetTEAMPanelCurrentMerc( gusSelectedSoldier ); break; } - - } + void CreateCurrentTacticalPanelButtons( ) { switch( gsCurInterfacePanel ) diff --git a/Tactical/Interface.h b/Tactical/Interface.h index 07aa6068..e596305f 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -372,9 +372,9 @@ enum extern BOOLEAN gfSwitchPanel; extern BOOLEAN gfUIStanceDifferent; -extern UINT8 gbNewPanel; -extern UINT16 gubNewPanelParam; -extern INT16 gsCurInterfacePanel; +extern UINT8 gbNewPanel; +extern SoldierID gubNewPanelParam; +extern INT16 gsCurInterfacePanel; extern UINT32 guiRENDERBUFFER; extern UINT32 guiCLOSE; @@ -465,7 +465,7 @@ BOOLEAN DrawCTHIndicator(); void CreateCurrentTacticalPanelButtons( ); void RemoveCurrentTacticalPanelButtons( ); -void SetCurrentTacticalPanelCurrentMerc( UINT16 ubID ); +void SetCurrentTacticalPanelCurrentMerc( SoldierID ubID ); void SetCurrentInterfacePanel( UINT8 ubNewPanel ); BOOLEAN IsMercPortraitVisible( UINT16 ubSoldierID ); diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 2a6bd403..6bd9f7c2 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -5082,7 +5082,7 @@ CHAR8 *GetSceneFilename( ) return( gzLevelFilenames[ gubCurrentScene ] ); } -extern BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal, INT16 sSoldierID ); +extern BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal, SoldierID sSoldierID ); // NB if making changes don't forget to update NewOKDestinationAndDirection BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel ) @@ -5482,7 +5482,7 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect UINT8 ubWallOrientation; BOOLEAN fCheckGivenGridNo = TRUE; UINT8 ubTestDirection; - EXITGRID ExitGrid; + EXITGRID ExitGrid; // Set default direction if (pubDirection) @@ -5551,7 +5551,7 @@ INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirect { if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { - SOLDIERTYPE *pTargetSoldier = MercPtrs[usSoldierIndex]; + SOLDIERTYPE *pTargetSoldier = usSoldierIndex; sGridNo = pTargetSoldier->sGridNo; if (CREATURE_OR_BLOODCAT(pTargetSoldier) || gAnimControl[pTargetSoldier->usAnimState].ubEndHeight == ANIM_PRONE) { @@ -5874,7 +5874,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub { if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { - SOLDIERTYPE *pTargetSoldier = MercPtrs[usSoldierIndex]; + SOLDIERTYPE *pTargetSoldier = usSoldierIndex; sGridNo = pTargetSoldier->sGridNo; if (CREATURE_OR_BLOODCAT(pTargetSoldier) || gAnimControl[pTargetSoldier->usAnimState].ubEndHeight == ANIM_PRONE) { @@ -7307,7 +7307,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // HEADROCK HAM B2.8: Now also reveals equipment dropped by militia, if requirement is met. if ( pTeamSoldier->bTeam == ENEMY_TEAM || (gGameExternalOptions.ubMilitiaDropEquipment == 2 && pTeamSoldier->bTeam == MILITIA_TEAM) || - (gGameExternalOptions.ubMilitiaDropEquipment == 1 && pTeamSoldier->bTeam == MILITIA_TEAM && Menptr[pTeamSoldier->ubAttackerID].bTeam != OUR_TEAM) ) + (gGameExternalOptions.ubMilitiaDropEquipment == 1 && pTeamSoldier->bTeam == MILITIA_TEAM && pTeamSoldier->ubAttackerID->bTeam != OUR_TEAM) ) { //add a flag to the item so when all enemies are killed, we can run through and reveal all the enemies items usItemFlags |= WORLD_ITEM_DROPPED_FROM_ENEMY; @@ -7328,7 +7328,7 @@ void RemoveCapturedEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // HEADROCK HAM B2.8: Militia will drop items only if allowed. if ( !(gGameExternalOptions.ubMilitiaDropEquipment == 0 && pTeamSoldier->bTeam == MILITIA_TEAM) && - !(gGameExternalOptions.ubMilitiaDropEquipment == 1 && pTeamSoldier->bTeam == MILITIA_TEAM && Menptr[pTeamSoldier->ubAttackerID].bTeam == OUR_TEAM) ) + !(gGameExternalOptions.ubMilitiaDropEquipment == 1 && pTeamSoldier->bTeam == MILITIA_TEAM && pTeamSoldier->ubAttackerID->bTeam == OUR_TEAM) ) { AddItemToPool( pTeamSoldier->sGridNo, pObj, bVisible, pTeamSoldier->pathing.bLevel, usItemFlags, -1 ); } @@ -7784,7 +7784,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_WON, gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); // Change music modes - if ( gfLastMercTalkedAboutKillingID == NOBODY || ( gfLastMercTalkedAboutKillingID != NOBODY && !( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) ) + if ( gfLastMercTalkedAboutKillingID == NOBODY || ( gfLastMercTalkedAboutKillingID != NOBODY && !( gfLastMercTalkedAboutKillingID->flags.uiStatusFlags & SOLDIER_MONSTER ) ) ) { #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalVictory[gbWorldSectorZ]; @@ -7798,7 +7798,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if (!is_networked) ShouldBeginAutoBandage( ); } - else if ( gfLastMercTalkedAboutKillingID != NOBODY && ( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) + else if ( gfLastMercTalkedAboutKillingID != NOBODY && ( gfLastMercTalkedAboutKillingID->flags.uiStatusFlags & SOLDIER_MONSTER ) ) { // OJW - 20081222 - dont auto-bandage if networked if (!is_networked) @@ -7820,11 +7820,11 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) { // OK, If we have just finished a battle with creatures........ play killed creature quote... // - if ( gfLastMercTalkedAboutKillingID != NOBODY && ( MercPtrs[ gfLastMercTalkedAboutKillingID ]->flags.uiStatusFlags & SOLDIER_MONSTER ) ) + if ( gfLastMercTalkedAboutKillingID != NOBODY && ( gfLastMercTalkedAboutKillingID->flags.uiStatusFlags & SOLDIER_MONSTER ) ) { } - else if ( gfLastMercTalkedAboutKillingID != NOBODY && ( MercPtrs[ gfLastMercTalkedAboutKillingID ]->ubBodyType == BLOODCAT ) ) + else if ( gfLastMercTalkedAboutKillingID != NOBODY && ( gfLastMercTalkedAboutKillingID->ubBodyType == BLOODCAT ) ) { SayBattleSoundFromAnyBodyInSector( BATTLE_SOUND_COOL1 ); } @@ -11529,9 +11529,9 @@ void TeamRestock(UINT8 bTeam) } // are we allowed to steal access this guy's inventory? -BOOLEAN AllowedToStealFromTeamMate( UINT16 ubID, UINT16 ubTargetID ) +BOOLEAN AllowedToStealFromTeamMate( SoldierID ubID, SoldierID ubTargetID ) { - if ( gGameExternalOptions.fAccessOtherMercInventories && ubID != ubTargetID && MercPtrs[ubID]->bTeam == MercPtrs[ubTargetID]->bTeam && !AM_AN_EPC(MercPtrs[ubTargetID]) && !IsVehicle(MercPtrs[ubTargetID]) ) + if ( gGameExternalOptions.fAccessOtherMercInventories && ubID != ubTargetID && ubID->bTeam == ubTargetID->bTeam && !AM_AN_EPC(ubTargetID) && !IsVehicle(ubTargetID) ) return TRUE; return FALSE; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index ff6543e4..d001ad45 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -369,7 +369,7 @@ void TeamDropAll(UINT8 bTeam, BOOLEAN fForce = FALSE); void TeamRestock(UINT8 bTeam); // are we allowed to steal access this guy's inventory? -BOOLEAN AllowedToStealFromTeamMate( UINT16 ubID, UINT16 ubTargetID ); +BOOLEAN AllowedToStealFromTeamMate( SoldierID ubID, SoldierID ubTargetID ); // Flugente: is an soldier profile already used? BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr); diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 63be9d2e..b13ed1b2 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -7672,7 +7672,7 @@ void CommunicateWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoi void IncrementWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel ) { - INT8 bPoint; + INT8 bPoint; bPoint = FindWatchedLoc( ubID, sGridNo, bLevel ); if (bPoint == -1) diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 7e1e1f4f..a5a1ff84 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -69,7 +69,7 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOLEAN fInBuilding); // HEADROCK HAM 5.1: Explosion Fragments launcher -void FireFragments( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection = DIRECTION_IRRELEVANT ); +void FireFragments( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection = DIRECTION_IRRELEVANT ); // Flugente: shoot a gun without anyone operating it (used for makeshift traps wih guns) void FireFragmentsTrapGun( SOLDIERTYPE* pThrower, INT32 gridno, INT16 sZ, OBJECTTYPE* pObj, UINT8 ubDirection = NORTH ); @@ -394,16 +394,16 @@ void IgniteExplosion( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGr void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ) { EXPLOSIONTYPE *pExplosion; - UINT32 uiFlags; - UINT8 ubOwner; - UINT8 ubTypeID; - INT16 sX; - INT16 sY; - INT16 sZ; - INT32 sGridNo; - UINT16 usItem; - INT32 iIndex; - INT8 bLevel; + UINT32 uiFlags; + SoldierID ubOwner; + UINT8 ubTypeID; + INT16 sX; + INT16 sY; + INT16 sZ; + INT32 sGridNo; + UINT16 usItem; + INT32 iIndex; + INT8 bLevel; // Assign param values uiFlags = pExpParams->uiFlags; @@ -449,17 +449,17 @@ void GenerateExplosion( EXPLOSION_PARAMS *pExpParams ) void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ) { - UINT32 uiFlags; - UINT8 ubOwner; - UINT8 ubTypeID; - INT16 sX; - INT16 sY; - INT16 sZ; - INT32 sGridNo; - UINT16 usItem; - UINT8 ubTerrainType; - INT8 bLevel; - INT32 sSoundID; + UINT32 uiFlags; + SoldierID ubOwner; + UINT8 ubTypeID; + INT16 sX; + INT16 sY; + INT16 sZ; + INT32 sGridNo; + UINT16 usItem; + UINT8 ubTerrainType; + INT8 bLevel; + INT32 sSoundID; ANITILE_PARAMS AniParams; @@ -5004,7 +5004,7 @@ BOOLEAN SetOffBombsInGridNo( SoldierID ubID, INT32 sGridNo, BOOLEAN fAllBombs, I return( fFoundMine ); } -void ActivateSwitchInGridNo( UINT16 ubID, INT32 sGridNo ) +void ActivateSwitchInGridNo( SoldierID ubID, INT32 sGridNo ) { UINT32 uiWorldBombIndex; OBJECTTYPE * pObj; @@ -5430,7 +5430,7 @@ UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOL // HEADROCK HAM 5.1: This handles launching fragments out of an explosion. The number of fragments is read from // the Explosives.XML file, and they each have a set amount of damage and range as well. They are currently // fired at completely random trajectories. -void FireFragments( UINT16 ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection ) +void FireFragments( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, UINT16 usItem, UINT8 ubDirection ) { // WANNE: Disable Fragments in a multiplayer game, because this can lead to crashes when stepping on mines, ... if (is_networked) diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index dd6b3747..029f55f8 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -13,20 +13,17 @@ // Explosion Data typedef struct { - UINT32 uiFlags; - - UINT16 ubOwner; - INT8 ubTypeID; - - UINT16 usItem; - - INT16 sX; // World X ( optional ) - INT16 sY; // World Y ( optional ) - INT16 sZ; // World Z ( optional ) - INT32 sGridNo; // World GridNo - BOOLEAN fLocate; - INT8 bLevel; // World level - UINT8 ubUnsed[1]; + UINT32 uiFlags; + SoldierID ubOwner; + INT8 ubTypeID; + UINT16 usItem; + INT16 sX; // World X ( optional ) + INT16 sY; // World Y ( optional ) + INT16 sZ; // World Z ( optional ) + INT32 sGridNo; // World GridNo + BOOLEAN fLocate; + INT8 bLevel; // World level + UINT8 ubUnsed[1]; } EXPLOSION_PARAMS; @@ -34,12 +31,11 @@ typedef struct typedef struct { EXPLOSION_PARAMS Params; - BOOLEAN fAllocated; - INT16 sCurrentFrame; - INT32 iID; - INT32 iLightID; - UINT8 ubUnsed[2]; - + BOOLEAN fAllocated; + INT16 sCurrentFrame; + INT32 iID; + INT32 iLightID; + UINT8 ubUnsed[2]; } EXPLOSIONTYPE; @@ -112,7 +108,7 @@ void HandleExplosionWarningAnimations( ); void DecayBombTimers( void ); void SetOffBombsByFrequency( SoldierID ubID, INT8 bFrequency ); BOOLEAN SetOffBombsInGridNo( SoldierID ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ); -void ActivateSwitchInGridNo( UINT16 ubID, INT32 sGridNo ); +void ActivateSwitchInGridNo( SoldierID ubID, INT32 sGridNo ); void SetOffPanicBombs( UINT16 ubID, INT8 bPanicTrigger ); void UpdateExplosionFrame( INT32 iIndex, INT16 sCurrentFrame ); diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 150fdb01..bbbfde88 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -632,7 +632,7 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT extern UINT16 gusTempDragBuildSoldierID; -BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileIndex, INT16 sExclusionID, BOOLEAN fAddingForReal = FALSE, INT16 sSoldierID = NOBODY ) +BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileIndex, INT16 sExclusionID, BOOLEAN fAddingForReal = FALSE, SoldierID sSoldierID = NOBODY ) { // Verifies whether a structure is blocked from being added to the map at a particular point DB_STRUCTURE * pDBStructure; @@ -646,15 +646,15 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC BOOLEAN fIgnorePeople = (BOOLEAN)(sExclusionID == IGNORE_PEOPLE_STRUCTURE_ID); BOOLEAN fVehicleIgnoreObstacles = (BOOLEAN)(sExclusionID == VEHICLE_IGNORE_OBSTACLES_STRUCTURE_ID); - if( gGameExternalOptions.ubCarsRammingMaxStructureArmour && sSoldierID != NOBODY && MercPtrs[ sSoldierID ]->usSoldierFlagMask2 & SOLDIER_RAM_THROUGH_OBSTACLES ) + if( gGameExternalOptions.ubCarsRammingMaxStructureArmour && sSoldierID != NOBODY && sSoldierID->usSoldierFlagMask2 & SOLDIER_RAM_THROUGH_OBSTACLES ) { fVehicleIgnoreObstacles = TRUE; } - else if ( gGameExternalOptions.ubEnemyJeepsRammingMaxStructureArmour && sSoldierID != NOBODY && COMBAT_JEEP( MercPtrs[sSoldierID] ) ) + else if ( gGameExternalOptions.ubEnemyJeepsRammingMaxStructureArmour && sSoldierID != NOBODY && COMBAT_JEEP( sSoldierID ) ) { fVehicleIgnoreObstacles = TRUE; } - else if ( gGameExternalOptions.ubTanksRammingMaxStructureArmour && sSoldierID != NOBODY && TANK( MercPtrs[sSoldierID] ) ) + else if ( gGameExternalOptions.ubTanksRammingMaxStructureArmour && sSoldierID != NOBODY && TANK( sSoldierID ) ) { fVehicleIgnoreObstacles = TRUE; } @@ -736,25 +736,25 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC // but not monsters and such (they can't fall down due to lack of animations) // also make sure AI won't flatten their allies if( !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT | SOLDIER_MONSTER ) ) && - ((!ARMED_VEHICLE( MercPtrs[sSoldierID] ) && gGameExternalOptions.fAllowCarsDrivingOverPeople) || - (ARMED_VEHICLE( MercPtrs[sSoldierID] ) && gGameExternalOptions.fAllowTanksDrivingOverPeople)) && - ( MercPtrs[ sSoldierID ]->bTeam == gbPlayerNum || MercPtrs[ sSoldierID ]->bTeam != pSoldier->bTeam ) ) + ((!ARMED_VEHICLE( sSoldierID ) && gGameExternalOptions.fAllowCarsDrivingOverPeople) || + (ARMED_VEHICLE( sSoldierID ) && gGameExternalOptions.fAllowTanksDrivingOverPeople)) && + ( sSoldierID->bTeam == gbPlayerNum || sSoldierID->bTeam != pSoldier->bTeam ) ) { pExistingStructure = pExistingStructure->pNext; // damage people when driving on them if( fAddingForReal ) { - if ( TANK( MercPtrs[sSoldierID] ) ) + if ( TANK( sSoldierID ) ) { - pSoldier->EVENT_SoldierGotHit( 0, Random(10)+5, Random(200)+Random(200), MercPtrs[ sSoldierID ]->ubDirection, 0, sSoldierID, FIRE_WEAPON_VEHICLE_TRAUMA, 0, 0, pSoldier->sGridNo ); + pSoldier->EVENT_SoldierGotHit( 0, Random(10)+5, Random(200)+Random(200), sSoldierID->ubDirection, 0, sSoldierID, FIRE_WEAPON_VEHICLE_TRAUMA, 0, 0, pSoldier->sGridNo ); } - else if( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE && MercPtrs[ sSoldierID ]->IsFastMovement() ) + else if( gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE && sSoldierID->IsFastMovement() ) { - pSoldier->EVENT_SoldierGotHit( 0, Random(5), Random(100)+Random(100), MercPtrs[ sSoldierID ]->ubDirection, 0, sSoldierID, FIRE_WEAPON_VEHICLE_TRAUMA, 0, 0, pSoldier->sGridNo ); + pSoldier->EVENT_SoldierGotHit( 0, Random(5), Random(100)+Random(100), sSoldierID->ubDirection, 0, sSoldierID, FIRE_WEAPON_VEHICLE_TRAUMA, 0, 0, pSoldier->sGridNo ); } else { - pSoldier->EVENT_SoldierGotHit( 0, Random(10)+5, Random(200)+Random(200), MercPtrs[ sSoldierID ]->ubDirection, 0, sSoldierID, FIRE_WEAPON_VEHICLE_TRAUMA, 0, 0, pSoldier->sGridNo ); + pSoldier->EVENT_SoldierGotHit( 0, Random(10)+5, Random(200)+Random(200), sSoldierID->ubDirection, 0, sSoldierID, FIRE_WEAPON_VEHICLE_TRAUMA, 0, 0, pSoldier->sGridNo ); } } continue; @@ -770,9 +770,9 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC else { // only if structure is weak enough - if ( (!ARMED_VEHICLE( MercPtrs[sSoldierID] ) && gubMaterialArmour[pExistingStructure->pDBStructureRef->pDBStructure->ubArmour] < gGameExternalOptions.ubCarsRammingMaxStructureArmour) || - (COMBAT_JEEP( MercPtrs[sSoldierID] ) && gubMaterialArmour[pExistingStructure->pDBStructureRef->pDBStructure->ubArmour] < gGameExternalOptions.ubEnemyJeepsRammingMaxStructureArmour) || - (TANK( MercPtrs[sSoldierID] ) && gubMaterialArmour[pExistingStructure->pDBStructureRef->pDBStructure->ubArmour] < gGameExternalOptions.ubTanksRammingMaxStructureArmour) ) + if ( (!ARMED_VEHICLE( sSoldierID ) && gubMaterialArmour[pExistingStructure->pDBStructureRef->pDBStructure->ubArmour] < gGameExternalOptions.ubCarsRammingMaxStructureArmour) || + (COMBAT_JEEP( sSoldierID ) && gubMaterialArmour[pExistingStructure->pDBStructureRef->pDBStructure->ubArmour] < gGameExternalOptions.ubEnemyJeepsRammingMaxStructureArmour) || + (TANK( sSoldierID ) && gubMaterialArmour[pExistingStructure->pDBStructureRef->pDBStructure->ubArmour] < gGameExternalOptions.ubTanksRammingMaxStructureArmour) ) { // when not just plotting path, really destroy structure if( fAddingForReal ) @@ -911,7 +911,7 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC { if( MercPtrs[ pExistingStructure->usStructureID ] != NULL && MercPtrs[ pExistingStructure->usStructureID ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) { - if( MercPtrs[ sSoldierID ]->flags.fInNonintAnim == TRUE || gAnimControl[ MercPtrs[ sSoldierID ]->usAnimState ].ubEndHeight == ANIM_PRONE ) + if( sSoldierID->flags.fInNonintAnim == TRUE || gAnimControl[ sSoldierID->usAnimState ].ubEndHeight == ANIM_PRONE ) { pExistingStructure = pExistingStructure->pNext; continue; @@ -958,7 +958,7 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC return( TRUE ); } -BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal, INT16 sSoldierID ) +BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal, SoldierID sSoldierID ) { UINT8 ubLoop; INT16 sCubeOffset; @@ -1001,7 +1001,7 @@ BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_ST return( TRUE ); } -BOOLEAN OkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal, INT16 sSoldierID ) +BOOLEAN OkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal, SoldierID sSoldierID ) { return( InternalOkayToAddStructureToWorld( sBaseGridNo, bLevel, pDBStructureRef, sExclusionID, fAddingForReal, sSoldierID ) ); } @@ -1036,15 +1036,15 @@ BOOLEAN AddStructureToTile( MAP_ELEMENT * pMapElement, STRUCTURE * pStructure, U STRUCTURE * InternalAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, LEVELNODE * pLevelNode ) { // Adds a complete structure to the world at a location plus all other locations covered by the structure - INT32 sGridNo; - STRUCTURE ** ppStructure; - STRUCTURE * pBaseStructure; - DB_STRUCTURE * pDBStructure; - DB_STRUCTURE_TILE ** ppTile; - UINT8 ubLoop; - UINT8 ubLoop2; - INT16 sBaseTileHeight=-1; - UINT16 usStructureID; + INT32 sGridNo; + STRUCTURE **ppStructure; + STRUCTURE *pBaseStructure; + DB_STRUCTURE *pDBStructure; + DB_STRUCTURE_TILE **ppTile; + UINT8 ubLoop; + UINT8 ubLoop2; + INT16 sBaseTileHeight=-1; + UINT16 usStructureID; CHECKF( pDBStructureRef ); CHECKF( pLevelNode ); diff --git a/TileEngine/structure.h b/TileEngine/structure.h index 2870deac..12dd50b1 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -37,7 +37,7 @@ BOOLEAN FreeStructureFile( STRUCTURE_FILE_REF * pStructureFile ); // // functions at the structure instance level // -BOOLEAN OkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal = FALSE, INT16 sSoldierID = NOBODY ); +BOOLEAN OkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, INT16 sExclusionID, BOOLEAN fAddingForReal = FALSE, SoldierID sSoldierID = NOBODY ); // for the PTR argument of AddStructureToWorld, pass in a LEVELNODE * please! BOOLEAN AddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel, DB_STRUCTURE_REF * pDBStructureRef, PTR pLevelN ); @@ -136,4 +136,4 @@ UINT8 StructureFlagToType( UINT32 uiFlag ); UINT32 GetStructureOpenSound( STRUCTURE *pStructure, BOOLEAN fClose ); -#endif \ No newline at end of file +#endif From 2e147d4bd767c8a4eeddeb3b0e3f218f7d523c67 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:35:26 +0200 Subject: [PATCH 103/571] Convert to SoldierID --- Tactical/Overhead.cpp | 14 +++++++------- Tactical/Soldier Control.cpp | 4 ++-- Tactical/Soldier Control.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 6bd9f7c2..db65278d 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -8799,7 +8799,7 @@ INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier ) extern void IncrementWatchedLoc(UINT16 ubID, INT32 sGridNo, INT8 bLevel); -void HandleSuppressionFire( UINT16 ubTargetedMerc, UINT16 ubCausedAttacker ) +void HandleSuppressionFire( SoldierID ubTargetedMerc, SoldierID ubCausedAttacker ) { /////////////////////////////////////////////////////////////////////////////// // @@ -8831,7 +8831,7 @@ void HandleSuppressionFire( UINT16 ubTargetedMerc, UINT16 ubCausedAttacker ) //////////////////////////////////////////////////////////////////////////////////////////////////// // SANDRO - modify suppression effectiveness based on weapon caliber (i.e. damage) INT16 sFinalSuppressionEffectiveness = gGameExternalOptions.sSuppressionEffectiveness; - pAttacker = MercPtrs[ubCausedAttacker]; + pAttacker = ubCausedAttacker; if (pAttacker && pAttacker->inv[pAttacker->ubAttackingHand].exists() && Item[pAttacker->inv[pAttacker->ubAttackingHand].usItem].usItemClass == IC_GUN) { OBJECTTYPE *pWeapon = &pAttacker->inv[pAttacker->ubAttackingHand]; @@ -9577,11 +9577,11 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) // Strange as this may seem, this function returns a pointer to // the *target* in case the target has changed sides as a result // of being attacked - SOLDIERTYPE * pSoldier; - SOLDIERTYPE * pTarget; - BOOLEAN fEnterCombat = FALSE; - UINT32 cnt; - UINT16 ubID; + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pTarget; + BOOLEAN fEnterCombat = FALSE; + UINT32 cnt; + SoldierID ubID; // if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT)) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index f7b40549..44ccf827 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -21415,12 +21415,12 @@ BOOLEAN SOLDIERTYPE::InPositionForTurncoatAttempt( UINT16 usID ) return FALSE; } -UINT8 SOLDIERTYPE::GetTurncoatConvinctionChance( UINT16 usID, INT16 sApproach ) +UINT8 SOLDIERTYPE::GetTurncoatConvinctionChance( SoldierID usID, INT16 sApproach ) { if ( usID >= NOBODY ) return 0; - SOLDIERTYPE* pSoldier = MercPtrs[usID]; + SOLDIERTYPE* pSoldier = usID; if ( !pSoldier || pSoldier->bTeam != ENEMY_TEAM ) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index d4a5ccd6..3ccedd4e 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -2087,7 +2087,7 @@ public: // Flugente: turncoats BOOLEAN InPositionForTurncoatAttempt( UINT16 usID ); - UINT8 GetTurncoatConvinctionChance( UINT16 usID, INT16 usApproach ); + UINT8 GetTurncoatConvinctionChance( SoldierID usID, INT16 usApproach ); void AttemptToCreateTurncoat( UINT16 usID ); BOOLEAN OrderTurnCoatToSwitchSides( UINT16 usID ); void OrderAllTurnCoatToSwitchSides(); From f39078357be22f40fcb95bb9971c3515be5f5753 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:39:13 +0200 Subject: [PATCH 104/571] Remove unused function parameters --- Tactical/Soldier Control.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 44ccf827..e8b93737 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1734,7 +1734,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); -void SoldierGotHitVehicle( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); +void SoldierGotHitVehicle( SOLDIERTYPE* pSoldier, UINT16 bDirection ); UINT8 CalcScreamVolume( SOLDIERTYPE * pSoldier, UINT8 ubCombinedLoss ); void PlaySoldierFootstepSound( SOLDIERTYPE *pSoldier ); void HandleSystemNewAISituation( SOLDIERTYPE *pSoldier, BOOLEAN fResetABC ); @@ -6144,7 +6144,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // anv: soldier got rammed by vehicle if ( ubSpecial == FIRE_WEAPON_VEHICLE_TRAUMA ) { - SoldierGotHitVehicle( this, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); + SoldierGotHitVehicle( this, bDirection ); return; } @@ -6895,7 +6895,7 @@ void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDam } -void SoldierGotHitVehicle( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) +void SoldierGotHitVehicle(SOLDIERTYPE *pSoldier, UINT16 bDirection) { INT32 sNewGridNo = 0; // IF HERE AND GUY IS DEAD, RETURN! From 2e92da4e127d4108f435a5831fecb02ff95b75fd Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:43:39 +0200 Subject: [PATCH 105/571] Convert to SoldierID --- Tactical/Animation Cache.cpp | 4 ++-- Tactical/Animation Cache.h | 4 ++-- Tactical/Soldier Control.cpp | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Tactical/Animation Cache.cpp b/Tactical/Animation Cache.cpp index 3b320c60..ad1977f6 100644 --- a/Tactical/Animation Cache.cpp +++ b/Tactical/Animation Cache.cpp @@ -47,7 +47,7 @@ BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pA return( TRUE ); } -void DeleteAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ) +void DeleteAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ) { // Allocate entries if ( pAnimCache->usCachedSurfaces!= NULL ) @@ -146,7 +146,7 @@ BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType -void UnLoadCachedAnimationSurfaces( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ) +void UnLoadCachedAnimationSurfaces( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ) { UINT8 cnt; diff --git a/Tactical/Animation Cache.h b/Tactical/Animation Cache.h index a64063c9..cbba71c8 100644 --- a/Tactical/Animation Cache.h +++ b/Tactical/Animation Cache.h @@ -20,9 +20,9 @@ extern UINT32 guiCacheSize; BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation ); BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ); -void DeleteAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ); +void DeleteAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ); void DetermineOptimumAnimationCacheSize( ); -void UnLoadCachedAnimationSurfaces( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ); +void UnLoadCachedAnimationSurfaces( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index e8b93737..dde70588 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2820,9 +2820,10 @@ BOOLEAN SOLDIERTYPE::ChangeSoldierState( UINT16 usNewState, UINT16 usStartingAni // This function reevaluates the stance if the guy sees us! BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) { - INT32 cnt, iClosestEnemy = NOBODY; + INT32 cnt; + SoldierID iClosestEnemy = NOBODY; INT16 sTargetXPos, sTargetYPos; - BOOLEAN fReturnVal = FALSE; + BOOLEAN fReturnVal = FALSE; INT16 sDist, sClosestDist = 10000; // make the chosen one not turn to face us @@ -2875,21 +2876,21 @@ BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) if ( gGameExternalOptions.fNoEnemyAutoReadyWeapon == 0 ) { // Change to fire ready animation - ConvertGridNoToXY( MercPtrs[iClosestEnemy]->sGridNo, &sTargetXPos, &sTargetYPos ); + ConvertGridNoToXY( iClosestEnemy->sGridNo, &sTargetXPos, &sTargetYPos ); pSoldier->flags.fDontChargeReadyAPs = TRUE; // Ready weapon - fReturnVal = pSoldier->SoldierReadyWeapon( sTargetXPos, sTargetYPos, FALSE, AIDecideHipOrShoulderStance( pSoldier, MercPtrs[iClosestEnemy]->sGridNo ) ); + fReturnVal = pSoldier->SoldierReadyWeapon( sTargetXPos, sTargetYPos, FALSE, AIDecideHipOrShoulderStance( pSoldier, iClosestEnemy->sGridNo ) ); return(fReturnVal); } // this makes the soldier to only turn towards our direction, instead of raising his weapon else if ( gGameExternalOptions.fNoEnemyAutoReadyWeapon == 2 ) { - //ConvertGridNoToXY( MercPtrs[ iClosestEnemy ]->sGridNo, &sTargetXPos, &sTargetYPos ); + //ConvertGridNoToXY( iClosestEnemy->sGridNo, &sTargetXPos, &sTargetYPos ); //sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier ); - INT16 sFacingDir = GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, MercPtrs[iClosestEnemy]->sGridNo ); + INT16 sFacingDir = GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, iClosestEnemy->sGridNo ); if ( sFacingDir != pSoldier->ubDirection ) { From 9d62b9a37a054918a9462ceb16065191c12637b6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:46:57 +0200 Subject: [PATCH 106/571] Remove unused function parameters --- Tactical/Soldier Control.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index dde70588..84addbd3 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1731,7 +1731,7 @@ UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ); void SelectFallAnimation( SOLDIERTYPE *pSoldier ); BOOLEAN FullStructAlone( INT32 sGridNo, UINT8 ubRadius ); void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); -void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); +void SoldierGotHitBlade( SOLDIERTYPE* pSoldier, UINT8 ubHitLocation ); void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitVehicle( SOLDIERTYPE* pSoldier, UINT16 bDirection ); @@ -6386,7 +6386,7 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 } if ( Item[usWeaponIndex].usItemClass & IC_BLADE ) { - SoldierGotHitBlade( this, usWeaponIndex, sDamage, bDirection, sRange, ubAttackerID, ubSpecial, ubHitLocation ); + SoldierGotHitBlade( this, ubHitLocation ); // anv: taunts are called from UseBlade() } // marke setting ammo explosions included here with 3rd 'or' including ubReason @@ -6813,11 +6813,10 @@ void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 SoldierCollapse( pSoldier ); break; } - } -void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) +void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT8 ubHitLocation ) { // Flugente: if hit in legs or torso, blood will be on our uniform - parts of the clothes cannot be worn anymore if ( ubHitLocation == AIM_SHOT_TORSO ) @@ -6856,7 +6855,6 @@ void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDam pSoldier->EVENT_InitNewSoldierAnim( GENERIC_HIT_PRONE, 0, FALSE ); break; } - } From 9acf9949524afd9b82f2dc3a21fb1b2e71e81c72 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:50:01 +0200 Subject: [PATCH 107/571] Convert gusTempDragBuildSoldierID to SoldierID --- Tactical/Handle Items.cpp | 2 +- TileEngine/structure.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 2a1a1ba5..56311613 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -7798,7 +7798,7 @@ BOOLEAN BuildStructFromName( INT32 sGridNo, INT8 sLevel, const char* aStr, UINT8 return FALSE; } -UINT16 gusTempDragBuildSoldierID = NOBODY; +SoldierID gusTempDragBuildSoldierID = NOBODY; BOOLEAN BuildStructDrag( INT32 sGridNo, INT8 sLevel, UINT32 uiTileType, UINT8 usIndex, UINT16 usSoldierID ) { diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index bbbfde88..8a2db1fb 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -630,7 +630,7 @@ STRUCTURE * CreateStructureFromDB( DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubT return( pStructure ); } -extern UINT16 gusTempDragBuildSoldierID; +extern SoldierID gusTempDragBuildSoldierID; BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUCTURE_REF * pDBStructureRef, UINT8 ubTileIndex, INT16 sExclusionID, BOOLEAN fAddingForReal = FALSE, SoldierID sSoldierID = NOBODY ) { @@ -942,7 +942,7 @@ BOOLEAN OkayToAddStructureToTile( INT32 sBaseGridNo, INT16 sCubeOffset, DB_STRUC { // Flugente: we allow this if this structure is being dragged by a soldier, otherwise we can't move containers our of rooms (and are likely to unintenionally bar rooms) if (pExistingStructure->fFlags & STRUCTURE_OPENABLE - && !( gusTempDragBuildSoldierID != NOBODY && MercPtrs[gusTempDragBuildSoldierID]->sDragGridNo ) ) + && !( gusTempDragBuildSoldierID != NOBODY && gusTempDragBuildSoldierID->sDragGridNo ) ) { // don't allow two openable structures in the same tile or things will screw // up on an interface level From e9a13e12d8d6c8524e271b90bdf987587f93bbac Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 17:11:03 +0200 Subject: [PATCH 108/571] Convert to SoldierID --- Multiplayer/client.cpp | 2 +- Tactical/Handle Items.cpp | 2 +- Tactical/Handle Items.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index e4d40437..4d967455 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -3793,7 +3793,7 @@ void recieveSTATE(RPCParameters *rpcParameters) { EV_S_CHANGESTATE* new_state = (EV_S_CHANGESTATE*)rpcParameters->input; - SOLDIERTYPE * pSoldier=MercPtrs[ new_state->usSoldierID ]; + SOLDIERTYPE * pSoldier = new_state->usSoldierID; if(pSoldier->bActive) { diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 56311613..de09582e 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -7800,7 +7800,7 @@ BOOLEAN BuildStructFromName( INT32 sGridNo, INT8 sLevel, const char* aStr, UINT8 SoldierID gusTempDragBuildSoldierID = NOBODY; -BOOLEAN BuildStructDrag( INT32 sGridNo, INT8 sLevel, UINT32 uiTileType, UINT8 usIndex, UINT16 usSoldierID ) +BOOLEAN BuildStructDrag( INT32 sGridNo, INT8 sLevel, UINT32 uiTileType, UINT8 usIndex, SoldierID usSoldierID ) { // needs to be a valid location if ( TileIsOutOfBounds( sGridNo ) ) diff --git a/Tactical/Handle Items.h b/Tactical/Handle Items.h index 2f523798..596b889a 100644 --- a/Tactical/Handle Items.h +++ b/Tactical/Handle Items.h @@ -297,7 +297,7 @@ BOOLEAN IsDragStructurePresent( INT32 sGridNo, INT8 sLevel, UINT32& arusTileType void GetDragStructureXmlEntry( UINT32 ausTileType, UINT16 ausStructureNumber, int& arXmlVectorEntry ); BOOLEAN RemoveStructDrag( INT32 sGridNo, INT8 sLevel, UINT32 uiTileType ); void CorrectDragStructData( INT32 sGridNo, INT8 sLevel, UINT8 ausHitpoints, UINT8 ausDecalFlags ); -BOOLEAN BuildStructDrag( INT32 sGridNo, INT8 sLevel, UINT32 uiTileType, UINT8 usIndex, UINT16 usSoldierID ); +BOOLEAN BuildStructDrag( INT32 sGridNo, INT8 sLevel, UINT32 uiTileType, UINT8 usIndex, SoldierID usSoldierID ); void UpdateFortificationPossibleAmount(); void HandleFortificationUpdate(); From 06936b71c9c09fe28cef7b1f5d090809c321d2b3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 17:22:30 +0200 Subject: [PATCH 109/571] Convert to SoldierID Rearranged struct to optimize memory layout --- Utils/Event Pump.h | 180 ++++++++++++++++++++++----------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/Utils/Event Pump.h b/Utils/Event Pump.h index 232eb49b..bce66e43 100644 --- a/Utils/Event Pump.h +++ b/Utils/Event Pump.h @@ -59,170 +59,171 @@ typedef struct typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - UINT16 usNewState; + UINT32 usTargetGridNo; // WANNE - MP: Used for manipulating the target grid no + UINT32 uiUniqueId; + SoldierID usSoldierID; + UINT16 usNewState; INT16 sXPos; INT16 sYPos; - UINT16 usStartingAniCode; - BOOLEAN fForce; - UINT8 usNewDirection;//hayden - UINT32 usTargetGridNo; // WANNE - MP: Used for manipulating the target grid no + UINT16 usStartingAniCode; + BOOLEAN fForce; + UINT8 usNewDirection;//hayden } EV_S_CHANGESTATE; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - INT32 usNewDestination; + SoldierID usSoldierID; + UINT32 uiUniqueId; + INT32 usNewDestination; } EV_S_CHANGEDEST; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - FLOAT dNewXPos; - FLOAT dNewYPos; + SoldierID usSoldierID; + UINT32 uiUniqueId; + FLOAT dNewXPos; + FLOAT dNewYPos; } EV_S_SETPOSITION; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - INT32 sDestGridNo; + UINT32 uiUniqueId; + INT32 sDestGridNo; + SoldierID usSoldierID; UINT16 usMovementAnim; } EV_S_GETNEWPATH; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; + UINT32 uiUniqueId; + SoldierID usSoldierID; + } EV_S_BEGINTURN; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - UINT8 ubNewStance; + UINT32 uiUniqueId; + SoldierID usSoldierID; INT16 sXPos; INT16 sYPos; + UINT8 ubNewStance; } EV_S_CHANGESTANCE; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - UINT16 usNewDirection; + UINT32 uiUniqueId; + SoldierID usSoldierID; + UINT16 usNewDirection; } EV_S_SETDIRECTION; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - UINT16 usDesiredDirection; + UINT32 uiUniqueId; + SoldierID usSoldierID; + UINT16 usDesiredDirection; } EV_S_SETDESIREDDIRECTION; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - INT32 sTargetGridNo; - INT8 bTargetLevel; - INT8 bTargetCubeLevel; + UINT32 uiUniqueId; + INT32 sTargetGridNo; + SoldierID usSoldierID; + INT8 bTargetLevel; + INT8 bTargetCubeLevel; } EV_S_BEGINFIREWEAPON; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - INT32 sTargetGridNo; - INT8 bTargetLevel; - INT8 bTargetCubeLevel; + UINT32 uiUniqueId; + INT32 sTargetGridNo; + SoldierID usSoldierID; + INT8 bTargetLevel; + INT8 bTargetCubeLevel; } EV_S_FIREWEAPON; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - UINT16 usWeaponIndex; + UINT32 uiUniqueId; + INT32 iBullet; + SoldierID usSoldierID; + SoldierID ubAttackerID; + UINT16 usWeaponIndex; INT16 sDamage; INT16 sBreathLoss; - UINT16 usDirection; + UINT16 usDirection; INT16 sXPos; INT16 sYPos; INT16 sZPos; INT16 sRange; - UINT16 ubAttackerID; - BOOLEAN fHit; + BOOLEAN fHit; UINT8 ubSpecial; UINT8 ubLocation; - INT32 iBullet; - BOOLEAN fStopped; + BOOLEAN fStopped; } EV_S_WEAPONHIT; typedef struct { + INT32 iImpact; + INT32 iBullet; INT16 sXPos; INT16 sYPos; INT16 sZPos; - UINT16 usWeaponIndex; + UINT16 usWeaponIndex; INT16 bWeaponStatus; - UINT16 ubAttackerID; - UINT16 usStructureID; - INT32 iImpact; - INT32 iBullet; - BOOLEAN fStopped;//hayden + SoldierID ubAttackerID; + UINT16 usStructureID; + BOOLEAN fStopped;//hayden } EV_S_STRUCTUREHIT; typedef struct { - INT32 sGridNo; - UINT16 usStructureID; - BOOLEAN fBlowWindowSouth; - BOOLEAN fLargeForce; - UINT16 ubAttackerID; - INT32 iBullet; + INT32 sGridNo; + INT32 iBullet; + UINT16 usStructureID; + BOOLEAN fBlowWindowSouth; + BOOLEAN fLargeForce; + SoldierID ubAttackerID; } EV_S_WINDOWHIT; typedef struct { - UINT16 ubAttackerID; - INT32 iBullet; + INT32 iBullet; + SoldierID ubAttackerID; } EV_S_MISS; typedef struct { - UINT16 ubNoiseMaker; - INT32 sGridNo; - UINT8 bLevel; - UINT8 ubTerrType; - UINT8 ubVolume; - UINT8 ubNoiseType; - CHAR16 zNoiseMessage[320]; + INT32 sGridNo; + SoldierID ubNoiseMaker; + UINT8 bLevel; + UINT8 ubTerrType; + UINT8 ubVolume; + UINT8 ubNoiseType; + CHAR16 zNoiseMessage[320]; } EV_S_NOISE; typedef struct { - UINT16 usSoldierID; - UINT32 uiUniqueId; - UINT8 ubDirection; - INT32 sGridNo; + UINT32 uiUniqueId; + INT32 sGridNo; + SoldierID usSoldierID; INT16 sXPos; INT16 sYPos; - BOOLEAN fset; + UINT8 ubDirection; + BOOLEAN fset; } EV_S_STOP_MERC; @@ -230,35 +231,34 @@ typedef struct typedef struct { - UINT16 usSoldierID; -// UINT32 uiUniqueId; + SoldierID usSoldierID; +// UINT32 uiUniqueId; UINT16 usPathDataSize; // Size of Path - INT32 sAtGridNo; // Owner merc is at this tile when sending packet + INT32 sAtGridNo; // Owner merc is at this tile when sending packet UINT16 usCurrentPathIndex; // Index the owner of the merc is at when sending packet UINT16 usPathData[ MAX_PATH_LIST_SIZE ]; // make define // Next X tile to go to UINT16 ubNewState; // new movment Anim - INT32 sDestGridNo; -// INT8 bActionPoints; -// INT8 bBreath; // current breath value -// INT8 bDesiredDirection; - + INT32 sDestGridNo; +// INT8 bActionPoints; +// INT8 bBreath; // current breath value +// INT8 bDesiredDirection; // maybe send current action & breath points } EV_S_SENDPATHTONETWORK; typedef struct { - UINT16 usSoldierID; - //UINT32 uiUniqueId; - INT32 sAtGridNo; // Owner merc is at this tile when sending packet - INT8 bActionPoints; // current A.P. value - INT8 bBreath; // current breath value + INT32 sAtGridNo; // Owner merc is at this tile when sending packet + SoldierID usSoldierID; + //UINT32 uiUniqueId; + INT8 bActionPoints; // current A.P. value + INT8 bBreath; // current breath value //hayden - INT8 bLife; - INT8 bBleeding; - UINT16 usTactialTurnLimitCounter; - UINT16 usTactialTurnLimitMax; - UINT8 ubDirection; + INT8 bLife; + INT8 bBleeding; + UINT16 usTactialTurnLimitCounter; + UINT16 usTactialTurnLimitMax; + UINT8 ubDirection; UINT8 ubNewStance; } EV_S_UPDATENETWORKSOLDIER; From 74d752d45269b54846568390bd9f45e298e5d1d5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 18:15:36 +0200 Subject: [PATCH 110/571] More conversions to SoldierID --- Tactical/Handle UI.cpp | 4 +- Tactical/Handle UI.h | 2 +- Tactical/LOS.cpp | 2 +- Tactical/Soldier Control.cpp | 131 +++++++++++++++++------------------ Tactical/Soldier Control.h | 22 +++--- Tactical/TeamTurns.cpp | 18 ++--- Tactical/TeamTurns.h | 4 +- Tactical/Weapons.cpp | 26 +++---- Tactical/Weapons.h | 4 +- Tactical/faces.h | 2 +- TileEngine/physics.cpp | 6 +- TileEngine/physics.h | 6 +- TileEngine/worldman.cpp | 2 +- TileEngine/worldman.h | 4 +- 14 files changed, 115 insertions(+), 118 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index cca15ed9..2ad4e76e 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -6378,9 +6378,9 @@ BOOLEAN IsValidTalkableNPCFromMouse( UINT16 * pubSoldierID, BOOLEAN fGive, BOOLE } -BOOLEAN IsValidTalkableNPC( UINT16 ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) +BOOLEAN IsValidTalkableNPC( SoldierID ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) { - SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ]; + SOLDIERTYPE *pSoldier = ubSoldierID; BOOLEAN fValidGuy = FALSE; if ( gusSelectedSoldier != NOBODY ) diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index b72930ae..22bd3fa4 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -335,7 +335,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ); BOOLEAN UIOkForItemPickup( SOLDIERTYPE *pSoldier, INT32 sGridNo ); BOOLEAN IsValidTalkableNPCFromMouse( UINT16 * pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); -BOOLEAN IsValidTalkableNPC( UINT16 ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); +BOOLEAN IsValidTalkableNPC( SoldierID ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); BOOLEAN HandleTalkInit( ); diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 7c607510..9d9154c6 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -3436,7 +3436,7 @@ BOOLEAN BulletHitMerc( BULLET * pBullet, STRUCTURE * pStructure, BOOLEAN fIntend // be legal, but the bLevel May change... sNewGridNo = NewGridNo( pBullet->sGridNo, DirectionInc( gOppositeDirection[ SWeaponHit.usDirection ] ) ); - bSpewBloodLevel = MercPtrs[ SWeaponHit.usSoldierID ]->pathing.bLevel; + bSpewBloodLevel = SWeaponHit.usSoldierID->pathing.bLevel; fCanSpewBlood = TRUE; // If on anything other than bLevel of 0, we can pretty much freely spew blood diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 84addbd3..37cf962a 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1730,10 +1730,10 @@ void AdjustForFastTurnAnimation( SOLDIERTYPE *pSoldier ); UINT16 SelectFireAnimation( SOLDIERTYPE *pSoldier, UINT8 ubHeight ); void SelectFallAnimation( SOLDIERTYPE *pSoldier ); BOOLEAN FullStructAlone( INT32 sGridNo, UINT8 ubRadius ); -void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); +void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitBlade( SOLDIERTYPE* pSoldier, UINT8 ubHitLocation ); -void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); -void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); +void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); +void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ); void SoldierGotHitVehicle( SOLDIERTYPE* pSoldier, UINT16 bDirection ); UINT8 CalcScreamVolume( SOLDIERTYPE * pSoldier, UINT8 ubCombinedLoss ); void PlaySoldierFootstepSound( SOLDIERTYPE *pSoldier ); @@ -6492,7 +6492,7 @@ void DoGenericHit( SOLDIERTYPE *pSoldier, UINT8 ubSpecial, INT16 bDirection ) } -void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT16 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) +void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) { INT32 usNewGridNo; BOOLEAN fBlownAway = FALSE; @@ -6517,7 +6517,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD if ( Item[usWeaponIndex].usItemClass == IC_GUN ) ubDistMessy *= gItemSettings.fDistMessyModifierGun[Weapon[usWeaponIndex].ubWeaponType]; - if ( SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= ubDistMessy ) + if ( SpacesAway( pSoldier->sGridNo, ubAttackerID->sGridNo ) <= ubDistMessy ) { usNewGridNo = NewGridNo( pSoldier->sGridNo, (INT8)(DirectionInc( pSoldier->ubDirection )) ); @@ -6546,7 +6546,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD if ( Item[usWeaponIndex].usItemClass == IC_GUN ) ubDistMessy *= gItemSettings.fDistMessyModifierGun[Weapon[usWeaponIndex].ubWeaponType]; - if ( SpacesAway( pSoldier->sGridNo, Menptr[ubAttackerID].sGridNo ) <= ubDistMessy ) + if ( SpacesAway( pSoldier->sGridNo, ubAttackerID->sGridNo ) <= ubDistMessy ) { // possibly play torso explosion anim! @@ -6619,7 +6619,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD // Flugente: dynamic opinions if (gGameExternalOptions.fDynamicOpinions && ubAttackerID != NOBODY ) - HandleDynamicOpinionChange( MercPtrs[ubAttackerID], OPINIONEVENT_BRUTAL_GOOD, TRUE, TRUE ); + HandleDynamicOpinionChange( ubAttackerID, OPINIONEVENT_BRUTAL_GOOD, TRUE, TRUE ); return; } @@ -6634,7 +6634,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD // Flugente: dynamic opinions if (gGameExternalOptions.fDynamicOpinions && ubAttackerID != NOBODY ) - HandleDynamicOpinionChange( MercPtrs[ubAttackerID], OPINIONEVENT_BRUTAL_GOOD, TRUE, TRUE ); + HandleDynamicOpinionChange( ubAttackerID, OPINIONEVENT_BRUTAL_GOOD, TRUE, TRUE ); return; } @@ -6643,7 +6643,7 @@ void SoldierGotHitGunFire( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sD DoGenericHit( pSoldier, ubSpecial, bDirection ); } -void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) +void SoldierGotHitExplosion( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) { // Flugente: if hit in legs or torso, blood will be on our uniform - parts of the clothes cannot be worn anymore if ( ubHitLocation == AIM_SHOT_TORSO ) @@ -6858,7 +6858,7 @@ void SoldierGotHitBlade( SOLDIERTYPE *pSoldier, UINT8 ubHitLocation ) } -void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, UINT8 ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) +void SoldierGotHitPunch( SOLDIERTYPE *pSoldier, UINT16 usWeaponIndex, INT16 sDamage, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation ) { // IF HERE AND GUY IS DEAD, RETURN! @@ -12507,9 +12507,9 @@ void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirectio if ( this->flags.uiStatusFlags & SOLDIER_MONSTER ) { // Is there an unconscious guy at gridno...... - UINT16 ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); + SoldierID ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel ); - if ( ubTargetID != NOBODY && ((MercPtrs[ubTargetID]->stats.bLife < OKLIFE && MercPtrs[ubTargetID]->stats.bLife > 0) || (MercPtrs[ubTargetID]->bBreath < OKBREATH && MercPtrs[ubTargetID]->bCollapsed)) ) + if ( ubTargetID != NOBODY && ((ubTargetID->stats.bLife < OKLIFE && ubTargetID->stats.bLife > 0) || (ubTargetID->bBreath < OKBREATH && ubTargetID->bCollapsed)) ) { this->aiData.uiPendingActionData4 = ubTargetID; @@ -13140,13 +13140,12 @@ void SOLDIERTYPE::EVENT_SoldierBeginFirstAid( INT32 sGridNo, UINT8 ubDirection ) { SOLDIERTYPE *pTSoldier; //UINT32 uiMercFlags; - UINT16 usSoldierIndex; BOOLEAN fRefused = FALSE; - usSoldierIndex = WhoIsThere2( sGridNo, this->pathing.bLevel ); + SoldierID usSoldierIndex = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { - pTSoldier = MercPtrs[usSoldierIndex]; + pTSoldier = usSoldierIndex; //SANDRO - hack! Find out if we are a doctor with medical bag trying to make a surgery this->fDoingSurgery = FALSE; @@ -13275,7 +13274,7 @@ void SOLDIERTYPE::EVENT_SoldierEnterVehicle( INT32 sGridNo, UINT8 ubDirection, U if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { - pTSoldier = MercPtrs[usSoldierIndex]; + pTSoldier = usSoldierIndex; // Enter vehicle... EnterVehicle( pTSoldier, this, ubSeatIndex ); @@ -13790,7 +13789,7 @@ void SOLDIERTYPE::InternalGivingSoldierCancelServices( BOOLEAN fPlayEndAnim ) // GET TARGET SOLDIER if ( this->ubServicePartner != NOBODY ) { - pTSoldier = MercPtrs[this->ubServicePartner]; + pTSoldier = this->ubServicePartner; // END SERVICE! pTSoldier->ubServiceCount--; @@ -14773,12 +14772,12 @@ BOOLEAN SOLDIERTYPE::IsWeaponMounted( void ) if ( !IsLocationSittable( nextGridNoinSight, 0 ) ) { // resting our gun on people is allowed sometimes - UINT16 usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + SoldierID usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); if ( usPersonID == NOBODY ) applybipod = TRUE; else { - SOLDIERTYPE* pSoldier = MercPtrs[usPersonID]; + SOLDIERTYPE* pSoldier = usPersonID; // anv: vehicles don't mind if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) @@ -14797,7 +14796,7 @@ BOOLEAN SOLDIERTYPE::IsWeaponMounted( void ) // Flugente: dynamic opinions if (gGameExternalOptions.fDynamicOpinions) { - AddOpinionEvent(MercPtrs[usPersonID]->ubProfile, this->ubProfile, OPINIONEVENT_YOUMOUNTEDAGUNONMYBREASTS); + AddOpinionEvent(pSoldier->ubProfile, this->ubProfile, OPINIONEVENT_YOUMOUNTEDAGUNONMYBREASTS); } } } @@ -14847,12 +14846,12 @@ BOOLEAN SOLDIERTYPE::IsWeaponMounted( void ) if ( !IsLocationSittable( nextGridNoinSight, 0 ) ) { // resting our gun on people is allowed sometimes - UINT16 usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + SoldierID usPersonID = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); if ( usPersonID == NOBODY ) applybipod = TRUE; else { - SOLDIERTYPE* pSoldier = MercPtrs[usPersonID]; + SOLDIERTYPE* pSoldier = usPersonID; // anv: vehicles don't mind if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) @@ -14867,7 +14866,7 @@ BOOLEAN SOLDIERTYPE::IsWeaponMounted( void ) // Flugente: dynamic opinions if (gGameExternalOptions.fDynamicOpinions) { - AddOpinionEvent(MercPtrs[usPersonID]->ubProfile, this->ubProfile, OPINIONEVENT_YOUMOUNTEDAGUNONMYBREASTS); + AddOpinionEvent(pSoldier->ubProfile, this->ubProfile, OPINIONEVENT_YOUMOUNTEDAGUNONMYBREASTS); } } } @@ -15328,7 +15327,7 @@ BOOLEAN SOLDIERTYPE::IsFeedingExternal( UINT16 * pubId1, UINT16* pGunSlot1, UIN UINT16 lastslotforammo = MEDPOCK3POS; // for robots and AI-controlled soldiers (who don't have any LBE gear), we put a change in here so that ALL their slots are checked for ammo - if ( this->bTeam != gbPlayerNum || MercPtrs[this->ubID]->flags.uiStatusFlags & SOLDIER_ROBOT ) + if ( this->bTeam != gbPlayerNum || this->ubID->flags.uiStatusFlags & SOLDIER_ROBOT ) { firstslotforammo = HANDPOS; lastslotforammo = NUM_INV_SLOTS; @@ -15835,9 +15834,9 @@ BOOLEAN SOLDIERTYPE::EquipmentTooGood( BOOLEAN fCloselook ) // are we in covert mode? we need to have the correct flag set, and not wear anything suspicious, or behave in a suspicious way -BOOLEAN SOLDIERTYPE::SeemsLegit( UINT16 ubObserverID ) +BOOLEAN SOLDIERTYPE::SeemsLegit( SoldierID ubObserverID ) { - SOLDIERTYPE* pSoldier = MercPtrs[ubObserverID]; + SOLDIERTYPE* pSoldier = ubObserverID; if ( !pSoldier ) return TRUE; @@ -16123,7 +16122,7 @@ BOOLEAN SOLDIERTYPE::SeemsLegit( UINT16 ubObserverID ) } // do we recognize someone else as a combatant? -BOOLEAN SOLDIERTYPE::RecognizeAsCombatant( UINT16 ubTargetID ) +BOOLEAN SOLDIERTYPE::RecognizeAsCombatant( SoldierID ubTargetID ) { // this will only work with the new trait system if ( !gGameOptions.fNewTraitSystem ) @@ -16132,7 +16131,7 @@ BOOLEAN SOLDIERTYPE::RecognizeAsCombatant( UINT16 ubTargetID ) if ( ubTargetID == NOBODY ) return TRUE; - SOLDIERTYPE* pSoldier = MercPtrs[ubTargetID]; + SOLDIERTYPE* pSoldier = ubTargetID; if ( !pSoldier ) return TRUE; @@ -16462,12 +16461,12 @@ BOOLEAN SOLDIERTYPE::FreePrisoner( ) // we can only free people we are facing INT32 nextGridNoinSight = NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ); - UINT16 target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + SoldierID target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); // is there somebody? if ( target != NOBODY ) { - SOLDIERTYPE* pSoldier = MercPtrs[target]; + SOLDIERTYPE* pSoldier = target; // if he is captured, free him! // note that this would also work for prisoner civs that we spawn in our prisons. All needed would be commanding the AI to get there @@ -18860,7 +18859,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN // if he does not do so, active vox operators will be targetted. Who knows, the vox operator might be doing a heroic last stand for all we know... //BOOLEAN signalshellfired = FALSE; const UINT8 maxFiringMortarsAmount = 5; - UINT16 radiooperatorID = 0; + SoldierID radiooperatorID = 0; UINT8 mortaritemcnt = 0; UINT16 mortararray[maxFiringMortarsAmount] = { 0 }; @@ -19008,7 +19007,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN if ( radiooperatorID ) { - pSoldier = MercPtrs[radiooperatorID]; + pSoldier = radiooperatorID; // also drain the other guy's radio batteries pSoldier->UseRadio( ); @@ -19337,12 +19336,12 @@ BOOLEAN SOLDIERTYPE::AIDoctorFriend( ) // we can only free people we are facing INT32 nextGridNoinSight = NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ); - UINT16 target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); + SoldierID target = WhoIsThere2( nextGridNoinSight, this->pathing.bLevel ); // is there somebody? if ( target != NOBODY ) { - SOLDIERTYPE* pSoldier = MercPtrs[target]; + SOLDIERTYPE* pSoldier = target; if ( pSoldier->bTeam != ENEMY_TEAM ) return FALSE; @@ -20517,13 +20516,13 @@ BOOLEAN SOLDIERTYPE::CanDragInPrinciple(BOOLEAN fCheckStance) return TRUE; } -BOOLEAN SOLDIERTYPE::CanDragPerson(UINT16 usID, BOOLEAN fCheckStance) +BOOLEAN SOLDIERTYPE::CanDragPerson(SoldierID usID, BOOLEAN fCheckStance) { if (!CanDragInPrinciple(fCheckStance)) return FALSE; // check whether this guy exists etc. - SOLDIERTYPE* pSoldier = MercPtrs[usID]; + SOLDIERTYPE* pSoldier = usID; if ( pSoldier && pSoldier->bActive && pSoldier->bInSector ) { @@ -20804,7 +20803,7 @@ BOOLEAN SOLDIERTYPE::IsDragging( bool aStopIfConditionNotSatisfied ) return FALSE; } -void SOLDIERTYPE::SetDragOrderPerson( UINT16 usID ) +void SOLDIERTYPE::SetDragOrderPerson( SoldierID usID ) { if ( CanDragPerson( usID ) ) { @@ -20825,16 +20824,16 @@ void SOLDIERTYPE::SetDragOrderPerson( UINT16 usID ) } } -void SOLDIERTYPE::SetDragOrderCorpse( UINT32 usID ) +void SOLDIERTYPE::SetDragOrderCorpse( UINT32 uiCorpseID ) { - if ( CanDragCorpse( usID ) ) + if ( CanDragCorpse( uiCorpseID ) ) { // sevenfm: if someone is dragging this corpse, cancel drag SOLDIERTYPE *pSoldier; for (UINT32 uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) { pSoldier = MercPtrs[uiLoop]; - if (pSoldier && pSoldier->sDragCorpseID == usID) + if (pSoldier && pSoldier->sDragCorpseID == uiCorpseID) { pSoldier->CancelDrag(); } @@ -20842,7 +20841,7 @@ void SOLDIERTYPE::SetDragOrderCorpse( UINT32 usID ) CancelDrag(); - this->sDragCorpseID = usID; + this->sDragCorpseID = uiCorpseID; } } @@ -21014,7 +21013,7 @@ void SOLDIERTYPE::StopChatting() { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[DISTRACT_STOP_STR], this->GetName(), this->usChatPartnerID->GetName() ); - MercPtrs[this->usChatPartnerID]->usChatPartnerID = NOBODY; + this->usChatPartnerID->usChatPartnerID = NOBODY; this->usChatPartnerID = NOBODY; } } @@ -21372,7 +21371,7 @@ UINT8 SOLDIERTYPE::GetThiefEvadeDetectionChance() return totalvalue; } -BOOLEAN SOLDIERTYPE::InPositionForTurncoatAttempt( UINT16 usID ) +BOOLEAN SOLDIERTYPE::InPositionForTurncoatAttempt( SoldierID usID ) { if ( !gSkillTraitValues.fCOTurncoats || gbWorldSectorZ @@ -21387,7 +21386,7 @@ BOOLEAN SOLDIERTYPE::InPositionForTurncoatAttempt( UINT16 usID ) || usID == NOBODY ) return FALSE; - SOLDIERTYPE* pSoldier = MercPtrs[usID]; + SOLDIERTYPE* pSoldier = usID; if ( !pSoldier || pSoldier->bTeam != ENEMY_TEAM @@ -21543,12 +21542,12 @@ UINT8 SOLDIERTYPE::GetTurncoatConvinctionChance( SoldierID usID, INT16 sApproac return max( 0, min( 100, recruitrating - enemyresistancerating ) ); } -void SOLDIERTYPE::AttemptToCreateTurncoat( UINT16 usID ) +void SOLDIERTYPE::AttemptToCreateTurncoat( SoldierID usID ) { if ( usID >= NOBODY ) return; - SOLDIERTYPE* pSoldier = MercPtrs[usID]; + SOLDIERTYPE* pSoldier = usID; if ( !pSoldier || pSoldier->bTeam != ENEMY_TEAM @@ -21558,12 +21557,12 @@ void SOLDIERTYPE::AttemptToCreateTurncoat( UINT16 usID ) HandleTurncoatAttempt( pSoldier ); } -BOOLEAN SOLDIERTYPE::OrderTurnCoatToSwitchSides( UINT16 usID ) +BOOLEAN SOLDIERTYPE::OrderTurnCoatToSwitchSides( SoldierID usID ) { if ( usID >= NOBODY ) return FALSE; - SOLDIERTYPE* pSoldier = MercPtrs[usID]; + SOLDIERTYPE* pSoldier = usID; if (!pSoldier || pSoldier->bTeam != ENEMY_TEAM @@ -22545,12 +22544,12 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection if ( !gGameExternalOptions.fAllowPrisonerSystem ) return; - UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + SoldierID ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); - if ( ubPerson != NOBODY && MercPtrs[ubPerson]->CanBeCaptured( ) ) + if ( ubPerson != NOBODY && ubPerson->CanBeCaptured( ) ) { // we found someone we can handcuff - SOLDIERTYPE* pSoldier = MercPtrs[ubPerson]; + SOLDIERTYPE* pSoldier = ubPerson; // check wether we will be successful BOOLEAN success = FALSE; @@ -22688,12 +22687,12 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirection ) { - UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + SoldierID ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( ubPerson != NOBODY ) { // we found someone - SOLDIERTYPE* pSoldier = MercPtrs[ubPerson]; + SOLDIERTYPE* pSoldier = ubPerson; OBJECTTYPE* pObj = &(this->inv[HANDPOS]); @@ -22824,12 +22823,12 @@ void SOLDIERTYPE::EVENT_SoldierApplyItemToPerson( INT32 sGridNo, UINT8 ubDirecti void SOLDIERTYPE::EVENT_SoldierTakeBloodFromPerson( INT32 sGridNo, UINT8 ubDirection ) { - UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + SoldierID ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( ubPerson != NOBODY && ubPerson != this->ubID ) { // we found someone - SOLDIERTYPE* pSoldier = MercPtrs[ubPerson]; + SOLDIERTYPE* pSoldier = ubPerson; OBJECTTYPE* pObj = &( this->inv[HANDPOS] ); @@ -22895,12 +22894,12 @@ void SOLDIERTYPE::EVENT_SoldierTakeBloodFromPerson( INT32 sGridNo, UINT8 ubDirec void SOLDIERTYPE::EVENT_SoldierApplySplintToPerson( INT32 sGridNo, UINT8 ubDirection ) { - UINT16 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + SoldierID ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); if ( ubPerson != NOBODY && ubPerson != this->ubID ) { // we found someone - SOLDIERTYPE* pSoldier = MercPtrs[ubPerson]; + SOLDIERTYPE* pSoldier = ubPerson; OBJECTTYPE* pObj = &( this->inv[HANDPOS] ); @@ -22964,12 +22963,10 @@ void SOLDIERTYPE::EVENT_SoldierInteractiveAction( INT32 sGridNo, UINT16 usAction void SOLDIERTYPE::EVENT_SoldierBeginReloadRobot( INT32 sGridNo, UINT8 ubDirection, UINT8 ubMercSlot ) { - UINT16 ubPerson; - // Make sure we have a robot here.... - ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); + SoldierID ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel ); - if ( ubPerson != NOBODY && MercPtrs[ubPerson]->flags.uiStatusFlags & SOLDIER_ROBOT ) + if ( ubPerson != NOBODY && ubPerson->flags.uiStatusFlags & SOLDIER_ROBOT ) { // CHANGE DIRECTION AND GOTO ANIMATION NOW if (this->ubDirection != ubDirection) @@ -23195,18 +23192,18 @@ void AbandonBoxingDueToSurrenderCallback(UINT8 ubExitValue) } SOLDIERTYPE *pTMilitiaSoldier;//global pointer -BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT16 ubTargetID, BOOLEAN fValidate ) +BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( SoldierID ubTargetID, BOOLEAN fValidate ) { - INT16 sFacingDir, sXPos, sYPos, sAPCost; - SOLDIERTYPE *pTSoldier; - UINT32 uiRange; + INT16 sFacingDir, sXPos, sYPos, sAPCost; + SOLDIERTYPE *pTSoldier; + UINT32 uiRange; if ( ubTargetID == NOBODY ) { return(FALSE); } - pTSoldier = MercPtrs[ubTargetID]; + pTSoldier = ubTargetID; // Check distance again, to be sure if ( fValidate ) @@ -23392,7 +23389,7 @@ BOOLEAN SOLDIERTYPE::IsValidSecondHandBurst( void ) { if ( this->bDoAutofire ) { - // if second gun cannot use atuofire mode + // if second gun cannot use autofire mode if ( !IsGunAutofireCapable( &this->inv[SECONDHANDPOS] ) ) { return(FALSE); diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 3ccedd4e..81498083 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1254,7 +1254,7 @@ public: UINT16 *pCurrentShade; UINT8 ubFadeLevel; UINT8 ubServiceCount; - UINT16 ubServicePartner; + SoldierID ubServicePartner; THROW_PARAMS *pThrowParams; INT8 bReverse; LEVELNODE *pLevelNode; @@ -1427,7 +1427,7 @@ public: INT8 bOldBattleSnd; INT32 iBurstSoundID; INT8 bSlotItemTakenFrom; - UINT16 ubAutoBandagingMedic; + SoldierID ubAutoBandagingMedic; SoldierID ubRobotRemoteHolderID; UINT32 uiTimeOfLastContractUpdate; INT8 bTypeOfLastContract; @@ -1808,7 +1808,7 @@ public: BOOLEAN CheckSoldierHitRoof( void ); BOOLEAN CheckForBreathCollapse( void ); - BOOLEAN PlayerSoldierStartTalking( UINT16 ubTargetID, BOOLEAN fValidate ); + BOOLEAN PlayerSoldierStartTalking( SoldierID ubTargetID, BOOLEAN fValidate ); BOOLEAN InternalIsValidStance( INT8 bDirection, INT8 bNewStance ); BOOLEAN IsValidSecondHandShot( void ); BOOLEAN IsValidSecondHandBurst( void ); @@ -1859,10 +1859,10 @@ public: BOOLEAN EquipmentTooGood( BOOLEAN fCloselook ); // does soldier ubObserverID recognize us as his enemy? - BOOLEAN SeemsLegit( UINT16 ubObserverID ); + BOOLEAN SeemsLegit( SoldierID ubObserverID ); // do we recognize someone else as a combatant? - BOOLEAN RecognizeAsCombatant(UINT16 ubTargetID); + BOOLEAN RecognizeAsCombatant(SoldierID ubTargetID); // loose covert property void LooseDisguise( void ); @@ -2053,12 +2053,12 @@ public: // Flugente: drag people BOOLEAN CanDragInPrinciple(BOOLEAN fCheckStance = FALSE); - BOOLEAN CanDragPerson(UINT16 usID, BOOLEAN fCheckStance = FALSE); + BOOLEAN CanDragPerson(SoldierID usID, BOOLEAN fCheckStance = FALSE); BOOLEAN CanDragCorpse(UINT16 usCorpseNum, BOOLEAN fCheckStance = FALSE); BOOLEAN CanDragStructure(INT32 sGridNo, BOOLEAN fCheckStance = FALSE); BOOLEAN IsDragging(bool aStopIfConditionNotSatisfied = true); - void SetDragOrderPerson( UINT16 usID ); - void SetDragOrderCorpse( UINT32 usID ); + void SetDragOrderPerson( SoldierID usID ); + void SetDragOrderCorpse( UINT32 uiCorpseID ); void SetDragOrderStructure( INT32 sGridNo ); void CancelDrag(); @@ -2086,10 +2086,10 @@ public: UINT8 GetThiefEvadeDetectionChance(); // Flugente: turncoats - BOOLEAN InPositionForTurncoatAttempt( UINT16 usID ); + BOOLEAN InPositionForTurncoatAttempt( SoldierID usID ); UINT8 GetTurncoatConvinctionChance( SoldierID usID, INT16 usApproach ); - void AttemptToCreateTurncoat( UINT16 usID ); - BOOLEAN OrderTurnCoatToSwitchSides( UINT16 usID ); + void AttemptToCreateTurncoat( SoldierID usID ); + BOOLEAN OrderTurnCoatToSwitchSides( SoldierID usID ); void OrderAllTurnCoatToSwitchSides(); // Flugente: exploration assignment diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index fd496bd5..49d53cfd 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -102,9 +102,9 @@ UINT16 gubOutOfTurnPersons = 0; #define REMOVE_LATEST_INTERRUPT_GUY() (DeleteFromIntList( (gubOutOfTurnPersons), TRUE )) #define INTERRUPTS_OVER (gubOutOfTurnPersons == 1) -INT16 InterruptOnlyGuynum = NOBODY; -BOOLEAN InterruptsAllowed = TRUE; -BOOLEAN gfHiddenInterrupt = FALSE; +SoldierID InterruptOnlyGuynum = NOBODY; +BOOLEAN InterruptsAllowed = TRUE; +BOOLEAN gfHiddenInterrupt = FALSE; UINT8 gubLastInterruptedGuy = 0; extern UINT16 gsWhoThrewRock; @@ -1797,7 +1797,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponen } -INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN fUseWatchSpots ) +INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, SoldierID ubOpponentID, BOOLEAN fUseWatchSpots ) { INT32 iPoints; INT8 bLightLevel; @@ -1853,7 +1853,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN if (fUseWatchSpots && !(pSoldier->usSoldierFlagMask2 & SOLDIER_TRAIT_FOCUS)) { // if this is a previously noted spot of enemies, give bonus points! - iPoints += GetWatchedLocPoints( pSoldier->ubID, MercPtrs[ ubOpponentID ]->sGridNo, MercPtrs[ ubOpponentID ]->pathing.bLevel ); + iPoints += GetWatchedLocPoints( pSoldier->ubID, ubOpponentID->sGridNo, ubOpponentID->pathing.bLevel ); } // LOSE one point for each 2 additional opponents he currently sees, above 2 @@ -1882,7 +1882,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN // if soldier is still in shock from recent injuries, that penalizes him iPoints -= pSoldier->aiData.bShock; - ubDistance = (UINT8) PythSpacesAway( pSoldier->sGridNo, MercPtrs[ ubOpponentID ]->sGridNo ); + ubDistance = (UINT8) PythSpacesAway( pSoldier->sGridNo, ubOpponentID->sGridNo ); // if we are in combat mode - thus doing an interrupt rather than determine who gets first turn - // then give bonus @@ -1951,7 +1951,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN INT16 range = PythSpacesAway( pSoldier->sFocusGridNo, pSoldier->sGridNo ); INT16 radius = gSkillTraitValues.ubSNFocusRadius * range / 20; - INT16 range_opponent = PythSpacesAway( pSoldier->sFocusGridNo, MercPtrs[ubOpponentID]->sGridNo ); + INT16 range_opponent = PythSpacesAway( pSoldier->sFocusGridNo, ubOpponentID->sGridNo ); if ( range_opponent <= radius ) iPoints += gSkillTraitValues.sSNFocusInterruptBonus; @@ -2034,7 +2034,7 @@ INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN #endif if(is_networked) { - SOLDIERTYPE *pOpp = &Menptr[ubOpponentID]; + SOLDIERTYPE *pOpp = ubOpponentID; #ifdef JA2BETAVERSION ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_MPSYSTEM, L"Interrupt: '%s' vs '%s' = %d points.",pSoldier->name,pOpp->name, iPoints ); #endif @@ -2448,7 +2448,7 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) default: // interrupt is possible, run a duel DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, "Calculating int duel pts for onlooker in ResolveInterruptsVs" ); - pSoldier->aiData.bInterruptDuelPts = CalcInterruptDuelPts(pSoldier,pOpponent->ubID,TRUE); + pSoldier->aiData.bInterruptDuelPts = CalcInterruptDuelPts(pSoldier, pOpponent->ubID, TRUE); fIntOccurs = InterruptDuel(pOpponent,pSoldier); #ifdef DEBUG_INTERRUPTS if (fIntOccurs) diff --git a/Tactical/TeamTurns.h b/Tactical/TeamTurns.h index a53c0489..828e445b 100644 --- a/Tactical/TeamTurns.h +++ b/Tactical/TeamTurns.h @@ -11,7 +11,7 @@ extern BOOLEAN gfHiddenTurnbased; #define INTERRUPT_QUEUED (gubOutOfTurnPersons > 0) extern BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, INT8 bOldOppList); -extern INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, BOOLEAN fUseWatchSpots ); +extern INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, SoldierID ubOpponentID, BOOLEAN fUseWatchSpots ); extern void EndAITurn( void ); extern void DisplayHiddenInterrupt( SOLDIERTYPE * pSoldier ); extern BOOLEAN InterruptDuel( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent); @@ -30,4 +30,4 @@ void EndTurnEvents( void ); BOOLEAN NPCFirstDraw( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 4b2653c3..b2436930 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -5478,23 +5478,23 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT16 ubAttackerID, UINT16 usWeaponIndex, INT3 } -void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange, UINT16 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ) +void WeaponHit( SoldierID usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange, SoldierID ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ) { SOLDIERTYPE* pTargetSoldier = NULL; SOLDIERTYPE* pSoldier = NULL; - OBJECTTYPE* pObj = NULL; + OBJECTTYPE* pObj = NULL; // Get attacker if ( ubAttackerID != NOBODY ) { - pSoldier = MercPtrs[ ubAttackerID ]; + pSoldier = ubAttackerID; // Flugente: check for underbarrel weapons and use that object if necessary pObj = pSoldier->GetUsedWeapon( &pSoldier->inv[pSoldier->ubAttackingHand] ); } // Get Target - pTargetSoldier = MercPtrs[ usSoldierID ]; + pTargetSoldier = usSoldierID; MakeNoise( ubAttackerID, pTargetSoldier->sGridNo, pTargetSoldier->pathing.bLevel, gpWorldLevelData[pTargetSoldier->sGridNo].ubTerrainID, Weapon[ usWeaponIndex ].ubHitVolume, NOISE_BULLET_IMPACT ); @@ -5589,12 +5589,12 @@ void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 s } -void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT16 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ) +void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, SoldierID ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ) { BOOLEAN fDoMissForGun = FALSE; ANITILE *pNode; INT32 sGridNo; - INT8 bLevel; + INT8 bLevel; ANITILE_PARAMS AniParams; UINT16 usMissTileIndex, usMissTileType; STRUCTURE *pStructure = NULL; @@ -5610,9 +5610,9 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN // Flugente: check for underbarrel weapons and use that object if necessary if ( ubAttackerID != NOBODY ) { - pObj = MercPtrs[ ubAttackerID ]->GetUsedWeapon( &MercPtrs [ ubAttackerID ]->inv[MercPtrs[ubAttackerID]->ubAttackingHand] ); + pObj = ubAttackerID->GetUsedWeapon( &ubAttackerID->inv[ubAttackerID->ubAttackingHand] ); - pAttacker = MercPtrs[ ubAttackerID ]; + pAttacker = ubAttackerID; } // HEADROCK HAM 5: Define differently for fragments @@ -5676,7 +5676,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN // Get attacker if ( ubAttackerID != NOBODY ) - pSoldier = MercPtrs[ ubAttackerID ]; + pSoldier = ubAttackerID; UINT8 usDirection = DIRECTION_IRRELEVANT; if ( pSoldier ) @@ -5777,13 +5777,13 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN case MGCLASS: // Guy has missed, play random sound - if ( ubAttackerID != NOBODY && MercPtrs[ ubAttackerID ]->bTeam == gbPlayerNum ) + if ( ubAttackerID != NOBODY && ubAttackerID->bTeam == gbPlayerNum ) { - if ( !MercPtrs[ ubAttackerID ]->bDoBurst ) + if ( !ubAttackerID->bDoBurst ) { if ( Random( 40 ) == 0 ) { - MercPtrs[ ubAttackerID ]->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); + ubAttackerID->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } } @@ -6046,7 +6046,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UIN // ATE: Show misses...( if our team ) if ( gGameSettings.fOptions[ TOPTION_SHOW_MISSES ] ) { - if ( ubAttackerID != NOBODY && MercPtrs[ ubAttackerID ]->bTeam == gbPlayerNum ) + if ( ubAttackerID != NOBODY && ubAttackerID->bTeam == gbPlayerNum ) { LocateGridNo( sGridNo ); } diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 657b34cf..958d8642 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -454,8 +454,8 @@ extern INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier ); // Flugente: fire resistance INT16 ArmourVersusFirePercent( SOLDIERTYPE * pSoldier ); extern BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ); -extern void WeaponHit( UINT16 usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange, UINT16 ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ); -extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, UINT16 ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ); +extern void WeaponHit( SoldierID usSoldierID, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange, SoldierID ubAttackerID, BOOLEAN fHit, UINT8 ubSpecial, UINT8 ubHitLocation ); +extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, SoldierID ubAttackerID, UINT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped ); extern void WindowHit( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce ); // HEADROCK HAM 5.1: Moved to Bullets.h extern BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT32 sGridNo ); diff --git a/Tactical/faces.h b/Tactical/faces.h index 4ecc2b6c..adfa524d 100644 --- a/Tactical/faces.h +++ b/Tactical/faces.h @@ -170,7 +170,7 @@ typedef struct BOOLEAN fOldShowHighlight; INT8 bOldAssignment; INT8 ubOldServiceCount; - UINT8 ubOldServicePartner; + SoldierID ubOldServicePartner; BOOLEAN fOldShowMoveHilight; UINT16 sMouthFrame; diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index ac3761b5..d4ac3b3f 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -214,7 +214,7 @@ void RecountObjectSlots(void) } -INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ) +INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, SoldierID ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ) { INT32 iObjectIndex; FLOAT mass; @@ -258,7 +258,7 @@ INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, r pObject->Position.z = zPos; pObject->fVisible = TRUE; pObject->fTestObject = fTestObject; - pObject->ubOwner = ubOwner; + pObject->ubOwner = ubOwner; pObject->ubActionCode = ubActionCode; pObject->uiActionData = uiActionData; pObject->fDropItem = TRUE; @@ -546,7 +546,7 @@ BOOLEAN PhysicsUpdateLife( REAL_OBJECT *pObject, real DeltaTime ) { SOLDIERTYPE *pSoldier; - pSoldier = MercPtrs[ pObject->ubLastTargetTakenDamage ]; + pSoldier = pObject->ubLastTargetTakenDamage; bLevel = pSoldier->pathing.bLevel; } diff --git a/TileEngine/physics.h b/TileEngine/physics.h index 249334c8..17ed89ea 100644 --- a/TileEngine/physics.h +++ b/TileEngine/physics.h @@ -118,8 +118,8 @@ public: FLOAT dLifeSpan; BOOLEAN fFirstTimeMoved; INT32 sFirstGridNo; - UINT16 ubOwner; - UINT8 ubActionCode; + SoldierID ubOwner; + UINT8 ubActionCode; UINT32 uiActionData; BOOLEAN fDropItem; UINT32 uiNumTilesMoved; @@ -153,7 +153,7 @@ extern REAL_OBJECT ObjectSlots[ NUM_OBJECT_SLOTS ]; // OBJECT LIST STUFF -INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ); +INT32 CreatePhysicalObject( OBJECTTYPE *pGameObj, real dLifeLength, real xPos, real yPos, real zPos, real xForce, real yForce, real zForce, SoldierID ubOwner, UINT8 ubActionCode, UINT32 uiActionData, BOOLEAN fTestObject ); BOOLEAN RemoveObjectSlot( INT32 iObject ); void RemoveAllPhysicsObjects( ); // OJW - 20091002 - mp explosives diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index 1a91a147..f5692f28 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -3750,7 +3750,7 @@ BOOLEAN IsRoofVisible2( INT32 sMapPos ) } -UINT16 WhoIsThere2( INT32 sGridNo, INT8 bLevel ) +SoldierID WhoIsThere2( INT32 sGridNo, INT8 bLevel ) { STRUCTURE * pStructure; diff --git a/TileEngine/worldman.h b/TileEngine/worldman.h index eed5ca67..83cdf308 100644 --- a/TileEngine/worldman.h +++ b/TileEngine/worldman.h @@ -128,7 +128,7 @@ BOOLEAN RemoveShadowFromLevelNode( INT32 iMapIndex, LEVELNODE *pNode ); BOOLEAN AddMercToHead( INT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fAddStructInfo ); BOOLEAN RemoveMerc( INT32 iMapIndex, SOLDIERTYPE *pSoldier, BOOLEAN fPlaceHolder ); -UINT16 WhoIsThere2( INT32 sGridNo, INT8 bLevel ); +SoldierID WhoIsThere2( INT32 sGridNo, INT8 bLevel ); BOOLEAN AddMercStructureInfo( INT32 sGridNo, SOLDIERTYPE *pSoldier ); BOOLEAN AddMercStructureInfoFromAnimSurface( INT32 sGridNo, SOLDIERTYPE *pSoldier, UINT16 usAnimSurface, UINT16 usAnimState ); BOOLEAN UpdateMercStructureInfo( SOLDIERTYPE *pSoldier ); @@ -179,4 +179,4 @@ BOOLEAN IsLegionLevel( INT32 sGridNo ); BOOLEAN FindStruct(INT32 sSpot, INT8 bLevel, UINT16 usIndex); BOOLEAN FindStructFlag(INT32 sSpot, INT8 bLevel, UINT32 uiFlag); -#endif \ No newline at end of file +#endif From 9532fbfe2ca83fa33034921e07d020b0c0a0cc7b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:41:34 +0200 Subject: [PATCH 111/571] Convert to SoldierID --- Strategic/mapscreen.cpp | 2 +- Tactical/Dialogue Control.cpp | 4 +- Tactical/Faces.cpp | 181 +++++++++++++++--------------- Tactical/ShopKeeper Interface.cpp | 10 +- Tactical/ShopKeeper Interface.h | 2 +- Tactical/faces.h | 26 ++--- 6 files changed, 112 insertions(+), 113 deletions(-) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 3fd0fa4e..082b7825 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -5434,7 +5434,7 @@ UINT32 MapScreenHandle(void) // make him continue talking - ContinueDialogue( MercPtrs[ gpCurrentTalkingFace->ubSoldierID ], FALSE ); + ContinueDialogue( gpCurrentTalkingFace->ubSoldierID, FALSE ); // reset diabled flag //gpCurrentTalkingFace->fDisabled = FALSE; diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 75e5244a..a4739b70 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -1992,7 +1992,7 @@ BOOLEAN SpecialCharacterDialogueEventWithExtraParam( UINT32 uiSpecialEventFlag, } extern INT8 gbSelectedArmsDealerID; -extern UINT16 gusIDOfCivTrader; +extern SoldierID gusIDOfCivTrader; BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 iFaceIndex, UINT8 bUIHandlerID, BOOLEAN fFromSoldier ) { @@ -2107,7 +2107,7 @@ BOOLEAN ExecuteCharacterDialogue( UINT8 ubCharacterNum, UINT16 usQuoteNum, INT32 && iFaceIndex == -1 && gusIDOfCivTrader != NOBODY ) { - SOLDIERTYPE* pShopkeeper = MercPtrs[gusIDOfCivTrader]; + SOLDIERTYPE* pShopkeeper = gusIDOfCivTrader; if ( pShopkeeper ) { diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index dadad4d6..a61a627f 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -129,7 +129,7 @@ INT32 InitSoldierFace( SOLDIERTYPE *pSoldier ) } -INT32 InitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags ) +INT32 InitFace( UINT8 usMercProfileID, SoldierID ubSoldierID, UINT32 uiInitFlags ) { UINT32 uiBlinkFrequency; UINT32 uiExpressionFrequency; @@ -182,7 +182,7 @@ void SetPalettes(HVOBJECT *hVObject, UINT32 uiIndex) (*hVObject)->pShades[FLASH_PORTRAIT_GRAYSHADE] = Create16BPPPaletteShaded(Pal, 255, 255, 255, FALSE); } -INT32 InternalInitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ) +INT32 InternalInitFace( UINT8 usMercProfileID, SoldierID ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ) { FACETYPE *pFace; VOBJECT_DESC VObjectDesc; @@ -554,15 +554,14 @@ void DeleteFace( INT32 iFaceIndex ) } -void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, UINT16 ubSoldierID, UINT16 usFaceX, UINT16 usFaceY ) +void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, SoldierID ubSoldierID, UINT16 usFaceX, UINT16 usFaceY ) { - if( ubSoldierID == NOBODY ) + if( ubSoldierID >= NOBODY ) { return; } - SetAutoFaceActive( uiDisplayBuffer, uiRestoreBuffer, MercPtrs[ ubSoldierID ]->iFaceIndex, usFaceX, usFaceY ); - + SetAutoFaceActive( uiDisplayBuffer, uiRestoreBuffer, ubSoldierID->iFaceIndex, usFaceX, usFaceY ); } void GetFaceRelativeCoordinates( FACETYPE *pFace, UINT16 *pusEyesX, UINT16 *pusEyesY, UINT16 *pusMouthX, UINT16 *pusMouthY ) @@ -753,17 +752,17 @@ void InternalSetAutoFaceActive( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, // Are we a soldier? if ( pFace->ubSoldierID != NOBODY ) { - pFace->bOldSoldierLife = MercPtrs[ pFace->ubSoldierID ]->stats.bLife; + pFace->bOldSoldierLife = pFace->ubSoldierID->stats.bLife; } } -void SetAutoFaceInActiveFromSoldier( UINT16 ubSoldierID ) +void SetAutoFaceInActiveFromSoldier( SoldierID ubSoldierID ) { // Check for valid soldier CHECKV( ubSoldierID != NOBODY ); - SetAutoFaceInActive( MercPtrs[ ubSoldierID ]->iFaceIndex ); + SetAutoFaceInActive( ubSoldierID->iFaceIndex ); } @@ -795,7 +794,7 @@ void SetAutoFaceInActive(INT32 iFaceIndex ) // if ( pFace->ubSoldierID != NOBODY ) { - pSoldier = MercPtrs[ pFace->ubSoldierID ]; + pSoldier = pFace->ubSoldierID; // IF we are in tactical if ( pSoldier->bAssignment == iCurrentTacticalSquad && guiCurrentScreen == GAME_SCREEN ) @@ -948,11 +947,11 @@ void BlinkAutoFace( INT32 iFaceIndex ) // CHECK IF BUDDY IS DEAD, UNCONSCIOUS, ASLEEP, OR POW! if ( pFace->ubSoldierID != NOBODY ) { - uiFaceShade = GetFaceShade(MercPtrs[pFace->ubSoldierID], pFace, FALSE); + uiFaceShade = GetFaceShade(pFace->ubSoldierID, pFace, FALSE); - if ( ( MercPtrs[ pFace->ubSoldierID ]->stats.bLife < OKLIFE ) || - ( MercPtrs[ pFace->ubSoldierID ]->flags.fMercAsleep == TRUE ) || - ( MercPtrs[ pFace->ubSoldierID ]->bAssignment == ASSIGNMENT_POW ) ) + if ( ( pFace->ubSoldierID->stats.bLife < OKLIFE ) || + ( pFace->ubSoldierID->flags.fMercAsleep == TRUE ) || + ( pFace->ubSoldierID->bAssignment == ASSIGNMENT_POW ) ) { return; } @@ -1088,13 +1087,13 @@ void HandleFaceHilights( FACETYPE *pFace, UINT32 uiBuffer, INT16 sFaceX, INT16 s { if ( pFace->ubSoldierID != NOBODY ) { - if ( MercPtrs[ pFace->ubSoldierID ]->stats.bLife >= OKLIFE ) + if ( pFace->ubSoldierID->stats.bLife >= OKLIFE ) { // Lock buffer pDestBuf = LockVideoSurface( uiBuffer, &uiDestPitchBYTES ); SetClippingRegionAndImageWidth( uiDestPitchBYTES, sFaceX-2, sFaceY-1, sFaceX + pFace->usFaceWidth + 4, sFaceY + pFace->usFaceHeight + 4 ); - if ( MercPtrs[ pFace->ubSoldierID ]->bStealthMode ) + if ( pFace->ubSoldierID->bStealthMode ) { usLineColor = Get16BPPColor( FROMRGB( 158, 158, 12 ) ); } @@ -1237,7 +1236,7 @@ void MouthAutoFace( INT32 iFaceIndex ) // Set shade if (pFace->ubSoldierID != NOBODY) { - uiFaceShade = GetFaceShade(MercPtrs[pFace->ubSoldierID], pFace, FALSE); + uiFaceShade = GetFaceShade(pFace->ubSoldierID, pFace, FALSE); } HandleRenderFaceAdjustments( pFace, TRUE, FALSE, 0, pFace->usFaceX, pFace->usFaceY, pFace->usEyesX, pFace->usEyesY, uiFaceShade); @@ -1363,12 +1362,12 @@ UINT32 GetFaceShade(SOLDIERTYPE *pSoldier, FACETYPE *pFace, BOOLEAN fExternBlit) return FLASH_PORTRAIT_NOSHADE; } -BOOLEAN RenderAutoFaceFromSoldier( UINT16 ubSoldierID ) +BOOLEAN RenderAutoFaceFromSoldier( SoldierID ubSoldierID ) { // Check for valid soldier CHECKF( ubSoldierID != NOBODY ); - return( RenderAutoFace( MercPtrs[ ubSoldierID ]->iFaceIndex ) ); + return( RenderAutoFace( ubSoldierID->iFaceIndex ) ); } //---------------------------------------LEGION------------------------------- @@ -1629,16 +1628,16 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // BLIT HATCH if ( pFace->ubSoldierID != NOBODY ) { - pSoldier = MercPtrs[ pFace->ubSoldierID ]; + pSoldier = pFace->ubSoldierID; UINT8 faceProfileId = gMercProfiles[pSoldier->ubProfile].ubFaceIndex; BOOLEAN isIMP = gMercProfiles[pSoldier->ubProfile].Type == PROFILETYPE_IMP; - if (gGameSettings.fOptions[TOPTION_SHOW_TACTICAL_FACE_GEAR] && MercPtrs[pFace->ubSoldierID]->stats.bLife > 0 && !(pFace->uiFlags & FACE_BIGFACE)) + if (gGameSettings.fOptions[TOPTION_SHOW_TACTICAL_FACE_GEAR] && pSoldier->stats.bLife > 0 && !(pFace->uiFlags & FACE_BIGFACE)) { - if (MercPtrs[pFace->ubSoldierID]->inv[HELMETPOS].usItem > 0) + if (pSoldier->inv[HELMETPOS].usItem > 0) { - uiFaceItemOne = MercPtrs[pFace->ubSoldierID]->inv[HELMETPOS].usItem; + uiFaceItemOne = pSoldier->inv[HELMETPOS].usItem; if (uiFaceItemOne != NONE && zNewFaceGear[uiFaceItemOne].Type == 1) //back { @@ -1648,17 +1647,17 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // this section chooses the pictures for gas mask and NV goggles if the ini setting "SHOW_TACTICAL_FACE_GEAR" is TRUE // and the merc actually wears something to be shown - if (MercPtrs[pFace->ubSoldierID]->inv[HEAD1POS].usItem + MercPtrs[pFace->ubSoldierID]->inv[HEAD2POS].usItem > 0) + if (pSoldier->inv[HEAD1POS].usItem + pSoldier->inv[HEAD2POS].usItem > 0) { // WANNE: Removed the limitation // silversurfer: don't overwrite icons if they shall be shown! //if ( !gGameSettings.fOptions[ SHOW_TACTICAL_FACE_ICONS ] ) { - uiFaceItemOne = MercPtrs[pFace->ubSoldierID]->inv[HEAD1POS].usItem; - uiFaceItemTwo = MercPtrs[pFace->ubSoldierID]->inv[HEAD2POS].usItem; + uiFaceItemOne = pSoldier->inv[HEAD1POS].usItem; + uiFaceItemTwo = pSoldier->inv[HEAD2POS].usItem; - uiFaceOne = MercPtrs[pFace->ubSoldierID]->inv[HEAD1POS].usItem; - uiFaceTwo = MercPtrs[pFace->ubSoldierID]->inv[HEAD2POS].usItem; + uiFaceOne = pSoldier->inv[HEAD1POS].usItem; + uiFaceTwo = pSoldier->inv[HEAD2POS].usItem; // check first face slot if (uiFaceItemOne != NONE) @@ -1797,11 +1796,11 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } } - if (MercPtrs[pFace->ubSoldierID]->inv[HELMETPOS].usItem > 0) + if (pSoldier->inv[HELMETPOS].usItem > 0) // dirty hack for IMPs because they don't have pictures for face gear - // && ( MercPtrs[ pFace->ubSoldierID ]->ubProfile < 51 || MercPtrs[ pFace->ubSoldierID ]->ubProfile > 56 ) + // && ( pSoldier->ubProfile < 51 || pSoldier->ubProfile > 56 ) { - uiFaceItemOne = MercPtrs[pFace->ubSoldierID]->inv[HELMETPOS].usItem; + uiFaceItemOne = pSoldier->inv[HELMETPOS].usItem; if (uiFaceItemOne != NONE) { @@ -1815,7 +1814,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE //------------------------------------end of tactical face gear----------------------------- } - if ( (MercPtrs[pFace->ubSoldierID]->stats.bLife < CONSCIOUSNESS || MercPtrs[pFace->ubSoldierID]->flags.fDeadPanel ) ) + if ( (pSoldier->stats.bLife < CONSCIOUSNESS || pSoldier->flags.fDeadPanel ) ) { // Blit Closed eyes here! BltVideoObjectFromIndex( uiRenderBuffer, pFace->uiVideoObject, 1, usEyesX, usEyesY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -1824,14 +1823,14 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE BltVideoObjectFromIndex( uiRenderBuffer, guiHATCH, 0, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); } - if( MercPtrs[ pFace->ubSoldierID ]->flags.fMercAsleep == TRUE ) + if( pSoldier->flags.fMercAsleep == TRUE ) { // blit eyes closed BltVideoObjectFromIndex( uiRenderBuffer, pFace->uiVideoObject, 1, usEyesX, usEyesY, VO_BLT_SRCTRANSPARENCY, NULL ); } // Flugente: frozen soldiers are, well, frozen - if ( MercPtrs[pFace->ubSoldierID]->usSkillCooldown[SOLDIER_COOLDOWN_CRYO] ) + if ( pSoldier->usSkillCooldown[SOLDIER_COOLDOWN_CRYO] ) { // Blit Closed eyes here! BltVideoObjectFromIndex( uiRenderBuffer, pFace->uiVideoObject, 2, usEyesX, usEyesY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -1905,7 +1904,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } - if ( MercPtrs[ pFace->ubSoldierID ]->bInSector && ( ( ( gTacticalStatus.ubCurrentTeam != OUR_TEAM ) || !OK_INTERRUPT_MERC( MercPtrs[ pFace->ubSoldierID ] ) ) && !gfHiddenInterrupt ) || ( ( gfSMDisableForItems && !gfInItemPickupMenu ) && gusSMCurrentMerc == pFace->ubSoldierID && gsCurInterfacePanel == SM_PANEL ) ) + if ( pSoldier->bInSector && ( ( ( gTacticalStatus.ubCurrentTeam != OUR_TEAM ) || !OK_INTERRUPT_MERC( pSoldier ) ) && !gfHiddenInterrupt ) || ( ( gfSMDisableForItems && !gfInItemPickupMenu ) && gusSMCurrentMerc == pSoldier && gsCurInterfacePanel == SM_PANEL ) ) { // Blit hatch! BltVideoObjectFromIndex( uiRenderBuffer, guiHATCH, 0, sFaceX, sFaceY, VO_BLT_SRCTRANSPARENCY, NULL ); @@ -1913,12 +1912,12 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } // sevenfm: only show for alive soldiers, no face icons for big faces - if (MercPtrs[pFace->ubSoldierID]->stats.bLife > 0 && !(pFace->uiFlags & FACE_BIGFACE)) + if (pSoldier->stats.bLife > 0 && !(pFace->uiFlags & FACE_BIGFACE)) { // Check if a robot and is not controlled.... - if (MercPtrs[pFace->ubSoldierID]->flags.uiStatusFlags & SOLDIER_ROBOT) + if (pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT) { - if (!MercPtrs[pFace->ubSoldierID]->CanRobotBeControlled()) + if (!pSoldier->CanRobotBeControlled()) { // Not controlled robot sIconIndex = 5; @@ -1926,7 +1925,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } } - if (MercPtrs[pFace->ubSoldierID]->ControllingRobot()) + if (pSoldier->ControllingRobot()) { // controlling robot sIconIndex = 4; @@ -1939,10 +1938,10 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // this section chooses the icons for face gear if the ini setting "SHOW_TACTICAL_FACE_ICONS" is TRUE // and the merc actually wears something to be shown if (gGameSettings.fOptions[TOPTION_SHOW_TACTICAL_FACE_ICONS] && - (MercPtrs[pFace->ubSoldierID]->inv[HEAD1POS].usItem + MercPtrs[pFace->ubSoldierID]->inv[HEAD2POS].usItem) > 0) + (pSoldier->inv[HEAD1POS].usItem + pSoldier->inv[HEAD2POS].usItem) > 0) { - uiFaceItemOne = MercPtrs[pFace->ubSoldierID]->inv[HEAD1POS].usItem; - uiFaceItemTwo = MercPtrs[pFace->ubSoldierID]->inv[HEAD2POS].usItem; + uiFaceItemOne = pSoldier->inv[HEAD1POS].usItem; + uiFaceItemTwo = pSoldier->inv[HEAD2POS].usItem; //MM: fixing the hardcoded craziness here... // check first face slot @@ -2050,20 +2049,20 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } // If blind... - if (MercPtrs[pFace->ubSoldierID]->bBlindedCounter > 0) + if (pSoldier->bBlindedCounter > 0) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 6); bNumRightIcons++; } // Flugente: add drug symbol if drugged (without alcohol) - if (MercDrugged(MercPtrs[pFace->ubSoldierID])) + if (MercDrugged(pSoldier)) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 7); bNumRightIcons++; } - if (GetDrunkLevel(MercPtrs[pFace->ubSoldierID]) != SOBER) + if (GetDrunkLevel(pSoldier) != SOBER) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 8); bNumRightIcons++; @@ -2072,13 +2071,13 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // Flugente: food system - symbols used if hungry or thirsty if (UsingFoodSystem()) { - if (MercPtrs[pFace->ubSoldierID]->bDrinkLevel < FoodMoraleMods[FOOD_MERC_START_SHOW_HUNGER_SYMBOL].bThreshold) + if (pSoldier->bDrinkLevel < FoodMoraleMods[FOOD_MERC_START_SHOW_HUNGER_SYMBOL].bThreshold) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 9); bNumRightIcons++; } - if (MercPtrs[pFace->ubSoldierID]->bFoodLevel < FoodMoraleMods[FOOD_MERC_START_SHOW_HUNGER_SYMBOL].bThreshold) + if (pSoldier->bFoodLevel < FoodMoraleMods[FOOD_MERC_START_SHOW_HUNGER_SYMBOL].bThreshold) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 10); bNumRightIcons++; @@ -2094,7 +2093,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE UINT16 ubID2 = 0; UINT16 ubGunSlot2 = 0; UINT16 ubFaceSlot2 = 0; - if (MercPtrs[pFace->ubSoldierID]->IsFeedingExternal(&ubID1, &ubGunSlot1, &ubFaceSlot1, &ubID2, &ubGunSlot2, &ubFaceSlot2)) + if (pSoldier->IsFeedingExternal(&ubID1, &ubGunSlot1, &ubFaceSlot1, &ubID2, &ubGunSlot2, &ubFaceSlot2)) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 11); bNumRightIcons++; @@ -2102,33 +2101,33 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } // Flugente: add an icon if we are currently in disguise - if (MercPtrs[pFace->ubSoldierID]->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER)) + if (pSoldier->usSoldierFlagMask & (SOLDIER_COVERT_CIV | SOLDIER_COVERT_SOLDIER)) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 12); bNumRightIcons++; } // Flugente: add an icon if we are performing a multi-turn action - if (MercPtrs[pFace->ubSoldierID]->GetMultiTurnAction() == MTA_HACK) + if (pSoldier->GetMultiTurnAction() == MTA_HACK) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 30); bNumRightIcons++; } - else if (MercPtrs[pFace->ubSoldierID]->GetMultiTurnAction() > MTA_NONE) + else if (pSoldier->GetMultiTurnAction() > MTA_NONE) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 14); bNumRightIcons++; } // Flugente: icons for radio operator actions (not the assignment) - if (MercPtrs[pFace->ubSoldierID]->bAssignment != RADIO_SCAN) + if (pSoldier->bAssignment != RADIO_SCAN) { - if (MercPtrs[pFace->ubSoldierID]->usSoldierFlagMask & (SOLDIER_RADIO_OPERATOR_SCANNING | SOLDIER_RADIO_OPERATOR_LISTENING)) + if (pSoldier->usSoldierFlagMask & (SOLDIER_RADIO_OPERATOR_SCANNING | SOLDIER_RADIO_OPERATOR_LISTENING)) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 19); bNumRightIcons++; } - else if (MercPtrs[pFace->ubSoldierID]->usSoldierFlagMask & SOLDIER_RADIO_OPERATOR_JAMMING) + else if (pSoldier->usSoldierFlagMask & SOLDIER_RADIO_OPERATOR_JAMMING) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 20); bNumRightIcons++; @@ -2136,9 +2135,9 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } // Flugente: spotter - if (MercPtrs[pFace->ubSoldierID]->usSkillCounter[SOLDIER_COUNTER_SPOTTER] > 0) + if (pSoldier->usSkillCounter[SOLDIER_COUNTER_SPOTTER] > 0) { - if (MercPtrs[pFace->ubSoldierID]->IsSpotting()) + if (pSoldier->IsSpotting()) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 24); bNumRightIcons++; @@ -2151,21 +2150,21 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } // Flugente: focus trait - if (MercPtrs[pFace->ubSoldierID]->usSoldierFlagMask2 & SOLDIER_TRAIT_FOCUS) + if (pSoldier->usSoldierFlagMask2 & SOLDIER_TRAIT_FOCUS) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 17); bNumRightIcons++; } // Flugente: disease - if (MercPtrs[pFace->ubSoldierID]->HasDisease(TRUE, FALSE, TRUE)) + if (pSoldier->HasDisease(TRUE, FALSE, TRUE)) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 28); bNumRightIcons++; } // Flugente: drag stuff - if (MercPtrs[pFace->ubSoldierID]->IsDragging()) + if (pSoldier->IsDragging()) { DoRightIcon(uiRenderBuffer, pFace, sFaceX, sFaceY, bNumRightIcons, 31); ++bNumRightIcons; @@ -2178,7 +2177,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE case DOCTOR_MILITIA: sIconIndex_Assignment = 1; fDoIcon_Assignment = TRUE; - sPtsAvailable = CalculateHealingPointsForDoctor(MercPtrs[pFace->ubSoldierID], &usMaximumPts, FALSE); + sPtsAvailable = CalculateHealingPointsForDoctor(pSoldier, &usMaximumPts, FALSE); fShowCustomText = TRUE; @@ -2201,8 +2200,8 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sIconIndex_Assignment = 2; fDoIcon_Assignment = TRUE; // show current health / maximum health - sPtsAvailable = MercPtrs[pFace->ubSoldierID]->stats.bLife; - usMaximumPts = MercPtrs[pFace->ubSoldierID]->stats.bLifeMax; + sPtsAvailable = pSoldier->stats.bLife; + usMaximumPts = pSoldier->stats.bLifeMax; fShowNumber = TRUE; fShowMaximum = TRUE; break; @@ -2218,27 +2217,27 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE fShowNumber = TRUE; fShowMaximum = TRUE; - switch (MercPtrs[pFace->ubSoldierID]->bAssignment) + switch (pSoldier->bAssignment) { case(TRAIN_SELF) : - sPtsAvailable = GetSoldierTrainingPts(MercPtrs[pFace->ubSoldierID], MercPtrs[pFace->ubSoldierID]->bTrainStat, &usMaximumPts); + sPtsAvailable = GetSoldierTrainingPts(pSoldier, pSoldier->bTrainStat, &usMaximumPts); break; case(TRAIN_BY_OTHER) : - sPtsAvailable = GetSoldierStudentPts(MercPtrs[pFace->ubSoldierID], MercPtrs[pFace->ubSoldierID]->bTrainStat, &usMaximumPts); + sPtsAvailable = GetSoldierStudentPts(pSoldier, pSoldier->bTrainStat, &usMaximumPts); break; case(TRAIN_TOWN) : case DRILL_MILITIA: - sPtsAvailable = GetTownTrainPtsForCharacter(MercPtrs[pFace->ubSoldierID], &usMaximumPts); + sPtsAvailable = GetTownTrainPtsForCharacter(pSoldier, &usMaximumPts); // divide both amounts by 10 to make the displayed numbers a little more user-palatable (smaller) sPtsAvailable = (sPtsAvailable + 5) / 10; usMaximumPts = (usMaximumPts + 5) / 10; break; case(TRAIN_TEAMMATE) : - sPtsAvailable = GetBonusTrainingPtsDueToInstructor(MercPtrs[pFace->ubSoldierID], NULL, MercPtrs[pFace->ubSoldierID]->bTrainStat, &usMaximumPts); + sPtsAvailable = GetBonusTrainingPtsDueToInstructor(pSoldier, NULL, pSoldier->bTrainStat, &usMaximumPts); break; case TRAIN_WORKERS: fShowMaximum = FALSE; - sPtsAvailable = GetTrainWorkerPts(MercPtrs[pFace->ubSoldierID]); + sPtsAvailable = GetTrainWorkerPts(pSoldier); break; } break; @@ -2249,24 +2248,24 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE fDoIcon_Assignment = TRUE; // Show repair points if merc has a toolkit in his hand. Otherwise show cleaning points. if (ItemIsToolkit(pSoldier->inv[HANDPOS].usItem)) - sPtsAvailable = CalculateRepairPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts, FALSE); + sPtsAvailable = CalculateRepairPointsForRepairman(pSoldier, &usMaximumPts, FALSE); else - sPtsAvailable = CalculateCleaningPointsForRepairman(MercPtrs[pFace->ubSoldierID], &usMaximumPts); + sPtsAvailable = CalculateCleaningPointsForRepairman(pSoldier, &usMaximumPts); fShowNumber = TRUE; fShowMaximum = TRUE; // check if we are repairing a vehicle - if (Menptr[pFace->ubSoldierID].bVehicleUnderRepairID != -1) + if (pSoldier->bVehicleUnderRepairID != -1) { // reduce to a multiple of VEHICLE_REPAIR_POINTS_DIVISOR. This way skill too low will show up as 0 repair pts. sPtsAvailable -= (sPtsAvailable % VEHICLE_REPAIR_POINTS_DIVISOR); usMaximumPts -= (usMaximumPts % VEHICLE_REPAIR_POINTS_DIVISOR); } - else if (Menptr[pFace->ubSoldierID].flags.fFixingSAMSite) + else if (pSoldier->flags.fFixingSAMSite) { sPtsAvailable = (sPtsAvailable / SAM_SITE_REPAIR_DIVISOR); - INT16 sector = CALCULATE_STRATEGIC_INDEX(Menptr[pFace->ubSoldierID].sSectorX, Menptr[pFace->ubSoldierID].sSectorY); + INT16 sector = CALCULATE_STRATEGIC_INDEX(pSoldier->sSectorX, pSoldier->sSectorY); usMaximumPts = 100 - StrategicMap[sector].bSAMCondition; } @@ -2336,7 +2335,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE case DISEASE_DOCTOR_SECTOR: sIconIndex_Assignment = 1; fDoIcon_Assignment = TRUE; - sPtsAvailable = CalculateHealingPointsForDoctor(MercPtrs[pFace->ubSoldierID], &usMaximumPts, FALSE); + sPtsAvailable = CalculateHealingPointsForDoctor(pSoldier, &usMaximumPts, FALSE); fShowNumber = TRUE; fShowMaximum = TRUE; @@ -2348,15 +2347,15 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE case FORTIFICATION: sIconIndex_Assignment = 14; fDoIcon_Assignment = TRUE; - sPtsAvailable = (INT16)(MercPtrs[pFace->ubSoldierID]->GetConstructionPoints()); + sPtsAvailable = (INT16)(pSoldier->GetConstructionPoints()); fShowNumber = TRUE; fShowMaximum = TRUE; { - if (MercPtrs[pFace->ubSoldierID]->bSectorZ) + if (pSoldier->bSectorZ) { UNDERGROUND_SECTORINFO *pSectorInfo; - pSectorInfo = FindUnderGroundSector(MercPtrs[pFace->ubSoldierID]->sSectorX, MercPtrs[pFace->ubSoldierID]->sSectorY, MercPtrs[pFace->ubSoldierID]->bSectorZ); + pSectorInfo = FindUnderGroundSector(pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ); if (pSectorInfo) usMaximumPts = (INT16)(pSectorInfo->dFortification_MaxPossible); @@ -2364,7 +2363,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE else { SECTORINFO *pSectorInfo; - pSectorInfo = &SectorInfo[SECTOR(MercPtrs[pFace->ubSoldierID]->sSectorX, MercPtrs[pFace->ubSoldierID]->sSectorY)]; + pSectorInfo = &SectorInfo[SECTOR(pSoldier->sSectorX, pSoldier->sSectorY)]; if (pSectorInfo) usMaximumPts = (INT16)(pSectorInfo->dFortification_MaxPossible); @@ -2384,8 +2383,8 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } else { - bPtsAvailable = MercPtrs[pFace->ubSoldierID]->GetIntelGain(); - usMaximumPts = (UINT16)(MercPtrs[pFace->ubSoldierID]->GetUncoverRisk()); + bPtsAvailable = pSoldier->GetIntelGain(); + usMaximumPts = (UINT16)(pSoldier->GetUncoverRisk()); swprintf(sString, L"%4.2f/%d%%%%", bPtsAvailable, usMaximumPts); @@ -2397,7 +2396,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sIconIndex_Assignment = 35; fDoIcon_Assignment = TRUE; fShowCustomText = TRUE; - bPtsAvailable = MercPtrs[pFace->ubSoldierID]->GetBurialPoints(&usMaximumPts); + bPtsAvailable = pSoldier->GetBurialPoints(&usMaximumPts); swprintf(sString, L"%3.1f/%d", bPtsAvailable, usMaximumPts); break; @@ -2406,8 +2405,8 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sIconIndex_Assignment = 36; fDoIcon_Assignment = TRUE; fShowCustomText = TRUE; - sPtsAvailable = (INT16)MercPtrs[pFace->ubSoldierID]->GetAdministrationPoints(); - bPtsAvailable = GetAdministrationPercentage(MercPtrs[pFace->ubSoldierID]->sSectorX, MercPtrs[pFace->ubSoldierID]->sSectorY); + sPtsAvailable = (INT16)pSoldier->GetAdministrationPoints(); + bPtsAvailable = GetAdministrationPercentage(pSoldier->sSectorX, pSoldier->sSectorY); swprintf(sString, L"%d/%3.1f", sPtsAvailable, bPtsAvailable); break; @@ -2416,7 +2415,7 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE sIconIndex_Assignment = 34; fDoIcon_Assignment = TRUE; fShowCustomText = TRUE; - sPtsAvailable = (INT16)MercPtrs[pFace->ubSoldierID]->GetExplorationPoints(); + sPtsAvailable = (INT16)pSoldier->GetExplorationPoints(); // we only show our points, not how far we are with the task, lest the player deduct how many items there are to find in the first place swprintf( sString, L"%d", sPtsAvailable ); @@ -2424,14 +2423,14 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE } // Check for being serviced... - if (MercPtrs[pFace->ubSoldierID]->ubServicePartner != NOBODY) + if (pSoldier->ubServicePartner != NOBODY) { // Doctor... sIconIndex_Assignment = 1; fDoIcon_Assignment = TRUE; } - if (MercPtrs[pFace->ubSoldierID]->ubServiceCount != 0) + if (pSoldier->ubServiceCount != 0) { // Patient sIconIndex_Assignment = 2; @@ -2622,7 +2621,7 @@ BOOLEAN RenderAutoFace( INT32 iFaceIndex ) // Set shade if ( pFace->ubSoldierID != NOBODY ) { - uiFaceShade = GetFaceShade(MercPtrs[pFace->ubSoldierID], pFace, FALSE); + uiFaceShade = GetFaceShade(pFace->ubSoldierID, pFace, FALSE); SetFaceShade(pFace, uiFaceShade); } @@ -2655,12 +2654,12 @@ BOOLEAN RenderAutoFace( INT32 iFaceIndex ) } -BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, UINT16 ubSoldierID, INT16 sX, INT16 sY ) +BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, SoldierID ubSoldierID, INT16 sX, INT16 sY ) { // Check for valid soldier CHECKF( ubSoldierID != NOBODY ); - return( ExternRenderFace( uiBuffer, MercPtrs[ ubSoldierID ]->iFaceIndex, sX, sY ) ); + return( ExternRenderFace( uiBuffer, ubSoldierID->iFaceIndex, sX, sY ) ); } @@ -2686,7 +2685,7 @@ BOOLEAN ExternRenderFace( UINT32 uiBuffer, INT32 iFaceIndex, INT16 sX, INT16 sY UINT32 uiFaceShade = FLASH_PORTRAIT_NOSHADE; if ( pFace->ubSoldierID != NOBODY ) { - uiFaceShade = GetFaceShade(MercPtrs[pFace->ubSoldierID], pFace, TRUE); + uiFaceShade = GetFaceShade(pFace->ubSoldierID, pFace, TRUE); SetFaceShade(pFace, uiFaceShade); } @@ -2848,7 +2847,7 @@ void HandleAutoFaces( ) if ( pFace->ubSoldierID != NOBODY ) { // Get Life now - pSoldier = MercPtrs[ pFace->ubSoldierID ]; + pSoldier = pFace->ubSoldierID; bLife = pSoldier->stats.bLife; bInSector = pSoldier->bInSector; bAPs = pSoldier->bActionPoints; diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 5e7b5ca6..553a2ad7 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -295,7 +295,7 @@ INT32 giSKIMessageBox=-1; INT8 gbSelectedArmsDealerID = -1; //Contains the enum value for the currently selected arms dealer // Flugente: while we're trading, store the ID of non-NPC dealers -UINT16 gusIDOfCivTrader = NOBODY; +SoldierID gusIDOfCivTrader = NOBODY; //the quote that is in progress, in certain circumstances, we don't want queuing of related but different quotes INT32 giShopKeepDialogueEventinProgress = - 1; @@ -770,7 +770,7 @@ BOOLEAN EnterShopKeeperInterface() SOLDIERTYPE* pShopkeeper = NULL; if ( gusIDOfCivTrader != NOBODY ) - pShopkeeper = MercPtrs[gusIDOfCivTrader]; + pShopkeeper = gusIDOfCivTrader; else pShopkeeper = FindSoldierByProfileID( armsDealerInfo[gbSelectedArmsDealerID].ubShopKeeperID, FALSE ); @@ -1027,7 +1027,7 @@ BOOLEAN EnterShopKeeperInterface() { //add the item back to the current PC into the slot it came from //ADB screw slot, slot is (used to be, before it was deleted) only ever, so autoplace it - AutoPlaceObject(&Menptr[ gpSMCurrentMerc->ubID ], &gItemToAdd.ItemObject, FALSE); + AutoPlaceObject(gpSMCurrentMerc->ubID, &gItemToAdd.ItemObject, FALSE); } //Clear the contents of the structure @@ -1472,7 +1472,7 @@ BOOLEAN RenderShopKeeperInterface() // Flugente: if this is a non-NPC dealer, we instead show their body in their current animation else if ( gusIDOfCivTrader != NOBODY ) { - SOLDIERTYPE* pSoldier = MercPtrs[gusIDOfCivTrader]; + SOLDIERTYPE* pSoldier = gusIDOfCivTrader; if ( pSoldier ) { @@ -2457,7 +2457,7 @@ void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer ) } // Flugente: set up shopkeeper with a non-NPC -void EnterShopKeeperInterfaceScreen_NonNPC( INT8 ubArmsDealerID, UINT16 aMercID ) +void EnterShopKeeperInterfaceScreen_NonNPC( INT8 ubArmsDealerID, SoldierID aMercID ) { gusIDOfCivTrader = aMercID; diff --git a/Tactical/ShopKeeper Interface.h b/Tactical/ShopKeeper Interface.h index 549a0bea..af7565a0 100644 --- a/Tactical/ShopKeeper Interface.h +++ b/Tactical/ShopKeeper Interface.h @@ -97,7 +97,7 @@ bool RepairmanItemQsortCompare(INVENTORY_IN_SLOT& pInvSlot1, INVENTORY_IN_SLOT& void EnterShopKeeperInterfaceScreen( UINT8 ubArmsDealer ); // Flugente: set up shopkeeper with a non-NPC -void EnterShopKeeperInterfaceScreen_NonNPC( INT8 ubArmsDealerID, UINT16 aMercID ); +void EnterShopKeeperInterfaceScreen_NonNPC( INT8 ubArmsDealerID, SoldierID aMercID ); void EnableDisableShopkeeperButtons(UINT32 uiCurrentItemDescriptionScreen, int bpAction); diff --git a/Tactical/faces.h b/Tactical/faces.h index adfa524d..bb88eb38 100644 --- a/Tactical/faces.h +++ b/Tactical/faces.h @@ -104,7 +104,7 @@ typedef struct typedef struct { UINT32 uiFlags; // Basic flags - INT32 iID; + INT32 iID; BOOLEAN fAllocated; //Allocated or not BOOLEAN fTalking; //Set to true if face is talking ( can be sitting for user input to esc ) BOOLEAN fAnimatingTalking; // Set if the face is animating right now @@ -119,12 +119,12 @@ typedef struct BOOLEAN fFinishTalking; // A flag to indicate we want to delay after speech done - INT32 iVideoOverlay; // Value for video overlay ( not used too much ) + INT32 iVideoOverlay; // Value for video overlay ( not used too much ) UINT32 uiSoundID; // Sound ID if one being played - UINT16 ubSoldierID; // SoldierID if one specified - UINT8 ubCharacterNum; // Profile ID num + SoldierID ubSoldierID; // SoldierID if one specified + UINT8 ubCharacterNum; // Profile ID num UINT16 usFaceX; // X location to render face UINT16 usFaceY; // Y location to render face @@ -137,7 +137,7 @@ typedef struct BOOLEAN fDisplayTextOver; // Boolean indicating to display text on face BOOLEAN fOldDisplayTextOver; // OLD Boolean indicating to display text on face BOOLEAN fCanHandleInactiveNow; - wchar_t zDisplayText[ 30 ]; // String of text that can be displayed + wchar_t zDisplayText[ 30 ]; // String of text that can be displayed UINT16 usEyesX; UINT16 usEyesY; @@ -162,10 +162,10 @@ typedef struct UINT32 uiExpressionFrequency; UINT32 uiStopOverlayTimer; - UINT8 ubExpression; + UINT8 ubExpression; INT8 bOldSoldierLife; - INT16 bOldActionPoints; + INT16 bOldActionPoints; BOOLEAN fOldHandleUIHatch; BOOLEAN fOldShowHighlight; INT8 bOldAssignment; @@ -200,14 +200,14 @@ extern FACETYPE gFacesData[ NUM_FACE_SLOTS ]; // FACE HANDLING // // Faces are done like this: Call -INT32 InitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags ); +INT32 InitFace( UINT8 usMercProfileID, SoldierID ubSoldierID, UINT32 uiInitFlags ); // The first parameter is the profile ID and the second is the soldier ID ( which for most cases // will be NOBODY if the face is not created from a SOLDIERTYPE ) // This function allocates a slot in the table for the face, loads it's STI file, sets some // values for X,Y locations of eyes from the profile. Does not mkae the face visible or anything like that // INternal init face, called if you don;t want to give a profile ID ( send NO_PROFILE ) for ID -INT32 InternalInitFace( UINT8 usMercProfileID, UINT16 ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ); +INT32 InternalInitFace( UINT8 usMercProfileID, SoldierID ubSoldierID, UINT32 uiInitFlags, INT32 iFaceFileID, UINT32 uiBlinkFrequency, UINT32 uiExpressionFrequency ); // Removes the face from the internal table, deletes any memory allocated if any. @@ -279,10 +279,10 @@ void HandleTalkingAutoFaces( ); // Same Functions but taking soldier ID first to get profile ID INT32 InitSoldierFace( SOLDIERTYPE *pSoldier ); void DeleteSoldierFace( SOLDIERTYPE *pSoldier ); -void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, UINT16 ubSoldierID, UINT16 usFaceX, UINT16 usFaceY ); -void SetAutoFaceInActiveFromSoldier( UINT16 ubSoldierID ); -BOOLEAN RenderAutoFaceFromSoldier( UINT16 ubSoldierID ); -BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, UINT16 ubSoldierID, INT16 sX, INT16 sY ); +void SetAutoFaceActiveFromSoldier( UINT32 uiDisplayBuffer, UINT32 uiRestoreBuffer, SoldierID ubSoldierID, UINT16 usFaceX, UINT16 usFaceY ); +void SetAutoFaceInActiveFromSoldier( SoldierID ubSoldierID ); +BOOLEAN RenderAutoFaceFromSoldier( SoldierID ubSoldierID ); +BOOLEAN ExternRenderFaceFromSoldier( UINT32 uiBuffer, SoldierID ubSoldierID, INT16 sX, INT16 sY ); From f50bdf99ccbc3deff6c222853ece99e33a4072d1 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 20:41:09 +0200 Subject: [PATCH 112/571] Convert to SoldierID --- Multiplayer/client.cpp | 36 +++++++-------- Multiplayer/connect.h | 6 +-- Strategic/LuaInitNPCs.cpp | 4 +- Strategic/LuaInitNPCs.h | 2 +- Tactical/Faces.cpp | 4 +- Tactical/Handle Items.cpp | 86 +++++++++++++++++------------------ Tactical/Handle Items.h | 2 +- Tactical/Handle UI.cpp | 50 ++++++++++---------- Tactical/Handle UI.h | 18 ++++---- Tactical/Interface Items.cpp | 42 ++++++++--------- Tactical/Interface Items.h | 2 +- Tactical/Interface Panels.cpp | 22 ++++----- Tactical/Interface Panels.h | 12 ++--- Tactical/Item Types.h | 8 ++-- Tactical/Items.cpp | 8 ++-- Tactical/LOS.cpp | 2 +- Tactical/LOS.h | 4 +- Tactical/Overhead.h | 2 +- Tactical/Soldier Control.cpp | 33 +++++++------- Tactical/Soldier Control.h | 2 +- Tactical/Vehicles.cpp | 28 ++++++------ Tactical/Vehicles.h | 6 +-- 22 files changed, 188 insertions(+), 191 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 4d967455..f6c28480 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -388,16 +388,16 @@ typedef struct typedef struct { - UINT16 usSoldierID; - FLOAT dNewXPos; - FLOAT dNewYPos; + SoldierID usSoldierID; + FLOAT dNewXPos; + FLOAT dNewYPos; } gui_pos; typedef struct { - UINT16 usSoldierID; - INT16 usNewDirection; + SoldierID usSoldierID; + INT16 usNewDirection; } gui_dir; @@ -425,12 +425,12 @@ typedef struct typedef struct { - UINT16 ubID; + SoldierID ubID; INT8 bTeam; UINT16 gubOutOfTurnPersons; UINT16 gubOutOfTurnOrder[MAXMERCS]; BOOLEAN fMarkInterruptOccurred; - UINT16 Interrupted; + SoldierID Interrupted; } INT_STRUCT; typedef struct @@ -486,7 +486,7 @@ typedef struct float dZ; INT32 sGridNo; bool bWasDud; - UINT16 ubOwnerID; + SoldierID ubOwnerID; INT32 RealObjectID; // the local ID on the initiating client UINT32 uiPreRandomIndex; // send out our current pre-random index } grenade_result; @@ -967,7 +967,7 @@ void send_hit( EV_S_WEAPONHIT *SWeaponHit ) memcpy( &weaphit_struct , SWeaponHit, sizeof( EV_S_WEAPONHIT )); - UINT16 usSoldierID=weaphit_struct.usSoldierID; + SoldierID usSoldierID = weaphit_struct.usSoldierID; if(SWeaponHit->usSoldierID < 20)weaphit_struct.usSoldierID = weaphit_struct.usSoldierID+ubID_prefix; if(SWeaponHit->ubAttackerID < 20)weaphit_struct.ubAttackerID = weaphit_struct.ubAttackerID+ubID_prefix; @@ -981,9 +981,9 @@ void recieveHIT(RPCParameters *rpcParameters) EV_S_WEAPONHIT* SWeaponHit = (EV_S_WEAPONHIT*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ SWeaponHit->usSoldierID ]; - UINT16 usSoldierID; - UINT16 ubAttackerID; + SOLDIERTYPE *pSoldier = SWeaponHit->usSoldierID; + SoldierID usSoldierID; + SoldierID ubAttackerID; if((SWeaponHit->usSoldierID >= ubID_prefix) && (SWeaponHit->usSoldierID < (ubID_prefix+6))) // within our netbTeam range... usSoldierID = (SWeaponHit->usSoldierID - ubID_prefix); @@ -1157,7 +1157,7 @@ void send_gui_pos(SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos) { gui_pos gnPOS; - gnPOS.usSoldierID = (pSoldier->ubID)+ubID_prefix; + gnPOS.usSoldierID = pSoldier->ubID + ubID_prefix; gnPOS.dNewXPos = dNewXPos; gnPOS.dNewYPos = dNewYPos; @@ -1916,7 +1916,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) memcpy(INT.gubOutOfTurnOrder, gubOutOfTurnOrder, sizeof(UINT16) * MAXMERCS); INT.gubOutOfTurnPersons = gubOutOfTurnPersons; - INT.Interrupted=gusSelectedSoldier+ubID_prefix; + INT.Interrupted = gusSelectedSoldier + ubID_prefix; if(INT.bTeam==0) { @@ -3030,11 +3030,11 @@ void recieveGRENADE (RPCParameters *rpcParameters) } // we send a grenade result out to the clients as it may have been a fizzer -void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, UINT8 ubOwnerID, INT32 iRealObjectID, bool bIsDud) +void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, SoldierID ubOwnerID, INT32 iRealObjectID, bool bIsDud) { ubOwnerID = MPEncodeSoldierID(ubOwnerID); // translate our soldier to the "network" version - SOLDIERTYPE* pSoldier = MercPtrs[ubOwnerID]; + SOLDIERTYPE* pSoldier = ubOwnerID; if (pSoldier != NULL) { if ((pSoldier->bTeam == 1 && is_server) || IsOurSoldier(pSoldier)) @@ -3343,11 +3343,11 @@ void recieveDETONATEEXPLOSIVE (RPCParameters *rpcParameters) } } -void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldItem, UINT16 ubID) +void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldItem, SoldierID ubID) { ubID = MPEncodeSoldierID(ubID); - SOLDIERTYPE* pSoldier = MercPtrs[ubID]; + SOLDIERTYPE* pSoldier = ubID; if (pSoldier != NULL) { // explosive disarmed on this client, notify the other clients diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index e0975256..75f5d48b 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -112,14 +112,14 @@ void send_interrupt(SOLDIERTYPE *pSoldier); // OJW - 20091002 - explosives void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade); -void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, UINT8 ubOwnerID, INT32 iRealObjectID, bool bIsDud); +void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, SoldierID ubOwnerID, INT32 iRealObjectID, bool bIsDud); void send_plant_explosive (UINT16 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldIndex); void send_detonate_explosive (UINT32 uiWorldIndex, UINT16 ubID); void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ); void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, INT32 iSmokeEffectID); void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, SoldierID ubOwner ); void send_explosivedamage( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ); -void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldIndex, UINT16 ubID); +void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldIndex, SoldierID ubID); void OpenChatMsgBox(void); @@ -211,7 +211,7 @@ extern BOOLEAN fClientReceivedAllFiles; // sick of confusing myself :) // this one should be called before passing an ID off the client -inline UINT16 MPEncodeSoldierID( UINT16 ubID ) +inline SoldierID MPEncodeSoldierID( SoldierID ubID ) { if ( ubID < 20 ) return ubID + ubID_prefix; // soldier is ours diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 84c9a86f..f8ad68eb 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -2717,7 +2717,7 @@ void LuaHandleSectorLiberation( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, B void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, - INT32 sGridNo, UINT8 bLevel, UINT16 ubId, + INT32 sGridNo, UINT8 bLevel, SoldierID ubId, UINT16 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ) { const char* filename = "scripts\\Overhead.lua"; @@ -2731,7 +2731,7 @@ void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, SGP_THROW_IFFALSE( _LS.L.EvalFile( filename ), _BS( "Cannot open file: " ) << filename << _BS::cget ); - LuaFunction( _LS.L, "HandleInteractiveActionResult" ).Param( sSectorX ).Param( sSectorY ).Param( bSectorZ ).Param( sGridNo ).Param( bLevel ).Param( ubId ).Param( usActionType ).Param( sLuaactionid ).Param( difficulty ).Param( skill ).Call( 10 ); + LuaFunction( _LS.L, "HandleInteractiveActionResult" ).Param( sSectorX ).Param( sSectorY ).Param( bSectorZ ).Param( sGridNo ).Param( bLevel ).Param( ubId.i ).Param( usActionType ).Param( sLuaactionid ).Param( difficulty ).Param( skill ).Call( 10 ); } void LuaRecruitRPCAdditionalHandling( UINT8 usProfile ) diff --git a/Strategic/LuaInitNPCs.h b/Strategic/LuaInitNPCs.h index 043c0fa1..4a78976d 100644 --- a/Strategic/LuaInitNPCs.h +++ b/Strategic/LuaInitNPCs.h @@ -62,7 +62,7 @@ extern BOOLEAN LuaHandleQuestCodeOnSector( INT16 sSectorX, INT16 sSectorY, INT8 void LuaHandleSectorLiberation( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fFirstTime ); void LuaHandleInteractiveActionResult( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, - INT32 sGridNo, UINT8 bLevel, UINT16 ubId, + INT32 sGridNo, UINT8 bLevel, SoldierID ubId, UINT16 usActionType, INT32 sLuaactionid, INT32 difficulty, UINT16 skill ); void LuaRecruitRPCAdditionalHandling( UINT8 usProfile ); void LuaHandleSectorTacticalEntry( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, BOOLEAN fHasEverBeenPlayerControlled ); diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index a61a627f..97415f41 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -2087,10 +2087,10 @@ void HandleRenderFaceAdjustments( FACETYPE *pFace, BOOLEAN fDisplayBuffer, BOOLE // Flugente: are we supplying ammo to someone else? if (gGameExternalOptions.ubExternalFeeding > 0) { - UINT16 ubID1 = 0; + SoldierID ubID1 = NOBODY; UINT16 ubGunSlot1 = 0; UINT16 ubFaceSlot1 = 0; - UINT16 ubID2 = 0; + SoldierID ubID2 = NOBODY; UINT16 ubGunSlot2 = 0; UINT16 ubFaceSlot2 = 0; if (pSoldier->IsFeedingExternal(&ubID1, &ubGunSlot1, &ubFaceSlot1, &ubID2, &ubGunSlot2, &ubFaceSlot2)) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index de09582e..d4a9abb9 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -239,20 +239,20 @@ BOOLEAN HandleCheckForBadChangeToGetThrough( SOLDIERTYPE *pSoldier, SOLDIERTYPE INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHandItem, BOOLEAN fFromUI ) { - SOLDIERTYPE *pTargetSoldier = NULL; - UINT16 usSoldierIndex; - INT32 sTargetGridNo; - INT16 sAPCost; - INT32 sActionGridNo; - UINT8 ubDirection = 0; - INT32 sAdjustedGridNo; - BOOLEAN fDropBomb = FALSE; - BOOLEAN fAddingTurningCost = FALSE; - BOOLEAN fAddingRaiseGunCost = FALSE; - LEVELNODE *pIntNode; - STRUCTURE *pStructure; - UINT16 usRaiseGunCost = 0; - UINT16 usTurningCost = 0; + SOLDIERTYPE *pTargetSoldier = NULL; + SoldierID usSoldierIndex; + INT32 sTargetGridNo; + INT16 sAPCost; + INT32 sActionGridNo; + UINT8 ubDirection = 0; + INT32 sAdjustedGridNo; + BOOLEAN fDropBomb = FALSE; + BOOLEAN fAddingTurningCost = FALSE; + BOOLEAN fAddingRaiseGunCost = FALSE; + LEVELNODE *pIntNode; + STRUCTURE *pStructure; + UINT16 usRaiseGunCost = 0; + UINT16 usTurningCost = 0; //shadooow: automatically close EDB when opened and trying to use any weapon or action if (gfInItemDescBox) @@ -277,7 +277,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa //if ( FindSoldier( sGridNo, &usSoldierIndex, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) if ( ( usSoldierIndex = WhoIsThere2( sGridNo, bLevel ) ) != NOBODY ) { - pTargetSoldier = MercPtrs[ usSoldierIndex ]; + pTargetSoldier = usSoldierIndex; // anv: don't try to heal interactive spots if (fFromUI && Item[usHandItem].usItemClass != IC_MEDKIT) @@ -1394,11 +1394,11 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa } } - UINT16 ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); + SoldierID ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); // Flugente: apply misc items to other soldiers // sevenfm: check that target soldier is visible - if (ItemCanBeAppliedToOthers(usHandItem) && ubPerson != NOBODY && MercPtrs[ubPerson] && MercPtrs[ubPerson]->bVisible != 0) + if (ItemCanBeAppliedToOthers(usHandItem) && ubPerson != NOBODY && ubPerson->bVisible != 0) { // ATE: AI CANNOT GO THROUGH HERE! BOOLEAN fHadToUseCursorPos = FALSE; @@ -4292,9 +4292,8 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && - MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) - swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pTempItemPool->iItemIndex].object.ubNumberOfObjects, MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pTempItemPool->iItemIndex].object.ubNumberOfObjects, gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ], gWorldItems[ pTempItemPool->iItemIndex ].object.ubNumberOfObjects ); } @@ -4303,9 +4302,8 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && - MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) - swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ] ); } @@ -4413,9 +4411,8 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && - MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) - swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].object.ubNumberOfObjects, MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].object.ubNumberOfObjects, gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ], gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects ); } @@ -4424,9 +4421,8 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY && - MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]) - swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], MercPtrs[gWorldItems[pItemPool->iItemIndex].soldierID]->GetName()); + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ] ); } @@ -4814,12 +4810,12 @@ void RenderTopmostFlashingItems( ) BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) { SOLDIERTYPE *pTSoldier; - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; OBJECTTYPE *pObject; INT32 sGridNo; - UINT8 ubDirection; - UINT16 ubTargetMercID; + UINT8 ubDirection; + SoldierID ubTargetMercID; // DO SOME CHECKS IF WE CAN DO ANIMATION..... @@ -4828,7 +4824,7 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) sGridNo = pSoldier->aiData.sPendingActionData2; ubDirection = pSoldier->aiData.bPendingActionData3; - ubTargetMercID = (UINT16)pSoldier->aiData.uiPendingActionData4; + ubTargetMercID = static_cast( pSoldier->aiData.uiPendingActionData4 ); usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); @@ -4864,7 +4860,7 @@ BOOLEAN VerifyGiveItem( SOLDIERTYPE *pSoldier, SOLDIERTYPE **ppTargetSoldier ) if ( ubTargetMercID != NOBODY ) { - MercPtrs[ ubTargetMercID ]->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); + ubTargetMercID->flags.uiStatusFlags &= (~SOLDIER_ENGAGEDINACTION ); } OBJECTTYPE::DeleteMe( &pSoldier->pTempObject ); @@ -5078,13 +5074,13 @@ void SoldierGiveItemFromAnimation( SOLDIERTYPE *pSoldier ) INT32 AdjustGridNoForItemPlacement( SOLDIERTYPE *pSoldier, INT32 sGridNo ) { - STRUCTURE *pStructure; - INT16 sDesiredLevel; - INT32 sActionGridNo; - BOOLEAN fStructFound = FALSE; - UINT8 ubDirection; - INT32 sAdjustedGridNo; - UINT16 ubTargetID; + STRUCTURE *pStructure; + INT16 sDesiredLevel; + INT32 sActionGridNo; + BOOLEAN fStructFound = FALSE; + UINT8 ubDirection; + INT32 sAdjustedGridNo; + SoldierID ubTargetID; sActionGridNo = sGridNo; @@ -9405,11 +9401,11 @@ void DoInteractiveAction( INT32 sGridNo, SOLDIERTYPE *pSoldier ) // handle the default result of an interactive action // This is called either if no lua action id is set, or by lua if this should happen as a supplement to whatever lua does -void DoInteractiveActionDefaultResult( INT32 sGridNo, UINT16 ubID, BOOLEAN aSuccess ) +void DoInteractiveActionDefaultResult( INT32 sGridNo, SoldierID ubID, BOOLEAN aSuccess ) { SOLDIERTYPE* pSoldier = NULL; if ( ubID != NOBODY ) - pSoldier = MercPtrs[ubID]; + pSoldier = ubID; // we need a valid soldier and a valid object if ( !pSoldier ) @@ -10457,9 +10453,9 @@ void TakePhoto(SOLDIERTYPE* pSoldier, INT32 sGridNo, INT8 bLevel ) InARoom( newgridno, &room ); // check if there is someone here - UINT16 ubid = WhoIsThere2( newgridno, bLevel ); + SoldierID ubid = WhoIsThere2( newgridno, bLevel ); - LuaAddPhotoData( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, newgridno, bLevel, pSoldier->ubProfile, room, ( ubid == NOBODY ) ? NO_PROFILE : MercPtrs[ubid]->ubProfile ); + LuaAddPhotoData( gWorldSectorX, gWorldSectorY, gbWorldSectorZ, newgridno, bLevel, pSoldier->ubProfile, room, ( ubid == NOBODY ) ? NO_PROFILE : ubid->ubProfile ); } } } diff --git a/Tactical/Handle Items.h b/Tactical/Handle Items.h index 596b889a..b01e4b4a 100644 --- a/Tactical/Handle Items.h +++ b/Tactical/Handle Items.h @@ -329,7 +329,7 @@ extern ITEM_POOL *gpItemPool;//dnl ch26 210909 // Flugente: interactive actions void DoInteractiveAction( INT32 sGridNo, SOLDIERTYPE *pSoldier ); -void DoInteractiveActionDefaultResult( INT32 sGridNo, UINT16 ubID, BOOLEAN aSuccess ); +void DoInteractiveActionDefaultResult( INT32 sGridNo, SoldierID ubID, BOOLEAN aSuccess ); BOOLEAN SpendMoney( SOLDIERTYPE *pSoldier, UINT32 aAmount ); // character spends money - either from inventory or the account // Flugente: intel diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 2ad4e76e..aa5c7910 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -429,41 +429,41 @@ INT16 guiCreateBadGuyIndex = 8; // FLAGS // These flags are set for a single frame execution and then are reset for the next iteration. -BOOLEAN gfUIDisplayActionPoints = FALSE; +BOOLEAN gfUIDisplayActionPoints = FALSE; BOOLEAN gfUIDisplayActionPointsInvalid = FALSE; BOOLEAN gfUIDisplayActionPointsBlack = FALSE; -BOOLEAN gfUIDisplayActionPointsCenter = FALSE; +BOOLEAN gfUIDisplayActionPointsCenter = FALSE; -INT16 gUIDisplayActionPointsOffY = 0; -INT16 gUIDisplayActionPointsOffX = 0; -BOOLEAN gfUIDoNotHighlightSelMerc = FALSE; -BOOLEAN gfUIHandleSelection = FALSE; -BOOLEAN gfUIHandleSelectionAboveGuy = FALSE; -BOOLEAN gfUIInDeadlock = FALSE; -UINT16 gUIDeadlockedSoldier = NOBODY; -BOOLEAN gfUIHandleShowMoveGrid = FALSE; +INT16 gUIDisplayActionPointsOffY = 0; +INT16 gUIDisplayActionPointsOffX = 0; +BOOLEAN gfUIDoNotHighlightSelMerc = FALSE; +BOOLEAN gfUIHandleSelection = FALSE; +BOOLEAN gfUIHandleSelectionAboveGuy = FALSE; +BOOLEAN gfUIInDeadlock = FALSE; +UINT16 gUIDeadlockedSoldier = NOBODY; +BOOLEAN gfUIHandleShowMoveGrid = FALSE; INT32 gsUIHandleShowMoveGridLocation = NOWHERE ; -BOOLEAN gfUIOverItemPool = FALSE; -INT32 gfUIOverItemPoolGridNo = 0; -INT16 gsCurrentActionPoints = 1; -BOOLEAN gfUIHandlePhysicsTrajectory = FALSE; -BOOLEAN gfUIMouseOnValidCatcher = FALSE; -UINT16 gubUIValidCatcherID = 0; +BOOLEAN gfUIOverItemPool = FALSE; +INT32 gfUIOverItemPoolGridNo = 0; +INT16 gsCurrentActionPoints = 1; +BOOLEAN gfUIHandlePhysicsTrajectory = FALSE; +BOOLEAN gfUIMouseOnValidCatcher = FALSE; +SoldierID gubUIValidCatcherID = NOBODY; -BOOLEAN gfUIConfirmExitArrows = FALSE; +BOOLEAN gfUIConfirmExitArrows = FALSE; -BOOLEAN gfUIShowCurIntTile = FALSE; +BOOLEAN gfUIShowCurIntTile = FALSE; -BOOLEAN gfUIWaitingForUserSpeechAdvance = FALSE; // Waiting for key input/mouse click to advance speech -BOOLEAN gfUIKeyCheatModeOn = FALSE; // Sets cool cheat keys on -BOOLEAN gfUIAllMoveOn = FALSE; // Sets to all move -BOOLEAN gfUICanBeginAllMoveCycle = FALSE; // GEts set so we know that the next right-click is a move-call inc\stead of a movement cycle through +BOOLEAN gfUIWaitingForUserSpeechAdvance = FALSE; // Waiting for key input/mouse click to advance speech +BOOLEAN gfUIKeyCheatModeOn = FALSE; // Sets cool cheat keys on +BOOLEAN gfUIAllMoveOn = FALSE; // Sets to all move +BOOLEAN gfUICanBeginAllMoveCycle = FALSE; // GEts set so we know that the next right-click is a move-call inc\stead of a movement cycle through -INT32 gsSelectedGridNo = 0; -INT16 gsSelectedLevel = I_GROUND_LEVEL; -INT16 gsSelectedGuy = NOBODY; +INT32 gsSelectedGridNo = 0; +INT16 gsSelectedLevel = I_GROUND_LEVEL; +INT16 gsSelectedGuy = NOBODY; BOOLEAN gfUIDisplayDamage = FALSE; INT8 gbDamage = 0; diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index 22bd3fa4..ce634e5c 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -181,7 +181,7 @@ extern UI_EVENT gEvents[ NUM_UI_EVENTS ]; extern UI_MODE gCurrentUIMode; extern UI_MODE gOldUIMode; extern UINT32 guiCurrentEvent; -extern INT16 gsSelectedLevel; +extern INT16 gsSelectedLevel; extern BOOLEAN gfPlotNewMovement; extern UINT32 guiPendingOverrideEvent; @@ -191,34 +191,34 @@ extern BOOLEAN gfUIDisplayActionPoints; extern BOOLEAN gfUIDisplayActionPointsInvalid; extern BOOLEAN gfUIDisplayActionPointsBlack; extern BOOLEAN gfUIDisplayActionPointsCenter; -extern INT16 gUIDisplayActionPointsOffY; -extern INT16 gUIDisplayActionPointsOffX; +extern INT16 gUIDisplayActionPointsOffY; +extern INT16 gUIDisplayActionPointsOffX; extern BOOLEAN gfUIDoNotHighlightSelMerc; extern UINT32 guiShowUPDownArrows; extern BOOLEAN gfUIHandleSelection; extern BOOLEAN gfUIHandleSelectionAboveGuy; -extern INT32 gsSelectedGridNo; -extern INT16 gsSelectedGuy; +extern INT32 gsSelectedGridNo; +extern INT16 gsSelectedGuy; extern BOOLEAN gfUIInDeadlock; extern UINT16 gUIDeadlockedSoldier; extern BOOLEAN gfUIMouseOnValidCatcher; -extern UINT16 gubUIValidCatcherID; +extern SoldierID gubUIValidCatcherID; extern BOOLEAN gUIUseReverse; extern BOOLEAN gfUIHandleShowMoveGrid; -extern INT32 gsUIHandleShowMoveGridLocation; +extern INT32 gsUIHandleShowMoveGridLocation; extern BOOLEAN gfUIDisplayDamage; extern INT8 gbDamage; -extern INT32 gsDamageGridNo; +extern INT32 gsDamageGridNo; extern BOOLEAN gfFontPopupDo; extern BOOLEAN gUITargetReady; extern BOOLEAN gUITargetShotWaiting; -extern INT32 gsUITargetShotGridNo; +extern INT32 gsUITargetShotGridNo; extern CHAR16 gzLocation[ 20 ]; extern BOOLEAN gfUIBodyHitLocation; diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index c6235487..cdd87caa 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -3548,7 +3548,7 @@ void DegradeNewlyAddedItems( ) // GET SOLDIER if ( gTeamPanel[ cnt2 ].fOccupied ) { - pSoldier = MercPtrs[ gTeamPanel[ cnt2 ].ubID ]; + pSoldier = gTeamPanel[ cnt2 ].ubID; UINT32 invsize = pSoldier->inv.size(); for ( UINT32 cnt = 0; cnt < invsize; ++cnt ) @@ -4434,7 +4434,7 @@ void INVRenderSteeringWheel( UINT32 uiBuffer, UINT32 uiSteeringWheelIndex, SOLDI return; } - pVehicle = GetSoldierStructureForVehicle ( MercPtrs[ pSoldier->ubID ]->iVehicleId ); + pVehicle = GetSoldierStructureForVehicle ( pSoldier->ubID->iVehicleId ); if ( pVehicle == NULL ) { @@ -8796,11 +8796,11 @@ void DrawItemTileCursor( ) /*CHRISL: For some reason it's possible that gpItemPointerSoldier is not correctly set when we come into this function, but we require it to be set for this function to work. So for now, let's set it using gusUIFullTargetID.*/ if(gpItemPointerSoldier->exists() == false) - gpItemPointerSoldier = MercPtrs[ gusUIFullTargetID ]; + gpItemPointerSoldier = gusUIFullTargetID; if ( gfUIFullTargetFound ) { // Force mouse position to guy... - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; } gusCurMousePos = usMapPos; @@ -8871,7 +8871,7 @@ void DrawItemTileCursor( ) if ( gfUIFullTargetFound ) { // Get soldier - pSoldier = MercPtrs[ gusUIFullTargetID ]; + pSoldier = gusUIFullTargetID; // Are they on our team? // ATE: Can't be an EPC @@ -8881,7 +8881,7 @@ void DrawItemTileCursor( ) { // OK, on a valid pass gfUIMouseOnValidCatcher = 4; - gubUIValidCatcherID = gusUIFullTargetID; + gubUIValidCatcherID = gusUIFullTargetID; } else { @@ -8890,7 +8890,7 @@ void DrawItemTileCursor( ) { // OK, set global that this buddy can see catch... gfUIMouseOnValidCatcher = TRUE; - gubUIValidCatcherID = gusUIFullTargetID; + gubUIValidCatcherID = gusUIFullTargetID; } } } @@ -8927,7 +8927,7 @@ void DrawItemTileCursor( ) gubUIValidCatcherID = gusUIFullTargetID; // If this is a robot, change to say 'reload' - if ( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) + if ( gusUIFullTargetID->flags.uiStatusFlags & SOLDIER_ROBOT ) { gfUIMouseOnValidCatcher = 3; } @@ -8947,9 +8947,9 @@ void DrawItemTileCursor( ) // Get AP cost - if ( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) + if ( gusUIFullTargetID->flags.uiStatusFlags & SOLDIER_ROBOT ) { - sAPCost = GetAPsToReloadRobot( gpItemPointerSoldier, MercPtrs[ gusUIFullTargetID ] ); + sAPCost = GetAPsToReloadRobot( gpItemPointerSoldier, gusUIFullTargetID ); } else { @@ -9011,7 +9011,7 @@ void DrawItemTileCursor( ) { if ( gfUIMouseOnValidCatcher ) { - switch( gAnimControl[ MercPtrs[ gubUIValidCatcherID ]->usAnimState ].ubHeight ) + switch( gAnimControl[ gubUIValidCatcherID->usAnimState ].ubHeight ) { case ANIM_STAND: @@ -9029,7 +9029,7 @@ void DrawItemTileCursor( ) break; } - if ( MercPtrs[ gubUIValidCatcherID ]->pathing.bLevel > 0 ) + if ( gubUIValidCatcherID->pathing.bLevel > 0 ) { sEndZ = 0; } @@ -9135,9 +9135,9 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) if ( gfUIFullTargetFound ) { // Force mouse position to guy... - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; - if ( gAnimControl[ MercPtrs[ gusUIFullTargetID ]->usAnimState ].uiFlags & ANIM_MOVING ) + if ( gAnimControl[ gusUIFullTargetID->usAnimState ].uiFlags & ANIM_MOVING ) { return( FALSE ); } @@ -9380,14 +9380,14 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) sGridNo = usMapPos; // Kaiden: Vehicle Inventory change - Commented the following If test: - //if ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && MercPtrs[ gusUIFullTargetID ]->bTeam == gbPlayerNum && !AM_AN_EPC( MercPtrs[ gusUIFullTargetID ] ) && !( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + //if ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && gusUIFullTargetID->bTeam == gbPlayerNum && !AM_AN_EPC( gusUIFullTargetID ) && !( gusUIFullTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) // And added this one instead: - if ( ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && MercPtrs[ gusUIFullTargetID ]->bTeam == gbPlayerNum && !AM_AN_EPC( MercPtrs[ gusUIFullTargetID ] ) ) && !( (!gGameExternalOptions.fVehicleInventory) && (MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) ) + if ( ( sDist <= PASSING_ITEM_DISTANCE_OKLIFE && gfUIFullTargetFound && gusUIFullTargetID->bTeam == gbPlayerNum && !AM_AN_EPC( gusUIFullTargetID ) ) && !( (!gGameExternalOptions.fVehicleInventory) && (gusUIFullTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE) ) ) { // OK, do the transfer... { - pSoldier = MercPtrs[ gusUIFullTargetID ]; + pSoldier = gusUIFullTargetID; { // Change to inventory.... @@ -9489,7 +9489,7 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) // IF OVER OUR GUY... if ( gfUIFullTargetFound ) { - pSoldier = MercPtrs[ gusUIFullTargetID ]; + pSoldier = gusUIFullTargetID; // Kaiden: Vehicle Inventory change - Commented the following If Test: //if ( pSoldier->bTeam == gbPlayerNum && pSoldier->stats.bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) @@ -11483,9 +11483,9 @@ void RenderItemPickupMenu( ) Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID != NOBODY && - MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]) + gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID) //swprintf(pStr, L"%s (%s)", ShortItemNames[pObject->usItem], MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); - swprintf(pStr, L"(%s)", MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); + swprintf(pStr, L"(%s)", gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s", ShortItemNames[ pObject->usItem ] ); } @@ -12757,7 +12757,7 @@ BOOLEAN LoadItemCursorFromSavedGame( HWFILE hFile ) } else { - gpItemPointerSoldier = MercPtrs[ SaveStruct.ubSoldierID ]; + gpItemPointerSoldier = SaveStruct.ubSoldierID; } // Inv slot diff --git a/Tactical/Interface Items.h b/Tactical/Interface Items.h index e08f44e3..05192f76 100644 --- a/Tactical/Interface Items.h +++ b/Tactical/Interface Items.h @@ -166,7 +166,7 @@ public: BOOLEAN Save(HWFILE hFile); BOOLEAN Load(HWFILE hFile); - UINT16 ubSoldierID; + SoldierID ubSoldierID; UINT8 ubInvSlot; BOOLEAN fCursorActive; OBJECTTYPE ItemPointerInfo; diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index e5663769..d606dfb7 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -569,7 +569,7 @@ void UpdateSelectedSoldier( UINT16 usSoldierID, BOOLEAN fSelect ); void CheckForFacePanelStartAnims( SOLDIERTYPE *pSoldier, INT16 sPanelX, INT16 sPanelY ); void HandleSoldierFaceFlash( SOLDIERTYPE *pSoldier, INT16 sFaceX, INT16 sFaceY ); -BOOLEAN PlayerExistsInSlot( UINT16 ubID ); +BOOLEAN PlayerExistsInSlot( SoldierID ubID ); void UpdateStatColor( UINT32 uiTimer, BOOLEAN fIncrease, BOOLEAN fDamaged, BOOLEAN fAugmented ); // SANDRO - added argument // Flugente - me too extern void UpdateItemHatches(); @@ -6812,7 +6812,7 @@ void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) } -BOOLEAN PlayerExistsInSlot( UINT16 ubID ) +BOOLEAN PlayerExistsInSlot( SoldierID ubID ) { INT32 cnt; @@ -6870,17 +6870,17 @@ BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT16 ubMercID ) } -void AddPlayerToInterfaceTeamSlot( UINT16 ubID ) +void AddPlayerToInterfaceTeamSlot( SoldierID ubID ) { INT32 cnt; // If we are a vehicle don't ever add..... - if ( MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) + if ( ubID->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } - if ( !( MercPtrs[ ubID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( ubID->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) { if ( !PlayerExistsInSlot( ubID ) ) { @@ -6899,7 +6899,7 @@ void AddPlayerToInterfaceTeamSlot( UINT16 ubID ) fInterfacePanelDirty = DIRTYLEVEL2; // Set ID to do open anim - MercPtrs[ ubID ]->flags.fUInewMerc = TRUE; + ubID->flags.fUInewMerc = TRUE; break; } @@ -6909,14 +6909,14 @@ void AddPlayerToInterfaceTeamSlot( UINT16 ubID ) else { // anv: for passengers, position on team panel will be linked with seat in vehicle - if ( MercPtrs[ ubID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + if ( ubID->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { - SOLDIERTYPE *pVehicle = GetSoldierStructureForVehicle( MercPtrs[ ubID ]->iVehicleId ); + SOLDIERTYPE *pVehicle = GetSoldierStructureForVehicle( ubID->iVehicleId ); if( pVehicle != NULL ) { - for( UINT8 iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ MercPtrs[ ubID ]->iVehicleId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) + for( UINT8 iCounter = 0; iCounter < gNewVehicle[ pVehicleList[ ubID->iVehicleId ].ubVehicleType ].iNewSeatingCapacities; iCounter++ ) { - SOLDIERTYPE *pPassenger = pVehicleList[ MercPtrs[ ubID ]->iVehicleId ].pPassengers[ iCounter ]; + SOLDIERTYPE *pPassenger = pVehicleList[ ubID->iVehicleId ].pPassengers[ iCounter ]; if( pPassenger != NULL && pPassenger->ubID == ubID ) { gTeamPanel[ iCounter ].fOccupied = TRUE; @@ -6929,7 +6929,7 @@ void AddPlayerToInterfaceTeamSlot( UINT16 ubID ) fInterfacePanelDirty = DIRTYLEVEL2; // Set ID to do open anim - MercPtrs[ ubID ]->flags.fUInewMerc = TRUE; + ubID->flags.fUInewMerc = TRUE; return; } diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index e109ace3..95563cf2 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -83,11 +83,11 @@ SoldierID GetSMPanelCurrentMerc( ); void UpdateSMPanel( ); BOOLEAN InitTEAMSlots( ); -void AddPlayerToInterfaceTeamSlot( UINT16 ubID ); +void AddPlayerToInterfaceTeamSlot( SoldierID ubID ); BOOLEAN RemovePlayerFromInterfaceTeamSlot( UINT8 ubID ); BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT16 * pubID ); void RemoveAllPlayersFromSlot( ); -BOOLEAN PlayerExistsInSlot( UINT16 ubID ); +BOOLEAN PlayerExistsInSlot( SoldierID ubID ); BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT16 ubMercID ); void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ); void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ); @@ -105,7 +105,7 @@ void InitOldInventorySystem( ); // ATE TO BE MOVED TO INTERFACE_ITEMS.C extern INT8 gbNewItem[ NUM_INV_SLOTS ]; extern INT8 gbNewItemCycle[ NUM_INV_SLOTS ]; -extern UINT8 gubNewItemMerc; +extern UINT8 gubNewItemMerc; void ShowRadioLocator( SoldierID ubID, UINT8 ubLocatorSpeed ); void EndRadioLocator( UINT16 ubID ); @@ -118,12 +118,12 @@ extern BOOLEAN gfDisableTacticalPanelButtons; typedef struct { - UINT16 ubID; - BOOLEAN fOccupied; + SoldierID ubID; + BOOLEAN fOccupied; } TEAM_PANEL_SLOTS_TYPE; -extern TEAM_PANEL_SLOTS_TYPE gTeamPanel[ NUM_TEAM_SLOTS ]; +extern TEAM_PANEL_SLOTS_TYPE gTeamPanel[ NUM_TEAM_SLOTS ]; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 2034d16b..db414597 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -1,7 +1,7 @@ #ifndef ITEM_TYPES_H #define ITEM_TYPES_H -#include "types.h" +#include "Overhead Types.h" #include #include // THE_BOB : added for pocket popup definitions @@ -408,15 +408,15 @@ namespace ObjectDataStructs { struct OBJECT_BOMBS_AND_OTHER { // this is used by placed bombs, switches, and the action item INT16 bBombStatus; // % status - INT8 bDetonatorType; // timed, remote, or pressure-activated + INT8 bDetonatorType; // timed, remote, or pressure-activated UINT16 usBombItem; // the usItem of the bomb. union { INT8 bDelay; // >=0 values used only INT8 bFrequency; // >=0 values used only }; - UINT16 ubBombOwner; // side which placed the bomb - UINT8 bActionValue; // this is used by the ACTION_ITEM fake item + SoldierID ubBombOwner; // side which placed the bomb + UINT8 bActionValue; // this is used by the ACTION_ITEM fake item union { UINT8 ubTolerance; // tolerance value for panic triggers diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index cbcdfcd5..f17ed417 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -15287,10 +15287,10 @@ BOOLEAN ObjectIsExternalFeeder(SOLDIERTYPE* pSoldier, OBJECTTYPE * pObject) if ( !pSoldier || !pObject) return( FALSE ); - UINT16 usSoldierFeedingTarget1 = 0; + SoldierID usSoldierFeedingTarget1 = NOBODY; UINT16 usGunSlot1 = 0; UINT16 usAmmoSlot1 = 0; - UINT16 usSoldierFeedingTarget2 = 0; + SoldierID usSoldierFeedingTarget2 = NOBODY; UINT16 usGunSlot2 = 0; UINT16 usAmmoSlot2 = 0; if ( pSoldier->IsFeedingExternal(&usSoldierFeedingTarget1, &usGunSlot1, &usAmmoSlot1, &usSoldierFeedingTarget2, &usGunSlot2, &usAmmoSlot2) ) @@ -15345,10 +15345,10 @@ OBJECTTYPE* GetExternalFeedingObject(SOLDIERTYPE* pSoldier, OBJECTTYPE * pObject continue; // we check if that guy is feeding someone, and that someone is really us - UINT16 usTeamSoldierFeedingTarget1 = 0; + SoldierID usTeamSoldierFeedingTarget1 = NOBODY; UINT16 usGunSlot1 = 0; UINT16 usAmmoSlot1 = 0; - UINT16 usTeamSoldierFeedingTarget2 = 0; + SoldierID usTeamSoldierFeedingTarget2 = NOBODY; UINT16 usGunSlot2 = 0; UINT16 usAmmoSlot2 = 0; if ( pTeamSoldier->IsFeedingExternal(&usTeamSoldierFeedingTarget1, &usGunSlot1, &usAmmoSlot1, &usTeamSoldierFeedingTarget2, &usGunSlot2, &usAmmoSlot2) ) diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 9d9154c6..fff95973 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -4390,7 +4390,7 @@ UINT8 SoldierToSoldierBodyPartChanceToGetThrough( SOLDIERTYPE * pStartSoldier, S return( ChanceToGetThrough( pStartSoldier, (FLOAT) sX, (FLOAT) sY, dEndZPos ) ); } -UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, UINT16 ubTargetID ) +UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, SoldierID ubTargetID ) { FLOAT dEndZPos; INT16 sXPos; diff --git a/Tactical/LOS.h b/Tactical/LOS.h index 01bd9679..a03b4216 100644 --- a/Tactical/LOS.h +++ b/Tactical/LOS.h @@ -152,7 +152,7 @@ UINT8 SoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTY UINT8 SoldierToSoldierBodyPartChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier, UINT8 ubAimLocation ); UINT8 AISoldierToSoldierChanceToGetThrough( SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier ); UINT8 AISoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel ); -UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, UINT16 ubTargetID ); +UINT8 SoldierToLocationChanceToGetThrough( SOLDIERTYPE * pStartSoldier, INT32 sGridNo, INT8 bLevel, INT8 bCubeLevel, SoldierID ubTargetID ); INT32 SoldierToLocationWindowTest( SOLDIERTYPE * pStartSoldier, INT32 sEndGridNo ); // sevenfm: AI LOS functions INT32 LOS_Raised(SOLDIERTYPE * pStartSoldier, SOLDIERTYPE * pEndSoldier, int iTileSightLimit = CALC_FROM_ALL_DIRS, UINT8 ubAimLocation = LOS_POS); @@ -261,4 +261,4 @@ void DamageRiotShield( SOLDIERTYPE* pSoldier, INT32& rsDamage, INT32& rsSecondar extern INT8 GetStealth(SOLDIERTYPE* pSoldier); extern INT8 GetSightAdjustmentBasedOnLBE(SOLDIERTYPE* pSoldier); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index d001ad45..e9a09bbb 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -128,7 +128,7 @@ struct TacticalStatusType BOOLEAN fCantGetThrough; INT32 sCantGetThroughGridNo; INT32 sCantGetThroughSoldierGridNo; - UINT16 ubCantGetThroughID; + SoldierID ubCantGetThroughID; BOOLEAN fDidGameJustStart; BOOLEAN fStatChangeCheatOn; UINT8 ubLastRequesterTargetID; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 37cf962a..79fd04e8 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2285,14 +2285,13 @@ void SOLDIERTYPE::CalcNewActionPoints( void ) void SOLDIERTYPE::DoNinjaAttack( void ) { - //UINT32 uiMercFlags; - UINT16 usSoldierIndex; - SOLDIERTYPE *pTSoldier; - UINT8 ubTDirection; - UINT8 ubTargetStance; + //UINT32 uiMercFlags; + SOLDIERTYPE *pTSoldier; + UINT8 ubTDirection; + UINT8 ubTargetStance; - usSoldierIndex = WhoIsThere2( this->sTargetGridNo, this->pathing.bLevel ); + SoldierID usSoldierIndex = WhoIsThere2( this->sTargetGridNo, this->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { GetSoldier( &pTSoldier, usSoldierIndex ); @@ -9449,8 +9448,8 @@ void SOLDIERTYPE::BeginSoldierClimbUpRoof(void) return;//hayden disable climbing roof } - INT8 bNewDirection; - UINT16 ubWhoIsThere; + INT8 bNewDirection; + SoldierID ubWhoIsThere; if (FindHeigherLevel(this, this->sGridNo, this->ubDirection, &bNewDirection) && (this->pathing.bLevel == 0)) { @@ -9623,8 +9622,8 @@ void SOLDIERTYPE::BeginSoldierClimbWindow( void ) void SOLDIERTYPE::BeginSoldierClimbWall( void ) { - INT8 bNewDirection; - UINT16 ubWhoIsThere; + INT8 bNewDirection; + SoldierID ubWhoIsThere; if ( FindWallJumpDirection( this, this->sGridNo, this->ubDirection, &bNewDirection ) && (this->pathing.bLevel == 0) ) { @@ -9660,8 +9659,8 @@ void SOLDIERTYPE::BeginSoldierClimbWall( void ) void SOLDIERTYPE::BeginSoldierClimbWallUp( void ) { - INT8 bNewDirection; - UINT16 ubWhoIsThere; + INT8 bNewDirection; + SoldierID ubWhoIsThere; if ( FindLowerLevelWall( this, this->sGridNo, this->ubDirection, &bNewDirection ) && (this->pathing.bLevel > 0) ) { @@ -11309,8 +11308,8 @@ BOOLEAN SOLDIERTYPE::CheckSoldierHitRoof( void ) void SOLDIERTYPE::BeginSoldierClimbDownRoof(void) { - INT8 bNewDirection; - UINT16 ubWhoIsThere; + INT8 bNewDirection; + SoldierID ubWhoIsThere; if (FindLowerLevel(this, this->sGridNo, this->ubDirection, &bNewDirection) && (this->pathing.bLevel > 0)) { @@ -12469,7 +12468,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirectio { SOLDIERTYPE *pTSoldier; //UINT32 uiMercFlags; - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; UINT8 ubTDirection; ROTTING_CORPSE *pCorpse; @@ -12692,7 +12691,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio BOOLEAN fMartialArtist = FALSE; SOLDIERTYPE *pTSoldier; //UINT32 uiMercFlags; - UINT16 usSoldierIndex; + SoldierID usSoldierIndex; UINT8 ubTDirection; UINT16 usItem; @@ -15148,7 +15147,7 @@ void SOLDIERTYPE::InventoryExplosion( void ) } // Flugente: do we currently provide ammo (pAmmoSlot) for someone else's (pubId) gun (pGunSlot)? -BOOLEAN SOLDIERTYPE::IsFeedingExternal( UINT16 * pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, UINT16 * pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2 ) +BOOLEAN SOLDIERTYPE::IsFeedingExternal( SoldierID * pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, SoldierID * pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2 ) { // make sure we have to check this... if ( gGameExternalOptions.ubExternalFeeding == 0 ) diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 81498083..eebd00ee 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1839,7 +1839,7 @@ public: void InventoryExplosion( void ); // Flugente: do we currently provide ammo (pAmmoSlot) for someone else's (pubId) gun (pGunSlot)? - BOOLEAN IsFeedingExternal(UINT16 * pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, UINT16 * pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2); + BOOLEAN IsFeedingExternal(SoldierID * pubId1, UINT16* pGunSlot1, UINT16* pAmmoSlot1, SoldierID* pubId2, UINT16* pGunSlot2, UINT16* pAmmoSlot2); // Flugente: return first found object with a specific flag from our inventory OBJECTTYPE* GetObjectWithFlag( UINT64 aFlag ); diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index bf7c5f98..b4e6ad96 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -176,7 +176,7 @@ INT16 sVehicleInternalOrigArmorValues[ NUMBER_OF_TYPES_OF_VEHICLES ][ NUMBER_OF_ // set the driver of the vehicle -void SetDriver( INT32 iID, UINT16 ubID ); +void SetDriver( INT32 iID, SoldierID ubID ); //void RemoveSoldierFromVehicleBetweenSectors( pSoldier, iId ); @@ -1556,7 +1556,7 @@ SOLDIERTYPE *GetDriver( INT32 iID ) INT32 iCounter; if( pVehicleList[ iID ].ubDriver != NOBODY ) { - return( MercPtrs[ pVehicleList[ iID ].ubDriver ] ); + return( pVehicleList[ iID ].ubDriver ); } else { @@ -1573,25 +1573,27 @@ SOLDIERTYPE *GetDriver( INT32 iID ) } -void SetDriver( INT32 iID, UINT16 ubID ) +void SetDriver( INT32 iID, SoldierID ubID ) { // anv: first make sure previous driver won't be driver anymore - if( pVehicleList[ iID ].ubDriver != NOBODY && MercPtrs[ pVehicleList[ iID ].ubDriver ]->iVehicleId == iID ) + SOLDIERTYPE* prevDriver = pVehicleList[iID].ubDriver; + + if( prevDriver != NOBODY && prevDriver->iVehicleId == iID ) { - if( MercPtrs[ pVehicleList[ iID ].ubDriver ] ) + if( prevDriver ) { - MercPtrs[ pVehicleList[ iID ].ubDriver ]->flags.uiStatusFlags &= ~(SOLDIER_DRIVER); - if( GetSeatIndexFromSoldier( MercPtrs[ pVehicleList[ iID ].ubDriver ] ) != (-1) ) + prevDriver->flags.uiStatusFlags &= ~(SOLDIER_DRIVER); + if( GetSeatIndexFromSoldier( prevDriver ) != (-1) ) { - MercPtrs[ pVehicleList[ iID ].ubDriver ]->flags.uiStatusFlags |= SOLDIER_PASSENGER; + prevDriver->flags.uiStatusFlags |= SOLDIER_PASSENGER; } } } // set proper flags if( ubID != NOBODY ) { - MercPtrs[ ubID ]->flags.uiStatusFlags |= SOLDIER_DRIVER; - MercPtrs[ ubID ]->flags.uiStatusFlags &= ~(SOLDIER_PASSENGER); + ubID->flags.uiStatusFlags |= SOLDIER_DRIVER; + ubID->flags.uiStatusFlags &= ~(SOLDIER_PASSENGER); } pVehicleList[ iID ].ubDriver = ubID; } @@ -1821,7 +1823,7 @@ BOOLEAN ExitVehicle( SOLDIERTYPE *pSoldier ) } else { - UINT16 usTempSelectedSoldier = gusSelectedSoldier; + SoldierID usTempSelectedSoldier = gusSelectedSoldier; SetCurrentSquad( CurrentSquad(), TRUE ); @@ -1984,7 +1986,7 @@ void AddPassangersToTeamPanel( INT32 iId ) } -void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo, UINT16 ubAttackerID ) +void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo, SoldierID ubAttackerID ) { if ( ubReason != TAKE_DAMAGE_GAS_FIRE && ubReason != TAKE_DAMAGE_GAS_NOTFIRE ) { @@ -2013,7 +2015,7 @@ void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo } -void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, UINT16 ubAttackerID ) +void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, SoldierID ubAttackerID ) { // check state the armor was s'posed to be in vs. the current state..the difference / orig state is % chance // that a critical hit will occur diff --git a/Tactical/Vehicles.h b/Tactical/Vehicles.h index ceef6143..6cae9f84 100644 --- a/Tactical/Vehicles.h +++ b/Tactical/Vehicles.h @@ -289,7 +289,7 @@ typedef struct BOOLEAN fBetweenSectors; // between sectors? INT32 sGridNo; // location in tactical SOLDIERTYPE *pPassengers[ MAXPASSENGERS ]; - UINT16 ubDriver; + SoldierID ubDriver; INT16 sInternalHitLocations[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; INT16 sArmourType; INT16 sExternalArmorLocationsStatus[ NUMBER_OF_EXTERNAL_HIT_LOCATIONS_ON_VEHICLE ]; @@ -404,7 +404,7 @@ BOOLEAN SwapVehicleSeat( SOLDIERTYPE *pVehicle, SOLDIERTYPE *pSoldier, UINT8 ubS void AddPassangersToTeamPanel( INT32 iId ); -void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo , UINT16 ubAttackerID ); +void VehicleTakeDamage( UINT8 ubID, UINT8 ubReason, INT16 sDamage, INT32 sGridNo , SoldierID ubAttackerID ); // the soldiertype containing this tactical incarnation of this vehicle SOLDIERTYPE * GetSoldierStructureForVehicle( INT32 iId ); @@ -415,7 +415,7 @@ void AdjustVehicleAPs( SOLDIERTYPE *pSoldier, INT16 *pubPoints ); //INT16 GetOrigInternalArmorValueForVehicleInLocation( UINT8 ubID, UINT8 ubLocation ); // handle crit hit to vehicle in this location -void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, UINT16 ubAttackerID ); +void HandleCriticalHitForVehicleInLocation( UINT8 ubID, INT16 sDmg, INT32 sGridNo, SoldierID ubAttackerID ); // ste up armor values for this vehicle void SetUpArmorForVehicle( UINT8 ubID ); From b9641d4c90759c9fffe1c1f955227349f093d9e7 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 20:52:12 +0200 Subject: [PATCH 113/571] Convert to SoldierID --- Tactical/Overhead.cpp | 52 +++++++++++++++++++++---------------------- TacticalAI/AIMain.cpp | 9 +++----- TacticalAI/ai.h | 2 +- 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index db65278d..77d5ea2b 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -1508,12 +1508,10 @@ BOOLEAN ExecuteOverhead( ) } else // otherwise determine our target position { - SOLDIERTYPE *pTarget; - UINT16 usSoldierIndex; - usSoldierIndex = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); + SoldierID usSoldierIndex = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { - pTarget = MercPtrs[ usSoldierIndex ]; + SOLDIERTYPE* pTarget = usSoldierIndex; // we always need to crouch to prone target if ( gAnimControl[ pTarget->usAnimState ].ubEndHeight == ANIM_PRONE ) @@ -3659,8 +3657,8 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) { if ( pSoldier->ubAutoBandagingMedic != NOBODY ) { - DebugAI(AI_MSG_INFO, MercPtrs[pSoldier->ubAutoBandagingMedic], String("CancelAIAction: stop autobandaging in HandlePlayerTeamMemberDeath")); - CancelAIAction( MercPtrs[ pSoldier->ubAutoBandagingMedic ], TRUE ); + DebugAI(AI_MSG_INFO, pSoldier->ubAutoBandagingMedic, String("CancelAIAction: stop autobandaging in HandlePlayerTeamMemberDeath")); + CancelAIAction( pSoldier->ubAutoBandagingMedic, TRUE ); } } @@ -5087,7 +5085,7 @@ extern BOOLEAN InternalOkayToAddStructureToWorld( INT32 sBaseGridNo, INT8 bLevel // NB if making changes don't forget to update NewOKDestinationAndDirection BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel ) { - UINT16 bPerson; + SoldierID bPerson; STRUCTURE *pStructure; INT16 sDesiredLevel; BOOLEAN fOKCheckStruct; @@ -5112,7 +5110,7 @@ BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPe { if ( pCurrSoldier->bTeam == gbPlayerNum ) { - if ( ( Menptr[ bPerson ].bVisible >= 0) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) + if ( ( bPerson->bVisible >= 0) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) return( FALSE ); // if someone there it's NOT OK } else @@ -5234,7 +5232,7 @@ BOOLEAN NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPe // NB if making changes don't forget to update NewOKDestination INT16 NewOKDestinationAndDirection( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, INT8 bDirection, BOOLEAN fPeopleToo, INT8 bLevel ) { - UINT16 bPerson; + SoldierID bPerson; STRUCTURE *pStructure; INT16 sDesiredLevel; BOOLEAN fOKCheckStruct; @@ -5247,7 +5245,7 @@ INT16 NewOKDestinationAndDirection( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, I { if ( pCurrSoldier->bTeam == gbPlayerNum ) { - if ( ( Menptr[ bPerson ].bVisible >= 0) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) + if ( ( bPerson->bVisible >= 0) || ( gTacticalStatus.uiFlags & SHOW_ALL_MERCS ) ) return( FALSE ); // if someone there it's NOT OK } else @@ -5845,7 +5843,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub UINT8 ubWallOrientation; BOOLEAN fCheckGivenGridNo = TRUE; UINT8 ubTestDirection; - UINT16 ubWhoIsThere; + SoldierID ubWhoIsThere; // CHECK IF WE WANT TO FORCE GRIDNO TO PERSON if ( psAdjustedGridNo != NULL ) @@ -6151,7 +6149,7 @@ INT32 FindNextToAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pub INT32 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier, INT32 * psAdjustedTargetGridNo, UINT8 * pubDirection ) { INT32 sSpot; - UINT16 ubGuyThere; + SoldierID ubGuyThere; for ( UINT8 cnt = 0; cnt < NUM_WORLD_DIRECTIONS; ++cnt ) { @@ -6221,13 +6219,13 @@ BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, INT32 usMapPos ) void HandleTeamServices( UINT8 ubTeamNum ) { - INT32 cnt; - SOLDIERTYPE *pTeamSoldier, *pTargetSoldier; - UINT32 uiPointsUsed; - UINT16 usSoldierIndex; - UINT16 usKitPts; - INT8 bSlot; - BOOLEAN fDone; + INT32 cnt; + SOLDIERTYPE *pTeamSoldier, *pTargetSoldier; + UINT32 uiPointsUsed; + SoldierID usSoldierIndex; + UINT16 usKitPts; + INT8 bSlot; + BOOLEAN fDone; // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ ubTeamNum ].bFirstID; @@ -6246,7 +6244,7 @@ void HandleTeamServices( UINT8 ubTeamNum ) usSoldierIndex = WhoIsThere2( pTeamSoldier->sTargetGridNo, pTeamSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { - pTargetSoldier = MercPtrs[ usSoldierIndex ]; + pTargetSoldier = usSoldierIndex; if ( pTargetSoldier->ubServiceCount ) { @@ -6313,11 +6311,11 @@ void HandleTeamServices( UINT8 ubTeamNum ) void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) { SOLDIERTYPE *pTargetSoldier; - UINT32 uiPointsUsed; - UINT16 usSoldierIndex; - UINT16 usKitPts; - INT8 bSlot; - BOOLEAN fDone = FALSE; + UINT32 uiPointsUsed; + SoldierID usSoldierIndex; + UINT16 usKitPts; + INT8 bSlot; + BOOLEAN fDone = FALSE; if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive ) { @@ -6330,7 +6328,7 @@ void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier ) if ( usSoldierIndex != NOBODY ) { - pTargetSoldier = MercPtrs[ usSoldierIndex ]; + pTargetSoldier = usSoldierIndex; if ( pTargetSoldier->ubServiceCount ) { @@ -11384,7 +11382,7 @@ void CheckChatPartners() { pSoldier = MercPtrs[ubLoop]; - if ( pSoldier && pSoldier->bVisible && pSoldier->usChatPartnerID != NOBODY && MercPtrs[pSoldier->usChatPartnerID]->bVisible ) + if ( pSoldier && pSoldier->bVisible && pSoldier->usChatPartnerID != NOBODY && pSoldier->usChatPartnerID->bVisible ) { INT16 sScreenX, sScreenY; diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index a0d63c71..f3970d1d 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -1254,13 +1254,10 @@ void FreeUpNPCFromPendingAction( SOLDIERTYPE *pSoldier ) } } -void FreeUpNPCFromAttacking(UINT16 ubID) +void FreeUpNPCFromAttacking(SoldierID ubID) { - SOLDIERTYPE *pSoldier; - - pSoldier = MercPtrs[ubID]; - ActionDone(pSoldier); - pSoldier->pathing.bNeedToLook = TRUE; + ActionDone(ubID); + ubID->pathing.bNeedToLook = TRUE; } void FreeUpNPCFromLoweringGun( SOLDIERTYPE *pSoldier ) diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index 5f1da394..a6603ae3 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -220,7 +220,7 @@ BOOLEAN FindRoofClimbingPoints( SOLDIERTYPE * pSoldier, INT16 sDesiredSpot ); INT32 FindSpotMaxDistFromOpponents(SOLDIERTYPE *pSoldier); INT32 FindSweetCoverSpot(SOLDIERTYPE *pSoldier); -void FreeUpNPCFromAttacking(UINT16 ubID); +void FreeUpNPCFromAttacking(SoldierID ubID); void FreeUpNPCFromPendingAction( SOLDIERTYPE * pSoldier ); void FreeUpNPCFromTurning(SOLDIERTYPE *pSoldier, INT8 bLook); void FreeUpNPCFromStanceChange(SOLDIERTYPE *pSoldier ); From b6e8b0c5ffd7ae78257d0de75f5122e00468f98a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:09:13 +0200 Subject: [PATCH 114/571] Convert to SoldierID --- Tactical/Soldier Control.cpp | 8 ++++---- Tactical/Weapons.cpp | 2 +- Tactical/Weapons.h | 2 +- TileEngine/LightEffects.cpp | 4 ++-- TileEngine/LightEffects.h | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 79fd04e8..aa96c7e6 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -24132,8 +24132,8 @@ void SetSoldierPersonalLightLevel( SOLDIERTYPE *pSoldier ) void BeginSoldierClimbWallUp( SOLDIERTYPE *pSoldier ) { - INT8 bNewDirection; - UINT16 ubWhoIsThere; + INT8 bNewDirection; + SoldierID ubWhoIsThere; if ( FindLowerLevelWall( pSoldier, pSoldier->sGridNo, pSoldier->ubDirection, &bNewDirection ) && (pSoldier->pathing.bLevel > 0) ) { @@ -25356,10 +25356,10 @@ UINT16 GridNoSpotterCTHBonus( SOLDIERTYPE* pSniper, INT32 sGridNo, INT8 bTeam ) { BOOLEAN targetseen = FALSE; - UINT16 usID = WhoIsThere2( sGridNo, pSniper->bTargetLevel ); + SoldierID usID = WhoIsThere2( sGridNo, pSniper->bTargetLevel ); // is someone is at the sGridNo, check wether the spotter can see any part of him check wether head can be seen) - if ( usID != NOBODY && SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[usID], 0, NO_DISTANCE_LIMIT, AIM_SHOT_HEAD ) > 0 ) + if ( usID != NOBODY && SoldierToSoldierLineOfSightTest( pSoldier, usID, 0, NO_DISTANCE_LIMIT, AIM_SHOT_HEAD ) > 0 ) targetseen = TRUE; // otherwise check wether we can see the ground floor else if ( SoldierToVirtualSoldierLineOfSightTest( pSoldier, sGridNo, pSniper->pathing.bLevel, ANIM_PRONE, FALSE, NO_DISTANCE_LIMIT ) > 0 ) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index b2436930..ebe43661 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -12144,7 +12144,7 @@ FLOAT CalcNewChanceToHitAimTraitBonus(SOLDIERTYPE *pSoldier, FLOAT fAimCap, FLOA extern BOOLEAN IsRoofPresentAtGridNo( INT32 sGridNo ); // Flugente: fire item from A to B (intended for mortarshells and launchable grenades) -BOOLEAN ArtilleryStrike( UINT16 usItem, UINT16 ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ) +BOOLEAN ArtilleryStrike( UINT16 usItem, SoldierID ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ) { FLOAT dForce, dDegrees; INT16 sDestX, sDestY, sSrcX, sSrcY; diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 958d8642..650d18f3 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -536,7 +536,7 @@ FLOAT GetOverheatJamThreshold( OBJECTTYPE *pObj ); FLOAT GetOverheatDamageThresholdModifier( OBJECTTYPE *pObj ); FLOAT GetOverheatDamageThreshold( OBJECTTYPE *pObj ); -BOOLEAN ArtilleryStrike( UINT16 usItem, UINT16 ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ); +BOOLEAN ArtilleryStrike( UINT16 usItem, SoldierID ubOwnerID, UINT32 usStartingGridNo, UINT32 usTargetMapPos ); // Flugente: functions for using several barrels at once UINT8 GetNextBarrelMode( UINT16 usItem, UINT8 aBarrelMode ); diff --git a/TileEngine/LightEffects.cpp b/TileEngine/LightEffects.cpp index ea734df8..cc51640e 100644 --- a/TileEngine/LightEffects.cpp +++ b/TileEngine/LightEffects.cpp @@ -537,7 +537,7 @@ void ResetLightEffects() } // Flugente: create and destroy light sources tied to a person -void CreatePersonalLight( INT32 sGridNo, UINT16 ubID ) +void CreatePersonalLight( INT32 sGridNo, SoldierID ubID ) { INT32 iLightIndex = NewLightEffectInternal( sGridNo, 0, 1 ); @@ -548,7 +548,7 @@ void CreatePersonalLight( INT32 sGridNo, UINT16 ubID ) } } -void RemovePersonalLights( UINT16 ubID ) +void RemovePersonalLights( SoldierID ubID ) { LIGHTEFFECT *pLight; diff --git a/TileEngine/LightEffects.h b/TileEngine/LightEffects.h index 869d2e82..00b9b603 100644 --- a/TileEngine/LightEffects.h +++ b/TileEngine/LightEffects.h @@ -25,7 +25,7 @@ typedef struct // Flugente: added variables necessary for dynamic (flash-)lighting INT32 flags; - UINT16 ubOwner; + SoldierID ubOwner; } LIGHTEFFECT; @@ -55,7 +55,7 @@ void ResetLightEffects(); BOOLEAN IsLightEffectAtTile( INT32 sGridNo ); // Flugente: create and destroy light sources tied to a person -void CreatePersonalLight( INT32 sGridNo, UINT16 ubID ); -void RemovePersonalLights( UINT16 ubID ); +void CreatePersonalLight( INT32 sGridNo, SoldierID ubID ); +void RemovePersonalLights(SoldierID ubID ); -#endif \ No newline at end of file +#endif From ef9aa1b027aa4c63ee8448a18ae752e636141fd4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 22:29:31 +0200 Subject: [PATCH 115/571] Convert to SoldierID --- Multiplayer/client.cpp | 36 ++++---- Multiplayer/connect.h | 12 +-- Tactical/Bullets.h | 66 +++++++-------- Tactical/Dialogue Control.cpp | 4 +- Tactical/Interface Dialogue.cpp | 20 ++--- Tactical/Items.cpp | 2 +- Tactical/Items.h | 2 +- Tactical/Ja25_Tactical.cpp | 24 +++--- Tactical/Ja25_Tactical.h | 4 +- Tactical/LOS.cpp | 85 ++++++++++--------- Tactical/LOS.h | 2 +- Tactical/Soldier Control.cpp | 4 +- Tactical/Soldier Control.h | 2 +- Tactical/TeamTurns.cpp | 6 +- Tactical/Weapons.cpp | 62 +++++++------- Tactical/Weapons.h | 2 +- Tactical/bullets.cpp | 6 +- TacticalAI/AIUtils.cpp | 20 ++--- TacticalAI/ai.h | 20 ++--- TileEngine/Explosion Control.cpp | 136 +++++++++++++++---------------- TileEngine/Explosion Control.h | 12 +-- TileEngine/SmokeEffects.cpp | 2 +- TileEngine/SmokeEffects.h | 4 +- TileEngine/Tile Animation.h | 100 +++++++++++------------ TileEngine/structure.cpp | 2 +- TileEngine/structure.h | 2 +- 26 files changed, 318 insertions(+), 319 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index f6c28480..2b65f0fc 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -535,18 +535,18 @@ typedef struct typedef struct { - UINT8 ubDamageFunc; // 1 - gas damage , 2 - explosive damage - UINT16 ubSoldierID; - UINT16 usExplosiveClassID; - INT16 sSubsequent; - BOOL fRecompileMovementCosts; - INT16 sWoundAmt; - INT16 sBreathAmt; - UINT16 ubAttackerID; - UINT16 usItem; - INT32 sBombGridNo; - UINT32 uiDist; - UINT32 uiPreRandomIndex; + UINT8 ubDamageFunc; // 1 - gas damage , 2 - explosive damage + SoldierID ubSoldierID; + UINT16 usExplosiveClassID; + INT16 sSubsequent; + BOOL fRecompileMovementCosts; + INT16 sWoundAmt; + INT16 sBreathAmt; + SoldierID ubAttackerID; + UINT16 usItem; + INT32 sBombGridNo; + UINT32 uiDist; + UINT32 uiPreRandomIndex; } explosiondamage_struct; bullets_table bTable[11][50]; @@ -2920,7 +2920,7 @@ void recieveMAPCHANGE( RPCParameters *rpcParameters ) } // 20091002 - OJW - Explosives -void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade) +void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, SoldierID ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade) { ubOwner = MPEncodeSoldierID(ubOwner); // translate our soldier to the "network" version @@ -3229,11 +3229,11 @@ void recievePLANTEXPLOSIVE (RPCParameters *rpcParameters) } } -void send_detonate_explosive (UINT32 uiWorldIndex, UINT16 ubID) +void send_detonate_explosive (UINT32 uiWorldIndex, SoldierID ubID) { ubID = MPEncodeSoldierID(ubID); - SOLDIERTYPE* pSoldier = MercPtrs[ubID]; + SOLDIERTYPE* pSoldier = ubID; if (pSoldier != NULL) { // explosive detonated on this client, notify the other clients @@ -3466,7 +3466,7 @@ void recieveDISARMEXPLOSIVE (RPCParameters *rpcParameters) } } -void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ) +void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, SoldierID ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ) { spreadeffect_struct sef; @@ -3551,7 +3551,7 @@ void recieveSPREADEFFECT (RPCParameters *rpcParameters) } } -void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, INT32 iSmokeEffectID) +void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwner, INT32 iSmokeEffectID) { // i'm reusing this struct, the parameters are essentially the same spreadeffect_struct sef; @@ -3634,7 +3634,7 @@ void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sS client->RPC("sendEXPLOSIONDAMAGE",(const char*)&exp, (int)sizeof(explosiondamage_struct)*8, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0); } -void send_explosivedamage( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ) +void send_explosivedamage( SoldierID ubPerson, SoldierID ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ) { explosiondamage_struct exp; exp.ubDamageFunc = 2; diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index 75f5d48b..31fe44ea 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -111,19 +111,19 @@ void send_stop (EV_S_STOP_MERC *SStopMerc); void send_interrupt(SOLDIERTYPE *pSoldier); // OJW - 20091002 - explosives -void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT16 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade); +void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, SoldierID ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade); void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, SoldierID ubOwnerID, INT32 iRealObjectID, bool bIsDud); void send_plant_explosive (UINT16 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldIndex); -void send_detonate_explosive (UINT32 uiWorldIndex, UINT16 ubID); -void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ); -void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, INT32 iSmokeEffectID); +void send_detonate_explosive (UINT32 uiWorldIndex, SoldierID ubID); +void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, SoldierID ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ); +void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwner, INT32 iSmokeEffectID); void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, SoldierID ubOwner ); -void send_explosivedamage( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ); +void send_explosivedamage( SoldierID ubPerson, SoldierID ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent ); void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldIndex, SoldierID ubID); void OpenChatMsgBox(void); -INT8 FireBullet( UINT16 ubFirer, BULLET * pBullet, BOOLEAN fFake ); +INT8 FireBullet( SoldierID ubFirer, BULLET * pBullet, BOOLEAN fFake ); void reapplySETTINGS(); diff --git a/Tactical/Bullets.h b/Tactical/Bullets.h index 2cd3e602..2399d8d5 100644 --- a/Tactical/Bullets.h +++ b/Tactical/Bullets.h @@ -30,49 +30,49 @@ typedef struct LEVELNODE* pNodes[BULLET_TRACER_MAX_LENGTH]; //afp-end INT32 iBullet; - UINT16 ubFirerID; - UINT16 ubTargetID; - INT8 bStartCubesAboveLevelZ; - INT8 bEndCubesAboveLevelZ; - INT32 sGridNo; + SoldierID ubFirerID; + SoldierID ubTargetID; + INT8 bStartCubesAboveLevelZ; + INT8 bEndCubesAboveLevelZ; + INT32 sGridNo; INT16 sUnused; - UINT16 usLastStructureHit; - FIXEDPT qCurrX; - FIXEDPT qCurrY; - FIXEDPT qCurrZ; - FIXEDPT qIncrX; - FIXEDPT qIncrY; - FIXEDPT qIncrZ; - DOUBLE ddHorizAngle; + UINT16 usLastStructureHit; + FIXEDPT qCurrX; + FIXEDPT qCurrY; + FIXEDPT qCurrZ; + FIXEDPT qIncrX; + FIXEDPT qIncrY; + FIXEDPT qIncrZ; + DOUBLE ddHorizAngle; INT32 iCurrTileX; INT32 iCurrTileY; - INT8 bLOSIndexX; - INT8 bLOSIndexY; - BOOLEAN fCheckForRoof; + INT8 bLOSIndexX; + INT8 bLOSIndexY; + BOOLEAN fCheckForRoof; INT32 iCurrCubesZ; INT32 iLoop; - BOOLEAN fAllocated; - BOOLEAN fToDelete; - BOOLEAN fLocated; - BOOLEAN fReal; - BOOLEAN fAimed; - UINT32 uiLastUpdate; + BOOLEAN fAllocated; + BOOLEAN fToDelete; + BOOLEAN fLocated; + BOOLEAN fReal; + BOOLEAN fAimed; + UINT32 uiLastUpdate; UINT8 ubTilesPerUpdate; - UINT16 usClockTicksPerUpdate; - SOLDIERTYPE *pFirer; // Flugente: WARNING! We cannot assume this will be valid. Check wether ubFirerID is NOBODY first - INT32 sOrigGridNo; // HEADROCK HAM 5.1: Original tile does not necessarily have to be the pFirer's tile - INT32 sTargetGridNo; + UINT16 usClockTicksPerUpdate; + SOLDIERTYPE *pFirer; // Flugente: WARNING! We cannot assume this will be valid. Check wether ubFirerID is NOBODY first + INT32 sOrigGridNo; // HEADROCK HAM 5.1: Original tile does not necessarily have to be the pFirer's tile + INT32 sTargetGridNo; INT16 sHitBy; INT32 iImpact; INT32 iImpactReduction; INT32 iRange; INT32 iDistanceLimit; - UINT16 usFlags; - ANITILE *pAniTile; - ANITILE *pShadowAniTile; + UINT16 usFlags; + ANITILE *pAniTile; + ANITILE *pShadowAniTile; UINT16 ubItemStatus; - UINT16 fromItem; - INT32 flash; + UINT16 fromItem; + INT32 flash; // HEADROCK HAM B2.5: Experimental bullet tracer info. If the new tracer system is activated, this flag tells // the bullet animation functions to create a lightpath for this bullet. This means now all bullets in a tracer // magazine will cause a lightshow (that's the intended result). @@ -83,7 +83,7 @@ typedef struct extern UINT32 guiNumBullets; -INT32 CreateBullet( UINT16 ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ); +INT32 CreateBullet( SoldierID ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ); void RemoveBullet( INT32 iBullet ); void StopBullet( INT32 iBullet ); void UpdateBullets( ); @@ -107,4 +107,4 @@ BOOLEAN SaveBulletStructureToSaveGameFile( HWFILE hFile ); BOOLEAN LoadBulletStructureFromSavedGameFile( HWFILE hFile ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index a4739b70..296637c0 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -661,7 +661,7 @@ void HandleDialogue( ) SOLDIERTYPE *pSoldier; INT16 sPlayerGridNo; SoldierID ubPlayerID; - UINT8 ubQualifiedSoldierIDArray[ NUM_MERCS_WITH_NEW_QUOTES ]; + SoldierID ubQualifiedSoldierIDArray[ NUM_MERCS_WITH_NEW_QUOTES ]; UINT8 ubNumQualifiedMercs=0; UINT8 ubCnt=0; @@ -693,7 +693,7 @@ void HandleDialogue( ) //loop through all the mercs for( ubCnt=0; ubCntusQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_MORRIS; diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index d3d6263e..2ac44952 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -5206,10 +5206,10 @@ void CarmenLeavesSectorCallback( void ) void PerformJerryMiloAction301() { - UINT8 ubMercsPresent[NUM_MERCS_WITH_NEW_QUOTES]; + SoldierID ubMercsPresent[NUM_MERCS_WITH_NEW_QUOTES]; UINT8 usNumMercsPresent; SOLDIERTYPE *pSoldier=NULL; - UINT8 ubId; + SoldierID ubId; //Get the number and array of the new soldiers usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( ubMercsPresent, NULL ); @@ -5219,7 +5219,7 @@ void PerformJerryMiloAction301() { ubId = ubMercsPresent[ cnt ]; - TacticalCharacterDialogue( MercPtrs[ubId], QUOTE_DEATH_RATE_REFUSAL ); + TacticalCharacterDialogue( ubId, QUOTE_DEATH_RATE_REFUSAL ); } //Trigger Jerry Milo's script record 11 ( call action 302 ) @@ -5231,8 +5231,8 @@ void PerformJerryMiloAction301() void PerformJerryMiloAction302() { - UINT8 ubMercsPresent[NUM_MERCS_WITH_NEW_QUOTES]; - UINT8 usNumMercsPresent; + SoldierID ubMercsPresent[NUM_MERCS_WITH_NEW_QUOTES]; + UINT8 usNumMercsPresent; //off jazz //Get the number and array of the new soldiers @@ -5384,11 +5384,11 @@ void HandleSpecificQuoteWhenLeavingNpcTalkMenu() void HaveQualifiedMercSayQuoteAboutNpcWhenLeavingTalkScreen( UINT8 ubNpcProfileID, UINT32 uiQuoteNum ) { - UINT8 usNumMercsPresent; - UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; - UINT8 ValidSoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES] = {0}; - UINT8 ubNumValidSoldiers=0; - UINT8 ubCnt; + UINT8 usNumMercsPresent; + SoldierID SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + SoldierID ValidSoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES] = {0}; + UINT8 ubNumValidSoldiers=0; + UINT8 ubCnt; SOLDIERTYPE *pSoldier=NULL; SOLDIERTYPE * pNPC; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index f17ed417..70de1d87 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -9304,7 +9304,7 @@ void CheckEquipmentForFragileItemDamage( SOLDIERTYPE *pSoldier, INT32 iDamage ) } -BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, UINT16 ubOwner ) +BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, SoldierID ubOwner ) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; diff --git a/Tactical/Items.h b/Tactical/Items.h index 2afff8f0..fe9465b1 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -296,7 +296,7 @@ UINT16 StandardGunListReplacement( UINT16 usGun ); UINT16 FindReplacementMagazine( UINT8 ubCalibre, UINT16 ubMagSize, UINT8 ubAmmoType); UINT16 FindReplacementMagazineIfNecessary( UINT16 usOldGun, UINT16 usOldAmmo, UINT16 usNewGun ); -BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, UINT16 ubOwner ); +BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, INT32 iDamage, SoldierID ubOwner ); BOOLEAN CompatibleFaceItem( UINT16 usItem1, UINT16 usItem2 ); diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 417dc46e..42cd8ba2 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -452,7 +452,7 @@ BOOLEAN IsSoldierQualifiedInitialHireMerc( SOLDIERTYPE *pSoldier ) } } -UINT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray ) +UINT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierID *pSoldierIdArray, UINT8 *pProfileIdArray ) { SOLDIERTYPE *pSoldier=NULL; UINT8 usNumMercsPresent=0; @@ -523,10 +523,10 @@ INT16 RandomProfileIdFromNewMercsOnPlayerTeam() } } -INT16 RandomSoldierIdFromNewMercsOnPlayerTeam() +SoldierID RandomSoldierIdFromNewMercsOnPlayerTeam() { - UINT8 usNumMercsPresent; - UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + UINT8 usNumMercsPresent; + SoldierID SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; //Get the number and array of the new soldiers usNumMercsPresent = GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierIdArray, NULL ); @@ -536,20 +536,20 @@ INT16 RandomSoldierIdFromNewMercsOnPlayerTeam() if( usNumMercsPresent > 0 ) { //return a random merc from the array - return( (INT16)( SoldierIdArray[ Random( usNumMercsPresent ) ] )); + return( ( SoldierIdArray[ Random( usNumMercsPresent ) ] )); } else { - return( -1 ); + return( NOBODY ); } } UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ) { - UINT8 usNumMercsPresent; - UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; - BOOLEAN UsedArray[NUM_MERCS_WITH_NEW_QUOTES]; - BOOLEAN fFound=FALSE; + UINT8 usNumMercsPresent; + SoldierID SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + BOOLEAN UsedArray[NUM_MERCS_WITH_NEW_QUOTES]; + BOOLEAN fFound=FALSE; UINT8 ubRand; memset( UsedArray, 0, NUM_MERCS_WITH_NEW_QUOTES ); @@ -1060,8 +1060,8 @@ void HandlePlayingQuoteWhenHiringNpc( UINT8 ubProfile ) BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQuoteNum ) { - UINT8 usNumMercsPresent; - UINT8 SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; + UINT8 usNumMercsPresent; + SoldierID SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; SOLDIERTYPE *pSoldier=NULL; //Get an array of the mercs on the team diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index a8b12371..b3c56725 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -37,8 +37,8 @@ typedef struct extern BOOLEAN gfFirstTimeInGameHeliCrash; INT16 RandomProfileIdFromNewMercsOnPlayerTeam(); -INT16 RandomSoldierIdFromNewMercsOnPlayerTeam(); -UINT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( UINT8 *pSoldierIdArray, UINT8 *pProfileIdArray ); +SoldierID RandomSoldierIdFromNewMercsOnPlayerTeam(); +UINT8 GetNumSoldierIdAndProfileIdOfTheNewMercsOnPlayerTeam( SoldierID *pSoldierIdArray, UINT8 *pProfileIdArray ); BOOLEAN IsSoldierQualifiedMerc( SOLDIERTYPE *pSoldier ); BOOLEAN IsSoldierQualifiedInitialHireMerc( SOLDIERTYPE *pSoldier ); BOOLEAN IsSoldierQualifiedMercForSeeingPowerGenFan( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index fff95973..3513e580 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -2435,7 +2435,7 @@ INT32 SoldierTo3DLocationLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT32 sGr { FLOAT dStartZPos, dEndZPos; INT16 sX, sY, sX2, sY2; - UINT16 ubTargetID; + SoldierID ubTargetID; BOOLEAN fOk; CHECKF( pStartSoldier ); @@ -2455,7 +2455,7 @@ INT32 SoldierTo3DLocationLineOfSightTest( SOLDIERTYPE * pStartSoldier, INT32 sGr if (ubTargetID != NOBODY) { // there's a merc there; do a soldier-to-soldier test - return( SoldierToSoldierLineOfSightTest( pStartSoldier, MercPtrs[ubTargetID], bAware, iTileSightLimit, LOS_POS, adjustForSight) ); + return( SoldierToSoldierLineOfSightTest( pStartSoldier, ubTargetID, bAware, iTileSightLimit, LOS_POS, adjustForSight) ); } // else... assume standing height dEndZPos = STANDING_LOS_POS + bLevel * HEIGHT_UNITS; @@ -4640,7 +4640,7 @@ void CalculateFiringIncrementsSimple( DOUBLE ddHorizAngle, DOUBLE ddVerticAngle, pBullet->qIncrZ = FloatToFixed( (FLOAT) ( sin( ddVerticAngle ) / sin( (PI/2) - ddVerticAngle ) * HEIGHTUNITS_PER_CELL ) );//dnl ch60 010913 } -INT8 FireBullet( UINT16 ubFirer, BULLET * pBullet, BOOLEAN fFake ) +INT8 FireBullet( SoldierID ubFirer, BULLET * pBullet, BOOLEAN fFake ) { //DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("FireBullet")); @@ -4654,7 +4654,7 @@ INT8 FireBullet( UINT16 ubFirer, BULLET * pBullet, BOOLEAN fFake ) pBullet->sGridNo = MAPROWCOLTOPOS( pBullet->iCurrTileY, pBullet->iCurrTileX ); if ( ubFirer != NOBODY ) - pBullet->pFirer = MercPtrs[ ubFirer ]; + pBullet->pFirer = ubFirer; else pBullet->pFirer = NULL; @@ -5775,7 +5775,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA // Note that this function does not make provisions for Fake Firing. There is no need for it, and it would needlessly // complicate things anyway. // Also note we receive start coordinates from the bomb itself, because there's nowhere else to get them. -INT8 FireFragmentGivenTarget( UINT16 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ) +INT8 FireFragmentGivenTarget( SoldierID ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ) { // Artificial... dStartZ++; @@ -6986,9 +6986,8 @@ INT8 ChanceToGetThrough(SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dE void MoveBullet( INT32 iBullet ) { - BULLET *pBullet; - - FIXEDPT qLandHeight; + BULLET *pBullet; + FIXEDPT qLandHeight; INT32 iCurrAboveLevelZ; INT32 iCurrCubesAboveLevelZ; INT16 sDesiredLevel; @@ -6997,48 +6996,48 @@ void MoveBullet( INT32 iBullet ) INT32 iOldTileY; INT32 iOldCubesZ; - MAP_ELEMENT * pMapElement; - STRUCTURE * pStructure; - STRUCTURE * pRoofStructure = NULL; + MAP_ELEMENT *pMapElement; + STRUCTURE *pStructure; + STRUCTURE *pRoofStructure = NULL; - FIXEDPT qLastZ; + FIXEDPT qLastZ; - SOLDIERTYPE * pTarget; - UINT16 ubTargetID; - BOOLEAN fIntended; - BOOLEAN fStopped; - INT8 bOldLOSIndexX; - INT8 bOldLOSIndexY; + SOLDIERTYPE *pTarget; + SoldierID ubTargetID; + BOOLEAN fIntended; + BOOLEAN fStopped; + INT8 bOldLOSIndexX; + INT8 bOldLOSIndexY; - UINT32 uiTileInc = 0; - UINT32 uiTime; + UINT32 uiTileInc = 0; + UINT32 uiTime; - INT8 bDir; - INT32 iGridNo, iAdjGridNo; + INT8 bDir; + INT32 iGridNo, iAdjGridNo; - INT32 iRemainingImpact; + INT32 iRemainingImpact; - FIXEDPT qDistToTravelX; - FIXEDPT qDistToTravelY; - INT32 iStepsToTravelX; - INT32 iStepsToTravelY; - INT32 iStepsToTravel; + FIXEDPT qDistToTravelX; + FIXEDPT qDistToTravelY; + INT32 iStepsToTravelX; + INT32 iStepsToTravelY; + INT32 iStepsToTravel; - INT32 iNumLocalStructures; - INT32 iStructureLoop; - UINT32 uiChanceOfHit; + INT32 iNumLocalStructures; + INT32 iStructureLoop; + UINT32 uiChanceOfHit; - BOOLEAN fResolveHit; + BOOLEAN fResolveHit; - INT32 i; - BOOLEAN fGoingOver = FALSE; - BOOLEAN fHitStructure; + INT32 i; + BOOLEAN fGoingOver = FALSE; + BOOLEAN fHitStructure; - FIXEDPT qWallHeight; - FIXEDPT qWindowBottomHeight; - FIXEDPT qWindowTopHeight; + FIXEDPT qWallHeight; + FIXEDPT qWindowBottomHeight; + FIXEDPT qWindowTopHeight; - UINT16 lastriotshieldholder = NOBODY; // added by Flugente + SoldierID lastriotshieldholder = NOBODY; // added by Flugente pBullet = GetBulletPtr( iBullet ); @@ -7358,7 +7357,7 @@ void MoveBullet( INT32 iBullet ) ubTargetID = WhoIsThere2( iAdjGridNo, (INT8) sDesiredLevel ); if (ubTargetID != NOBODY) { - pTarget = MercPtrs[ ubTargetID ]; + pTarget = ubTargetID; if ( IS_MERC_BODY_TYPE( pTarget ) && (pBullet->ubFirerID == NOBODY || pBullet->pFirer->bSide != pTarget->bSide) ) { // buckshot has only a 1 in 2 chance of applying a suppression point @@ -9911,7 +9910,7 @@ UINT32 CalcCounterForceAccuracy(SOLDIERTYPE *pShooter, OBJECTTYPE *pWeapon, UINT // If we can't see the target, but buddies can see it, CF-Accuracy drops by 50% // If we can't see the target and neither can buddies, CF-Accuracy drops by 75% - UINT16 ubTargetID = WhoIsThere2( pShooter->sTargetGridNo, pShooter->bTargetLevel ); // Target ubID + SoldierID ubTargetID = WhoIsThere2( pShooter->sTargetGridNo, pShooter->bTargetLevel ); // Target ubID INT16 sDistVis = pShooter->GetMaxDistanceVisible(pShooter->sTargetGridNo, pShooter->bTargetLevel, CALC_FROM_ALL_DIRS ) * CELL_X_SIZE; gbForceWeaponNotReady = true; INT16 sDistVisNoScope = pShooter->GetMaxDistanceVisible(pShooter->sTargetGridNo, pShooter->bTargetLevel, CALC_FROM_ALL_DIRS ) * CELL_X_SIZE; @@ -9920,12 +9919,12 @@ UINT32 CalcCounterForceAccuracy(SOLDIERTYPE *pShooter, OBJECTTYPE *pWeapon, UINT INT32 iSightRange = 0; if (ubTargetID != NOBODY) - iSightRange = SoldierToSoldierLineOfSightTest( pShooter, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pShooter->bAimShotLocation, false ); + iSightRange = SoldierToSoldierLineOfSightTest( pShooter, ubTargetID, TRUE, NO_DISTANCE_LIMIT, pShooter->bAimShotLocation, false ); if (iSightRange == 0) { // didn't do a bodypart-based test or can't see specific body part aimed at iSightRange = SoldierTo3DLocationLineOfSightTest( pShooter, pShooter->sTargetGridNo, pShooter->bTargetLevel, pShooter->bTargetCubeLevel, TRUE, NO_DISTANCE_LIMIT, false ); } if (iSightRange == 0) { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties - iSightRange = SoldierToSoldierLineOfSightTest( pShooter, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pShooter->bAimShotLocation, false, true ); + iSightRange = SoldierToSoldierLineOfSightTest( pShooter, ubTargetID, TRUE, NO_DISTANCE_LIMIT, pShooter->bAimShotLocation, false, true ); } // Modify iSightRange for scope use diff --git a/Tactical/LOS.h b/Tactical/LOS.h index a03b4216..69e03f0e 100644 --- a/Tactical/LOS.h +++ b/Tactical/LOS.h @@ -69,7 +69,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA // HEADROCK HAM 4: Changed the name of one argument to avoid confusion with the new CTH system. INT8 FireBulletGivenTargetNCTH( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usHandItem, INT16 sApertureRatio, BOOLEAN fBuckshot, BOOLEAN fFake ); // HEADROCK HAM 5: Function for fragments ejected from an explosion. -INT8 FireFragmentGivenTarget( UINT16 ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ); +INT8 FireFragmentGivenTarget( SoldierID ubOwner, FLOAT dStartX, FLOAT dStartY, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, UINT16 usExplosiveItem ); // Flugente: fire a shot from a gun that has no user (used for traps with attached guns) INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT32 gridno, FLOAT dStartZ, FLOAT dEndX, FLOAT dEndY, FLOAT dEndZ, INT16 sHitBy); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index aa96c7e6..a415b2e1 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -25194,13 +25194,13 @@ BOOLEAN MajorTrait( UINT8 uiSkillTraitNumber ) return FALSE; } -BOOLEAN GetRadioOperatorSignal( UINT8 usOwner, INT32* psTargetGridNo ) +BOOLEAN GetRadioOperatorSignal( SoldierID usOwner, INT32* psTargetGridNo ) { // get the 'real owner' if ( usOwner > 1 ) { // a merc planted this - if he's a radio operator, use his gridno - SOLDIERTYPE* pSoldier = MercPtrs[usOwner - 2]; + SOLDIERTYPE* pSoldier = (usOwner - 2); if ( pSoldier && pSoldier->CanUseRadio( FALSE ) && pSoldier->bActive && pSoldier->bInSector && (pSoldier->sSectorX == gWorldSectorX) && (pSoldier->sSectorY == gWorldSectorY) && (pSoldier->bSectorZ == gbWorldSectorZ) ) { diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index eebd00ee..158cb352 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -2227,7 +2227,7 @@ BOOLEAN DecideAltAnimForBigMerc( SOLDIERTYPE * pSoldier ); // added by Flugente BOOLEAN TwoStagedTrait( UINT8 uiSkillTraitNumber ); // determine if this (new) trait has two stages BOOLEAN MajorTrait( UINT8 uiSkillTraitNumber ); // determine if this is a major trait -BOOLEAN GetRadioOperatorSignal(UINT8 usOwner, INT32* psTargetGridNo); // retrieve the gridno of a radio operator who (or whose team) ordered an artillery strike +BOOLEAN GetRadioOperatorSignal( SoldierID usOwner, INT32* psTargetGridNo); // retrieve the gridno of a radio operator who (or whose team) ordered an artillery strike BOOLEAN IsValidArtilleryOrderSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT8 bTeam ); // can an artillery strike be ordered FROM this sector BOOLEAN SectorJammed(); BOOLEAN PlayerTeamIsScanning(); diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 49d53cfd..975e4b19 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -114,10 +114,10 @@ typedef struct { UINT16 ubOutOfTurnPersons; - INT16 InterruptOnlyGuynum; + SoldierID InterruptOnlyGuynum; INT16 sWhoThrewRock; - BOOLEAN InterruptsAllowed; - BOOLEAN fHiddenInterrupt; + BOOLEAN InterruptsAllowed; + BOOLEAN fHiddenInterrupt; UINT8 ubLastInterruptedGuy; UINT8 ubFiller[16]; diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index ebe43661..8e527f79 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -2444,7 +2444,7 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) //CHAR8 zBurstString[512]; UINT8 ubDirection; INT32 sNewGridNo; - UINT16 ubMerc; + SoldierID ubMerc; BOOLEAN fGonnaHit = FALSE; FLOAT dExpGain = 0; UINT32 uiDepreciateTest; @@ -2967,14 +2967,14 @@ BOOLEAN UseGunNCTH( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) if ( ubMerc != NOBODY ) { - if ( gAnimControl[ MercPtrs[ ubMerc ]->usAnimState ].ubHeight != ANIM_PRONE ) + if ( gAnimControl[ ubMerc->usAnimState ].ubHeight != ANIM_PRONE ) { // Increment attack counter... // gTacticalStatus.ubAttackBusyCount++; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Exaust from LAW", gTacticalStatus.ubAttackBusyCount ) ); DebugAttackBusy( "Incrementing Attack: Exaust from LAW\n" ); - MercPtrs[ ubMerc ]->EVENT_SoldierGotHit( MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo ); + ubMerc->EVENT_SoldierGotHit( MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo ); } } } @@ -3232,7 +3232,7 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) // CHAR8 zBurstString[512]; UINT8 ubDirection; INT32 sNewGridNo; - UINT16 ubMerc; + SoldierID ubMerc; BOOLEAN fGonnaHit = FALSE; UINT16 usExpGain = 0; UINT32 uiDepreciateTest; @@ -3785,14 +3785,14 @@ BOOLEAN UseGun( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) if ( ubMerc != NOBODY ) { - if ( gAnimControl[ MercPtrs[ ubMerc ]->usAnimState ].ubHeight != ANIM_PRONE ) + if ( gAnimControl[ ubMerc->usAnimState ].ubHeight != ANIM_PRONE ) { // Increment attack counter... // gTacticalStatus.ubAttackBusyCount++; DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Incrementing Attack: Exaust from LAW", gTacticalStatus.ubAttackBusyCount ) ); DebugAttackBusy( "Incrementing Attack: Exaust from LAW\n" ); - MercPtrs[ ubMerc ]->EVENT_SoldierGotHit( MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo ); + ubMerc->EVENT_SoldierGotHit( MINI_GRENADE, 10, 200, pSoldier->ubDirection, 0, pSoldier->ubID, 0, ANIM_CROUCH, 0, sNewGridNo ); } } } @@ -4097,15 +4097,15 @@ BOOLEAN UseBlade( SOLDIERTYPE *pSoldier , INT32 sTargetGridNo ) PossiblyStartEnemyTaunt( pTargetSoldier, TAUNT_GOT_MISSED_BLADE, pSoldier->ubID ); // if it was another team shooting at someone under our control - if ( (pSoldier->bTeam != Menptr[ pTargetSoldier->ubID ].bTeam ) ) + if ( (pSoldier->bTeam != pTargetSoldier->ubID->bTeam ) ) { if (pTargetSoldier->bTeam == gbPlayerNum) { // AGILITY GAIN (10): Target avoids a knife attack // Snap: stat gains should match stat requirements - StatChange( MercPtrs[ pTargetSoldier->ubID ], DEXTAMT, 15, FALSE); - StatChange( MercPtrs[ pTargetSoldier->ubID ], AGILAMT, 5, FALSE); - StatChange( MercPtrs[ pTargetSoldier->ubID ], STRAMT, 5, FALSE); + StatChange( pTargetSoldier->ubID, DEXTAMT, 15, FALSE); + StatChange( pTargetSoldier->ubID, AGILAMT, 5, FALSE); + StatChange( pTargetSoldier->ubID, STRAMT, 5, FALSE); } } // 0verhaul: Another case that is handled by the animation transition system. @@ -4940,10 +4940,10 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo, BOOLEAN fStea BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) { - UINT32 uiHitChance; + UINT32 uiHitChance; INT8 bLoop; - UINT16 ubTargetID; - SOLDIERTYPE * pTargetSoldier; + SoldierID ubTargetID; + SOLDIERTYPE *pTargetSoldier; //INT16 sAPCost = 0;//dnl ch72 180913 uiHitChance = CalcThrownChanceToHit( pSoldier, sTargetGridNo, pSoldier->aiData.bAimTime, AIM_SHOT_TORSO ); @@ -4965,7 +4965,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) } else { - pTargetSoldier = MercPtrs[ ubTargetID ]; + pTargetSoldier = ubTargetID; } if ( pTargetSoldier && pTargetSoldier->bTeam == pSoldier->bTeam ) @@ -4987,7 +4987,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) pTargetSoldier = NULL; if ( ubTargetID != NOBODY ) { - pTargetSoldier = MercPtrs[ ubTargetID ]; + pTargetSoldier = ubTargetID; if ( pTargetSoldier->bTeam != pSoldier->bTeam ) { usNumTargets++; @@ -5315,7 +5315,7 @@ BOOLEAN UseLauncher( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) return( TRUE ); } -BOOLEAN DoSpecialEffectAmmoMiss( UINT16 ubAttackerID, UINT16 usWeaponIndex, INT32 sGridNo, INT16 sXPos, INT16 sYPos, INT16 sZPos, BOOLEAN fSoundOnly, BOOLEAN fFreeupAttacker, INT32 iBullet ) +BOOLEAN DoSpecialEffectAmmoMiss( SoldierID ubAttackerID, UINT16 usWeaponIndex, INT32 sGridNo, INT16 sXPos, INT16 sYPos, INT16 sZPos, BOOLEAN fSoundOnly, BOOLEAN fFreeupAttacker, INT32 iBullet ) { ANITILE_PARAMS AniParams; UINT8 ubAmmoType = 0; @@ -5324,7 +5324,7 @@ BOOLEAN DoSpecialEffectAmmoMiss( UINT16 ubAttackerID, UINT16 usWeaponIndex, INT3 // Flugente: check for underbarrel weapons and use that object if necessary if ( ubAttackerID != NOBODY ) { - OBJECTTYPE* pObj = MercPtrs[ ubAttackerID ]->GetUsedWeapon( &MercPtrs[ ubAttackerID ]->inv[ MercPtrs[ ubAttackerID ]->ubAttackingHand ] ); + OBJECTTYPE* pObj = ubAttackerID->GetUsedWeapon( &ubAttackerID->inv[ ubAttackerID->ubAttackingHand ] ); ubAmmoType = (*pObj)[0]->data.gun.ubGunAmmoType; usItem = (*pObj).usItem; @@ -6036,7 +6036,7 @@ void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStatus, Sol // Set attacker ID pNode->usMissAnimationPlayed = usMissTileType; - pNode->ubAttackerMissed = ubAttackerID; + pNode->ubAttackerMissed = ubAttackerID; // Adjust for absolute positioning pNode->pLevelNode->uiFlags |= LEVELNODE_USEABSOLUTEPOS; pNode->pLevelNode->sRelativeX = sXPos; @@ -6278,7 +6278,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi UINT16 usInHand; OBJECTTYPE * pInHand; INT16 sDistVis, sDistVisNoScope; - UINT16 ubTargetID; + SoldierID ubTargetID; bool fCantSeeTarget = false; FLOAT scopeRangeMod = 0.0f; @@ -6327,7 +6327,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi if (ubTargetID != NOBODY && (pSoldier->aiData.bOppList[ubTargetID] == SEEN_CURRENTLY || gbPublicOpplist[pSoldier->bTeam][ubTargetID] == SEEN_CURRENTLY)) { - iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false ); + iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, ubTargetID, TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false ); } if (iSightRange == 0) { @@ -6338,7 +6338,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties if (ubTargetID != NOBODY) - iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true ); + iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, ubTargetID, TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true ); fCantSeeTarget = true; } @@ -6639,8 +6639,8 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, INT16 bonusProgression[8] = {500,500,600,600,750,750,750,1000}; //Aiming progression UINT16 usInHand, usShockPenalty, MIN_RANGE_FOR_FULL_COWER, MAX_TARGET_COWERING_PENALTY; UINT16 iBulletsLeft, iTracersFired = 0, iBulletsPerTracer, iBulletsSinceLastTracer=0, iRoundsFiredPreviously; - INT8 bBandaged, maxClickBonus = 10, AIM_PENALTY_PER_TARGET_SHOCK; - UINT16 ubTargetID; + INT8 bBandaged, maxClickBonus = 10, AIM_PENALTY_PER_TARGET_SHOCK; + SoldierID ubTargetID; UINT8 bLightLevel, ubCoweringDivisor, ubAutoPenaltySinceLastTracer = 0; FLOAT maxBonus, aimTimeBonus, scopeRangeMod = 0.0f, iAimBonus; bool fCantSeeTarget = false, fCoverObscured = false; @@ -6685,7 +6685,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, iScopeVisionRangeBonus = GetTotalVisionRangeBonus(pSoldier, bLightLevel); // not an actual range value, simply a modifier for range calculations if (ubTargetID != NOBODY && ( pSoldier->aiData.bOppList[ubTargetID] == SEEN_CURRENTLY || gbPublicOpplist[pSoldier->bTeam][ubTargetID] == SEEN_CURRENTLY ) ) - iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false ); + iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, ubTargetID, TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false ); if (iSightRange == 0) { @@ -6698,7 +6698,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, { // Can't see the target but we still need to know what the sight range would be if we could so we can deal with cover penalties if (ubTargetID != NOBODY) - iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, MercPtrs[ubTargetID], TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true ); + iSightRange = SoldierToSoldierLineOfSightTest( pSoldier, ubTargetID, TRUE, NO_DISTANCE_LIMIT, pSoldier->bAimShotLocation, false, true ); fCantSeeTarget = true; fCoverObscured = false; } @@ -9061,7 +9061,7 @@ INT32 HTHImpact( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTarget, INT32 iHitBy, BO return( iImpact ); } -void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) +void ShotMiss( SoldierID ubAttackerID, INT32 iBullet ) { BOOLEAN fDoMissForGun = FALSE; SOLDIERTYPE* pAttacker = NULL; @@ -9070,7 +9070,7 @@ void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) if ( ubAttackerID == NOBODY ) return; - pAttacker = MercPtrs[ ubAttackerID ]; + pAttacker = ubAttackerID; if ( pAttacker->ubOppNum != NOBODY ) { @@ -9086,7 +9086,7 @@ void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) } } - switch( Weapon[ MercPtrs[ ubAttackerID ]->usAttackingWeapon ].ubWeaponClass ) + switch( Weapon[ ubAttackerID->usAttackingWeapon ].ubWeaponClass ) { case HANDGUNCLASS: case RIFLECLASS: @@ -9095,11 +9095,11 @@ void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) case MGCLASS: // Guy has missed, play random sound - if ( MercPtrs[ ubAttackerID ]->bTeam == gbPlayerNum ) + if ( ubAttackerID->bTeam == gbPlayerNum ) { if ( Random(40) == 0 ) { - MercPtrs[ ubAttackerID ]->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); + ubAttackerID->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } } fDoMissForGun = TRUE; @@ -9142,7 +9142,7 @@ void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ) // PLAY SOUND AND FLING DEBRIS // RANDOMIZE SOUND SYSTEM - if ( !DoSpecialEffectAmmoMiss( ubAttackerID, MercPtrs[ ubAttackerID ]->usAttackingWeapon, NOWHERE, 0, 0, 0, TRUE, TRUE, 0 ) ) + if ( !DoSpecialEffectAmmoMiss( ubAttackerID, ubAttackerID->usAttackingWeapon, NOWHERE, 0, 0, 0, TRUE, TRUE, 0 ) ) { PlayJA2Sample( MISS_1 + Random(8), RATE_11025, HIGHVOLUME, 1, MIDDLEPAN ); } diff --git a/Tactical/Weapons.h b/Tactical/Weapons.h index 650d18f3..8f6afb7e 100644 --- a/Tactical/Weapons.h +++ b/Tactical/Weapons.h @@ -459,7 +459,7 @@ extern void StructureHit( INT32 iBullet, UINT16 usWeaponIndex, INT16 bWeaponStat extern void WindowHit( INT32 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce ); // HEADROCK HAM 5.1: Moved to Bullets.h extern BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT32 sGridNo ); -extern void ShotMiss( UINT16 ubAttackerID, INT32 iBullet ); +extern void ShotMiss( SoldierID ubAttackerID, INT32 iBullet ); extern UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ); extern UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ); extern UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos, INT8 bTargetLevel, UINT16 usAnimState);//dnl ch59 180813 diff --git a/Tactical/bullets.cpp b/Tactical/bullets.cpp index 193cf9b9..0f904908 100644 --- a/Tactical/bullets.cpp +++ b/Tactical/bullets.cpp @@ -71,7 +71,7 @@ void RecountBullets(void) } -INT32 CreateBullet( UINT16 ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ) +INT32 CreateBullet( SoldierID ubFirerID, BOOLEAN fFake, UINT16 usFlags,UINT16 fromItem ) { INT32 iBulletIndex; BULLET *pBullet; @@ -245,7 +245,7 @@ void LocateBullet( INT32 iBulletIndex ) // Check if a bad guy fired! if ( gBullets[ iBulletIndex ].ubFirerID != NOBODY ) { - if ( MercPtrs[ gBullets[ iBulletIndex ].ubFirerID ]->bSide == gbPlayerNum ) + if ( gBullets[ iBulletIndex ].ubFirerID->bSide == gbPlayerNum ) { if ( !gBullets[ iBulletIndex ].fLocated ) { @@ -633,7 +633,7 @@ BOOLEAN LoadBulletStructureFromSavedGameFile( HWFILE hFile ) //Set some parameters gBullets[usCnt].uiLastUpdate = 0; if( gBullets[usCnt].ubFirerID != NOBODY ) - gBullets[usCnt].pFirer = &Menptr[ gBullets[usCnt].ubFirerID ]; + gBullets[usCnt].pFirer = gBullets[usCnt].ubFirerID; else gBullets[usCnt].pFirer = NULL; diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index e8cd046b..4b4d0357 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -5670,7 +5670,7 @@ BOOLEAN DuskLight(void) return FALSE; } -BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) +BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID) { INT8 bPersonalKnowledge; INT8 bPublicKnowledge; @@ -5694,7 +5694,7 @@ BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) return FALSE; } -INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) +INT8 Knowledge(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5709,7 +5709,7 @@ INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) return PublicKnowledge(pSoldier->bTeam, ubOpponentID); } -INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) +INT32 KnownLocation(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5724,7 +5724,7 @@ INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) return KnownPublicLocation(pSoldier->bTeam, ubOpponentID); } -INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) +INT8 KnownLevel(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5739,7 +5739,7 @@ INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) return KnownPublicLevel(pSoldier->bTeam, ubOpponentID); } -INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) +INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5749,7 +5749,7 @@ INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) return pSoldier->aiData.bOppList[ubOpponentID]; } -INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) +INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5763,7 +5763,7 @@ INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) return gsLastKnownOppLoc[pSoldier->ubID][ubOpponentID]; } -INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) +INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID) { if (!pSoldier || ubOpponentID == NOBODY) { @@ -5773,7 +5773,7 @@ INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID) return gbLastKnownOppLevel[pSoldier->ubID][ubOpponentID]; } -INT8 PublicKnowledge(UINT8 bTeam, UINT16 ubOpponentID) +INT8 PublicKnowledge(UINT8 bTeam, SoldierID ubOpponentID) { if (bTeam >= MAXTEAMS || ubOpponentID == NOBODY) { @@ -5783,7 +5783,7 @@ INT8 PublicKnowledge(UINT8 bTeam, UINT16 ubOpponentID) return gbPublicOpplist[bTeam][ubOpponentID]; } -INT32 KnownPublicLocation(UINT8 bTeam, UINT16 ubOpponentID) +INT32 KnownPublicLocation(UINT8 bTeam, SoldierID ubOpponentID) { if (bTeam >= MAXTEAMS || ubOpponentID == NOBODY) { @@ -5797,7 +5797,7 @@ INT32 KnownPublicLocation(UINT8 bTeam, UINT16 ubOpponentID) return gsPublicLastKnownOppLoc[bTeam][ubOpponentID]; } -INT8 KnownPublicLevel(UINT8 bTeam, UINT16 ubOpponentID) +INT8 KnownPublicLevel(UINT8 bTeam, SoldierID ubOpponentID) { if (bTeam >= MAXTEAMS || ubOpponentID == NOBODY) { diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index a6603ae3..3d990d88 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -387,19 +387,19 @@ BOOLEAN AICheckSpecialRole(SOLDIERTYPE *pSoldier); // Knowledge functions // ************************************************************* -INT8 Knowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); -INT32 KnownLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); -INT8 KnownLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); +INT8 Knowledge(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID); +INT32 KnownLocation(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID); +INT8 KnownLevel(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID); -BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); +BOOLEAN UsePersonalKnowledge(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID); -INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); -INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); -INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, UINT16 ubOpponentID); +INT8 PersonalKnowledge(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID); +INT32 KnownPersonalLocation(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID); +INT8 KnownPersonalLevel(SOLDIERTYPE *pSoldier, SoldierID ubOpponentID); -INT8 PublicKnowledge(UINT8 bTeam, UINT16 ubOpponentID); -INT32 KnownPublicLocation(UINT8 bTeam, UINT16 ubOpponentID); -INT8 KnownPublicLevel(UINT8 bTeam, UINT16 ubOpponentID); +INT8 PublicKnowledge(UINT8 bTeam, SoldierID ubOpponentID); +INT32 KnownPublicLocation(UINT8 bTeam, SoldierID ubOpponentID); +INT8 KnownPublicLevel(UINT8 bTeam, SoldierID ubOpponentID); #define MAX_FLANKS_RED 25 #define MAX_FLANKS_YELLOW 25 diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index a5a1ff84..5569c419 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -63,7 +63,7 @@ BOOLEAN HookerInRoom( UINT16 usRoom ); // MODULE FOR EXPLOSIONS // Spreads the effects of explosions... -BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT16 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ); +BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, SoldierID ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ); // Flashbang effect on soldier UINT8 DetermineFlashbangEffect( SOLDIERTYPE *pSoldier, INT8 ubExplosionDir, BOOLEAN fInBuilding); @@ -192,7 +192,7 @@ UINT32 guiNumExplosions = 0; INT32 GetFreeExplosion( void ); void RecountExplosions( void ); void GenerateExplosionFromExplosionPointer( EXPLOSIONTYPE *pExplosion ); -void HandleBuldingDestruction( INT32 sGridNo, UINT16 ubOwner ); +void HandleBuldingDestruction( INT32 sGridNo, SoldierID ubOwner ); #ifdef JA2UB //JA25 UB @@ -650,13 +650,13 @@ void HandleFencePartnerCheck( INT32 sStructGridNo ) INT8 ExplosiveDamageStructureAtGridNo( STRUCTURE * pCurrent, STRUCTURE **ppNextCurrent, INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, - BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT16 ubOwner, INT8 bLevel, + BOOLEAN *pfRecompileMovementCosts, BOOLEAN fOnlyWalls, BOOLEAN fSubSequentMultiTilesTransitionDamage, SoldierID ubOwner, INT8 bLevel, UINT8 ubReason ) { #ifdef JA2BETAVERSION if (is_networked) { CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"ExplosiveDamageStructureAtGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompMoveCosts : %i , fOnlyWalls : %i , SubsMulTilTransDmg : %i , ubOwner : %i , bLevel : %i )\n", sGridNo, sWoundAmt , uiDist, (int)*pfRecompileMovementCosts , (int)fOnlyWalls , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel ); + sprintf(tmpMPDbgString,"ExplosiveDamageStructureAtGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompMoveCosts : %i , fOnlyWalls : %i , SubsMulTilTransDmg : %i , ubOwner : %i , bLevel : %i )\n", sGridNo, sWoundAmt , uiDist, (int)*pfRecompileMovementCosts , (int)fOnlyWalls , (int)fSubSequentMultiTilesTransitionDamage , ubOwner.i , bLevel ); MPDebugMsg(tmpMPDbgString); } #endif @@ -1329,14 +1329,14 @@ STRUCTURE *gStruct; void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, - BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT16 ubOwner, + BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, SoldierID ubOwner, INT8 bLevel, UINT8 ubReason ) { #ifdef JA2BETAVERSION if (is_networked) { CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"ExplosiveDamageGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompileMoveCosts : %i , fOnlyWalls : %i , MultiStructSpecialFlag : %i ,fSubsequentMultiTilesTransDmg : %i , ubOwner : %i , bLevel : %i )\n", sGridNo, sWoundAmt ,uiDist, (int)*pfRecompileMovementCosts , (int)fOnlyWalls , bMultiStructSpecialFlag , (int)fSubSequentMultiTilesTransitionDamage , ubOwner , bLevel ); + sprintf(tmpMPDbgString,"ExplosiveDamageGridNo ( sGridNo : %i , sWoundAmt : %i , uiDist : %i , fRecompileMoveCosts : %i , fOnlyWalls : %i , MultiStructSpecialFlag : %i ,fSubsequentMultiTilesTransDmg : %i , ubOwner : %i , bLevel : %i )\n", sGridNo, sWoundAmt ,uiDist, (int)*pfRecompileMovementCosts , (int)fOnlyWalls , bMultiStructSpecialFlag , (int)fSubSequentMultiTilesTransitionDamage , ubOwner.i , bLevel ); MPDebugMsg(tmpMPDbgString); } #endif @@ -1511,12 +1511,12 @@ void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, } -BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent, BOOL fFromRemoteClient ) +BOOLEAN DamageSoldierFromBlast( SoldierID ubPerson, SoldierID ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent, BOOL fFromRemoteClient ) { // OJW - 20091028 if (is_networked && is_client) { - SOLDIERTYPE* pSoldier = MercPtrs[ubPerson]; + SOLDIERTYPE* pSoldier = ubPerson; if (pSoldier != NULL) { // only the owner of a merc may send damage (as this takes into account equipped armor) @@ -1532,9 +1532,9 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid } } #ifdef JA2BETAVERSION - CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"DamageSoldierFromBlast ( ubPerson : %i , ubOwner : %i , sBombGridNo : %i , sWoundAmt : %i , sBreathAmt : %i , uiDist : %i , usItem : %i , sSubs : %i , fFromRemoteClient : %i )\n",ubPerson, ubOwner , sBombGridNo , sWoundAmt , sBreathAmt , uiDist , usItem , sSubsequent , fFromRemoteClient ); - MPDebugMsg(tmpMPDbgString); + CHAR tmpMPDbgString[512]; + sprintf(tmpMPDbgString,"DamageSoldierFromBlast ( ubPerson : %i , ubOwner : %i , sBombGridNo : %i , sWoundAmt : %i , sBreathAmt : %i , uiDist : %i , usItem : %i , sSubs : %i , fFromRemoteClient : %i )\n",ubPerson.i, ubOwner.i , sBombGridNo , sWoundAmt , sBreathAmt , uiDist , usItem , sSubsequent , fFromRemoteClient ); + MPDebugMsg(tmpMPDbgString); #endif } @@ -1547,7 +1547,7 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid BOOLEAN fFlashbang = Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_FLASHBANG; UINT16 usHalfExplosionRadius; - pSoldier = MercPtrs[ ubPerson ]; // someone is here, and they're gonna get hurt + pSoldier = ubPerson; // someone is here, and they're gonna get hurt if (!pSoldier->bActive || !pSoldier->bInSector || !pSoldier->stats.bLife ) return( FALSE ); @@ -1612,29 +1612,29 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid // SANDRO - STOMP traits else { - if ( ubOwner < TOTAL_SOLDIERS && (MercPtrs[ ubOwner ] != NULL) && gGameOptions.fNewTraitSystem) + if ( ubOwner < TOTAL_SOLDIERS && gGameOptions.fNewTraitSystem) { // Demolitions damage bonus with bombs and mines - if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], DEMOLITIONS_NT ) && + if ( HAS_SKILL_TRAIT( ubOwner, DEMOLITIONS_NT ) && Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL && Item[usItem].usItemClass == IC_BOMB && (!ItemIsAttachment(usItem) || ItemIsMine(usItem))) { sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubDEDamageOfBombsAndMines) / 100.0f + 0.5f); } // Heavy Weapons trait bonus damage to tanks - if ( HAS_SKILL_TRAIT( MercPtrs[ubOwner], HEAVY_WEAPONS_NT ) && (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && + if ( HAS_SKILL_TRAIT( ubOwner, HEAVY_WEAPONS_NT ) && (ARMED_VEHICLE( pSoldier ) || ENEMYROBOT( pSoldier )) && Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL ) { - sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubHWDamageTanksBonusPercent * NUM_SKILL_TRAITS( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT )) / 100.0f + 0.5f); // +30% + sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubHWDamageTanksBonusPercent * NUM_SKILL_TRAITS( ubOwner, HEAVY_WEAPONS_NT )) / 100.0f + 0.5f); // +30% } // Heavy Weapons trait bonus damage with rocket, grenade launchers and mortar - else if ( HAS_SKILL_TRAIT( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT ) && + else if ( HAS_SKILL_TRAIT( ubOwner, HEAVY_WEAPONS_NT ) && Explosive[Item[usItem].ubClassIndex].ubType == EXPLOSV_NORMAL && ((Item[usItem].usItemClass == IC_BOMB && ItemIsAttachment(usItem) && !ItemIsMine(usItem) ) || // mortar shells (Item[usItem].usItemClass == IC_GRENADE && (ItemIsGLgrenade(usItem) || ItemIsElectronic(usItem)) ) || // rockets for rocketlaunchers (I haven't found any other way) (Item[usItem].usItemClass == IC_LAUNCHER ) || ItemIsRocketLauncher(usItem) || ItemIsSingleShotRocketLauncher(usItem) ) ) { - sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubHWDamageBonusPercentForHW * NUM_SKILL_TRAITS( MercPtrs[ ubOwner ], HEAVY_WEAPONS_NT )) / 100.0f + 0.5f); // +15% + sNewWoundAmt = (INT16)(sNewWoundAmt * (100 + gSkillTraitValues.ubHWDamageBonusPercentForHW * NUM_SKILL_TRAITS( ubOwner, HEAVY_WEAPONS_NT )) / 100.0f + 0.5f); // +15% } } @@ -1890,9 +1890,9 @@ BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGrid pSoldier->ubMiscSoldierFlags |= SOLDIER_MISC_HURT_BY_EXPLOSION; - if ( ubOwner != NOBODY && MercPtrs[ ubOwner ]->bTeam == gbPlayerNum && pSoldier->bTeam != gbPlayerNum ) + if ( ubOwner != NOBODY && ubOwner->bTeam == gbPlayerNum && pSoldier->bTeam != gbPlayerNum ) { - ProcessImplicationsOfPCAttack( MercPtrs[ ubOwner ], &pSoldier, REASON_EXPLOSION ); + ProcessImplicationsOfPCAttack( ubOwner, &pSoldier, REASON_EXPLOSION ); } return( TRUE ); @@ -2163,7 +2163,7 @@ BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, IN return( fRecompileMovementCosts ); } -BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, UINT16 ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ) +BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usItem, SoldierID ubOwner, INT16 sSubsequent, BOOLEAN *pfMercHit, INT8 bLevel, INT32 iSmokeEffectID ) { #ifdef JA2BETAVERSION if (is_networked) { @@ -2174,7 +2174,7 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte #endif INT16 sWoundAmt = 0,sBreathAmt = 0, /* sNewWoundAmt = 0, sNewBreathAmt = 0, */ sStructDmgAmt; - UINT16 ubPerson; + SoldierID ubPerson; SOLDIERTYPE *pSoldier; EXPLOSIVETYPE *pExplosive; INT16 sX, sY; @@ -2533,7 +2533,7 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte return( fRecompileMovementCosts ); } - pSoldier = MercPtrs[ ubPerson ]; // someone is here, and they're gonna get hurt + pSoldier = ubPerson; // someone is here, and they're gonna get hurt // silversurfer: Gas now only has an effect when the container had time to emit some. Initially it will do nothing. // This prevents the problem that we have to suffer two times without a chance to react (1st when the grenade hits our position, 2nd when our turn starts) @@ -2918,11 +2918,11 @@ void GetRayStopInfo( UINT32 uiNewSpot, UINT8 ubDir, INT8 bLevel, BOOLEAN fSmokeE -void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID, BOOL fFromRemoteClient, BOOL fNewSmokeEffect ) +void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, SoldierID ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID, BOOL fFromRemoteClient, BOOL fNewSmokeEffect ) { if (is_networked && is_client) { - SOLDIERTYPE* pAttacker = MercPtrs[ubOwner]; + SOLDIERTYPE* pAttacker = ubOwner; if (pAttacker != NULL) { if (IsOurSoldier(pAttacker) || (pAttacker->bTeam == 1 && is_server)) @@ -2932,7 +2932,7 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, { // let all the other clients know we are spawning this effect // and align them with our random number generator - send_spreadeffect(sGridNo,ubRadius,usItem,ubOwner,fSubsequent,bLevel,iSmokeEffectID); + send_spreadeffect(sGridNo, ubRadius, usItem, ubOwner, fSubsequent, bLevel, iSmokeEffectID); } } else if (!fFromRemoteClient) @@ -3803,7 +3803,7 @@ void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemo if (IsOurSoldier((SOLDIERTYPE*)gubPersonToSetOffExplosions) || IsOurSoldier((SOLDIERTYPE*)soldierID)) { // we set off the bomb (could be failed disarm) or we own it, tell the other clients we are setting it off - send_detonate_explosive(iWorldIndex,gubPersonToSetOffExplosions); + send_detonate_explosive(iWorldIndex, gubPersonToSetOffExplosions); } else if (gWorldBombs[uiWorldBombIndex].bIsFromRemotePlayer && !fFromRemoteClient) { @@ -3932,10 +3932,10 @@ BOOLEAN ActivateSurroundingTripwire( SoldierID ubID, INT32 sGridNo, INT8 bLevel, // SANDRO - merc records // only if we blew up somebody not in our team(no achievement for blowing our guys :)), only if owner exists and have profile - if ( (MercPtrs[ubID]->bTeam != gbPlayerNum) && ((*pObj)[0]->data.misc.ubBombOwner > 1) ) + if ( (ubID->bTeam != gbPlayerNum) && ((*pObj)[0]->data.misc.ubBombOwner > 1) ) { - if ( MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->ubProfile != NO_PROFILE && MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->bTeam == gbPlayerNum ) - gMercProfiles[ MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->ubProfile ].records.usExpDetonated++; + if ( ((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile != NO_PROFILE && ((*pObj)[0]->data.misc.ubBombOwner - 2)->bTeam == gbPlayerNum ) + gMercProfiles[ ((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile ].records.usExpDetonated++; } /*if (pObj->usItem != ACTION_ITEM || (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP) @@ -3962,7 +3962,7 @@ BOOLEAN ActivateSurroundingTripwire( SoldierID ubID, INT32 sGridNo, INT8 bLevel, } // Flugente: A special function for tripwire gun traps. Search if pObj has a gun attached. If so, fire a shot from that gun in a specific direction. Afterwards place the gun on the ground -void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT16 ubId, UINT8 ubDirection ) +void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, SoldierID ubId, UINT8 ubDirection ) { if ( !pObj ) return; @@ -3980,7 +3980,7 @@ void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT gTacticalStatus.uiFlags |= (DISALLOW_SIGHT | CHECK_SIGHT_AT_END_OF_ATTACK); } - FireFragmentsTrapGun( MercPtrs[ubId], sGridNo, 0, pObj, ubDirection ); + FireFragmentsTrapGun( ubId, sGridNo, 0, pObj, ubDirection ); // this is important... if not set, the game will remain in a loop gTacticalStatus.ubAttackBusyCount = 0; @@ -4055,11 +4055,11 @@ void HandleExplosionQueue( void ) if ( sSoundID > NO_ALT_SOUND ) PlayJA2Sample( sSoundID, RATE_11025, SoundVolume( HIGHVOLUME, sGridNo ), 1, SoundDir( sGridNo ) ); - UINT16 ubID = WhoIsThere2( sGridNo, ubLevel ); + SoldierID ubID = WhoIsThere2( sGridNo, ubLevel ); if ( ubID != NOBODY ) { - SOLDIERTYPE* pSoldier = MercPtrs[ubID]; + SOLDIERTYPE* pSoldier = ubID; INT16 damage = Explosive[Item[pObj->usItem].ubClassIndex].ubDamage * 0.67f + Random( Explosive[Item[pObj->usItem].ubClassIndex].ubDamage * 0.67f ); INT16 breathdamage = Explosive[Item[pObj->usItem].ubClassIndex].ubStunDamage * 0.67f + Random( Explosive[Item[pObj->usItem].ubClassIndex].ubStunDamage * 0.67f ); @@ -4172,7 +4172,7 @@ void HandleExplosionQueue( void ) INT16 sX, sY; ConvertGridNoToCenterCellXY(sGridNo, &sX, &sY); - fAttFound=HandleAttachedExplosions( (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2), sX, sY, 0, + fAttFound = HandleAttachedExplosions( ((*pObj)[0]->data.misc.ubBombOwner - 2), sX, sY, 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, FALSE, ubLevel, (*pObj)[0]->data.ubDirection, pObj); } } @@ -4219,7 +4219,7 @@ void HandleExplosionQueue( void ) // determine gridno to attack - smoke signal required. Otherwise, it is assumed the radio operator ordered the bombing of his OWN position // if we cannot even find a radio operator, all bets are off - target a random gridno // the usual +/- 2 shenanigans - UINT16 usOwner = NOBODY; + SoldierID usOwner = NOBODY; if ( (*pObj)[0]->data.misc.ubBombOwner > 1 ) usOwner = (*pObj)[0]->data.misc.ubBombOwner - 2; @@ -4251,7 +4251,7 @@ void HandleExplosionQueue( void ) // bomb objects only store the SIDE who placed the bomb! :-( if ( (*pObj)[0]->data.misc.ubBombOwner > 1 ) { - IgniteExplosion( (UINT8) ((*pObj)[0]->data.misc.ubBombOwner - 2), sX, sY, 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel, (*pObj)[0]->data.ubDirection, pObj); + IgniteExplosion( ((*pObj)[0]->data.misc.ubBombOwner - 2), sX, sY, 0, sGridNo, (*pObj)[0]->data.misc.usBombItem, ubLevel, (*pObj)[0]->data.ubDirection, pObj); } else { @@ -4704,12 +4704,12 @@ void SetOffBombsByFrequency( SoldierID ubID, INT8 bFrequency ) // SANDRO - added merc records and some exp if ( ((*pObj)[0]->data.misc.ubBombOwner) > 1 ) { - if ( MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)]->ubProfile != NO_PROFILE && - MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)]->bTeam == gbPlayerNum ) + if ( ((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile != NO_PROFILE && + ((*pObj)[0]->data.misc.ubBombOwner - 2)->bTeam == gbPlayerNum ) { - gMercProfiles[MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)]->ubProfile].records.usExpDetonated++; + gMercProfiles[((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile].records.usExpDetonated++; - StatChange( MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)], EXPLODEAMT, ( 5 ), FALSE ); + StatChange( ((*pObj)[0]->data.misc.ubBombOwner - 2), EXPLODEAMT, ( 5 ), FALSE ); } } @@ -4804,12 +4804,12 @@ void SetOffBombsByFrequency( SoldierID ubID, INT8 bFrequency ) // SANDRO - added merc records and some exp if ( ((*pObj)[0]->data.misc.ubBombOwner) > 1 ) { - if ( MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)]->ubProfile != NO_PROFILE && - MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)]->bTeam == gbPlayerNum ) + if ( ((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile != NO_PROFILE && + ((*pObj)[0]->data.misc.ubBombOwner - 2)->bTeam == gbPlayerNum ) { - gMercProfiles[MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)]->ubProfile].records.usExpDetonated++; + gMercProfiles[((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile].records.usExpDetonated++; - StatChange( MercPtrs[((*pObj)[0]->data.misc.ubBombOwner - 2)], EXPLODEAMT, ( 5 ), FALSE ); + StatChange( ((*pObj)[0]->data.misc.ubBombOwner - 2), EXPLODEAMT, ( 5 ), FALSE ); } } @@ -4979,8 +4979,8 @@ BOOLEAN SetOffBombsInGridNo( SoldierID ubID, INT32 sGridNo, BOOLEAN fAllBombs, I // only if we blew up somebody not in our team(no achievement for blowing our guys :)), only if owner exists and have profile if ( (ubID->bTeam != gbPlayerNum) && ((*pObj)[0]->data.misc.ubBombOwner > 1) ) { - if ( MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->ubProfile != NO_PROFILE && MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->bTeam == gbPlayerNum ) - gMercProfiles[ MercPtrs[ ((*pObj)[0]->data.misc.ubBombOwner - 2) ]->ubProfile ].records.usExpDetonated++; + if ( ((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile != NO_PROFILE && ((*pObj)[0]->data.misc.ubBombOwner - 2)->bTeam == gbPlayerNum ) + gMercProfiles[ ((*pObj)[0]->data.misc.ubBombOwner - 2)->ubProfile ].records.usExpDetonated++; } /*if (pObj->usItem != ACTION_ITEM || (*pObj)[0]->data.misc.bActionValue == ACTION_ITEM_BLOW_UP) @@ -5305,7 +5305,7 @@ void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) // loop through civ team and find // anybody who is an NPC and // see if they get angry -void HandleBuldingDestruction( INT32 sGridNo, UINT16 ubOwner ) +void HandleBuldingDestruction( INT32 sGridNo, SoldierID ubOwner ) { SOLDIERTYPE * pSoldier; UINT16 cnt; @@ -5315,7 +5315,7 @@ void HandleBuldingDestruction( INT32 sGridNo, UINT16 ubOwner ) return; } - if ( MercPtrs[ ubOwner ]->bTeam != gbPlayerNum ) + if ( ubOwner->bTeam != gbPlayerNum ) { return; } @@ -5339,7 +5339,7 @@ void HandleBuldingDestruction( INT32 sGridNo, UINT16 ubOwner ) if ( DoesNPCOwnBuilding( pSoldier, sGridNo ) ) { - MakeNPCGrumpyForMinorOffense( pSoldier, MercPtrs[ ubOwner ] ); + MakeNPCGrumpyForMinorOffense( pSoldier, ubOwner ); } } } @@ -5624,9 +5624,9 @@ void HavePersonAtGridnoStop( UINT32 sGridNo ) SoldierID ubID = WhoIsThere2( sGridNo, 0 ); //is it a valid person - if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) ) + if ( (ubID != NOBODY) && (ubID->bTeam == gbPlayerNum) ) { - SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; //Stop the merc pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); @@ -5732,10 +5732,10 @@ void HandleDestructionOfPowerGenFan() // Have a qualified merc say a quote // //Get a random qualified merc to say the quote - INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); - if( bID != -1 ) + SoldierID bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + if( bID != NOBODY ) { - DelayedMercQuote( Menptr[ bID ].ubProfile, QUOTE_ACCEPT_CONTRACT_RENEWAL, GetWorldTotalSeconds() + 2 ); + DelayedMercQuote( bID->ubProfile, QUOTE_ACCEPT_CONTRACT_RENEWAL, GetWorldTotalSeconds() + 2 ); } } @@ -5773,8 +5773,8 @@ void HandleSeeingFortifiedDoor( UINT32 sGridNo ) gJa25SaveStruct.uiJa25GeneralFlags |= JA_GF__PLAYER_HAS_SEEN_FORTIFIED_DOOR; //find out whos is the one walking across the trap - INT16 sID = WhoIsThere2( sGridNo, 0 ); - if( sID != NOBODY && IsSoldierQualifiedMerc( &Menptr[ sID ] ) ) + SoldierID sID = WhoIsThere2( sGridNo, 0 ); + if( sID != NOBODY && IsSoldierQualifiedMerc( sID ) ) { } else @@ -5783,10 +5783,10 @@ void HandleSeeingFortifiedDoor( UINT32 sGridNo ) sID = RandomSoldierIdFromNewMercsOnPlayerTeam(); } - if( sID != -1 ) + if( sID != NOBODY ) { //say the quote - TacticalCharacterDialogue( &Menptr[ sID ], QUOTE_LENGTH_OF_CONTRACT ); + TacticalCharacterDialogue( sID, QUOTE_LENGTH_OF_CONTRACT ); } } @@ -5801,11 +5801,11 @@ void HandleSwitchToOpenFortifiedDoor( UINT32 sGridNo ) //remeber that the switch to open the forified door on level 1, has been pulled gJa25SaveStruct.ubStatusOfFortifiedDoor = FD__OPEN; - INT16 bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); + SoldierID bID = RandomSoldierIdFromNewMercsOnPlayerTeam(); - if( bID != -1 ) + if( bID != NOBODY ) { - TacticalCharacterDialogue( &Menptr[ bID ], QUOTE_COMMENT_BEFORE_HANG_UP ); + TacticalCharacterDialogue( bID, QUOTE_COMMENT_BEFORE_HANG_UP ); } } @@ -5834,7 +5834,7 @@ void HandleSeeingPowerGenFan( UINT32 sGridNo ) if( ubPerson != NOBODY ) { - pSoldier = &Menptr[ ubPerson ]; + pSoldier = ubPerson; //if the fan is stopped And is this merc is a qualified merc but Not a power gen fan qualified merc? if( IsSoldierQualifiedMerc( pSoldier ) && fFanIsStopped ) @@ -5886,7 +5886,7 @@ void HandleSeeingPowerGenFan( UINT32 sGridNo ) } #endif -void HandleBuddyExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection ) +void HandleBuddyExplosions(SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection ) { // Flugente: Items can have secondary explosions if ( Item[usItem].usBuddyItem ) @@ -5907,7 +5907,7 @@ void HandleBuddyExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sG } // sevenfm: handle explosive items from attachments -BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj) +BOOLEAN HandleAttachedExplosions( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj) { BOOLEAN binderFound = FALSE; BOOLEAN detonator = FALSE; @@ -6264,10 +6264,10 @@ void RoofDestruction( INT32 sGridNo, BOOLEAN fWithExplosion ) // if there is anybody at the floor level, damage them with the debris // we have to do this BEFORE people drop down. It would otherwise be possible for a falling person to avoid this damage, depending on order of collapsing and possible gridno-shifts. - UINT16 ubId = WhoIsThere2( sGridNo, 0 ); + SoldierID ubId = WhoIsThere2( sGridNo, 0 ); if ( ubId != NOBODY ) { - pSoldier = MercPtrs[ubId]; + pSoldier = ubId; pSoldier->EVENT_StopMerc( pSoldier->sGridNo, pSoldier->ubDirection ); @@ -6283,7 +6283,7 @@ void RoofDestruction( INT32 sGridNo, BOOLEAN fWithExplosion ) ubId = WhoIsThere2( sGridNo, 1 ); if ( ubId != NOBODY ) { - pSoldier = MercPtrs[ubId]; + pSoldier = ubId; INT32 soldierdropoffgridno = sGridNo; if ( !IsLocationSittable( soldierdropoffgridno, FALSE ) ) diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index 029f55f8..d4c8e531 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -132,16 +132,16 @@ void RemoveActiveExplosionMarkers(); #define GASMASK_MIN_STATUS 70 // OJW - 20091028 - Explosion damage sync -BOOLEAN DamageSoldierFromBlast( UINT16 ubPerson, UINT16 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent, BOOL fFromRemoteClient = FALSE ); +BOOLEAN DamageSoldierFromBlast( SoldierID ubPerson, SoldierID ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent, BOOL fFromRemoteClient = FALSE ); BOOLEAN DishOutGasDamage( SOLDIERTYPE * pSoldier, EXPLOSIVETYPE * pExplosive, INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, SoldierID ubOwner, BOOL fFromRemoteClient = FALSE ); -void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT16 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectNum, BOOL fFromRemoteClient = FALSE, BOOL fNewSmokeEffect = FALSE ); +void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, SoldierID ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectNum, BOOL fFromRemoteClient = FALSE, BOOL fNewSmokeEffect = FALSE ); void AddBombToQueue( UINT32 uiWorldBombIndex, UINT32 uiTimeStamp, BOOL fFromRemoteClient = FALSE ); // Flugente: activate everything connected to a tripwire in the surrounding if sGridNo on level bLevel with regard to the tripwire netwrok and hierarchy determined by ubFlag BOOLEAN ActivateSurroundingTripwire( SoldierID ubID, INT32 sGridNo, INT8 bLevel, UINT32 ubFlag ); // Flugente: A special function for tripwire gun traps. Search if pObj has a gun attached. If so, fire a shot from that gun in a specific direction. Afterwards place the gun on the ground -void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, UINT16 ubId, UINT8 ubDirection ); +void CheckAndFireTripwireGun( OBJECTTYPE* pObj, INT32 sGridNo, INT8 bLevel, SoldierID ubId, UINT8 ubDirection ); extern void ToggleActionItemsByFrequency( INT8 bFrequency ); extern void PerformItemAction( INT32 sGridNo, OBJECTTYPE * pObj ); @@ -166,15 +166,15 @@ extern void HandleSeeingFortifiedDoor( UINT32 sGridNo );//Ja25 UB void ExplosiveDamageGridNo( INT32 sGridNo, INT16 sWoundAmt, UINT32 uiDist, BOOLEAN *pfRecompileMovementCosts, - BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, UINT16 ubOwner, + BOOLEAN fOnlyWalls, INT8 bMultiStructSpecialFlag, BOOLEAN fSubSequentMultiTilesTransitionDamage, SoldierID ubOwner, INT8 bLevel, UINT8 ubReason ); // Flugente: handle secondary explosive effects -void HandleBuddyExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection ); +void HandleBuddyExplosions( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection ); // sevenfm: handle explosive items from attachments -BOOLEAN HandleAttachedExplosions(UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ); +BOOLEAN HandleAttachedExplosions( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32 sGridNo, UINT16 usItem, BOOLEAN fLocate, INT8 bLevel, UINT8 ubDirection, OBJECTTYPE * pObj ); void CheckForBuriedBombsAndRemoveFlags( INT32 sGridNo, INT8 bLevel ); UINT16 CalcTotalVolatility(OBJECTTYPE * pObj); BOOLEAN FindBinderAttachment (OBJECTTYPE * pObj); diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 0ee78b3f..a4bf340e 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -332,7 +332,7 @@ INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, return( iSmokeIndex ); } -INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, BOOLEAN fFromRemoteClient, UINT8 ubDuration, UINT8 ubRadius, UINT8 ubGeneration) +INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwner, BOOLEAN fFromRemoteClient, UINT8 ubDuration, UINT8 ubRadius, UINT8 ubGeneration) { SMOKEEFFECT *pSmoke; INT32 iSmokeIndex; diff --git a/TileEngine/SmokeEffects.h b/TileEngine/SmokeEffects.h index 590f1d8a..5b899f3d 100644 --- a/TileEngine/SmokeEffects.h +++ b/TileEngine/SmokeEffects.h @@ -57,7 +57,7 @@ void AddSmokeEffectToTile( INT32 iSmokeEffectID, INT8 bType, INT32 sGridNo, INT8 void RemoveSmokeEffectFromTile( INT32 sGridNo, INT8 bLevel ); -INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, BOOLEAN fFromRemoteClient = 0, UINT8 ubDuration = 0, UINT8 ubRadius = 0, UINT8 ubGeneration = 0); +INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwner, BOOLEAN fFromRemoteClient = 0, UINT8 ubDuration = 0, UINT8 ubRadius = 0, UINT8 ubGeneration = 0); BOOLEAN SaveSmokeEffectsToSaveGameFile( HWFILE hFile ); BOOLEAN LoadSmokeEffectsFromLoadGameFile( HWFILE hFile ); @@ -77,4 +77,4 @@ BOOLEAN CheckSmokeEffect(INT32 sGridNo, INT8 bLevel, INT8 bType); // find smoke effect on visible screen BOOLEAN FindVisibleSmokeEffect(INT8 bType); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Tile Animation.h b/TileEngine/Tile Animation.h index a428c77b..1a56eaba 100644 --- a/TileEngine/Tile Animation.h +++ b/TileEngine/Tile Animation.h @@ -38,70 +38,70 @@ typedef struct TAG_anitile { - struct TAG_anitile *pNext; - UINT32 uiFlags; // flags struct - UINT32 uiTimeLastUpdate; // Stuff for animated tiles + struct TAG_anitile *pNext; + UINT32 uiFlags; // flags struct + UINT32 uiTimeLastUpdate; // Stuff for animated tiles - LEVELNODE *pLevelNode; - UINT8 ubLevelID; - INT16 sCurrentFrame; - INT16 sStartFrame; - INT16 sDelay; - UINT16 usTileType; - UINT16 usNumFrames; + LEVELNODE *pLevelNode; + UINT8 ubLevelID; + INT16 sCurrentFrame; + INT16 sStartFrame; + INT16 sDelay; + UINT16 usTileType; + UINT16 usNumFrames; - UINT16 usMissAnimationPlayed; - UINT16 ubAttackerMissed; - INT16 sRelativeX; - INT16 sRelativeY; - INT16 sRelativeZ; - INT32 sGridNo; - UINT16 usTileIndex; + UINT16 usMissAnimationPlayed; + SoldierID ubAttackerMissed; + INT16 sRelativeX; + INT16 sRelativeY; + INT16 sRelativeZ; + INT32 sGridNo; + UINT16 usTileIndex; - UINT16 usCachedTileSubIndex; // sub Index - INT16 sCachedTileID; // Index into cached tile ID + UINT16 usCachedTileSubIndex; // sub Index + INT16 sCachedTileID; // Index into cached tile ID - UINT8 ubOwner; - UINT8 ubKeyFrame1; - UINT32 uiKeyFrame1Code; - UINT8 ubKeyFrame2; - UINT32 uiKeyFrame2Code; + UINT8 ubOwner; + UINT8 ubKeyFrame1; + UINT32 uiKeyFrame1Code; + UINT8 ubKeyFrame2; + UINT32 uiKeyFrame2Code; - UINT32 uiUserData; - UINT8 ubUserData2; - UINT32 uiUserData3; + UINT32 uiUserData; + UINT8 ubUserData2; + UINT32 uiUserData3; - INT8 bFrameCountAfterStart; - INT32 lightSprite; + INT8 bFrameCountAfterStart; + INT32 lightSprite; } ANITILE; typedef struct TAG_anitile_params { - UINT32 uiFlags; // flags struct - UINT8 ubLevelID; // Level ID for rendering layer - INT16 sStartFrame; // Start frame - INT16 sDelay; // Delay time - UINT16 usTileType; // Tile databse type ( optional ) - UINT16 usTileIndex; // Tile database index ( optional ) - INT16 sX; // World X ( optional ) - INT16 sY; // World Y ( optional ) - INT16 sZ; // World Z ( optional ) - INT32 sGridNo; // World GridNo + UINT32 uiFlags; // flags struct + UINT8 ubLevelID; // Level ID for rendering layer + INT16 sStartFrame; // Start frame + INT16 sDelay; // Delay time + UINT16 usTileType; // Tile databse type ( optional ) + UINT16 usTileIndex; // Tile database index ( optional ) + INT16 sX; // World X ( optional ) + INT16 sY; // World Y ( optional ) + INT16 sZ; // World Z ( optional ) + INT32 sGridNo; // World GridNo - LEVELNODE *pGivenLevelNode; // Levelnode for existing tile ( optional ) - CHAR8 zCachedFile[ 100 ]; // Filename for cached tile name ( optional ) + LEVELNODE *pGivenLevelNode; // Levelnode for existing tile ( optional ) + CHAR8 zCachedFile[ 100 ]; // Filename for cached tile name ( optional ) - UINT8 ubOwner; // UBID for the owner - UINT8 ubKeyFrame1; // Key frame 1 - UINT32 uiKeyFrame1Code; // Key frame code - UINT8 ubKeyFrame2; // Key frame 2 - UINT32 uiKeyFrame2Code; // Key frame code + UINT8 ubOwner; // UBID for the owner + UINT8 ubKeyFrame1; // Key frame 1 + UINT32 uiKeyFrame1Code; // Key frame code + UINT8 ubKeyFrame2; // Key frame 2 + UINT32 uiKeyFrame2Code; // Key frame code - UINT32 uiUserData; - UINT8 ubUserData2; - UINT32 uiUserData3; - INT32 lightSprite; + UINT32 uiUserData; + UINT8 ubUserData2; + UINT32 uiUserData3; + INT32 lightSprite; } ANITILE_PARAMS; diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 8a2db1fb..6bad3e2f 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1764,7 +1764,7 @@ BOOLEAN StructureDensity( STRUCTURE * pStructure, UINT8 * pubLevel0, UINT8 * pub return( TRUE ); } -INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT16 ubOwner, INT32 sAntiMaterialImpact ) +INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, SoldierID ubOwner, INT32 sAntiMaterialImpact ) { // do damage to a structure; returns TRUE if the structure should be removed STRUCTURE *pBase; diff --git a/TileEngine/structure.h b/TileEngine/structure.h index 12dd50b1..b0a21599 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -91,7 +91,7 @@ STRUCTURE* GetTallestStructureOnGridnoDrag( INT32 sGridNo, INT8 bLevel ); // FUNCTIONS FOR DETERMINING STUFF THAT BLOCKS VIEW FOR TILE_bASED LOS INT8 GetBlockingStructureInfo( INT32 sGridNo, INT8 bDir, INT8 bNextDir, INT8 bLevel, INT8 *pStructHeight, STRUCTURE ** ppTallestStructure, BOOLEAN fWallsBlock ); -INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, UINT16 ubOwner, INT32 sAntiMaterialImpact = 0 ); +INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, INT32 sGridNo, INT16 sX, INT16 sY, SoldierID ubOwner, INT32 sAntiMaterialImpact = 0 ); // Material armour type enumeration enum From d149b6ffeae28a7d50ebe5503441113a48d43278 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 22:39:58 +0200 Subject: [PATCH 116/571] Correct parameter order --- TileEngine/SmokeEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index a4bf340e..2ea2d122 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -355,7 +355,7 @@ INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwne { // let all the other clients know we are spawning this effect // and align them with our random number generator - send_newsmokeeffect(sGridNo, usItem, ubOwner, bLevel, iSmokeIndex); + send_newsmokeeffect(sGridNo, usItem, bLevel, ubOwner, iSmokeIndex); } else if (!fFromRemoteClient) { From b74ccf3ddc78adba208b92eb0efd4ead91e7c0ca Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:45:48 +0200 Subject: [PATCH 117/571] Convert to SoldierID --- Ja2/gamescreen.cpp | 10 +-- Ja2/gamescreen.h | 10 +-- Strategic/ASD.cpp | 2 +- Strategic/Assignments.cpp | 2 +- Strategic/Assignments.h | 4 +- Strategic/Auto Resolve.cpp | 4 +- Tactical/Handle UI.cpp | 122 ++++++++++++++-------------- Tactical/Handle UI.h | 8 +- Tactical/Interface Cursors.cpp | 2 +- Tactical/Interface Items.cpp | 44 +++++----- Tactical/Interface Panels.cpp | 6 +- Tactical/Interface Panels.h | 2 +- Tactical/Interface.cpp | 2 +- Tactical/Interface.h | 2 +- Tactical/Merc Entering.cpp | 76 ++++++++--------- Tactical/Merc Hiring.cpp | 4 +- Tactical/Merc Hiring.h | 2 +- Tactical/Overhead Types.h | 2 +- Tactical/Real Time Input.cpp | 4 +- Tactical/Soldier Control.h | 118 +++++++++++++-------------- Tactical/SoldierTooltips.cpp | 4 +- Tactical/Turn Based Input.cpp | 24 +++--- Tactical/UI Cursors.cpp | 36 ++++---- Tactical/UI Cursors.h | 4 +- Tactical/merc entering.h | 4 +- TacticalAI/AIInternals.h | 30 +++---- TacticalAI/AIList.cpp | 22 ++--- TacticalAI/AIList.h | 18 ++-- TacticalAI/AIMain.cpp | 34 ++++---- TacticalAI/Attacks.cpp | 54 ++++++------ TacticalAI/CreatureDecideAction.cpp | 4 +- TacticalAI/DecideAction.cpp | 8 +- TacticalAI/FindLocations.cpp | 10 +-- TacticalAI/Knowledge.cpp | 2 +- TacticalAI/Medical.cpp | 14 ++-- TacticalAI/NPC.cpp | 11 +-- TacticalAI/ai.h | 8 +- TileEngine/Explosion Control.cpp | 2 +- TileEngine/Explosion Control.h | 2 +- TileEngine/SmokeEffects.cpp | 2 +- TileEngine/SmokeEffects.h | 18 ++-- TileEngine/overhead map.cpp | 2 +- TileEngine/physics.cpp | 4 +- TileEngine/pits.cpp | 4 +- TileEngine/structure.cpp | 4 +- 45 files changed, 376 insertions(+), 375 deletions(-) diff --git a/Ja2/gamescreen.cpp b/Ja2/gamescreen.cpp index d95c5266..e4f9046d 100644 --- a/Ja2/gamescreen.cpp +++ b/Ja2/gamescreen.cpp @@ -108,10 +108,10 @@ INT32 giCounterPeriodOverlay = 0; BOOLEAN gfExitToNewSector = FALSE; //UINT8 gubNewSectorExitDirection; -BOOLEAN gfGameScreenLocateToSoldier = FALSE; -BOOLEAN gfEnteringMapScreen = FALSE; -UINT32 uiOldMouseCursor; -UINT16 gubPreferredInitialSelectedGuy = NOBODY; +BOOLEAN gfGameScreenLocateToSoldier = FALSE; +BOOLEAN gfEnteringMapScreen = FALSE; +UINT32 uiOldMouseCursor; +SoldierID gubPreferredInitialSelectedGuy = NOBODY; BOOLEAN gfTacticalIsModal = FALSE; MOUSE_REGION gTacticalDisableRegion; @@ -1038,7 +1038,7 @@ void TacticalScreenLocateToSoldier( ) if ( gubPreferredInitialSelectedGuy != NOBODY ) { // ATE: Put condition here... - if ( OK_CONTROLLABLE_MERC( MercPtrs[ gubPreferredInitialSelectedGuy ] ) && OK_INTERRUPT_MERC( MercPtrs[ gubPreferredInitialSelectedGuy ] ) ) + if ( OK_CONTROLLABLE_MERC( gubPreferredInitialSelectedGuy ) && OK_INTERRUPT_MERC( gubPreferredInitialSelectedGuy ) ) { LocateSoldier( gubPreferredInitialSelectedGuy, 10 ); SelectSoldier( gubPreferredInitialSelectedGuy, FALSE, TRUE ); diff --git a/Ja2/gamescreen.h b/Ja2/gamescreen.h index 49a65019..11a0ccf3 100644 --- a/Ja2/gamescreen.h +++ b/Ja2/gamescreen.h @@ -1,7 +1,7 @@ #ifndef _GAMESCREEN_H #define _GAMESCREEN_H - +#include "Overhead Types.h" #include "fade screen.h" #define ARE_IN_FADE_IN( ) ( gfFadeIn || gfFadeInitialized ) @@ -14,9 +14,9 @@ void FadeOutGameScreen( ); typedef void (*MODAL_HOOK)( void ); -extern BOOLEAN gfGameScreenLocateToSoldier; -extern BOOLEAN gfEnteringMapScreen; -extern UINT16 gubPreferredInitialSelectedGuy; +extern BOOLEAN gfGameScreenLocateToSoldier; +extern BOOLEAN gfEnteringMapScreen; +extern SoldierID gubPreferredInitialSelectedGuy; void EnterMapScreen( ); @@ -41,4 +41,4 @@ void InitHelicopterEntranceByMercs( void ); void InternalLeaveTacticalScreen( UINT32 uiNewScreen ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/ASD.cpp b/Strategic/ASD.cpp index 41bad719..443c4d89 100644 --- a/Strategic/ASD.cpp +++ b/Strategic/ASD.cpp @@ -1091,7 +1091,7 @@ void EnemyHeliSAMCheck( INT16 id ) // also check whether this sector is not enemy-controlled - we can't have the AI shooting at its own helis if ( pSAMStrategicMap && !pSAMStrategicMap->fEnemyControlled ) { - UINT16 ubBestSAMOperatorID = NOBODY; + SoldierID ubBestSAMOperatorID = NOBODY; FLOAT samcth = GetBestSAMOperatorCTH_Player( gpSamSectorX[i], gpSamSectorY[i], 0, &ubBestSAMOperatorID ); // cth is reduced if SAM is damaged, even if it can still operate diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 2a4aaec5..bed21b31 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -3776,7 +3776,7 @@ UINT32 CalculateSnitchInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPt } // Flugente: Determine the best cth with SAMs in a sector, and which merc has that cth if present -FLOAT GetBestSAMOperatorCTH_Player( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT16 *pubID ) +FLOAT GetBestSAMOperatorCTH_Player( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, SoldierID *pubID ) { // if nobody is here, nobody can fire FLOAT bestsamcth = 0.0f; diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 03672ed7..fe5c2c05 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -318,7 +318,7 @@ UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier ); UINT32 CalculateSnitchInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ); // Flugente: Determine the best cth with SAMs in a sector, and which merc has that cth if present -FLOAT GetBestSAMOperatorCTH_Player( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT16 *pubID ); +FLOAT GetBestSAMOperatorCTH_Player( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, SoldierID *pubID ); INT16 GetTrainWorkerPts(SOLDIERTYPE *pSoldier); @@ -592,4 +592,4 @@ UINT8 CalcSoldierNeedForSleep( SOLDIERTYPE *pSoldier ); // Flugente: administration assignment FLOAT GetAdministrationPercentage( INT16 sX, INT16 sY ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 6613354a..e55eb561 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -3009,9 +3009,7 @@ void MercCellMouseClickCallback( MOUSE_REGION *reg, INT32 reason ) if( gpAR->pRobotCell ) { //if controller is retreating, make the robot retreat too. - UINT16 ubRobotControllerID; - - ubRobotControllerID = gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID; + SoldierID ubRobotControllerID = gpAR->pRobotCell->pSoldier->ubRobotRemoteHolderID; if( ubRobotControllerID == NOBODY ) { diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index aa5c7910..f07301e8 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -293,7 +293,7 @@ BOOLEAN gfResetUIMovementOptimization = FALSE; BOOLEAN gfResetUIItemCursorOptimization = FALSE; BOOLEAN gfBeginVehicleCursor = FALSE; INT32 gsOutOfRangeGridNo = NOWHERE; -UINT16 gubOutOfRangeMerc = NOBODY; +SoldierID gubOutOfRangeMerc = NOBODY; BOOLEAN gfOKForExchangeCursor = FALSE; UINT32 guiUIInterfaceSwapCursorsTime = 0; INT32 gsJumpOverGridNo = 0; @@ -463,29 +463,29 @@ BOOLEAN gfUICanBeginAllMoveCycle = FALSE; // GEts set so we know that the ne INT32 gsSelectedGridNo = 0; INT16 gsSelectedLevel = I_GROUND_LEVEL; -INT16 gsSelectedGuy = NOBODY; +SoldierID gsSelectedGuy = NOBODY; -BOOLEAN gfUIDisplayDamage = FALSE; -INT8 gbDamage = 0; -INT32 gsDamageGridNo = 0; +BOOLEAN gfUIDisplayDamage = FALSE; +INT8 gbDamage = 0; +INT32 gsDamageGridNo = 0; -BOOLEAN gfUIRefreshArrows = FALSE; +BOOLEAN gfUIRefreshArrows = FALSE; // Thse flags are not re-set after each frame -BOOLEAN gfPlotNewMovement = FALSE; -BOOLEAN gfPlotNewMovementNOCOST = FALSE; -UINT32 guiShowUPDownArrows = ARROWS_HIDE_UP | ARROWS_HIDE_DOWN; -INT8 gbAdjustStanceDiff = 0; -INT8 gbClimbID = 0; +BOOLEAN gfPlotNewMovement = FALSE; +BOOLEAN gfPlotNewMovementNOCOST = FALSE; +UINT32 guiShowUPDownArrows = ARROWS_HIDE_UP | ARROWS_HIDE_DOWN; +INT8 gbAdjustStanceDiff = 0; +INT8 gbClimbID = 0; -BOOLEAN gfUIShowExitEast = FALSE; -BOOLEAN gfUIShowExitWest = FALSE; -BOOLEAN gfUIShowExitNorth = FALSE; -BOOLEAN gfUIShowExitSouth = FALSE; -BOOLEAN gfUIShowExitExitGrid = FALSE; +BOOLEAN gfUIShowExitEast = FALSE; +BOOLEAN gfUIShowExitWest = FALSE; +BOOLEAN gfUIShowExitNorth = FALSE; +BOOLEAN gfUIShowExitSouth = FALSE; +BOOLEAN gfUIShowExitExitGrid = FALSE; -BOOLEAN gfUINewStateForIntTile = FALSE; +BOOLEAN gfUINewStateForIntTile = FALSE; BOOLEAN gfUIForceReExamineCursorData = FALSE; @@ -2210,7 +2210,7 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) // anv: if we selected vehicle driver, move his vehicle if ( pSoldier->flags.uiStatusFlags & (SOLDIER_DRIVER ) ) { - pSoldier = GetSoldierStructureForVehicle( MercPtrs[ pSoldier->ubID ]->iVehicleId ); + pSoldier = GetSoldierStructureForVehicle( pSoldier->iVehicleId ); // anv: if shift is pressed, treat is as ram + move - flag has to be set for later add structure checks if ( _KeyDown( SHIFT ) ) { @@ -2981,7 +2981,7 @@ UINT32 UIHandleCAMercShoot( UI_EVENT *pUIEvent ) if ( gfUIFullTargetFound ) { // Get target soldier, if one exists - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; } if ( pTSoldier != NULL ) @@ -3464,7 +3464,7 @@ BOOLEAN SelectedMercCanAffordMove( ) return( FALSE ); } -void GetMercClimbDirection( UINT16 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ) +void GetMercClimbDirection( SoldierID ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ) { INT8 bNewDirection; SOLDIERTYPE *pSoldier; @@ -3625,11 +3625,11 @@ void ToggleLookCursorMode( UINT32 *puiNewEvent ) BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) { - SOLDIERTYPE *pSoldier; - UINT16 usSoldierIndex; - UINT32 uiMercFlags; - INT32 usMapPos; - BOOLEAN fFoundMerc = FALSE; + SOLDIERTYPE *pSoldier; + SoldierID usSoldierIndex; + UINT32 uiMercFlags; + INT32 usMapPos; + BOOLEAN fFoundMerc = FALSE; if( !GetMouseMapPos( &usMapPos) ) { @@ -3768,16 +3768,16 @@ BOOLEAN UIHandleOnMerc( BOOLEAN fMovementMode ) ErasePath( TRUE ); // Show cursor with highlight on selected merc - guiNewUICursor = NO_UICURSOR; + guiNewUICursor = NO_UICURSOR; // Show cursor with highlight - gfUIHandleSelection = ENEMY_GUY_SELECTION; - gsSelectedGridNo = pSoldier->sGridNo; - gsSelectedLevel = pSoldier->pathing.bLevel; + gfUIHandleSelection = ENEMY_GUY_SELECTION; + gsSelectedGridNo = pSoldier->sGridNo; + gsSelectedLevel = pSoldier->pathing.bLevel; } } - gfUIHandleSelectionAboveGuy = TRUE; - gsSelectedGuy = usSoldierIndex; + gfUIHandleSelectionAboveGuy = TRUE; + gsSelectedGuy = usSoldierIndex; } } else @@ -3838,9 +3838,9 @@ UINT32 UIHandleIETOnTerrain( UI_EVENT *pUIEvent ) } -void UIHandleSoldierStanceChange( UINT16 ubSoldierID, INT8 bNewStance ) +void UIHandleSoldierStanceChange( SoldierID ubSoldierID, INT8 bNewStance ) { - SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ]; + SOLDIERTYPE *pSoldier = ubSoldierID; if( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) { @@ -4058,7 +4058,7 @@ void GetCursorMovementFlags( UINT32 *puiCursorFlags ) BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, INT32 usMapPos, UINT32 uiFlags ) { BOOLEAN fSetCursor = FALSE; - static UINT16 usTargetID = NOBODY; + static SoldierID usTargetID = NOBODY; static BOOLEAN fTargetFound = FALSE; BOOLEAN fTargetFoundAndLookingForOne = FALSE; @@ -4588,7 +4588,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags ) // Check if we are on a target if ( gfUIFullTargetFound ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, gusUIFullTargetID->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { sActionGridNo = sAdjustedGridNo; @@ -4596,7 +4596,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags ) ///////////////////////////////////////////////////////////////////////////////////////// // CHANGED BY SANDRO - REDUCE AP COST TO STEAL FOR MARTIAL ARTS AND HAND TO HAND NEW TRAITS - if (MercPtrs[ gusUIFullTargetID ]->bCollapsed && gGameExternalOptions.fEnhancedCloseCombatSystem) + if (gusUIFullTargetID->bCollapsed && gGameExternalOptions.fEnhancedCloseCombatSystem) { sAPCost += (GetBasicAPsToPickupItem( pSoldier )); // stealing from collapsed soldiers is treated differently } @@ -4641,7 +4641,7 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags ) { if ( gfUIFullTargetFound ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, gusUIFullTargetID->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if (!TileIsOutOfBounds(sActionGridNo)) { @@ -4813,7 +4813,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; } if ( IsRepairableStructAtGridNo( usMapPos, NULL ) && pSoldier->pathing.bLevel == 0 ) @@ -4830,7 +4830,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; } if ( IsRefuelableStructAtGridNo( usMapPos, NULL ) && pSoldier->pathing.bLevel == 0 ) @@ -4847,7 +4847,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; } if ( pSoldier->pathing.bLevel == 0 ) @@ -4874,7 +4874,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[gusUIFullTargetID]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; } UINT16 structindex; @@ -4893,7 +4893,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; return( TRUE ); } @@ -4916,7 +4916,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - if ( pSoldier->ubID != gusUIFullTargetID && MercPtrs[gusUIFullTargetID]->IsValidBloodDonor() ) + if ( pSoldier->ubID != gusUIFullTargetID && gusUIFullTargetID->IsValidBloodDonor() ) return( TRUE ); } } @@ -4930,7 +4930,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - if ( pSoldier->ubID != gusUIFullTargetID && MercPtrs[gusUIFullTargetID]->CanReceiveSplint() ) + if ( pSoldier->ubID != gusUIFullTargetID && gusUIFullTargetID->CanReceiveSplint() ) return( TRUE ); } } @@ -4944,7 +4944,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) { if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; return( TRUE ); } @@ -4998,7 +4998,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ) } // IF a guy's here, chack if they need medical help! - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; // If we are a vehicle... if ( ( pTSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_ROBOT ) ) ) @@ -5578,12 +5578,12 @@ UINT32 UIHandleLCLook( UI_EVENT *pUIEvent ) UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) { - SOLDIERTYPE *pSoldier; - UINT16 ubTargID; - UINT32 uiRange; - INT32 usMapPos; - BOOLEAN fValidTalkableGuy = FALSE; - INT32 sTargetGridNo; + SOLDIERTYPE *pSoldier; + SoldierID ubTargID; + UINT32 uiRange; + INT32 usMapPos; + BOOLEAN fValidTalkableGuy = FALSE; + INT32 sTargetGridNo; // Get soldier if ( !GetSoldier( &pSoldier, gusSelectedSoldier ) ) @@ -5616,7 +5616,7 @@ UINT32 UIHandleTOnTerrain( UI_EVENT *pUIEvent ) // Get distance away if ( fValidTalkableGuy ) { - sTargetGridNo = MercPtrs[ ubTargID ]->sGridNo; + sTargetGridNo = ubTargID->sGridNo; } uiRange = PythSpacesAway( pSoldier->sGridNo, sTargetGridNo ); @@ -6365,7 +6365,7 @@ UINT32 UIHandleLAEndLockOurTurn( UI_EVENT *pUIEvent ) -BOOLEAN IsValidTalkableNPCFromMouse( UINT16 * pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) +BOOLEAN IsValidTalkableNPCFromMouse( SoldierID *pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ) { // Check if there is a guy here to talk to! if ( gfUIFullTargetFound ) @@ -6790,7 +6790,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT32 usM // unless we are over our own vehicle, then we can call vehicle menu if( gfUIFullTargetFound ) { - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; if( pSoldier->iVehicleId == pTSoldier->bVehicleID ) { guiNewUICursor = ENTER_VEHICLE_UICURSOR; @@ -6803,7 +6803,7 @@ INT8 UIHandleInteractiveTilesAndItemsOnTerrain( SOLDIERTYPE *pSoldier, INT32 usM if ( gfUIFullTargetFound ) { - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; // anv: added condition - make sure we won't put vehicle in another vehicle if ( OK_ENTERABLE_VEHICLE( pTSoldier ) && pTSoldier->bVisible != -1 && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER | SOLDIER_VEHICLE ) ) ) @@ -7198,7 +7198,7 @@ BOOLEAN ValidQuickExchangePosition( ) // Check if we over a civ if ( gfUIFullTargetFound ) { - pOverSoldier = MercPtrs[ gusUIFullTargetID ]; + pOverSoldier = gusUIFullTargetID; //KM: Replaced this older if statement for the new one which allows exchanging with militia //if ( ( pOverSoldier->bSide != gbPlayerNum ) && pOverSoldier->aiData.bNeutral ) @@ -7265,7 +7265,7 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fChec INT32 sFourGrids[4], sDistance=0, sSpot, sInBetween, sInBetween2, iDoorGridNo; static const UINT8 sDirs[4] = { NORTH, EAST, SOUTH, WEST }; //INT32 cnt; - UINT16 ubGuyThere; + SoldierID ubGuyThere; UINT8 ubMovementCost, ubDirection; INT8 bTileHeight = 0; @@ -7370,7 +7370,7 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fChec ubGuyThere = WhoIsThere2( sInBetween, pSoldier->pathing.bLevel ); if ( ubGuyThere != NOBODY && ubGuyThere != pSoldier->ubID ) { - if ( gAnimControl[ MercPtrs[ ubGuyThere ]->usAnimState ].ubHeight != ANIM_PRONE ) + if ( gAnimControl[ ubGuyThere->usAnimState ].ubHeight != ANIM_PRONE ) { return( FALSE ); } @@ -7444,12 +7444,12 @@ BOOLEAN IsValidJumpLocation( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fChec // If there's a guy on any of the two middle tiles, and he's not prone, we can't jump over him ubGuyThere = WhoIsThere2( sInBetween, pSoldier->pathing.bLevel ); - if ( ubGuyThere != NOBODY && ubGuyThere != pSoldier->ubID && gAnimControl[ MercPtrs[ ubGuyThere ]->usAnimState ].ubHeight != ANIM_PRONE ) + if ( ubGuyThere != NOBODY && ubGuyThere != pSoldier->ubID && gAnimControl[ ubGuyThere->usAnimState ].ubHeight != ANIM_PRONE ) { return( FALSE ); } ubGuyThere = WhoIsThere2( sInBetween2, pSoldier->pathing.bLevel ); - if ( ubGuyThere != NOBODY && ubGuyThere != pSoldier->ubID && gAnimControl[ MercPtrs[ ubGuyThere ]->usAnimState ].ubHeight != ANIM_PRONE ) + if ( ubGuyThere != NOBODY && ubGuyThere != pSoldier->ubID && gAnimControl[ ubGuyThere->usAnimState ].ubHeight != ANIM_PRONE ) { return( FALSE ); } diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index ce634e5c..eab79f68 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -198,7 +198,7 @@ extern UINT32 guiShowUPDownArrows; extern BOOLEAN gfUIHandleSelection; extern BOOLEAN gfUIHandleSelectionAboveGuy; extern INT32 gsSelectedGridNo; -extern INT16 gsSelectedGuy; +extern SoldierID gsSelectedGuy; extern BOOLEAN gfUIInDeadlock; extern UINT16 gUIDeadlockedSoldier; @@ -320,13 +320,13 @@ void AdjustSoldierCreationStartValues( ); BOOLEAN SelectedMercCanAffordAttack( ); BOOLEAN SelectedMercCanAffordMove( ); -void GetMercClimbDirection( UINT16 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); +void GetMercClimbDirection( SoldierID ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); void ToggleHandCursorMode( UINT32 *puiNewEvent ); void ToggleTalkCursorMode( UINT32 *puiNewEvent ); void ToggleLookCursorMode( UINT32 *puiNewEvent ); -void UIHandleSoldierStanceChange( UINT16 ubSoldierID, INT8 bNewStance ); +void UIHandleSoldierStanceChange( SoldierID ubSoldierID, INT8 bNewStance ); void GetCursorMovementFlags( UINT32 *puiCursorFlags ); BOOLEAN HandleUIMovementCursor( SOLDIERTYPE *pSoldier, UINT32 uiCursorFlags, INT32 usMapPos, UINT32 uiFlags ); @@ -334,7 +334,7 @@ BOOLEAN UIMouseOnValidAttackLocation( SOLDIERTYPE *pSoldier ); BOOLEAN UIOkForItemPickup( SOLDIERTYPE *pSoldier, INT32 sGridNo ); -BOOLEAN IsValidTalkableNPCFromMouse( UINT16 * pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); +BOOLEAN IsValidTalkableNPCFromMouse( SoldierID *pubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); BOOLEAN IsValidTalkableNPC( SoldierID ubSoldierID, BOOLEAN fGive, BOOLEAN fAllowMercs, BOOLEAN fCheckCollapsed ); BOOLEAN HandleTalkInit( ); diff --git a/Tactical/Interface Cursors.cpp b/Tactical/Interface Cursors.cpp index 386e086a..baf0ad0a 100644 --- a/Tactical/Interface Cursors.cpp +++ b/Tactical/Interface Cursors.cpp @@ -335,7 +335,7 @@ BOOLEAN DrawUICursor( ) // If we are over a target, jump to that.... if ( gfUIFullTargetFound ) { - gusTargetDropPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + gusTargetDropPos = gusUIFullTargetID->sGridNo; } // Put tile on the floor diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index cdd87caa..b3f56f6a 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -8773,23 +8773,23 @@ BOOLEAN SoldierCanSeeCatchComing( SOLDIERTYPE *pSoldier, INT32 sSrcGridNo ) void DrawItemTileCursor( ) { - INT32 usMapPos; - UINT16 usIndex; - UINT16 ubSoldierID; - INT16 sAPCost; - BOOLEAN fRecalc; - UINT32 uiCursorFlags; - INT32 sFinalGridNo; - UINT32 uiCursorId = CURSOR_ITEM_GOOD_THROW; - SOLDIERTYPE *pSoldier; - BOOLEAN fGiveItem = FALSE; - INT32 sActionGridNo; - UINT8 ubDirection; - static UINT32 uiOldCursorId = 0; - static UINT16 usOldMousePos = 0; - INT16 sEndZ = 0; - INT16 sDist; - INT8 bLevel; + INT32 usMapPos; + UINT16 usIndex; + SoldierID ubSoldierID; + INT16 sAPCost; + BOOLEAN fRecalc; + UINT32 uiCursorFlags; + INT32 sFinalGridNo; + UINT32 uiCursorId = CURSOR_ITEM_GOOD_THROW; + SOLDIERTYPE *pSoldier; + BOOLEAN fGiveItem = FALSE; + INT32 sActionGridNo; + UINT8 ubDirection; + static UINT32 uiOldCursorId = 0; + static UINT16 usOldMousePos = 0; + INT16 sEndZ = 0; + INT16 sDist; + INT8 bLevel; if (GetMouseMapPos( &usMapPos) ) { @@ -9120,15 +9120,15 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) } - UINT8 ubDirection; - UINT16 ubSoldierID; - UINT16 usItem; + UINT8 ubDirection; + SoldierID ubSoldierID; + UINT16 usItem; INT16 sAPCost; SOLDIERTYPE *pSoldier=NULL; UINT8 ubThrowActionCode=0; - UINT32 uiThrowActionData=0; + UINT32 uiThrowActionData=0; INT16 sEndZ = 0; - BOOLEAN fGiveItem = FALSE; + BOOLEAN fGiveItem = FALSE; INT32 sGridNo; INT16 sDist; diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index d606dfb7..40df6462 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -6403,10 +6403,10 @@ void ShowRadioLocator( SoldierID ubID, UINT8 ubLocatorSpeed ) } } -void EndRadioLocator( UINT16 ubID ) +void EndRadioLocator( SoldierID ubID ) { - MercPtrs[ ubID ]->flags.fFlashLocator = FALSE; - MercPtrs[ ubID ]->flags.fShowLocator = FALSE; + ubID->flags.fFlashLocator = FALSE; + ubID->flags.fShowLocator = FALSE; } diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 95563cf2..8908aa30 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -108,7 +108,7 @@ extern INT8 gbNewItemCycle[ NUM_INV_SLOTS ]; extern UINT8 gubNewItemMerc; void ShowRadioLocator( SoldierID ubID, UINT8 ubLocatorSpeed ); -void EndRadioLocator( UINT16 ubID ); +void EndRadioLocator( SoldierID ubID ); extern MOUSE_REGION gSMPanelRegion; diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 11f920fd..3d543bf6 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -1667,7 +1667,7 @@ void DrawCTHPixelToBuffer( UINT16 *pBuffer, UINT32 uiPitch, INT16 sLeft, INT16 s //QUOTE_SYSTEM_STRUCT soldierTTInfo; -void DrawSelectedUIAboveGuy( UINT16 usSoldierID ) +void DrawSelectedUIAboveGuy( SoldierID usSoldierID ) { SOLDIERTYPE *pSoldier; INT16 sXPos, sYPos; diff --git a/Tactical/Interface.h b/Tactical/Interface.h index e596305f..2d2f7d00 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -458,7 +458,7 @@ void HandleInterfaceBackgrounds( ); void BeginOverlayMessage( UINT32 uiFont, STR16 pFontString, ... ); void EndOverlayMessage( ); -void DrawSelectedUIAboveGuy( UINT16 usSoldierID ); +void DrawSelectedUIAboveGuy( SoldierID usSoldierID ); // HEADROCK HAM 4: Draw the CTH indicator, using values grabbed from the global CTH array BOOLEAN DrawCTHIndicator(); diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index ce3c7279..e657ad45 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -355,7 +355,7 @@ UINT8 ubHeliScripts[ NUM_HELI_STATES ][ MAX_HELI_SCRIPT ] = BOOLEAN gfHandleHeli = FALSE; -UINT16 gusHeliSeats[ MAX_MERC_IN_HELI ]; +SoldierID gusHeliSeats[ MAX_MERC_IN_HELI ]; INT8 gbNumHeliSeatsOccupied = 0; BOOLEAN gfFirstGuyDown = FALSE; @@ -392,7 +392,7 @@ void ResetHeliSeats( ) gbNumHeliSeatsOccupied = 0; } -void AddMercToHeli( UINT16 ubID ) +void AddMercToHeli( SoldierID ubID ) { if ( gbNumHeliSeatsOccupied < MAX_MERC_IN_HELI ) { @@ -502,21 +502,21 @@ void HandleHeliDrop( BOOLEAN fPlayer ) { // Add merc to sector #ifdef JA2UB - //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; - MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; + //gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + gusHeliSeats[ cnt ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; #else - //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; - MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; + //gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + gusHeliSeats[ cnt ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; #endif // HEADROCK HAM 3.5: Externalized! - UpdateMercInSector( MercPtrs[ gusHeliSeats[ cnt ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); + UpdateMercInSector( gusHeliSeats[ cnt ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); // Check for merc arrives quotes... - HandleMercArrivesQuotes( MercPtrs[ gusHeliSeats[ cnt ] ] ); + HandleMercArrivesQuotes( gusHeliSeats[ cnt ] ); - ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ cnt ] ]->GetName() ); + ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], gusHeliSeats[ cnt ]->GetName() ); } @@ -558,23 +558,23 @@ void HandleHeliDrop( BOOLEAN fPlayer ) { // Add merc to sector #ifdef JA2UB - //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; - MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; + //gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + gusHeliSeats[ cnt ]->usStrategicInsertionData = gGameUBOptions.LOCATEGRIDNO; #else - //MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; - MercPtrs[ gusHeliSeats[ cnt ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + //gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_NORTH; + gusHeliSeats[ cnt ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; // sevenfm: if soldiers land into enemy sector, use gsGridNoSweetSpot - //MercPtrs[ gusHeliSeats[ cnt ] ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; - MercPtrs[gusHeliSeats[cnt]]->usStrategicInsertionData = gsGridNoSweetSpot; + //gusHeliSeats[ cnt ]->usStrategicInsertionData = gGameExternalOptions.iInitialMercArrivalLocation; + gusHeliSeats[ cnt ]->usStrategicInsertionData = gsGridNoSweetSpot; #endif // HEADROCK HAM 3.5: Externalized! - UpdateMercInSector( MercPtrs[ gusHeliSeats[ cnt ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); + UpdateMercInSector( gusHeliSeats[ cnt ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); // Check for merc arrives quotes... - HandleMercArrivesQuotes( MercPtrs[ gusHeliSeats[ cnt ] ] ); + HandleMercArrivesQuotes( gusHeliSeats[ cnt ] ); - ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ cnt ] ]->GetName() ); + ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], gusHeliSeats[ cnt ]->GetName() ); } // Remove heli @@ -698,24 +698,24 @@ void HandleHeliDrop( BOOLEAN fPlayer ) { // Flugente: it is now possible to use airdrops with soldiers after they have arrived in Arulco. In that case, they might have an animation that breaks EVENT_InitNewSoldierAnim prematurely. // In the worst case, this can cause the game to be unable to finish the airdrop. For that reason, we set all those soldiers to the STANDING animation. - MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usAnimState = STANDING; - MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->EVENT_InitNewSoldierAnim( HELIDROP, 0 , FALSE ); + gusHeliSeats[ gbCurDrop ]->usAnimState = STANDING; + gusHeliSeats[ gbCurDrop ]->EVENT_InitNewSoldierAnim( HELIDROP, 0 , FALSE ); // Change insertion code - MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usStrategicInsertionData = gsGridNoSweetSpot; + gusHeliSeats[ gbCurDrop ]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + gusHeliSeats[ gbCurDrop ]->usStrategicInsertionData = gsGridNoSweetSpot; // HEADROCK HAM 3.5: Externalized! - UpdateMercInSector( MercPtrs[ gusHeliSeats[ gbCurDrop ] ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); - //EVENT_SetSoldierPosition( MercPtrs[ gusHeliSeats[ gbCurDrop ] ], sWorldX, sWorldY ); + UpdateMercInSector( gusHeliSeats[ gbCurDrop ], gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY, startingZ ); + //EVENT_SetSoldierPosition( gusHeliSeats[ gbCurDrop ], sWorldX, sWorldY ); // IF the first guy down, set squad! if ( gfFirstGuyDown ) { gfFirstGuyDown = FALSE; - SetCurrentSquad( MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->bAssignment, TRUE ); + SetCurrentSquad( gusHeliSeats[ gbCurDrop ]->bAssignment, TRUE ); } - ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->GetName() ); + ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[ MERC_HAS_ARRIVED_STR ], gusHeliSeats[ gbCurDrop ]->GetName() ); ++gbCurDrop; @@ -1024,7 +1024,7 @@ void HandleFirstHeliDropOfGame( ) CharacterDialogueWithSpecialEvent( 0, 0, 0, DIALOGUE_TACTICAL_UI , FALSE , FALSE , DIALOGUE_SPECIAL_EVENT_ENABLE_AI ,0, 0 ); } -UINT16 SpawnAirDropElite( INT32 sGridNo ) +SoldierID SpawnAirDropElite( INT32 sGridNo ) { SOLDIERTYPE *pSoldier; @@ -1076,7 +1076,7 @@ void InitiateEnemyAirDropSoldiers( INT32 sGridNo ) for ( int i = 0; i < 6; ++i ) { - UINT16 id = SpawnAirDropElite( gMapInformation.sSouthGridNo + i ); + SoldierID id = SpawnAirDropElite( gMapInformation.sSouthGridNo + i ); if ( id == NOBODY ) return; @@ -1192,23 +1192,23 @@ void HandleEnemyAirdrop( ) { // Flugente: it is now possible to use airdrops with soldiers after they have arrived in Arulco. In that case, they might have an animation that breaks EVENT_InitNewSoldierAnim prematurely. // In the worst case, this can cause the game to be unable to finish the airdrop. For that reason, we set all those soldiers to the STANDING aniamtion. - //MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->usAnimState = STANDING; - MercPtrs[gusHeliSeats[gbCurDrop]]->EVENT_InitNewSoldierAnim( HELIDROP, 0, FALSE ); + //gusHeliSeats[ gbCurDrop ]->usAnimState = STANDING; + gusHeliSeats[gbCurDrop]->EVENT_InitNewSoldierAnim( HELIDROP, 0, FALSE ); // Change insertion code - MercPtrs[gusHeliSeats[gbCurDrop]]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - MercPtrs[gusHeliSeats[gbCurDrop]]->usStrategicInsertionData = gsGridNoSweetSpot; + gusHeliSeats[gbCurDrop]->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + gusHeliSeats[gbCurDrop]->usStrategicInsertionData = gsGridNoSweetSpot; // HEADROCK HAM 3.5: Externalized! - UpdateMercInSector( MercPtrs[gusHeliSeats[gbCurDrop]], gWorldSectorX, gWorldSectorY, startingZ ); + UpdateMercInSector( gusHeliSeats[gbCurDrop], gWorldSectorX, gWorldSectorY, startingZ ); // IF the first guy down, set squad! if ( gfFirstGuyDown ) { gfFirstGuyDown = FALSE; - //SetCurrentSquad( MercPtrs[ gusHeliSeats[ gbCurDrop ] ]->bAssignment, TRUE ); + //SetCurrentSquad( gusHeliSeats[ gbCurDrop ]->bAssignment, TRUE ); } - ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[MERC_HAS_ARRIVED_STR], MercPtrs[gusHeliSeats[gbCurDrop]]->GetName( ) ); + ScreenMsg( FONT_MCOLOR_WHITE, MSG_INTERFACE, TacticalStr[MERC_HAS_ARRIVED_STR], gusHeliSeats[gbCurDrop]->GetName( ) ); ++gbCurDrop; diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 5df4fed2..92410d87 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -425,7 +425,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) } -void MercArrivesCallback( UINT16 ubSoldierID ) +void MercArrivesCallback( SoldierID ubSoldierID ) { MERCPROFILESTRUCT *pMerc; SOLDIERTYPE *pSoldier; @@ -457,7 +457,7 @@ void MercArrivesCallback( UINT16 ubSoldierID ) // stop time compression until player restarts it StopTimeCompression(); - pSoldier = &Menptr[ ubSoldierID ]; + pSoldier = ubSoldierID; pMerc = &gMercProfiles[ pSoldier->ubProfile ]; diff --git a/Tactical/Merc Hiring.h b/Tactical/Merc Hiring.h index d083788d..a7366b48 100644 --- a/Tactical/Merc Hiring.h +++ b/Tactical/Merc Hiring.h @@ -46,7 +46,7 @@ extern INT16 gsMercArriveSectorY; INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc); -void MercArrivesCallback( UINT16 ubSoldierID ); +void MercArrivesCallback( SoldierID ubSoldierID ); BOOLEAN IsMercHireable( UINT8 ubMercID ); BOOLEAN IsMercDead( UINT8 ubMercID ); UINT16 NumberOfMercsOnPlayerTeam(); diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 1807979a..d4ed672f 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -361,7 +361,7 @@ typedef CHAR8 PaletteRepID[ 30 ]; typedef struct { UINT8 ubType; - PaletteRepID ID; + PaletteRepID ID; UINT8 ubPaletteSize; UINT8 *r; UINT8 *g; diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index 9ba02699..10928e46 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -1489,7 +1489,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) { if( gfUIFullTargetFound ) { - if ( IsValidTalkableNPC( gusUIFullTargetID, FALSE, FALSE, FALSE ) && !_KeyDown( SHIFT ) && !AM_AN_EPC( pSoldier ) && MercPtrs[ gusUIFullTargetID ]->bTeam != ENEMY_TEAM && !ValidQuickExchangePosition( ) ) + if ( IsValidTalkableNPC( gusUIFullTargetID, FALSE, FALSE, FALSE ) && !_KeyDown( SHIFT ) && !AM_AN_EPC( pSoldier ) && gusUIFullTargetID->bTeam != ENEMY_TEAM && !ValidQuickExchangePosition( ) ) { uiMoveTargetSoldierId = gusUIFullTargetID; *puiNewEvent = T_CHANGE_TO_TALKING; @@ -1536,7 +1536,7 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ) { guiUITargetSoldierId = gusUIFullTargetID; - if ( MercPtrs[ gusUIFullTargetID ]->bTeam != gbPlayerNum ) + if ( gusUIFullTargetID->bTeam != gbPlayerNum ) { fOnValidGuy = TRUE; } diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 158cb352..473da2a0 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -788,65 +788,65 @@ public: void ConvertFrom_101_To_102(const OLDSOLDIERTYPE_101& src); public: // AI STUFF from before the changes to the memory structure - INT8 bOppList[MAX_NUM_SOLDIERS]; // AI knowledge database - INT8 bLastAction; - INT8 bAction; - INT32 usActionData; - INT8 bNextAction; - INT32 usNextActionData; - INT8 bActionInProgress; - INT8 bAlertStatus; - INT8 bOppCnt; - INT8 bNeutral; - INT8 bNewSituation; - INT8 bNextTargetLevel; - INT8 bOrders; - INT8 bAttitude; - INT8 bUnderFire; - INT8 bShock; - INT8 bUnderEscort; - INT8 bBypassToGreen; - UINT8 ubLastMercToRadio; - INT8 bDominantDir; // AI main direction to face... - INT8 bPatrolCnt; // number of patrol gridnos - INT8 bNextPatrolPnt; // index to next patrol gridno - INT32 sPatrolGrid[MAXPATROLGRIDS];// AI list for ptr->orders==PATROL - INT32 sNoiseGridno; - UINT8 ubNoiseVolume; - INT8 bLastAttackHit; - UINT16 ubXRayedBy; - FLOAT dHeightAdjustment; - INT8 bMorale; - INT8 bTeamMoraleMod; - INT8 bTacticalMoraleMod; - INT8 bStrategicMoraleMod; - INT8 bAIMorale; - UINT8 ubPendingAction; - UINT8 ubPendingActionAnimCount; - UINT32 uiPendingActionData1; - INT32 sPendingActionData2; - INT8 bPendingActionData3; - INT8 ubDoorHandleCode; - UINT32 uiPendingActionData4; - INT8 bInterruptDuelPts; - INT8 bPassedLastInterrupt; - INT16 bIntStartAPs; //100AP - INT8 bMoved; - INT8 bHunting; - UINT8 ubLastCall; - UINT16 ubCaller; - INT32 sCallerGridNo; - UINT8 bCallPriority; - INT8 bCallActedUpon; - INT8 bFrenzied; - INT8 bNormalSmell; - INT8 bMonsterSmell; - INT8 bMobility; - INT8 bRTPCombat; - INT8 fAIFlags; - INT16 bAimTime; //100AP - INT8 bShownAimTime; - UINT8 ubInterruptCounter[MAX_NUM_SOLDIERS]; // SANDRO - interrupt counter added + INT8 bOppList[MAX_NUM_SOLDIERS]; // AI knowledge database + INT8 bLastAction; + INT8 bAction; + INT32 usActionData; + INT8 bNextAction; + INT32 usNextActionData; + INT8 bActionInProgress; + INT8 bAlertStatus; + INT8 bOppCnt; + INT8 bNeutral; + INT8 bNewSituation; + INT8 bNextTargetLevel; + INT8 bOrders; + INT8 bAttitude; + INT8 bUnderFire; + INT8 bShock; + INT8 bUnderEscort; + INT8 bBypassToGreen; + UINT8 ubLastMercToRadio; + INT8 bDominantDir; // AI main direction to face... + INT8 bPatrolCnt; // number of patrol gridnos + INT8 bNextPatrolPnt; // index to next patrol gridno + INT32 sPatrolGrid[MAXPATROLGRIDS];// AI list for ptr->orders==PATROL + INT32 sNoiseGridno; + UINT8 ubNoiseVolume; + INT8 bLastAttackHit; + UINT16 ubXRayedBy; + FLOAT dHeightAdjustment; + INT8 bMorale; + INT8 bTeamMoraleMod; + INT8 bTacticalMoraleMod; + INT8 bStrategicMoraleMod; + INT8 bAIMorale; + UINT8 ubPendingAction; + UINT8 ubPendingActionAnimCount; + UINT32 uiPendingActionData1; + INT32 sPendingActionData2; + INT8 bPendingActionData3; + INT8 ubDoorHandleCode; + UINT32 uiPendingActionData4; + INT8 bInterruptDuelPts; + INT8 bPassedLastInterrupt; + INT16 bIntStartAPs; //100AP + INT8 bMoved; + INT8 bHunting; + UINT8 ubLastCall; + SoldierID ubCaller; + INT32 sCallerGridNo; + UINT8 bCallPriority; + INT8 bCallActedUpon; + INT8 bFrenzied; + INT8 bNormalSmell; + INT8 bMonsterSmell; + INT8 bMobility; + INT8 bRTPCombat; + INT8 fAIFlags; + INT16 bAimTime; //100AP + INT8 bShownAimTime; + UINT8 ubInterruptCounter[MAX_NUM_SOLDIERS]; // SANDRO - interrupt counter added }; class STRUCT_Flags//last edited at version 102 diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index ceb58df0..854a4141 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -133,7 +133,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) { //CHRISL: Changed the second parameter to use the same information as the 'F' hotkey uses. //iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( gusSelectedSoldier->sGridNo, sSoldierGridNo ) / 10; - iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( gusSelectedSoldier->sGridNo, MercPtrs[ gusUIFullTargetID ]->sGridNo ) / 10; + iRangeToTarget = GetRangeInCellCoordsFromGridNoDiff( gusSelectedSoldier->sGridNo, gusUIFullTargetID->sGridNo ) / 10; } // WANNE: If we want to show the tooltip of milita and no merc is present in the sector else @@ -145,7 +145,7 @@ void SoldierTooltip( SOLDIERTYPE* pSoldier ) // SANDRO - don't use this if detail set to debug! if ( gGameExternalOptions.gfAllowUDTRange && gGameExternalOptions.ubSoldierTooltipDetailLevel != DL_Debug && !(gTacticalStatus.uiFlags & SHOW_ALL_MERCS) ) { - uiMaxTooltipDistance = (UINT32)( gusSelectedSoldier->GetMaxDistanceVisible(MercPtrs[ gusUIFullTargetID ]->sGridNo, 0, CALC_FROM_WANTED_DIR) * (gGameExternalOptions.ubUDTModifier)); + uiMaxTooltipDistance = (UINT32)( gusSelectedSoldier->GetMaxDistanceVisible(gusUIFullTargetID->sGridNo, 0, CALC_FROM_WANTED_DIR) * (gGameExternalOptions.ubUDTModifier)); uiMaxTooltipDistance /= 100; } //SCORE: Otherwise if we're using dynamics then do this diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index bdd31b7f..9fb928c1 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -573,7 +573,7 @@ void QueryTBLeftButton( UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) { // Select guy - if ( ( guiUIFullTargetFlags & SELECTED_MERC) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) && !( MercPtrs[ gusUIFullTargetID ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( ( guiUIFullTargetFlags & SELECTED_MERC) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC ) && !( gusUIFullTargetID->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { *puiNewEvent = M_CHANGE_TO_ADJPOS_MODE; fIgnoreLeftUp = FALSE; @@ -1250,7 +1250,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) if( gfUIFullTargetFound ) { // ATE: Don't do this automatically for enemies...... - if ( MercPtrs[ gusUIFullTargetID ]->bTeam != ENEMY_TEAM ) + if ( gusUIFullTargetID->bTeam != ENEMY_TEAM ) { uiMoveTargetSoldierId = gusUIFullTargetID; if ( IsValidTalkableNPC( gusUIFullTargetID, FALSE, FALSE, FALSE ) && !_KeyDown( SHIFT ) && !AM_AN_EPC( pSoldier ) && !ValidQuickExchangePosition( ) ) @@ -1280,7 +1280,7 @@ void GetTBMousePositionInput( UINT32 *puiNewEvent ) { guiUITargetSoldierId = gusUIFullTargetID; - if ( MercPtrs[ gusUIFullTargetID ]->bTeam != gbPlayerNum ) + if ( gusUIFullTargetID->bTeam != gbPlayerNum ) { fOnValidGuy = TRUE; //ddd turn off flag that indicates aim/autofire mode adjustment (aimed burst/auto) @@ -3593,7 +3593,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) { //Display the range to the target - DisplayRangeToTarget( gusSelectedSoldier, MercPtrs[gusUIFullTargetID]->sGridNo ); + DisplayRangeToTarget( gusSelectedSoldier, gusUIFullTargetID->sGridNo ); } else { @@ -4648,7 +4648,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) { // Get soldier... - pSoldier2 = MercPtrs[ gusUIFullTargetID ]; + pSoldier2 = gusUIFullTargetID; // Check if both OK.... if ( pSoldier1->stats.bLife >= OKLIFE && pSoldier2->ubID != gusSelectedSoldier ) @@ -5677,7 +5677,7 @@ INT8 CheckForAndHandleHandleVehicleInteractiveClick( SOLDIERTYPE *pSoldier, UINT if ( gfUIFullTargetFound ) { - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; // anv: added condition - make sure we won't put vehicle in another vehicle if ( OK_ENTERABLE_VEHICLE( pTSoldier ) && pTSoldier->bVisible != -1 && OKUseVehicle( pTSoldier->ubProfile ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER | SOLDIER_VEHICLE ) ) ) @@ -5824,18 +5824,18 @@ void HandleHandCursorClick( INT32 usMapPos, UINT32 *puiNewEvent ) // Flugente: allow stealing if the other guy is an enemy, OR if we are on the same team if ( (( guiUIFullTargetFlags & ENEMY_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC )) || (AllowedToStealFromTeamMate(pSoldier->ubID, (UINT8)gusUIFullTargetID) && guiUIFullTargetFlags & OWNED_MERC) ) { - sActionGridNo = FindAdjacentGridEx( pSoldier, MercPtrs[ gusUIFullTargetID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( pSoldier, gusUIFullTargetID->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) { sActionGridNo = sAdjustedGridNo; } // Steal! - sAPCost = GetAPsToStealItem( pSoldier, MercPtrs[ gusUIFullTargetID ], sActionGridNo ); // SANDRO - added target variable + sAPCost = GetAPsToStealItem( pSoldier, gusUIFullTargetID, sActionGridNo ); // SANDRO - added target variable if ( EnoughPoints( pSoldier, sAPCost, 0, TRUE ) ) { - MercStealFromMerc( pSoldier, MercPtrs[ gusUIFullTargetID ] ); + MercStealFromMerc( pSoldier, gusUIFullTargetID ); *puiNewEvent = A_CHANGE_TO_MOVE; @@ -5962,7 +5962,7 @@ void HandleHandCursorRightClick( INT32 usMapPos, UINT32 *puiNewEvent ) if( gfUIFullTargetFound ) { - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; if( OK_ENTERABLE_VEHICLE( pTSoldier ) && pTSoldier->bVisible != -1 && OKUseVehicle( pTSoldier->ubProfile ) ) { // anv: if we are passengers, only show menu when clicking on vehicle we're in @@ -6058,10 +6058,10 @@ INT8 HandleMoveModeInteractiveClick( INT32 usMapPos, UINT32 *puiNewEvent ) if ( ValidQuickExchangePosition( ) ) { // Check if we can... - if ( CanExchangePlaces( pSoldier, MercPtrs[ gusUIFullTargetID ], TRUE ) ) + if ( CanExchangePlaces( pSoldier, gusUIFullTargetID, TRUE ) ) { gpExchangeSoldier1 = pSoldier; - gpExchangeSoldier2 = MercPtrs[ gusUIFullTargetID ]; + gpExchangeSoldier2 = gusUIFullTargetID; // Do message box... //DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ EXCHANGE_PLACES_REQUESTER ], GAME_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, ExchangeMessageBoxCallBack, NULL ); diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 6cdd0e3d..bfbc2e96 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -134,7 +134,7 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs // FUNCTIONS FOR CURSOR DETERMINATION! -UINT8 GetProperItemCursor( UINT16 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ) +UINT8 GetProperItemCursor( SoldierID ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ) { SOLDIERTYPE *pSoldier; UINT32 uiCursorFlags; @@ -144,7 +144,7 @@ UINT8 GetProperItemCursor( UINT16 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPo UINT8 ubCursorID=0; UINT8 ubItemCursor = 0; - pSoldier = MercPtrs[ ubSoldierID ]; + pSoldier = ubSoldierID; fRecalc = GetMouseRecalcAndShowAPFlags( &uiCursorFlags, &fShowAPs ); @@ -159,7 +159,7 @@ UINT8 GetProperItemCursor( UINT16 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPo // Calculate target gridno! if ( gfUIFullTargetFound ) { - sTargetGridNo = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sTargetGridNo = gusUIFullTargetID->sGridNo; } else { @@ -573,7 +573,7 @@ UINT8 HandleActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos, BOOLEA { if ( gusUIFullTargetID != NOBODY ) { - if ( SoldierToSoldierBodyPartChanceToGetThrough( pSoldier, MercPtrs[ gusUIFullTargetID ], pSoldier->bAimShotLocation ) < OK_CHANCE_TO_GET_THROUGH ) + if ( SoldierToSoldierBodyPartChanceToGetThrough( pSoldier, gusUIFullTargetID, pSoldier->bAimShotLocation ) < OK_CHANCE_TO_GET_THROUGH ) { gfCannotGetThrough = TRUE; } @@ -1556,7 +1556,7 @@ void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN // Check if we can find a soldier here if ( gfUIFullTargetFound ) { - pTargetSoldier = MercPtrs[ gusUIFullTargetID ]; + pTargetSoldier = gusUIFullTargetID; if ( FindRelativeSoldierPosition( pTargetSoldier, &usFlags, gusMouseXPos, gusMouseYPos ) ) { @@ -1594,7 +1594,7 @@ void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN { if ( gfUIFullTargetFound ) { - pTargetSoldier = MercPtrs[ gusUIFullTargetID ]; + pTargetSoldier = gusUIFullTargetID; if ( pTargetSoldier->ubBodyType == CROW ) { @@ -2583,7 +2583,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos ) // 'snap' cursor to target tile.... if ( gfUIFullTargetFound ) { - usMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + usMapPos = gusUIFullTargetID->sGridNo; } @@ -2609,7 +2609,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos ) if ( gfUIFullTargetFound ) { // Get target soldier, if one exists - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; sGridNo = pTSoldier->sGridNo; bTargetLevel = pSoldier->pathing.bLevel; @@ -2727,7 +2727,7 @@ void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos ) if ( gfUIFullTargetFound ) { // Get target soldier, if one exists - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; sGridNo = pTSoldier->sGridNo; bTargetLevel = pSoldier->pathing.bLevel; @@ -3172,7 +3172,7 @@ void HandleWheelAdjustCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, INT16 sDelta // 'snap' cursor to target tile.... if ( gfUIFullTargetFound ) { - sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = gusUIFullTargetID->sGridNo; } switch( ubCursor ) @@ -3180,8 +3180,8 @@ void HandleWheelAdjustCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, INT16 sDelta case TARGETCURS: // warn if bad chance to get through if ( gfUIFullTargetFound && - !HandleCheckForBadChangeToGetThrough( pSoldier, MercPtrs[ gusUIFullTargetID ], - MercPtrs[ gusUIFullTargetID ]->sGridNo , MercPtrs[ gusUIFullTargetID ]->pathing.bLevel ) ) + !HandleCheckForBadChangeToGetThrough( pSoldier, gusUIFullTargetID, + gusUIFullTargetID->sGridNo , gusUIFullTargetID->pathing.bLevel ) ) { return; } @@ -3370,7 +3370,7 @@ void HandleWheelAdjustCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, INT16 sDelta // 'snap' cursor to target tile.... if ( gfUIFullTargetFound ) { - sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = gusUIFullTargetID->sGridNo; } @@ -3442,7 +3442,7 @@ void HandleWheelAdjustCursor( SOLDIERTYPE *pSoldier, INT16 sMapPos, INT16 sDelta if ( gfUIFullTargetFound ) { // Get target soldier, if one exists - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; sGridNo = pTSoldier->sGridNo; bTargetLevel = pSoldier->pathing.bLevel; @@ -3608,7 +3608,7 @@ void HandleWheelAdjustCursor( SOLDIERTYPE *pSoldier, INT32 sMapPos, INT32 sDelta // 'snap' cursor to target tile.... if ( gfUIFullTargetFound ) - sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = gusUIFullTargetID->sGridNo; int aimlevelchange = 1; int maxAimCanAfford = 0; @@ -3681,7 +3681,7 @@ void HandleWheelAdjustCursor( SOLDIERTYPE *pSoldier, INT32 sMapPos, INT32 sDelta if ( gfUIFullTargetFound ) { // Get target soldier, if one exists - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; sGridNo = pTSoldier->sGridNo; bTargetLevel = pSoldier->pathing.bLevel; @@ -3836,7 +3836,7 @@ void HandleWheelAdjustCursorWOAB( SOLDIERTYPE *pSoldier, INT32 sMapPos, INT32 sD // 'snap' cursor to target tile.... if ( gfUIFullTargetFound ) { - sMapPos = MercPtrs[ gusUIFullTargetID ]->sGridNo; + sMapPos = gusUIFullTargetID->sGridNo; } @@ -3908,7 +3908,7 @@ void HandleWheelAdjustCursorWOAB( SOLDIERTYPE *pSoldier, INT32 sMapPos, INT32 sD if ( gfUIFullTargetFound ) { // Get target soldier, if one exists - pTSoldier = MercPtrs[ gusUIFullTargetID ]; + pTSoldier = gusUIFullTargetID; sGridNo = pTSoldier->sGridNo; bTargetLevel = pSoldier->pathing.bLevel; diff --git a/Tactical/UI Cursors.h b/Tactical/UI Cursors.h index b20e97f3..415246c4 100644 --- a/Tactical/UI Cursors.h +++ b/Tactical/UI Cursors.h @@ -9,7 +9,7 @@ #define REFINE_KNIFE_2 (gGameExternalOptions.fEnhancedCloseCombatSystem ? gSkillTraitValues.ubModifierForAPsAddedOnAimedBladedAttackes*2 : 6) -UINT8 GetProperItemCursor( UINT16 ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ); +UINT8 GetProperItemCursor( SoldierID ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ); void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ); void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ); @@ -30,4 +30,4 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs // based on how trained the shooter is. UINT32 ChanceToHitApproximation( SOLDIERTYPE * pSoldier, UINT32 uiChance ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/merc entering.h b/Tactical/merc entering.h index 30b80744..28d0ec0e 100644 --- a/Tactical/merc entering.h +++ b/Tactical/merc entering.h @@ -4,7 +4,7 @@ extern BOOLEAN gfIngagedInDrop; void ResetHeliSeats( ); -void AddMercToHeli( UINT16 ubID ); +void AddMercToHeli( SoldierID ubID ); // Flugente: we might want to set the helicopter dropoff point without starting it at the same time void SetHelicopterDroppoint( INT32 sGridNo ); @@ -14,7 +14,7 @@ void StartHelicopterRun(); void HandleHeliDrop( BOOLEAN fPlayer = TRUE ); -UINT16 SpawnAirDropElite( INT32 sGridNo ); +SoldierID SpawnAirDropElite( INT32 sGridNo ); void InitiateEnemyAirDropSoldiers( INT32 sGridNo ); void HandleEnemyAirdrop( ); diff --git a/TacticalAI/AIInternals.h b/TacticalAI/AIInternals.h index b732cb5e..b3293287 100644 --- a/TacticalAI/AIInternals.h +++ b/TacticalAI/AIInternals.h @@ -130,20 +130,20 @@ typedef struct class ATTACKTYPE { public: - UINT8 ubPossible; // is this attack form possible - UINT16 ubOpponent; // which soldier is the victim + UINT8 ubPossible; // is this attack form possible + SoldierID ubOpponent; // which soldier is the victim //CHANGED STRUCTURE VALUE BY GOTTHARD 7/14/07 - INT16 ubAimTime; // how many extra APs to spend on aiming - INT16 ubChanceToReallyHit; // chance to hit * chance to get through cover + INT16 ubAimTime; // how many extra APs to spend on aiming + INT16 ubChanceToReallyHit; // chance to hit * chance to get through cover //END STRUCTURE CHANGE BY GOTTHARD 7/14/07 - INT16 ubAPCost; // how many APs the attack will use up - INT32 iAttackValue; // relative worthiness of this type of attack - INT32 sTarget; // target gridno of this attack - INT8 bTargetLevel; // target level of this attack - INT8 bWeaponIn; // the inv slot of the weapon in question - INT8 bScopeMode; // SANDRO: added for scope mode and alternative weapon holding - UINT8 ubStance; // recommended stance for attack - UINT8 ubFriendlyFireChance; // highest chance to hit someone of our guys //dnl ch61 180813 + INT16 ubAPCost; // how many APs the attack will use up + INT32 iAttackValue; // relative worthiness of this type of attack + INT32 sTarget; // target gridno of this attack + INT8 bTargetLevel; // target level of this attack + INT8 bWeaponIn; // the inv slot of the weapon in question + INT8 bScopeMode; // SANDRO: added for scope mode and alternative weapon holding + UINT8 ubStance; // recommended stance for attack + UINT8 ubFriendlyFireChance; // highest chance to hit someone of our guys //dnl ch61 180813 ATTACKTYPE(void){ InitAttackType(this); } void InitAttackType(ATTACKTYPE *pAttack); @@ -212,7 +212,7 @@ void CreatureDecideAlertStatus( SOLDIERTYPE *pCreature ); // sevenfm: void CheckTossSelfSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow); void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow); -void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT16 ubOpponentID); +void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, SoldierID ubOpponentID); INT32 FindTossSpotInDirection(INT32 sSpot, INT8 bLevel, INT32 sTargetSpot, BOOLEAN fCheckAdjacentDirections, BOOLEAN fCheckFarther); void CheckTossGrenadeAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT8 ubGrenadeType); @@ -254,7 +254,7 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN int LegalNPCDestination(SOLDIERTYPE *pSoldier, INT32 sGridno, UINT8 ubPathMode, UINT8 ubWaterOK, UINT8 fFlags); void LoadWeaponIfNeeded(SOLDIERTYPE *pSoldier); INT32 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN * pfClimbingNecessary, BOOLEAN * pfReachable ); -INT32 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc ); +INT32 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, SoldierID * pubDesiredMerc ); void NPCDoesAct(SOLDIERTYPE *pSoldier); void NPCDoesNothing(SOLDIERTYPE *pSoldier); INT8 OKToAttack(SOLDIERTYPE *ptr, int target); @@ -318,7 +318,7 @@ BOOLEAN GetBestAoEGridNo(SOLDIERTYPE *pSoldier, INT32* pGridNo, INT16 aRadius, U // Get the ID of the farthest opponent we can see, with an optional minimum range // puID - ID of the farthest opponent pSoldier can see // sRange - only return true and give an idea if opponent found is further away than this -BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, UINT16 * puID, INT16 sRange); +BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, SoldierID *puID, INT16 sRange); // are there more allies than friends in adjacent sectors? BOOLEAN MoreFriendsThanEnemiesinNearbysectors(UINT8 ausTeam, INT16 aX, INT16 aY, INT8 aZ); diff --git a/TacticalAI/AIList.cpp b/TacticalAI/AIList.cpp index 618c643d..e91c48e1 100644 --- a/TacticalAI/AIList.cpp +++ b/TacticalAI/AIList.cpp @@ -46,7 +46,7 @@ void DeleteAIListEntry( AILIST * pEntry ) pEntry->pNext = NULL; } -UINT16 FindEmptyAIListEntry( void ) +SoldierID FindEmptyAIListEntry( void ) { UINT16 ubLoop; @@ -61,7 +61,7 @@ UINT16 FindEmptyAIListEntry( void ) return( AI_LIST_SIZE ); } -AILIST * CreateNewAIListEntry( UINT16 ubNewEntry, UINT16 ubID, INT8 bPriority ) +AILIST * CreateNewAIListEntry( UINT16 ubNewEntry, SoldierID ubID, INT8 bPriority ) { gAIList[ ubNewEntry ].ubID = ubID; gAIList[ ubNewEntry ].bPriority = bPriority; @@ -69,10 +69,10 @@ AILIST * CreateNewAIListEntry( UINT16 ubNewEntry, UINT16 ubID, INT8 bPriority ) return( &(gAIList[ ubNewEntry ]) ); } -UINT16 RemoveFirstAIListEntry( void ) +SoldierID RemoveFirstAIListEntry( void ) { AILIST *pOldFirstEntry; - UINT16 ubID; + SoldierID ubID; while ( gpFirstAIListEntry != NULL) { @@ -94,7 +94,7 @@ UINT16 RemoveFirstAIListEntry( void ) return( NOBODY ); } -void RemoveAIListEntryForID( UINT16 ubID ) +void RemoveAIListEntryForID( SoldierID ubID ) { AILIST * pEntry; AILIST * pPrevEntry; @@ -123,9 +123,9 @@ void RemoveAIListEntryForID( UINT16 ubID ) // none found, that's okay } -BOOLEAN InsertIntoAIList( UINT16 ubID, INT8 bPriority ) +BOOLEAN InsertIntoAIList( SoldierID ubID, INT8 bPriority ) { - UINT16 ubNewEntry; + SoldierID ubNewEntry; AILIST * pEntry, * pNewEntry, * pPrevEntry = NULL; ubNewEntry = FindEmptyAIListEntry(); @@ -276,15 +276,15 @@ BOOLEAN SatisfiesAIListConditions( SOLDIERTYPE * pSoldier, UINT16 * pubDoneCount return( TRUE ); } -BOOLEAN MoveToFrontOfAIList( UINT16 ubID ) +BOOLEAN MoveToFrontOfAIList( SoldierID ubID ) { // we'll have to fake this guy's alert status (in the list) to be the same as the current // front of the list INT8 bPriority; - UINT16 ubNewEntry; - AILIST * pNewEntry; + SoldierID ubNewEntry; + AILIST *pNewEntry; - if ( !SatisfiesAIListConditions( MercPtrs[ ubID ], NULL, FALSE ) ) + if ( !SatisfiesAIListConditions( ubID, NULL, FALSE ) ) { // can't do dat! return( FALSE ); diff --git a/TacticalAI/AIList.h b/TacticalAI/AIList.h index bb44ac29..49858a90 100644 --- a/TacticalAI/AIList.h +++ b/TacticalAI/AIList.h @@ -1,18 +1,18 @@ -#include "Types.h" +#include "Overhead Types.h" typedef struct AILIST { - UINT16 ubID; - INT8 bPriority; - UINT8 ubUnused; - struct AILIST * pNext; + SoldierID ubID; + INT8 bPriority; + UINT8 ubUnused; + struct AILIST *pNext; } AILIST; #define MAX_AI_PRIORITY 100 extern void ClearAIList( void ); -extern AILIST * CreateNewAIListEntry( UINT16 ubNewEntry, UINT16 ubID, INT8 bAlertStatus ); -extern BOOLEAN InsertIntoAIList( UINT16 ubID, INT8 bAlertStatus ); -extern UINT16 RemoveFirstAIListEntry( void ); +extern AILIST * CreateNewAIListEntry( UINT16 ubNewEntry, SoldierID ubID, INT8 bAlertStatus ); +extern BOOLEAN InsertIntoAIList( SoldierID ubID, INT8 bAlertStatus ); +extern SoldierID RemoveFirstAIListEntry( void ); extern BOOLEAN BuildAIListForTeam( INT8 bTeam ); -extern BOOLEAN MoveToFrontOfAIList( UINT16 ubID ); +extern BOOLEAN MoveToFrontOfAIList( SoldierID ubID ); diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index f3970d1d..f6d32bea 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -874,7 +874,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) { - UINT16 ubID; + SoldierID ubID; if (gfTurnBasedAI) { @@ -885,19 +885,19 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) } // search for any player merc to say close call quote - for ( ubID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubID++ ) + for ( ubID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubID ) { - if ( OK_INSECTOR_MERC( MercPtrs[ ubID ] ) ) + if ( OK_INSECTOR_MERC( ubID ) ) { - if ( MercPtrs[ ubID ]->flags.fCloseCall ) + if ( ubID->flags.fCloseCall ) { - if ( !gTacticalStatus.fSomeoneHit && MercPtrs[ ubID ]->bNumHitsThisTurn == 0 && !(MercPtrs[ ubID ]->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) + if ( !gTacticalStatus.fSomeoneHit && ubID->bNumHitsThisTurn == 0 && !(ubID->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) { // say close call quote! - TacticalCharacterDialogue( MercPtrs[ ubID ], QUOTE_CLOSE_CALL ); - MercPtrs[ ubID ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; + TacticalCharacterDialogue( ubID, QUOTE_CLOSE_CALL ); + ubID->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; } - MercPtrs[ ubID ]->flags.fCloseCall = FALSE; + ubID->flags.fCloseCall = FALSE; } } } @@ -942,7 +942,7 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) ubID = RemoveFirstAIListEntry(); if (ubID != NOBODY) { - StartNPCAI( MercPtrs[ ubID ] ); + StartNPCAI( ubID ); return; } @@ -1165,12 +1165,12 @@ INT32 FindAdjacentSpotBeside(SOLDIERTYPE *pSoldier, INT32 sGridNo) return(sCheapestDest); } -UINT16 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ) +SoldierID GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ) { - UINT32 uiLoop; - INT32 iThreatVal,iMinThreat = 30000; - SOLDIERTYPE *pTargetSoldier; - UINT16 ubTargetSoldier = NOBODY; + UINT32 uiLoop; + INT32 iThreatVal,iMinThreat = 30000; + SOLDIERTYPE *pTargetSoldier; + SoldierID ubTargetSoldier = NOBODY; // Loop through all mercs @@ -1914,7 +1914,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) UINT16 usHandItem = pSoldier->inv[HANDPOS].usItem; INT8 bSlot; - UINT16 usSoldierIndex; // added by SANDRO + SoldierID usSoldierIndex; // added by SANDRO #ifdef TESTAICONTROL if (gfTurnBasedAI || gTacticalStatus.fAutoBandageMode) @@ -2594,7 +2594,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) usSoldierIndex = WhoIsThere2( pSoldier->aiData.usActionData, pSoldier->bTargetLevel); if ( usSoldierIndex != NOBODY ) { - MercStealFromMerc( pSoldier, MercPtrs[usSoldierIndex] ); + MercStealFromMerc( pSoldier, usSoldierIndex ); PossiblyStartEnemyTaunt( pSoldier, TAUNT_STEAL, usSoldierIndex ); } @@ -2628,7 +2628,7 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier) case AI_ACTION_USE_SKILL: { - UINT16 ubID = WhoIsThere2( pSoldier->aiData.usActionData, 0 ); + SoldierID ubID = WhoIsThere2( pSoldier->aiData.usActionData, 0 ); BOOLEAN result = pSoldier->UseSkill(pSoldier->usAISkillUse, pSoldier->aiData.usActionData, ubID); diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 25ea052a..703cc950 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -716,16 +716,16 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot) //dnl ch62 180813 ignore firing into breathless targets if there are targets in better condition // sevenfm: check that best opponent exists if (pBestShot->ubOpponent != NOBODY && - (Menptr[pBestShot->ubOpponent].bCollapsed || Menptr[pBestShot->ubOpponent].bBreathCollapsed) && - Menptr[pBestShot->ubOpponent].bBreath < OKBREATH - && Menptr[pBestShot->ubOpponent].bBreath < pOpponent->bBreath) + (pBestShot->ubOpponent->bCollapsed || pBestShot->ubOpponent->bBreathCollapsed) && + pBestShot->ubOpponent->bBreath < OKBREATH + && pBestShot->ubOpponent->bBreath < pOpponent->bBreath) { iPercentBetter = PERCENT_TO_IGNORE_THREAT; } // sevenfm: if best opponent is dying and new opponent is ok, use new opponent if (pBestShot->ubOpponent != NOBODY && - Menptr[pBestShot->ubOpponent].stats.bLife < OKLIFE && + pBestShot->ubOpponent->stats.bLife < OKLIFE && pOpponent->stats.bLife >= OKLIFE) { iPercentBetter = PERCENT_TO_IGNORE_THREAT; @@ -735,7 +735,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot) // guy is conscious at all if (iPercentBetter < -PERCENT_TO_IGNORE_THREAT && pBestShot->ubOpponent != NOBODY && - Menptr[pBestShot->ubOpponent].stats.bLife >= OKLIFE) + pBestShot->ubOpponent->stats.bLife >= OKLIFE) { // then stick with the older guy as the better target continue; @@ -753,7 +753,7 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot) // sevenfm: if new opponent is dying and best opponent is ok, ignore new opponent if (pBestShot->ubOpponent != NOBODY && - Menptr[pBestShot->ubOpponent].stats.bLife >= OKLIFE && + pBestShot->ubOpponent->stats.bLife >= OKLIFE && pOpponent->stats.bLife < OKLIFE) { //DebugShot(pSoldier, String("new opponent is dying, best opponent is ok - skip")); @@ -845,7 +845,8 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) INT32 sGridNo, sEndGridNo, sFriendTile[MAXMERCS], sOpponentTile[MAXMERCS]; INT8 bFriendLevel[MAXMERCS], bOpponentLevel[MAXMERCS]; INT32 iEstDamage; - UINT16 ubFriendCnt = 0,ubOpponentCnt = 0, ubOpponentID[MAXMERCS]; + UINT16 ubFriendCnt = 0, ubOpponentCnt = 0; + SoldierID ubOpponentID[MAXMERCS]; UINT8 ubMaxPossibleAimTime; INT16 sRawAPCost, sMinAPcost; UINT8 ubChanceToHit, ubChanceToGetThrough, ubChanceToReallyHit, ubFriendlyFireChance; @@ -1479,7 +1480,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) iThreatValue = iOppThreatValue[ubLoop2]; // estimate how much damage this tossed item would do to him - iEstDamage = EstimateThrowDamage(pSoldier,bPayloadPocket,MercPtrs[ubOpponentID[ubLoop2]],sGridNo); + iEstDamage = EstimateThrowDamage(pSoldier, bPayloadPocket, ubOpponentID[ubLoop2], sGridNo); if (usOppDist) { @@ -1492,7 +1493,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) iTotalThreatValue += (iThreatValue * iEstDamage); // only count opponents still standing worth shooting at (in range) - if (Menptr[ ubOpponentID[ubLoop2] ].stats.bLife >= OKLIFE) + if (ubOpponentID[ubLoop2]->stats.bLife >= OKLIFE) { ubOppsInRange++; if (usOppDist < 2) @@ -1599,7 +1600,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // limit RPG use, unless can hit several enemies, shooting at tank or opponent is in a room if (ItemIsRocketLauncher(usInHand) && ubOppsInRange < 2 && - !ARMED_VEHICLE(MercPtrs[ubOpponentID[ubLoop]]) && + !ARMED_VEHICLE(ubOpponentID[ubLoop]) && (!InARoom(sOpponentTile[ubLoop], NULL) || pSoldier->bTeam != ENEMY_TEAM)) { continue; // next gridno @@ -1691,7 +1692,7 @@ void CalcBestThrow(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) { ubMinChanceToReallyHit = 30; } - else if (EXPLOSIVE_GUN(usInHand) && !ARMED_VEHICLE(pSoldier) && (pBestThrow->ubOpponent == NOBODY || !ARMED_VEHICLE(MercPtrs[pBestThrow->ubOpponent]))) + else if (EXPLOSIVE_GUN(usInHand) && !ARMED_VEHICLE(pSoldier) && (pBestThrow->ubOpponent == NOBODY || !ARMED_VEHICLE(pBestThrow->ubOpponent))) { ubMinChanceToReallyHit = 80; } @@ -1916,7 +1917,7 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt // guy is conscious at all if (iPercentBetter < -PERCENT_TO_IGNORE_THREAT && pBestStab->ubOpponent != NOBODY && - Menptr[pBestStab->ubOpponent].stats.bLife >= OKLIFE) + pBestStab->ubOpponent->stats.bLife >= OKLIFE) { // then stick with the older guy as the better target continue; @@ -1937,12 +1938,12 @@ void CalcBestStab(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestStab, BOOLEAN fBladeAt // OOOF! That was a lot of work! But we've got a new best target! pBestStab->ubPossible = TRUE; pBestStab->ubOpponent = pOpponent->ubID; - pBestStab->ubAimTime = ubBestAimTime; - pBestStab->ubChanceToReallyHit = ubChanceToReallyHit; - pBestStab->sTarget = pOpponent->sGridNo; - pBestStab->bTargetLevel = pOpponent->pathing.bLevel; - pBestStab->iAttackValue = iAttackValue; - pBestStab->ubAPCost = ubMinAPCost + ubBestAimTime; + pBestStab->ubAimTime = ubBestAimTime; + pBestStab->ubChanceToReallyHit = ubChanceToReallyHit; + pBestStab->sTarget = pOpponent->sGridNo; + pBestStab->bTargetLevel = pOpponent->pathing.bLevel; + pBestStab->iAttackValue = iAttackValue; + pBestStab->ubAPCost = ubMinAPCost + ubBestAimTime; } } @@ -3480,7 +3481,8 @@ BOOLEAN GetBestAoEGridNo(SOLDIERTYPE *pSoldier, INT32* pGridNo, INT16 aRadius, U { UINT16 ubLoop, ubLoop2; INT32 sGridNo, sFriendTile[MAXMERCS], sOpponentTile[MAXMERCS], sTabooTile[MAXMERCS]; - UINT16 ubFriendCnt = 0,ubOpponentCnt = 0, ubTabooCnt = 0, ubOpponentID[MAXMERCS]; + UINT16 ubFriendCnt = 0, ubOpponentCnt = 0, ubTabooCnt = 0; + SoldierID ubOpponentID[MAXMERCS]; INT32 bMaxLeft,bMaxRight,bMaxUp,bMaxDown, i, j; INT8 bPersOL, bPublOL; SOLDIERTYPE *pFriend; @@ -3670,7 +3672,7 @@ BOOLEAN GetBestAoEGridNo(SOLDIERTYPE *pSoldier, INT32* pGridNo, INT16 aRadius, U // Get the ID of the farthest opponent we can see, with an optional minimum range // puID - ID of the farthest opponent pSoldier can see // sRange - only return an true and give an idea if opponent found is further away than this -BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, UINT16 * puID, INT16 sRange) +BOOLEAN GetFarthestOpponent(SOLDIERTYPE *pSoldier, SoldierID *puID, INT16 sRange) { INT32 sGridNo; UINT32 uiLoop; @@ -3885,13 +3887,13 @@ void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) INT8 bLevel = pSoldier->pathing.bLevel; // check all friends - SOLDIERTYPE * pFriend; - INT32 sClosestFriendSpot = NOWHERE; - INT8 bClosestFriendLevel = 0; - UINT16 ubClosestFriendID = NOBODY; + SOLDIERTYPE *pFriend; + INT32 sClosestFriendSpot = NOWHERE; + INT8 bClosestFriendLevel = 0; + SoldierID ubClosestFriendID = NOBODY; INT32 sFriendSpot; - INT8 bFriendLevel; + INT8 bFriendLevel; INT32 sClosestOpponent; @@ -3999,7 +4001,7 @@ void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) // check if we can toss grenade at spot, and prepare attack data // grenade should be in hand -void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, UINT16 ubOpponentID) +void CheckTossAt(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow, INT32 sTargetSpot, INT8 bTargetLevel, SoldierID ubOpponentID) { UINT16 usInHand, usGrenade; INT32 iTossRange; diff --git a/TacticalAI/CreatureDecideAction.cpp b/TacticalAI/CreatureDecideAction.cpp index e453b321..9e01ff8e 100644 --- a/TacticalAI/CreatureDecideAction.cpp +++ b/TacticalAI/CreatureDecideAction.cpp @@ -1154,8 +1154,8 @@ INT8 CreatureDecideActionBlack( SOLDIERTYPE * pSoldier ) // if the selected opponent is not a threat (unconscious & !serviced) // (usually, this means all the guys we see our unconscious, but, on // rare occasions, we may not be able to shoot a healthy guy, too) - if ((Menptr[BestShot.ubOpponent].stats.bLife < OKLIFE) && - !Menptr[BestShot.ubOpponent].bService) + if ((BestShot.ubOpponent->stats.bLife < OKLIFE) && + !BestShot.ubOpponent->bService) { // if our attitude is NOT aggressive if (pSoldier->aiData.bAttitude != AGGRESSIVE) diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index 9b3a00ac..25f1016e 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -595,10 +595,10 @@ INT8 DecideActionBoxerEnteringRing(SOLDIERTYPE *pSoldier) INT8 DecideActionNamedNPC( SOLDIERTYPE * pSoldier ) { - INT32 sDesiredMercLoc; - UINT8 ubDesiredMercDir; - UINT8 ubDesiredMerc; - INT32 sDesiredMercDist; + INT32 sDesiredMercLoc; + UINT8 ubDesiredMercDir; + SoldierID ubDesiredMerc; + INT32 sDesiredMercDist; #ifdef DEBUGDECISIONS STR16 tempstr; #endif diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 1b726e20..d87a4a08 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -119,7 +119,7 @@ void AICenterXY( INT32 sGridNo, FLOAT * pdX, FLOAT * pdY ) *pdY = (FLOAT) (sYPos * CELL_Y_SIZE + CELL_Y_SIZE / 2); } -INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) +INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, SoldierID ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) { // When considering a gridno for cover, we want to take into account cover if we // lie down, so we return the LOWEST chance to get through for that location. @@ -158,7 +158,7 @@ INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOp return( bWorstCTGT ); } -INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) +INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, SoldierID ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) { // When considering a gridno for cover, we want to take into account cover if we // lie down, so we return the LOWEST chance to get through for that location. @@ -192,7 +192,7 @@ INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 s } -INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) +INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, SoldierID ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ) { // NOTE: CTGT stands for "ChanceToGetThrough..." @@ -592,7 +592,7 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT32 sMyGridNo, INT32 iMyThreat, INT32 i UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo ) { UINT8 ubLoop, ubCount; - UINT16 ubWhoIsThere; + SoldierID ubWhoIsThere; INT32 sTempGridNo; ubCount = 0; @@ -603,7 +603,7 @@ UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo ) if ( sTempGridNo != sGridNo ) { ubWhoIsThere = WhoIsThere2( sTempGridNo, pSoldier->pathing.bLevel ); - if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID && MercPtrs[ ubWhoIsThere ]->bTeam == pSoldier->bTeam ) + if ( ubWhoIsThere != NOBODY && ubWhoIsThere != pSoldier->ubID && ubWhoIsThere->bTeam == pSoldier->bTeam ) { ubCount++; } diff --git a/TacticalAI/Knowledge.cpp b/TacticalAI/Knowledge.cpp index c6e93a1f..74fafb00 100644 --- a/TacticalAI/Knowledge.cpp +++ b/TacticalAI/Knowledge.cpp @@ -200,7 +200,7 @@ INT32 MostImportantNoiseHeard( SOLDIERTYPE *pSoldier, INT32 *piRetValue, BOOLEAN if (*pbPublOL < NOT_HEARD_OR_SEEN) { // calculate how far this noise was, and its relative "importance" - iDistAway = SpacesAway(pSoldier->sGridNo,gsPublicLastKnownOppLoc[pSoldier->bTeam][pTemp->ubID]); + iDistAway = SpacesAway(pSoldier->sGridNo, gsPublicLastKnownOppLoc[pSoldier->bTeam][pTemp->ubID]); iNoiseValue = (*pbPublOL) * iDistAway; // always a negative number! if (iNoiseValue > iBestValue) diff --git a/TacticalAI/Medical.cpp b/TacticalAI/Medical.cpp index 5a46f6ee..35c2a334 100644 --- a/TacticalAI/Medical.cpp +++ b/TacticalAI/Medical.cpp @@ -42,7 +42,7 @@ BOOLEAN FindAutobandageClimbPoint( INT32 sDesiredGridNo, BOOLEAN fClimbUp ) BUILDING * pBuilding; UINT8 ubNumClimbSpots; UINT8 ubLoop; - UINT16 ubWhoIsThere; + SoldierID ubWhoIsThere; pBuilding = FindBuilding( sDesiredGridNo ); if (!pBuilding) @@ -55,12 +55,12 @@ BOOLEAN FindAutobandageClimbPoint( INT32 sDesiredGridNo, BOOLEAN fClimbUp ) for ( ubLoop = 0; ubLoop < ubNumClimbSpots; ubLoop++ ) { ubWhoIsThere = WhoIsThere2( pBuilding->sUpClimbSpots[ ubLoop ], 1 ); - if ( ubWhoIsThere != NOBODY && !CanCharacterAutoBandageTeammate( MercPtrs[ ubWhoIsThere ] ) ) + if ( ubWhoIsThere != NOBODY && !CanCharacterAutoBandageTeammate( ubWhoIsThere ) ) { continue; } ubWhoIsThere = WhoIsThere2( pBuilding->sDownClimbSpots[ ubLoop ], 0 ); - if ( ubWhoIsThere != NOBODY && !CanCharacterAutoBandageTeammate( MercPtrs[ ubWhoIsThere ] ) ) + if ( ubWhoIsThere != NOBODY && !CanCharacterAutoBandageTeammate( ubWhoIsThere ) ) { continue; } @@ -122,7 +122,7 @@ BOOLEAN CanAutoBandage( BOOLEAN fDoFullCheck ) UINT16 cnt; UINT16 ubMedics = 0, ubPatients = 0; SOLDIERTYPE * pSoldier; - static UINT16 ubIDForFullCheck = NOBODY; + static SoldierID ubIDForFullCheck = NOBODY; // run though the list of chars on team cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -311,7 +311,7 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) { // only switch to this patient if our distance is closer than // the other medic's - pOtherMedic = MercPtrs[ pPatient->ubAutoBandagingMedic ]; + pOtherMedic = pPatient->ubAutoBandagingMedic; sOtherAdjacentGridNo = FindAdjacentGridEx( pOtherMedic, sPatientGridNo, &ubDirection, &sAdjustedGridNo, FALSE, FALSE ); if (sOtherAdjacentGridNo != -1) { @@ -379,8 +379,8 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) if (pBestPatient->ubAutoBandagingMedic != NOBODY) { // cancel that medic - DebugAI(AI_MSG_INFO, MercPtrs[pBestPatient->ubAutoBandagingMedic], String("CancelAIAction: medic: find patient")); - CancelAIAction( MercPtrs[ pBestPatient->ubAutoBandagingMedic ], TRUE ); + DebugAI(AI_MSG_INFO, pBestPatient->ubAutoBandagingMedic, String("CancelAIAction: medic: find patient")); + CancelAIAction( pBestPatient->ubAutoBandagingMedic, TRUE ); } pBestPatient->ubAutoBandagingMedic = pSoldier->ubID; *pfDoClimb = FALSE; diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 8ee54c8a..fcd67cb1 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -2557,12 +2557,13 @@ void Converse( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach, UINT32 uiApproachData } } -INT32 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, UINT8 * pubDesiredMerc ) +INT32 NPCConsiderInitiatingConv( SOLDIERTYPE * pNPC, SoldierID * pubDesiredMerc ) { - INT32 sMyGridNo, sDist, sDesiredMercDist = 100; - UINT8 ubNPC; - UINT16 ubMerc, ubDesiredMerc = NOBODY; - UINT8 ubTalkDesire, ubHighestTalkDesire = 0; + INT32 sMyGridNo, sDist, sDesiredMercDist = 100; + UINT8 ubNPC; + UINT16 ubMerc; + SoldierID ubDesiredMerc = NOBODY; + UINT8 ubTalkDesire, ubHighestTalkDesire = 0; SOLDIERTYPE * pMerc; SOLDIERTYPE * pDesiredMerc = NULL; NPCQuoteInfo * pNPCQuoteInfoArray; diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index 3d990d88..70a211ec 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -228,7 +228,7 @@ void FreeUpNPCFromLoweringGun( SOLDIERTYPE *pSoldier ); void FreeUpNPCFromRoofClimb(SOLDIERTYPE *pSoldier ); UINT8 GetClosestOpponent( SOLDIERTYPE *pSoldier ); -UINT16 GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ); +SoldierID GetMostThreateningOpponent( SOLDIERTYPE *pSoldier ); void HandleSoldierAI( SOLDIERTYPE *pSoldier ); void HandleInitialRedAlert( INT8 bTeam, UINT8 ubCommunicate); @@ -271,9 +271,9 @@ INT32 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT32 sPos, INT8 bAction ); BOOLEAN CanClimbFromHere (SOLDIERTYPE * pSoldier, BOOLEAN fUp ); // HEADROCK HAM 3.6: Adding includes for A* cover calculations -INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); -INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); -INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT16 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); +INT8 CalcWorstCTGTForPosition( SOLDIERTYPE * pSoldier, SoldierID ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); +INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, SoldierID ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); +INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, SoldierID ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft ); UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo ); // Flugente: get the id of the closest soldier (coser than x tiles) of a specific team with a specific flag that we can currently see diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index 5569c419..ee31dac1 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -4855,7 +4855,7 @@ void SetOffBombsByFrequency( SoldierID ubID, INT8 bFrequency ) } } -void SetOffPanicBombs( UINT16 ubID, INT8 bPanicTrigger ) +void SetOffPanicBombs( SoldierID ubID, INT8 bPanicTrigger ) { // need to turn off gridnos & flags in gTacticalStatus gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ] = NOWHERE; diff --git a/TileEngine/Explosion Control.h b/TileEngine/Explosion Control.h index d4c8e531..466a3ca0 100644 --- a/TileEngine/Explosion Control.h +++ b/TileEngine/Explosion Control.h @@ -109,7 +109,7 @@ void DecayBombTimers( void ); void SetOffBombsByFrequency( SoldierID ubID, INT8 bFrequency ); BOOLEAN SetOffBombsInGridNo( SoldierID ubID, INT32 sGridNo, BOOLEAN fAllBombs, INT8 bLevel ); void ActivateSwitchInGridNo( SoldierID ubID, INT32 sGridNo ); -void SetOffPanicBombs( UINT16 ubID, INT8 bPanicTrigger ); +void SetOffPanicBombs( SoldierID ubID, INT8 bPanicTrigger ); void UpdateExplosionFrame( INT32 iIndex, INT16 sCurrentFrame ); void RemoveExplosionData( INT32 iIndex ); diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 2ea2d122..91119d53 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -348,7 +348,7 @@ INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwne // OJW - 20091027 - Synchronizing smoke effect start for multiplayer if (is_networked && is_client) { - SOLDIERTYPE* pSoldier = MercPtrs[ubOwner]; + SOLDIERTYPE* pSoldier = ubOwner; if (pSoldier != NULL) { if (pSoldier->bTeam == 0 || (pSoldier->bTeam == 1 && is_server)) diff --git a/TileEngine/SmokeEffects.h b/TileEngine/SmokeEffects.h index 5b899f3d..ab4affe1 100644 --- a/TileEngine/SmokeEffects.h +++ b/TileEngine/SmokeEffects.h @@ -28,16 +28,16 @@ typedef struct TAG_SMOKE_EFFECT UINT8 ubDuration; // the number of turns gas will remain effective UINT8 ubRadius; // the current radius of the cloud in map tiles - UINT8 bFlags; // 0 - outdoors (fast spread), 1 - indoors (slow) + UINT8 bFlags; // 0 - outdoors (fast spread), 1 - indoors (slow) UINT8 bAge; // the number of turns gas has been around - BOOLEAN fAllocated; - INT8 bType; - UINT16 usItem; - UINT16 ubOwner; - UINT8 ubGeneration; - UINT32 uiTimeOfLastUpdate; - INT8 iMPTeamIndex; - INT32 iMPSmokeEffectID; + BOOLEAN fAllocated; + INT8 bType; + UINT16 usItem; + SoldierID ubOwner; + UINT8 ubGeneration; + UINT32 uiTimeOfLastUpdate; + INT8 iMPTeamIndex; + INT32 iMPSmokeEffectID; } SMOKEEFFECT; extern SMOKEEFFECT gSmokeEffectData[ NUM_SMOKE_EFFECT_SLOTS ]; diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 9db3faca..14dd2f31 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -768,7 +768,7 @@ void HandleOverheadUI(void) { INT32 sMousePos = 0; InputAtom InputEvent; - UINT16 ubID; + SoldierID ubID; // CHECK FOR MOUSE OVER REGIONS... if(GetOverheadMouseGridNo(&sMousePos)) diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index d4ac3b3f..eb2179a8 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -2734,7 +2734,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) (*pObj)[0]->data.misc.bDelay = 1; // for non-player grenades, add turn so player could disarm grenade or run away - if ( pObject->ubOwner != NOBODY && MercPtrs[pObject->ubOwner]->bTeam != gbPlayerNum ) + if ( pObject->ubOwner != NOBODY && pObject->ubOwner->bTeam != gbPlayerNum ) { (*pObj)[0]->data.misc.bDelay++; } @@ -2762,7 +2762,7 @@ void HandleArmedObjectImpact( REAL_OBJECT *pObject ) if ( pObject->ubOwner != NOBODY && !fGoodStatus ) { - MercPtrs[ pObject->ubOwner ]->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) ); + pObject->ubOwner->DoMercBattleSound( (INT8)( BATTLE_SOUND_CURSE1 ) ); } } } diff --git a/TileEngine/pits.cpp b/TileEngine/pits.cpp index a789e660..86f0e548 100644 --- a/TileEngine/pits.cpp +++ b/TileEngine/pits.cpp @@ -207,7 +207,7 @@ void RemoveAllPits() void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT32 sGridNo, INT16 sRadius ) { INT32 x, y, sNewGridNo; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE *pSoldier; @@ -227,7 +227,7 @@ void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT32 sGridNo, INT16 s { // OK, make guy fall... // Set data to look for exit grid.... - pSoldier = MercPtrs[ ubID ]; + pSoldier = ubID; pSoldier->aiData.uiPendingActionData4 = sNewGridNo; diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 6bad3e2f..31d49000 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1915,9 +1915,9 @@ INT8 DamageStructure( STRUCTURE * pStructure, UINT8 ubDamage, UINT8 ubReason, IN gpWorldLevelData[ tmpgridno ].uiFlags |= MAPELEMENT_STRUCTURE_DAMAGED; // handle structure revenge - damage to vehicle - to be resolved after movement - if ( ubOwner != NOBODY && MercPtrs[ubOwner] && !ARMED_VEHICLE( MercPtrs[ubOwner] ) ) + if ( ubOwner != NOBODY && !ARMED_VEHICLE( ubOwner ) ) { - MercPtrs[ubOwner]->SoldierTakeDelayedDamage(0, Random(max(0,(ubBaseArmour-10)/5)) + max(0,(ubBaseArmour-10)/5), 0, TAKE_DAMAGE_STRUCTURE_EXPLOSION, NOBODY, MercPtrs[ ubOwner ]->sGridNo, 0, TRUE); + ubOwner->SoldierTakeDelayedDamage(0, Random(max(0,(ubBaseArmour-10)/5)) + max(0,(ubBaseArmour-10)/5), 0, TAKE_DAMAGE_STRUCTURE_EXPLOSION, NOBODY, ubOwner->sGridNo, 0, TRUE); } // recompile = TRUE means that we destroyed something From 657097aa545a58e55d74e3690c8c60497e4420ad Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:47:26 +0200 Subject: [PATCH 118/571] Remove unused global --- Tactical/Handle UI.cpp | 1 - Tactical/Handle UI.h | 1 - 2 files changed, 2 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index f07301e8..c2c624ff 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -440,7 +440,6 @@ BOOLEAN gfUIDoNotHighlightSelMerc = FALSE; BOOLEAN gfUIHandleSelection = FALSE; BOOLEAN gfUIHandleSelectionAboveGuy = FALSE; BOOLEAN gfUIInDeadlock = FALSE; -UINT16 gUIDeadlockedSoldier = NOBODY; BOOLEAN gfUIHandleShowMoveGrid = FALSE; INT32 gsUIHandleShowMoveGridLocation = NOWHERE ; BOOLEAN gfUIOverItemPool = FALSE; diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index eab79f68..ff74b70c 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -200,7 +200,6 @@ extern BOOLEAN gfUIHandleSelectionAboveGuy; extern INT32 gsSelectedGridNo; extern SoldierID gsSelectedGuy; extern BOOLEAN gfUIInDeadlock; -extern UINT16 gUIDeadlockedSoldier; extern BOOLEAN gfUIMouseOnValidCatcher; extern SoldierID gubUIValidCatcherID; From f49013307f6396dd3589f75256f8dae0d9a64f0b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 01:01:57 +0200 Subject: [PATCH 119/571] Convert to SoldierID --- Laptop/insurance Contract.cpp | 4 +- Multiplayer/client.cpp | 95 +++++++++++------------ Multiplayer/connect.h | 6 +- Multiplayer/fresh_header.h | 12 +-- Strategic/Map Screen Interface.cpp | 8 +- Strategic/Merc Contract.cpp | 9 ++- Strategic/PreBattle Interface.cpp | 9 ++- Strategic/mapscreen.cpp | 14 ++-- Tactical/Handle Items.cpp | 4 +- Tactical/Handle Items.h | 4 +- Tactical/Interface Panels.cpp | 120 +++++++++++++++-------------- Tactical/Interface Panels.h | 6 +- Tactical/Item Types.cpp | 2 +- Tactical/Item Types.h | 4 +- Tactical/Turn Based Input.cpp | 4 +- Tactical/UI Cursors.cpp | 24 +++--- Tactical/UI Cursors.h | 2 +- Tactical/World Items.cpp | 9 ++- Tactical/World Items.h | 2 +- TileEngine/renderworld.cpp | 2 +- 20 files changed, 175 insertions(+), 165 deletions(-) diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index 0e23acc6..418df377 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -1461,8 +1461,8 @@ void InsuranceContractPayLifeInsuranceForDeadMerc( UINT16 ubPayoutID ) if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID == Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].ubID ) { // and if the soldier is still active ( player hasn't removed carcass yet ), reset insurance flag - if( Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].bActive ) - Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].usLifeInsurance = 0; + if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID->bActive ) + LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID->usLifeInsurance = 0; } //add transaction to players account diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 2b65f0fc..251f81f5 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -470,7 +470,7 @@ typedef struct float dForceY; float dForceZ; UINT32 sTargetGridNo; - UINT16 ubID; + SoldierID ubID; UINT8 ubActionCode; UINT32 uiActionData; UINT16 usItem; @@ -494,7 +494,7 @@ typedef struct typedef struct { UINT32 sGridNo; - UINT16 ubID; + SoldierID ubID; UINT16 usItem; UINT8 ubItemStatus; UINT32 uiWorldIndex; // the local World Index of this bomb on its creators client @@ -506,7 +506,7 @@ typedef struct typedef struct { - UINT16 ubID; + SoldierID ubID; UINT32 uiWorldItemIndex; UINT8 ubMPTeamIndex; UINT32 uiPreRandomIndex; // send out our current pre-random index @@ -516,7 +516,7 @@ typedef struct { UINT32 uiWorldItemIndex; UINT8 ubMPTeamIndex; - UINT16 ubID; + SoldierID ubID; UINT32 sGridNo; UINT32 uiPreRandomIndex; // send out our current pre-random index } disarm_struct; @@ -526,7 +526,7 @@ typedef struct INT32 sGridNo; UINT8 ubRadius; UINT16 usItem; - UINT16 ubOwner; + SoldierID ubOwner; BOOLEAN fSubsequent; INT8 bLevel; INT32 iSmokeEffectID; @@ -802,7 +802,7 @@ void recievePATH(RPCParameters *rpcParameters) EV_S_SENDPATHTONETWORK* SNetPath = (EV_S_SENDPATHTONETWORK*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ SNetPath->usSoldierID ]; + SOLDIERTYPE *pSoldier = SNetPath->usSoldierID; memcpy(pSoldier->pathing.usPathingData, SNetPath->usPathData,sizeof(UINT16)*30); @@ -863,7 +863,7 @@ void recieveSTANCE(RPCParameters *rpcParameters) EV_S_CHANGESTANCE* SChangeStance = (EV_S_CHANGESTANCE*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ SChangeStance->usSoldierID ]; + SOLDIERTYPE *pSoldier = SChangeStance->usSoldierID; pSoldier->ChangeSoldierStance( SChangeStance->ubNewStance ); @@ -906,7 +906,7 @@ void recieveDIR(RPCParameters *rpcParameters) EV_S_SETDESIREDDIRECTION* SSetDesiredDirection = (EV_S_SETDESIREDDIRECTION*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ SSetDesiredDirection->usSoldierID ]; + SOLDIERTYPE *pSoldier = SSetDesiredDirection->usSoldierID; pSoldier->EVENT_SetSoldierDesiredDirection( SSetDesiredDirection->usDesiredDirection ); @@ -945,7 +945,7 @@ void recieveFIRE(RPCParameters *rpcParameters) EV_S_BEGINFIREWEAPON* SBeginFireWeapon = (EV_S_BEGINFIREWEAPON*)rpcParameters->input; //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"SendBeginFireWeaponEvent" ); - SOLDIERTYPE *pSoldier = MercPtrs[ SBeginFireWeapon->usSoldierID ]; + SOLDIERTYPE *pSoldier = SBeginFireWeapon->usSoldierID; pSoldier->sTargetGridNo = SBeginFireWeapon->sTargetGridNo; pSoldier->bTargetLevel = SBeginFireWeapon->bTargetLevel; @@ -1019,7 +1019,7 @@ void send_dismiss(UINT16 ubCurrentSoldierID) client->RPC("sendDISMISS",(const char*)&sDismissMerc, (int)sizeof(send_dismiss_struct)*8, HIGH_PRIORITY, RELIABLE, 0, UNASSIGNED_SYSTEM_ADDRESS, true, 0, UNASSIGNED_NETWORK_ID,0); } -void send_hire( UINT8 iNewIndex, UINT8 ubCurrentSoldier, INT16 iTotalContractLength, BOOLEAN fCopyProfileItemsOver) +void send_hire( SoldierID iNewIndex, UINT8 ubCurrentSoldier, INT16 iTotalContractLength, BOOLEAN fCopyProfileItemsOver) { send_hire_struct sHireMerc; @@ -1028,7 +1028,7 @@ void send_hire( UINT8 iNewIndex, UINT8 ubCurrentSoldier, INT16 iTotalContractLen sHireMerc.fCopyProfileItemsOver=fCopyProfileItemsOver; sHireMerc.bTeam=netbTeam; - SOLDIERTYPE *pSoldier = MercPtrs[ iNewIndex ]; + SOLDIERTYPE *pSoldier = iNewIndex; UINT8 sectorEdge = cStartingSectorEdge; @@ -1169,7 +1169,7 @@ void recieveguiPOS(RPCParameters *rpcParameters) { gui_pos* gnPOS = (gui_pos*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ gnPOS->usSoldierID ]; + SOLDIERTYPE *pSoldier = gnPOS->usSoldierID; INT32 sNewGridNo; @@ -1195,7 +1195,7 @@ void recieveguiDIR(RPCParameters *rpcParameters) { gui_dir* gnDIR = (gui_dir*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ gnDIR->usSoldierID ]; + SOLDIERTYPE *pSoldier = gnDIR->usSoldierID; pSoldier->EVENT_SetSoldierDirection( gnDIR->usNewDirection ); } @@ -1899,7 +1899,7 @@ void recieveSTOP (RPCParameters *rpcParameters) { EV_S_STOP_MERC* SStopMerc =(EV_S_STOP_MERC*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ SStopMerc->usSoldierID ]; + SOLDIERTYPE *pSoldier = SStopMerc->usSoldierID; pSoldier->EVENT_InternalSetSoldierPosition( SStopMerc->sXPos, SStopMerc->sYPos,FALSE, FALSE, FALSE ); pSoldier->EVENT_SetSoldierDirection( SStopMerc->ubDirection ); @@ -1944,7 +1944,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) if (cGameType == MP_TYPE_COOP) { INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input; - SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted]; + SOLDIERTYPE* pOpponent = INT->Interrupted; if( INT->bTeam == netbTeam || is_server)//its for us or we are server and its for AI which we control { @@ -1978,7 +1978,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Recieved interrupt between %s and %s.", TeamNameStrings[pOpponent->bTeam], TeamNameStrings[INT->bTeam] ); //start interrupt turn //real interrupt code - SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ]; + SOLDIERTYPE* pSoldier = INT->ubID; ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1); StartInterrupt(); } @@ -1994,7 +1994,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated - SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ]; + SOLDIERTYPE* pSoldier = INT->ubID; ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1); StartInterrupt(); } @@ -2003,7 +2003,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) else { INT_STRUCT* INT = (INT_STRUCT*)rpcParameters->input; - SOLDIERTYPE* pOpponent = MercPtrs[ INT->Interrupted]; + SOLDIERTYPE* pOpponent = INT->Interrupted; if(INT->bTeam==netbTeam)//for us { @@ -2028,7 +2028,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) if( INT->bTeam != 0)//not for our team - hayden { //stop moving merc who was interrupted and init UI bar - SOLDIERTYPE* pMerc = MercPtrs[ INT->ubID ]; + SOLDIERTYPE* pMerc = INT->ubID; pMerc->HaultSoldierFromSighting(TRUE); FreezeInterfaceForEnemyTurn(); InitEnemyUIBar( 0, 0 ); @@ -2049,7 +2049,7 @@ void send_interrupt (SOLDIERTYPE *pSoldier) { ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Interrupt of %s awarded to you.", TeamNameStrings[pOpponent->bTeam] );//was MPClientMessage[37], can be reconnected if text updated and translated - SOLDIERTYPE* pSoldier = MercPtrs[ INT->ubID ]; + SOLDIERTYPE* pSoldier = INT->ubID; ManSeesMan(pSoldier,pOpponent,pOpponent->sGridNo,pOpponent->pathing.bLevel,2,1); StartInterrupt(); } @@ -2924,7 +2924,7 @@ void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yP { ubOwner = MPEncodeSoldierID(ubOwner); // translate our soldier to the "network" version - SOLDIERTYPE* pSoldier = MercPtrs[ubOwner]; + SOLDIERTYPE* pSoldier = ubOwner; if (pSoldier != NULL) { if ((pSoldier->bTeam == 1 && is_server) || IsOurSoldier(pSoldier)) @@ -2942,7 +2942,6 @@ void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yP gren.ubID = ubOwner; gren.usItem = pGameObj->usItem; gren.sTargetGridNo = sTargetGridNo; - gren.ubID = ubOwner; gren.RealObjectID = iRealObjectID; gren.IsThrownGrenade = bIsThrownGrenade; gren.uiPreRandomIndex = guiPreRandomIndex; @@ -2965,7 +2964,7 @@ void recieveGRENADE (RPCParameters *rpcParameters) gren->ubID = MPDecodeSoldierID(gren->ubID); - SOLDIERTYPE* pThrower = MercPtrs[ gren->ubID ]; + SOLDIERTYPE* pThrower = gren->ubID; if (pThrower != NULL) { guiPreRandomIndex = gren->uiPreRandomIndex; @@ -3067,7 +3066,7 @@ void recieveGRENADERESULT (RPCParameters *rpcParameters) gres->ubOwnerID = MPDecodeSoldierID(gres->ubOwnerID); - SOLDIERTYPE* pThrower = MercPtrs[ gres->ubOwnerID ]; + SOLDIERTYPE* pThrower = gres->ubOwnerID; if (pThrower != NULL) { // grenade wasnt thrown by one of our guys, so we should do it on the client @@ -3128,7 +3127,7 @@ void recieveGRENADERESULT (RPCParameters *rpcParameters) } } -void send_plant_explosive (UINT16 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldItemIndex) +void send_plant_explosive (SoldierID ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldItemIndex) { explosive_obj exp; @@ -3160,7 +3159,7 @@ void recievePLANTEXPLOSIVE (RPCParameters *rpcParameters) exp->ubID = MPDecodeSoldierID( exp->ubID ); - SOLDIERTYPE* pSoldier = MercPtrs[ exp->ubID ]; + SOLDIERTYPE* pSoldier = exp->ubID; if (pSoldier != NULL) { // explosive wasnt planted on our client, so we should do it on the client @@ -3297,7 +3296,7 @@ void recieveDETONATEEXPLOSIVE (RPCParameters *rpcParameters) det->ubID = MPDecodeSoldierID(det->ubID); - SOLDIERTYPE* pSoldier = MercPtrs[det->ubID]; + SOLDIERTYPE* pSoldier = det->ubID; if (pSoldier != NULL) { // if explosive detonation didnt originate from this client then its need to be performed here @@ -3410,7 +3409,7 @@ void recieveDISARMEXPLOSIVE (RPCParameters *rpcParameters) disarm->ubID = MPDecodeSoldierID(disarm->ubID); - SOLDIERTYPE* pSoldier = MercPtrs[disarm->ubID]; + SOLDIERTYPE* pSoldier = disarm->ubID; if (pSoldier != NULL) { // if explosive disarm didnt originate from this client then its need to be performed here @@ -3439,7 +3438,7 @@ void recieveDISARMEXPLOSIVE (RPCParameters *rpcParameters) // print out a screen message if it was our bomb if (disarm->ubMPTeamIndex == netbTeam) { - SOLDIERTYPE * pBombOwner = MercPtrs[gWorldItems[ gWorldBombs[ uiCount ].iItemIndex ].soldierID]; + SOLDIERTYPE * pBombOwner = gWorldItems[ gWorldBombs[ uiCount ].iItemIndex ].soldierID; if (pBombOwner != NULL) { ScreenMsg( FONT_LTBLUE , MSG_MPSYSTEM , MPClientMessage[71], pBombOwner->name, pSoldier->name); @@ -3494,7 +3493,7 @@ void recieveSPREADEFFECT (RPCParameters *rpcParameters) sef->ubOwner = MPDecodeSoldierID(sef->ubOwner); - SOLDIERTYPE* pSoldier = MercPtrs[sef->ubOwner]; + SOLDIERTYPE* pSoldier = sef->ubOwner; if (pSoldier != NULL) { @@ -3579,7 +3578,7 @@ void recieveNEWSMOKEEFFECT (RPCParameters *rpcParameters) // translate any of our soldier ids back to the correct local copy sef->ubOwner = MPDecodeSoldierID(sef->ubOwner); - SOLDIERTYPE* pSoldier = MercPtrs[sef->ubOwner]; + SOLDIERTYPE* pSoldier = sef->ubOwner; if (pSoldier != NULL) { // new smoke effect didnt originate from us @@ -3665,7 +3664,7 @@ void recieveEXPLOSIONDAMAGE (RPCParameters *rpcParameters) exp->ubAttackerID = MPDecodeSoldierID(exp->ubAttackerID); - SOLDIERTYPE* pSoldier = MercPtrs[exp->ubSoldierID]; + SOLDIERTYPE* pSoldier = exp->ubSoldierID; if (pSoldier != NULL) { @@ -3733,7 +3732,7 @@ void recieveBULLET(RPCParameters *rpcParameters) INT8 bTeam = OUR_TEAM; if ( netb->net_bullet.ubFirerID != NOBODY ) { - pFirer = MercPtrs[ netb->net_bullet.ubFirerID ]; + pFirer = netb->net_bullet.ubFirerID; bTeam=pFirer->bTeam; } @@ -3837,8 +3836,8 @@ void recieveSTATE(RPCParameters *rpcParameters) void send_death( SOLDIERTYPE *pSoldier ) { death_struct nDeath; - nDeath.soldier_id=pSoldier->ubID; - nDeath.attacker_id=pSoldier->ubAttackerID; + nDeath.soldier_id = pSoldier->ubID; + nDeath.attacker_id = pSoldier->ubAttackerID; // Translate soldier id for other clients if the soldier was one of ours if(pSoldier->ubID<20)nDeath.soldier_id=nDeath.soldier_id+ubID_prefix; @@ -3852,7 +3851,7 @@ void send_death( SOLDIERTYPE *pSoldier ) nDeath.attacker_id = pSoldier->ubNextToPreviousAttackerID; } - SOLDIERTYPE * pAttacker=MercPtrs[ nDeath.attacker_id ]; + SOLDIERTYPE * pAttacker = nDeath.attacker_id; INT8 pA_bTeam=CLIENT_NUM; CHAR16 pA_name[ 10 ]; INT8 pS_bTeam=CLIENT_NUM; @@ -3951,15 +3950,15 @@ void send_death( SOLDIERTYPE *pSoldier ) void recieveDEATH (RPCParameters *rpcParameters) { death_struct* nDeath = (death_struct*)rpcParameters->input; - SOLDIERTYPE * pSoldier=MercPtrs[ nDeath->soldier_id ]; + SOLDIERTYPE * pSoldier = nDeath->soldier_id; - UINT16 ubAttackerID; + SoldierID ubAttackerID; if((nDeath->attacker_id >= ubID_prefix) && (nDeath->attacker_id < (ubID_prefix+6))) ubAttackerID = (nDeath->attacker_id - ubID_prefix); else ubAttackerID = nDeath->attacker_id; - SOLDIERTYPE * pAttacker=MercPtrs[ ubAttackerID ]; + SOLDIERTYPE * pAttacker = ubAttackerID; INT8 pA_bTeam; CHAR16 pA_name[ 10 ]; INT8 pS_bTeam; @@ -4070,7 +4069,7 @@ void send_miss(EV_S_MISS * SMiss) void recievehitSTRUCT (RPCParameters *rpcParameters) { EV_S_STRUCTUREHIT* struct_hit = (EV_S_STRUCTUREHIT*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ struct_hit->ubAttackerID ]; + SOLDIERTYPE *pSoldier = struct_hit->ubAttackerID; INT8 bTeam=pSoldier->bTeam; INT32 iBullet = bTable[bTeam][struct_hit->iBullet].local_id; @@ -4093,7 +4092,7 @@ void recieveMISS (RPCParameters *rpcParameters) { EV_S_MISS* shot_miss = (EV_S_MISS*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ shot_miss->ubAttackerID ]; + SOLDIERTYPE *pSoldier = shot_miss->ubAttackerID; INT8 bTeam=pSoldier->bTeam; INT32 iBullet = bTable[bTeam][shot_miss->iBullet].local_id; @@ -4198,7 +4197,7 @@ BOOLEAN check_status (void)// any 'enemies' and clients left to fight ?? void UpdateSoldierToNetwork ( SOLDIERTYPE *pSoldier ) { //this send stats to other clients at intervals - UINT16 id = pSoldier->ubID; + SoldierID id = pSoldier->ubID; UINT32 time = GetJA2Clock(); if(id < 20 || (is_server && id <120)) @@ -4243,7 +4242,7 @@ void UpdateSoldierFromNetwork (RPCParameters *rpcParameters) { EV_S_UPDATENETWORKSOLDIER* SUpdateNetworkSoldier = (EV_S_UPDATENETWORKSOLDIER*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ SUpdateNetworkSoldier->usSoldierID ]; + SOLDIERTYPE *pSoldier = SUpdateNetworkSoldier->usSoldierID; pSoldier->bBreath=SUpdateNetworkSoldier->bBreath; pSoldier->stats.bLife=SUpdateNetworkSoldier->bLife; @@ -4424,7 +4423,7 @@ void recieve_fireweapon (RPCParameters *rpcParameters) { EV_S_FIREWEAPON* SFireWeapon = (EV_S_FIREWEAPON*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ SFireWeapon->usSoldierID ]; + SOLDIERTYPE *pSoldier = SFireWeapon->usSoldierID; pSoldier->sTargetGridNo = SFireWeapon->sTargetGridNo; pSoldier->bTargetLevel = SFireWeapon->bTargetLevel; @@ -4449,7 +4448,7 @@ void recieve_door (RPCParameters *rpcParameters) { doors* sDoor = (doors*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ sDoor->ubID ]; + SOLDIERTYPE *pSoldier = sDoor->ubID; BOOLEAN fNoAnimations = FALSE; if ( !AllMercsLookForDoor( sDoor->sGridNo, FALSE ) )//check for los @@ -4725,14 +4724,14 @@ void recieve_heal (RPCParameters *rpcParameters) { heal* data = (heal*)rpcParameters->input; - UINT16 healed; + SoldierID healed; if((data->ubID >= ubID_prefix) && (data->ubID < (ubID_prefix+6))) healed = (data->ubID - ubID_prefix); else healed = data->ubID; - SOLDIERTYPE *pSoldier = MercPtrs[ healed ]; + SOLDIERTYPE *pSoldier = healed; pSoldier->bBleeding=data->bBleeding; pSoldier->stats.bLife=data->bLife; @@ -4758,7 +4757,7 @@ void awardINT (RPCParameters *rpcParameters) { AIint* data= (AIint*)rpcParameters->input; - SOLDIERTYPE *pSoldier = MercPtrs[ data->ubID ]; + SOLDIERTYPE *pSoldier = data->ubID; StartInterrupt(); diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index 31fe44ea..349d524d 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -96,7 +96,7 @@ void send_dir ( SOLDIERTYPE *pSoldier, UINT16 usDesiredDirection ); void send_fire( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ); void send_hit( EV_S_WEAPONHIT *SWeaponHit ); void send_bullet( BULLET * pBullet, UINT16 usHandItem); -void send_hire( UINT8 iNewIndex, UINT8 ubCurrentSoldier, INT16 iTotalContractLength, BOOLEAN fCopyProfileItemsOver); +void send_hire( SoldierID iNewIndex, UINT8 ubCurrentSoldier, INT16 iTotalContractLength, BOOLEAN fCopyProfileItemsOver); void send_dismiss( UINT16 ubCurrentSoldierID); void send_gui_pos(SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos); @@ -113,7 +113,7 @@ void send_interrupt(SOLDIERTYPE *pSoldier); // OJW - 20091002 - explosives void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, SoldierID ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID, bool bIsThrownGrenade); void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, SoldierID ubOwnerID, INT32 iRealObjectID, bool bIsDud); -void send_plant_explosive (UINT16 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldIndex); +void send_plant_explosive ( SoldierID ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldIndex); void send_detonate_explosive (UINT32 uiWorldIndex, SoldierID ubID); void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, SoldierID ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID ); void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwner, INT32 iSmokeEffectID); @@ -220,7 +220,7 @@ inline SoldierID MPEncodeSoldierID( SoldierID ubID ) } // this one can be called anywhere, even if the ID was not "encoded" -inline UINT16 MPDecodeSoldierID( UINT16 ubID ) +inline SoldierID MPDecodeSoldierID( SoldierID ubID ) { if ( ubID >= ubID_prefix && ubID < (ubID_prefix + 7) ) return ubID - ubID_prefix; // soldier is ours diff --git a/Multiplayer/fresh_header.h b/Multiplayer/fresh_header.h index 46f90ec4..913bb035 100644 --- a/Multiplayer/fresh_header.h +++ b/Multiplayer/fresh_header.h @@ -5,29 +5,29 @@ extern int readyteamreg[10]; typedef struct { - UINT16 soldier_id; - UINT16 attacker_id; + SoldierID soldier_id; + SoldierID attacker_id; UINT8 attacker_team; UINT8 soldier_team; }death_struct; typedef struct { - UINT16 ubID; + SoldierID ubID; INT32 sGridNo; BOOLEAN fNoAnimations; }doors; typedef struct { - UINT16 ubID; + SoldierID ubID; INT8 bLife; INT8 bBleeding; }heal; typedef struct { - UINT16 ubID; + SoldierID ubID; INT8 bteam; }AIint; @@ -65,4 +65,4 @@ BOOLEAN check_status (void); extern UINT16 NumEnemyInSector( ); extern UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); void send_heal (SOLDIERTYPE *pSoldier ); -void requestAIint(SOLDIERTYPE *pSoldier ); \ No newline at end of file +void requestAIint(SOLDIERTYPE *pSoldier ); diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index d23f06c1..8e51fa4c 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -2380,9 +2380,9 @@ void RandomMercInGroupSaysQuote( GROUP *pGroup, UINT16 usQuoteNum ) { PLAYERGROUP *pPlayer; SOLDIERTYPE *pSoldier; - UINT16 ubMercsInGroup[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; - UINT16 ubNumMercs = 0; - UINT16 ubChosenMerc; + SoldierID ubMercsInGroup[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; // if traversing tactically, don't do this, unless time compression was required for some reason (don't go to sector) @@ -2414,7 +2414,7 @@ void RandomMercInGroupSaysQuote( GROUP *pGroup, UINT16 usQuoteNum ) if ( ubNumMercs > 0 ) { ubChosenMerc = (UINT16)Random( ubNumMercs ); - pSoldier = MercPtrs[ ubMercsInGroup[ ubChosenMerc ] ]; + pSoldier = ubMercsInGroup[ ubChosenMerc ]; TacticalCharacterDialogue( pSoldier, usQuoteNum ); } diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index 983d3e20..c0f4e4e2 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -1416,7 +1416,7 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) SOLDIERTYPE *pSoldier = NULL, *pSoldierWhoWillQuit = NULL; INT32 iCounter= 0, iNumberOnTeam = 0; // WDS - make number of mercenaries, etc. be configurable - UINT16 ubPotentialMercs[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; + SoldierID ubPotentialMercs[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; @@ -1499,15 +1499,16 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ) if ( ubNumMercs > 0 ) { ubChosenMerc = (UINT16)Random( ubNumMercs ); + SOLDIERTYPE *pChosenSoldier = ubPotentialMercs[ubChosenMerc]; SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1 ,MAP_SCREEN ,0 ,0 ,0 ); - HandleImportantMercQuote( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], QUOTE_CONTRACTS_OVER ); + HandleImportantMercQuote( pChosenSoldier, QUOTE_CONTRACTS_OVER ); SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,0 ,MAP_SCREEN ,0 ,0 ,0 ); AddReasonToWaitingListQueue( CONTRACT_EXPIRE_WARNING_REASON ); - TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ], 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 ); + TacticalCharacterDialogueWithSpecialEvent( pChosenSoldier, 0, DIALOGUE_SPECIAL_EVENT_SHOW_UPDATE_MENU, 0,0 ); - MercPtrs[ ubPotentialMercs[ ubChosenMerc ] ]->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_89_USED; + pChosenSoldier->ubContractRenewalQuoteCode = SOLDIER_CONTRACT_RENEW_QUOTE_89_USED; } } } diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 36fd826a..5aed8f36 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -2558,15 +2558,16 @@ void CheckForRobotAndIfItsControlled( void ) // search for the robot on player's team for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && AM_A_ROBOT( MercPtrs[ i ] )) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife && AM_A_ROBOT( pSoldier )) { // check whether it has a valid controller with it. This sets its ubRobotRemoteHolderID field. - MercPtrs[ i ]->UpdateRobotControllerGivenRobot( ); + pSoldier->UpdateRobotControllerGivenRobot( ); // if he has a controller, set controllers - if ( MercPtrs[ i ]->ubRobotRemoteHolderID != NOBODY ) + if ( pSoldier->ubRobotRemoteHolderID != NOBODY ) { - MercPtrs[ MercPtrs[ i ]->ubRobotRemoteHolderID ]->UpdateRobotControllerGivenController( ); + pSoldier->ubRobotRemoteHolderID->UpdateRobotControllerGivenController( ); } break; diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 082b7825..0f563116 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -14656,7 +14656,7 @@ void SortListOfMercsInTeamPanel( BOOLEAN fRetainSelectedMercs, BOOLEAN fReverse INT32 iCounter = 0, iCounterA = 0; INT16 sEndSectorA, sEndSectorB; INT32 iExpiryTime, iExpiryTimeA; - UINT16 uiID, uiIDA; + SoldierID uiID, uiIDA; SOLDIERTYPE *pSelectedSoldier[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; SOLDIERTYPE *pCurrentSoldier = NULL; SOLDIERTYPE *pPreviousSelectedInfoChar = NULL; @@ -15859,7 +15859,7 @@ void CancelPathsOfAllSelectedCharacters() // if we've clicked on a selected valid character if( ( gCharactersList[ bCounter ].fValid == TRUE ) && IsEntryInSelectedListSet( bCounter ) ) { - pSoldier = MercPtrs[ gCharactersList[ bCounter ].usSolID ]; + pSoldier = gCharactersList[ bCounter ].usSolID; // and he has a route set if ( GetLengthOfMercPath( pSoldier ) > 0 ) @@ -16283,10 +16283,10 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) SOLDIERTYPE *pSoldier = NULL; INT32 iCounter; // WDS - make number of mercenaries, etc. be configurable - UINT16 ubSelectedMercID[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; - UINT16 ubSelectedMercIndex[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; - UINT16 ubNumMercs = 0; - UINT16 ubChosenMerc; + SoldierID ubSelectedMercID[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; + UINT16 ubSelectedMercIndex[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; + UINT16 ubNumMercs = 0; + UINT16 ubChosenMerc; for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; iCounter++ ) @@ -16313,7 +16313,7 @@ void RandomAwakeSelectedMercConfirmsStrategicMove( void ) // select that merc so that when he speaks we're showing his portrait and not someone else ChangeSelectedInfoChar( ubSelectedMercIndex[ ubChosenMerc ], FALSE ); - MercPtrs[ ubSelectedMercID[ ubChosenMerc ] ]->DoMercBattleSound( BATTLE_SOUND_OK1 ); + ubSelectedMercID[ ubChosenMerc ]->DoMercBattleSound( BATTLE_SOUND_OK1 ); //TacticalCharacterDialogue( MercPtrs[ ubSelectedMercID[ ubChosenMerc ] ], ubQuoteNum ); } } diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index d4a9abb9..d95b6157 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -2953,12 +2953,12 @@ OBJECTTYPE* AddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UI return InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, soldierID, NULL ); } -OBJECTTYPE * AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ) +OBJECTTYPE * AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, SoldierID soldierID, INT32 * piItemIndex ) { return( InternalAddItemToPool( &sGridNo, pObject, bVisible, ubLevel, usFlags, bRenderZHeightAboveLevel, soldierID, piItemIndex ) ); } -OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ) +OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, SoldierID soldierID, INT32 * piItemIndex ) { ITEM_POOL *pItemPool; ITEM_POOL *pItemPoolTemp; diff --git a/Tactical/Handle Items.h b/Tactical/Handle Items.h index b01e4b4a..d43a42b5 100644 --- a/Tactical/Handle Items.h +++ b/Tactical/Handle Items.h @@ -195,8 +195,8 @@ void AllSoldiersLookforItems( BOOLEAN RevealRoofsAndItems ); void SoldierGetItemFromWorld( SOLDIERTYPE *pSoldier, INT32 iItemIndex, INT32 sGridNo, INT8 bZLevel, BOOLEAN *pfSelectionList ); OBJECTTYPE* AddItemToPool(INT32 sGridNo, OBJECTTYPE* pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID = -1); -OBJECTTYPE* AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ); -OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT16 soldierID, INT32 * piItemIndex ); +OBJECTTYPE* AddItemToPoolAndGetIndex( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, SoldierID soldierID, INT32 * piItemIndex ); +OBJECTTYPE* InternalAddItemToPool( INT32 *psGridNo, OBJECTTYPE *pObject, INT8 bVisible, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, SoldierID soldierID, INT32 * piItemIndex ); INT32 AdjustGridNoForItemPlacement( SOLDIERTYPE *pSoldier, INT32 sGridNo ); BOOLEAN GetItemPool( INT32 usMapPos, ITEM_POOL **ppItemPool, UINT8 ubLevel ); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 40df6462..ae0ed4cc 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3725,7 +3725,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else // item in cursor { - UINT16 ubSrcID, ubDestID; + SoldierID ubSrcID, ubDestID; BOOLEAN fOKToGo = FALSE; BOOLEAN fDeductPoints = FALSE; @@ -5277,7 +5277,7 @@ BOOLEAN InitializeTEAMPanel( ) { if ( gTeamPanel[ cnt ].ubID != NOBODY ) { - HandleMouseOverSoldierFaceForContMove( MercPtrs[ gTeamPanel[ cnt ].ubID ], TRUE ); + HandleMouseOverSoldierFaceForContMove( gTeamPanel[ cnt ].ubID, TRUE ); } } @@ -5352,7 +5352,7 @@ BOOLEAN ShutdownTEAMPanel( ) if ( gTeamPanel[ cnt ].ubID != NOBODY ) { - HandleMouseOverSoldierFaceForContMove( MercPtrs[ gTeamPanel[ cnt ].ubID ], FALSE ); + HandleMouseOverSoldierFaceForContMove( gTeamPanel[ cnt ].ubID, FALSE ); } } @@ -5416,7 +5416,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) } else { - pSoldier = MercPtrs[ gTeamPanel[ cnt ].ubID ]; + pSoldier = gTeamPanel[ cnt ].ubID; if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER ) ) { @@ -5520,7 +5520,7 @@ void RenderTEAMPanel( BOOLEAN fDirty ) // GET SOLDIER if ( gTeamPanel[ cnt ].fOccupied ) { - pSoldier = MercPtrs[ gTeamPanel[ cnt ].ubID ]; + pSoldier = gTeamPanel[ cnt ].ubID; // Update animations.... if ( pSoldier->flags.fClosePanel || pSoldier->flags.fClosePanelToDie ) @@ -6016,7 +6016,8 @@ void HandleMouseOverTeamFaceForContMove( BOOLEAN fOn ) void MercFacePanelMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT16 ubID, ubSoldierID; + UINT16 ubID; + SoldierID ubSoldierID; SOLDIERTYPE *pSoldier; ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); @@ -6040,7 +6041,7 @@ void MercFacePanelMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } - pSoldier = MercPtrs[ ubSoldierID ]; + pSoldier = ubSoldierID; if ( !pSoldier->bActive ) { @@ -6062,7 +6063,8 @@ void MercFacePanelMoveCallback( MOUSE_REGION * pRegion, INT32 iReason ) void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT16 ubID, ubSoldierID; + UINT16 ubID; + SoldierID ubSoldierID; ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); @@ -6085,7 +6087,7 @@ void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } - if ( !MercPtrs[ ubSoldierID ]->bActive ) + if ( !ubSoldierID->bActive ) { return; } @@ -6093,14 +6095,14 @@ void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_LBUTTON_DWN) { - //if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + //if ( ubSoldierID->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) //{ //} //else { SOLDIERTYPE *pSoldier; - pSoldier = MercPtrs[ ubSoldierID ]; + pSoldier = ubSoldierID; if ( pSoldier->aiData.bOppCnt > 0 ) { // Cycle.... @@ -6117,7 +6119,8 @@ void EnemyIndicatorClickCallback( MOUSE_REGION * pRegion, INT32 iReason ) void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT16 ubID, ubSoldierID; + UINT16 ubID; + SoldierID ubSoldierID; ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); @@ -6155,12 +6158,12 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) return; } - if ( !MercPtrs[ ubSoldierID ]->bActive ) + if ( !ubSoldierID->bActive ) { return; } - if (!OK_INTERRUPT_MERC(MercPtrs[ubSoldierID])) + if (!OK_INTERRUPT_MERC(ubSoldierID)) { return; } @@ -6169,10 +6172,10 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) { if ( !gfInItemPickupMenu && gpItemPointer == NULL ) { - //if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) - //if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER ) ) + //if ( ubSoldierID->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + //if ( ubSoldierID->flags.uiStatusFlags & ( SOLDIER_DRIVER ) ) //{ - // pVehicle = GetSoldierStructureForVehicle( MercPtrs[ ubSoldierID ]->iVehicleId ); + // pVehicle = GetSoldierStructureForVehicle( ubSoldierID->iVehicleId ); // HandleLocateSelectMerc( pVehicle->ubID, 0 ); //} @@ -6181,10 +6184,10 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( !InOverheadMap( ) ) { // If we can continue a move, do so! - if ( CheckForMercContMove( MercPtrs[ ubSoldierID ] ) ) + if ( CheckForMercContMove( ubSoldierID ) ) { // Continue - ContinueMercMovement( MercPtrs[ ubSoldierID ] ); + ContinueMercMovement( ubSoldierID ); ErasePath( TRUE ); } else @@ -6192,21 +6195,21 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) // HEADROCK HAM 3.5: Shift-Click a merc's face will add him to the current selection. if (!(gTacticalStatus.uiFlags & INCOMBAT) && _KeyDown( SHIFT ) ) { - if ( ! (MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) ) + if ( ! (ubSoldierID->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) ) { - if ( OK_CONTROLLABLE_MERC( MercPtrs[ ubSoldierID ] ) && !( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) + if ( OK_CONTROLLABLE_MERC( ubSoldierID ) && !( ubSoldierID->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) { - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s added", MercPtrs[ ubSoldierID ]->name ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s added", ubSoldierID->name ); gusSelectedSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; - MercPtrs[ ubSoldierID ]->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; + ubSoldierID->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; EndMultiSoldierSelection( TRUE ); } } // A shift-click on a selected character will remove that character from the current selection. else { - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s removed", MercPtrs[ ubSoldierID ]->name ); - MercPtrs[ ubSoldierID ]->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s removed", ubSoldierID->name ); + ubSoldierID->flags.uiStatusFlags &= (~SOLDIER_MULTI_SELECTED ); if (ubSoldierID != gusSelectedSoldier) { gusSelectedSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; @@ -6216,7 +6219,7 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) } else { - //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s selected", MercPtrs[ ubSoldierID ]->name ); + //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s selected", ubSoldierID->name ); HandleLocateSelectMerc( ubSoldierID, 0 ); } } @@ -6233,8 +6236,8 @@ void MercFacePanelCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( !InOverheadMap( ) ) { // Only if guy is not dead! - //if ( !( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_DEAD ) && !AM_AN_EPC( MercPtrs[ ubSoldierID ] ) && !( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) - if ( !( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_DEAD ) && !AM_AN_EPC( MercPtrs[ ubSoldierID ] ) ) + //if ( !( ubSoldierID->flags.uiStatusFlags & SOLDIER_DEAD ) && !AM_AN_EPC( ubSoldierID ) && !( ubSoldierID->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) ) + if ( !( ubSoldierID->flags.uiStatusFlags & SOLDIER_DEAD ) && !AM_AN_EPC( ubSoldierID ) ) { gfSwitchPanel = TRUE; gbNewPanel = SM_PANEL; @@ -6671,7 +6674,8 @@ void RenderSoldierTeamInv( SOLDIERTYPE *pSoldier, INT16 sX, INT16 sY, UINT8 ubPa void TMFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT16 ubID, ubSoldierID; + UINT16 ubID; + SoldierID ubSoldierID; ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); @@ -6694,7 +6698,7 @@ void TMFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) ubSoldierID = gTeamPanel[ ubID ].ubID; - if ( !MercPtrs[ ubSoldierID ]->bActive ) + if ( !ubSoldierID->bActive ) { return; } @@ -6721,7 +6725,8 @@ void TMFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT16 ubID, ubSoldierID; + UINT16 ubID; + SoldierID ubSoldierID; UINT16 usOldHandItem; ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); @@ -6739,9 +6744,9 @@ void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason == MSYS_CALLBACK_REASON_LBUTTON_UP ) { // anv: select vehicle by clicking on the steering wheel - //if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_DRIVER ) + //if ( ubSoldierID->flags.uiStatusFlags & SOLDIER_DRIVER ) //{ - // SOLDIERTYPE *pVehicle = GetSoldierStructureForVehicle( MercPtrs[ ubSoldierID ]->iVehicleId ); + // SOLDIERTYPE *pVehicle = GetSoldierStructureForVehicle( ubSoldierID->iVehicleId ); // HandleLocateSelectMerc( pVehicle->ubID, 0 ); //} //else @@ -6753,12 +6758,12 @@ void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason == MSYS_CALLBACK_REASON_RBUTTON_UP ) { - if ( !AM_A_ROBOT( MercPtrs[ ubSoldierID ] ) ) + if ( !AM_A_ROBOT( ubSoldierID ) ) { - usOldHandItem = MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem; - //SwapOutHandItem( MercPtrs[ ubSoldierID ] ); - SwapHandItems( MercPtrs[ ubSoldierID ] ); - MercPtrs[ ubSoldierID ]->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem ); + usOldHandItem = ubSoldierID->inv[HANDPOS].usItem; + //SwapOutHandItem( ubSoldierID ); + SwapHandItems( ubSoldierID ); + ubSoldierID->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, ubSoldierID->inv[HANDPOS].usItem ); fInterfacePanelDirty = DIRTYLEVEL2; } } @@ -6767,7 +6772,8 @@ void TMClickFirstHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) { - UINT16 ubID, ubSoldierID; + UINT16 ubID; + SoldierID ubSoldierID; UINT16 usOldHandItem; ubID = (UINT16) MSYS_GetRegionUserData( pRegion, 0 ); @@ -6783,28 +6789,28 @@ void TMClickSecondHandInvCallback( MOUSE_REGION * pRegion, INT32 iReason ) if (iReason == MSYS_CALLBACK_REASON_LBUTTON_UP ) { - if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) + if ( ubSoldierID->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) { - ExitVehicle( MercPtrs[ ubSoldierID ] ); + ExitVehicle( ubSoldierID ); } - else if (UsingNewInventorySystem() && !AM_A_ROBOT(MercPtrs[ubSoldierID])) + else if (UsingNewInventorySystem() && !AM_A_ROBOT(ubSoldierID)) { - MercPtrs[ubSoldierID]->SwitchWeapons(); + ubSoldierID->SwitchWeapons(); } } if (iReason == MSYS_CALLBACK_REASON_RBUTTON_UP ) { - if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) + if ( ubSoldierID->flags.uiStatusFlags & ( SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) { } else { - if ( !AM_A_ROBOT( MercPtrs[ ubSoldierID ] ) ) + if ( !AM_A_ROBOT( ubSoldierID ) ) { - usOldHandItem = MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem; - SwapHandItems( MercPtrs[ ubSoldierID ] ); - MercPtrs[ ubSoldierID ]->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, MercPtrs[ ubSoldierID ]->inv[HANDPOS].usItem ); + usOldHandItem = ubSoldierID->inv[HANDPOS].usItem; + SwapHandItems( ubSoldierID ); + ubSoldierID->ReLoadSoldierAnimationDueToHandItemChange( usOldHandItem, ubSoldierID->inv[HANDPOS].usItem ); fInterfacePanelDirty = DIRTYLEVEL2; } } @@ -6831,7 +6837,7 @@ BOOLEAN PlayerExistsInSlot( SoldierID ubID ) } -INT8 GetTeamSlotFromPlayerID( UINT16 ubID ) +INT8 GetTeamSlotFromPlayerID( SoldierID ubID ) { INT8 cnt; @@ -6850,7 +6856,7 @@ INT8 GetTeamSlotFromPlayerID( UINT16 ubID ) } -BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT16 ubMercID ) +BOOLEAN RemovePlayerFromTeamSlotGivenMercID( SoldierID ubMercID ) { INT32 cnt; @@ -6954,7 +6960,7 @@ BOOLEAN InitTEAMSlots( ) } -BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT16 * pubID ) +BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, SoldierID * pubID ) { if ( ubPanelSlot >= gGameOptions.ubSquadSize ) { @@ -6992,14 +6998,14 @@ BOOLEAN RemovePlayerFromInterfaceTeamSlot( UINT8 ubPanelSlot ) if ( gTeamPanel[ ubPanelSlot ].fOccupied ) { - if ( !( MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->flags.uiStatusFlags & SOLDIER_DEAD ) ) + if ( !( gTeamPanel[ ubPanelSlot ].ubID->flags.uiStatusFlags & SOLDIER_DEAD ) ) { // Set Id to close - MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->flags.fUICloseMerc = TRUE; + gTeamPanel[ ubPanelSlot ].ubID->flags.fUICloseMerc = TRUE; } // Set face to inactive... - SetAutoFaceInActive( MercPtrs[ gTeamPanel[ ubPanelSlot ].ubID ]->iFaceIndex ); + SetAutoFaceInActive( gTeamPanel[ ubPanelSlot ].ubID->iFaceIndex ); gTeamPanel[ ubPanelSlot ].fOccupied = FALSE; @@ -7132,7 +7138,7 @@ void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ) } } -UINT16 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) +SoldierID FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { INT32 cnt; INT32 bFirstID; @@ -7151,7 +7157,7 @@ UINT16 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLif if ( gTeamPanel[ cnt ].fOccupied ) { // Set Id to close - pTeamSoldier = MercPtrs[ gTeamPanel[ cnt ].ubID ]; + pTeamSoldier = gTeamPanel[ cnt ].ubID; if ( fOnlyRegularMercs ) { @@ -7211,7 +7217,7 @@ UINT16 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLif { if ( gTeamPanel[ cnt ].fOccupied ) { - pTeamSoldier = MercPtrs[ gTeamPanel[ cnt ].ubID ]; + pTeamSoldier = gTeamPanel[ cnt ].ubID; if ( fOnlyRegularMercs ) { diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 8908aa30..78fe0367 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -85,10 +85,10 @@ void UpdateSMPanel( ); BOOLEAN InitTEAMSlots( ); void AddPlayerToInterfaceTeamSlot( SoldierID ubID ); BOOLEAN RemovePlayerFromInterfaceTeamSlot( UINT8 ubID ); -BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, UINT16 * pubID ); +BOOLEAN GetPlayerIDFromInterfaceTeamSlot( UINT8 ubPanelSlot, SoldierID * pubID ); void RemoveAllPlayersFromSlot( ); BOOLEAN PlayerExistsInSlot( SoldierID ubID ); -BOOLEAN RemovePlayerFromTeamSlotGivenMercID( UINT16 ubMercID ); +BOOLEAN RemovePlayerFromTeamSlotGivenMercID( SoldierID ubMercID ); void CheckForAndAddMercToTeamPanel( SOLDIERTYPE *pSoldier ); void CleanUpStack( OBJECTTYPE * pObj, OBJECTTYPE * pCursorObj ); @@ -149,7 +149,7 @@ void GoToMapScreenFromTactical( void ); void FinishAnySkullPanelAnimations( ); -UINT16 FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); +SoldierID FindNextMercInTeamPanel( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); // CHRISL: New callback functions for backpack buttons BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus); diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 7409cc2f..85e2af84 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -125,7 +125,7 @@ bool IsSlotASmallPocket(int slot) return false; } -void CreateLBE (OBJECTTYPE* pObj, UINT16 ubID, int numSubPockets) +void CreateLBE (OBJECTTYPE* pObj, SoldierID ubID, int numSubPockets) { int uniqueID; LBENODE* pLBE = NULL; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index db414597..67600237 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -247,7 +247,7 @@ public: UINT32 lbeClass; UINT16 lbeIndex; - UINT16 ubID; + SoldierID ubID; BOOLEAN ZipperFlag; int uniqueID; UINT32 uiNodeChecksum; @@ -259,7 +259,7 @@ public: #define SIZEOF_LBENODE_POD (offsetof(LBENODE, endOfPOD)) bool checkLBEArrayIntegrity(bool verbose=false); // BOB: checks all worldItems for missing LBE info -void CreateLBE(OBJECTTYPE* pObj, UINT16 ubID, int numSubPockets); +void CreateLBE(OBJECTTYPE* pObj, SoldierID ubID, int numSubPockets); bool DestroyLBEIfEmpty(OBJECTTYPE* pObj, int stackIndex = 0); void DestroyLBE(OBJECTTYPE* pObj, int stackIndex = 0); void GetLBESlots(UINT32 LBEType, std::vector& LBESlots); diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 9fb928c1..ff479b90 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -284,7 +284,7 @@ void ItemCreationCallBack( UINT8 ubResult ); void CheatCreateItem(); // silversurfer: added for merc portrait swapping in tactical void SwapMercPortraits ( SOLDIERTYPE *pSoldier, INT8 bDirection ); -extern INT8 GetTeamSlotFromPlayerID( UINT16 ubID ); +extern INT8 GetTeamSlotFromPlayerID( SoldierID ubID ); extern FACETYPE *gpCurrentTalkingFace; // Flugente: toggle display of enemy role indicators @@ -6257,7 +6257,7 @@ void ChangeCurrentSquad( INT32 iSquad ) void HandleSelectMercSlot( UINT8 ubPanelSlot, INT8 bCode ) { - UINT16 ubID; + SoldierID ubID; if ( GetPlayerIDFromInterfaceTeamSlot( ubPanelSlot, &ubID ) ) { diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index bfbc2e96..b4e81763 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -1420,7 +1420,7 @@ UINT8 HandleNonActivatedTargetCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos , BO } -void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ) +void DetermineCursorBodyLocation( SoldierID ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ) { INT32 usMapPos; SOLDIERTYPE *pTargetSoldier = NULL, *pSoldier; @@ -1429,7 +1429,7 @@ void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN BOOLEAN fOnGuy = FALSE; LEVELNODE *pNode; - pSoldier = MercPtrs[ ubSoldierID ]; + pSoldier = ubSoldierID; if ( gTacticalStatus.ubAttackBusyCount > 0 ) { @@ -2263,10 +2263,10 @@ UINT8 HandleBloodbagCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActiv if ( HasItemFlag( ( &( pSoldier->inv[HANDPOS] ) )->usItem, EMPTY_BLOOD_BAG ) ) { // is there a person here? - UINT16 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); + SoldierID usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { - if ( usSoldierIndex != pSoldier->ubID && MercPtrs[usSoldierIndex]->IsValidBloodDonor() ) + if ( usSoldierIndex != pSoldier->ubID && usSoldierIndex->IsValidBloodDonor() ) return BLOODBAG_GREY_UICURSOR; } } @@ -2298,10 +2298,10 @@ UINT8 HandleSplintCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivat } // is there a person here? - UINT16 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); + SoldierID usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); if ( usSoldierIndex != NOBODY ) { - if ( usSoldierIndex != pSoldier->ubID && MercPtrs[usSoldierIndex]->CanReceiveSplint() ) + if ( usSoldierIndex != pSoldier->ubID && usSoldierIndex->CanReceiveSplint() ) return SPLINT_GREY_UICURSOR; } } @@ -2384,8 +2384,8 @@ UINT8 HandleHandcuffCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCurso if ( HasItemFlag( (&(pSoldier->inv[HANDPOS]))->usItem, HANDCUFFS ) ) { // is there a person here? - UINT16 usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); - if (usSoldierIndex != NOBODY && MercPtrs[usSoldierIndex] && MercPtrs[usSoldierIndex]->bVisible >= 0 && MercPtrs[usSoldierIndex]->CanBeCaptured()) + SoldierID usSoldierIndex = WhoIsThere2( sGridNo, pSoldier->pathing.bLevel ); + if (usSoldierIndex != NOBODY && usSoldierIndex->bVisible >= 0 && usSoldierIndex->CanBeCaptured()) { return( HANDCUFF_GREY_UICURSOR ); } @@ -2406,8 +2406,8 @@ UINT8 HandleApplyItemCursor(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCurso if (ItemCanBeAppliedToOthers((&(pSoldier->inv[HANDPOS]))->usItem)) { // is there a person here? - UINT16 ubPerson = WhoIsThere2(sGridNo, pSoldier->pathing.bLevel); - if (ubPerson != NOBODY && MercPtrs[ubPerson] && MercPtrs[ubPerson]->bVisible >= 0) + SoldierID ubPerson = WhoIsThere2(sGridNo, pSoldier->pathing.bLevel); + if (ubPerson != NOBODY && ubPerson->bVisible >= 0) { return(APPLYITEM_GREY_UICURSOR); } @@ -3022,8 +3022,8 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier ) if ( GetMouseMapPos( &usMapPos ) ) { // is there a person here? - UINT16 ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); - if (ubPerson != NOBODY && MercPtrs[ubPerson] && MercPtrs[ubPerson]->bVisible >= 0) + SoldierID ubPerson = WhoIsThere2(usMapPos, pSoldier->pathing.bLevel); + if (ubPerson != NOBODY && ubPerson->bVisible >= 0) { ubCursor = APPLYITEMCURS; } diff --git a/Tactical/UI Cursors.h b/Tactical/UI Cursors.h index 415246c4..6723dd46 100644 --- a/Tactical/UI Cursors.h +++ b/Tactical/UI Cursors.h @@ -10,7 +10,7 @@ UINT8 GetProperItemCursor( SoldierID ubSoldierID, UINT16 ubItemIndex, INT32 usMapPos, BOOLEAN fActivated ); -void DetermineCursorBodyLocation( UINT16 ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ); +void DetermineCursorBodyLocation( SoldierID ubSoldierID, BOOLEAN fDisplay, BOOLEAN fRecalc ); void HandleLeftClickCursor( SOLDIERTYPE *pSoldier ); void HandleRightClickAdjustCursor( SOLDIERTYPE *pSoldier, INT32 usMapPos ); diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index adcb9671..39238f14 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -610,7 +610,7 @@ void ResizeWorldItems(void)//dnl ch75 271013 #endif } -INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT16 soldierID ) +INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, SoldierID soldierID ) { UINT32 iItemIndex; INT32 iReturn; @@ -658,12 +658,15 @@ INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 { SOLDIERTYPE* pSoldier = NULL; - if (soldierID == -1) + if (soldierID == NOBODY) { if (gWorldItems[ iItemIndex ].object[0]->data.misc.ubBombOwner > 1) { soldierID = gWorldItems[ iItemIndex ].object[0]->data.misc.ubBombOwner - 2; // undo the hack - pSoldier = MercPtrs[ soldierID ]; + if ( soldierID < NOBODY ) + { + pSoldier = soldierID; + } } } diff --git a/Tactical/World Items.h b/Tactical/World Items.h index cd3ae1ee..03ae16f9 100644 --- a/Tactical/World Items.h +++ b/Tactical/World Items.h @@ -122,7 +122,7 @@ public: extern std::vector gWorldItems;//dnl ch75 261013 extern UINT32 guiNumWorldItems; -INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, INT16 soldierID ); +INT32 AddItemToWorld( INT32 sGridNo, OBJECTTYPE *pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, INT8 bVisible, SoldierID soldierID ); void RemoveItemFromWorld( INT32 iItemIndex ); INT32 FindWorldItem( UINT16 usItem ); diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index 52a575d8..755f4738 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -1106,7 +1106,7 @@ inline UINT16 * GetShadeTable(LEVELNODE * pNode, SOLDIERTYPE * pSoldier, SOLDIER } // Set shade // If a bad guy is highlighted - if (gfUIHandleSelectionAboveGuy == TRUE && MercPtrs[gsSelectedGuy]->bSide != gbPlayerNum) + if (gfUIHandleSelectionAboveGuy == TRUE && gsSelectedGuy->bSide != gbPlayerNum) { if (gsSelectedGuy == pSoldier->ubID) { From fa56a7ad6d408a0861e2bfbc95e76f718bc0f16e Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:34:41 +0200 Subject: [PATCH 120/571] Update Scheduling.cpp --- Strategic/Scheduling.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index 517ef586..ce263774 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -190,7 +190,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID ) } //Validate the existance of the soldier. - pSoldier = MercPtrs[ pSchedule->ubSoldierID ]; + pSoldier = pSchedule->ubSoldierID; if ( pSoldier->stats.bLife < OKLIFE ) { // dead or dying! @@ -331,7 +331,7 @@ void PrepareSchedulesForEditorEntry() prev->next = curr->next; else gpScheduleList = gpScheduleList->next; - MercPtrs[ curr->ubSoldierID ]->ubScheduleID = 0; + curr->ubSoldierID->ubScheduleID = 0; temp = curr; curr = curr->next; MemFree( temp ); @@ -653,11 +653,11 @@ BOOLEAN SortSchedule( SCHEDULENODE *pSchedule ) BOOLEAN BumpAnyExistingMerc( INT32 sGridNo ) { - UINT16 ubID; - SOLDIERTYPE * pSoldier; // NB this is the person already in the location, - INT32 sNewGridNo; - UINT8 ubDir; - INT16 sCellX, sCellY; + SoldierID ubID; + SOLDIERTYPE *pSoldier; // NB this is the person already in the location, + INT32 sNewGridNo; + UINT8 ubDir; + INT16 sCellX, sCellY; // this is for autoprocessing schedules... // there could be someone in the destination location, in which case @@ -675,7 +675,7 @@ BOOLEAN BumpAnyExistingMerc( INT32 sGridNo ) return( TRUE ); } - pSoldier = MercPtrs[ ubID ]; + pSoldier = ubID; // what if the existing merc is prone? sNewGridNo = FindGridNoFromSweetSpotWithStructDataFromSoldier( pSoldier, STANDING, 5, &ubDir, 1, pSoldier ); @@ -707,7 +707,7 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index ) return; } - pSoldier = MercPtrs[ pSchedule->ubSoldierID ]; + pSoldier = pSchedule->ubSoldierID; if (pSoldier->ubID == 0) { @@ -1381,16 +1381,16 @@ void ReplaceSleepSpot( SCHEDULENODE * pSchedule, UINT16 usNewSpot ) void SecureSleepSpot( SOLDIERTYPE * pSoldier, UINT32 usSleepSpot ) { - SOLDIERTYPE * pSoldier2; - UINT32 usSleepSpot2; - UINT32 uiLoop; - SCHEDULENODE * pSchedule; - UINT8 ubDirection; + SOLDIERTYPE *pSoldier2; + UINT32 usSleepSpot2; + SoldierID uiLoop; + SCHEDULENODE *pSchedule; + UINT8 ubDirection; // start after this soldier's ID so we don't duplicate work done in previous passes - for ( uiLoop = pSoldier->ubID + 1; uiLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; uiLoop++ ) + for ( uiLoop = pSoldier->ubID + 1; uiLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++uiLoop ) { - pSoldier2 = MercPtrs[ uiLoop ]; + pSoldier2 = uiLoop; if ( pSoldier2->bActive && pSoldier2->bInSector && pSoldier2->ubScheduleID != 0 ) { pSchedule = GetSchedule( pSoldier2->ubScheduleID ); From 66bd1e41c2894127afe8baef55b53d405e309e0e Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:27:14 +0200 Subject: [PATCH 121/571] Correct loops --- Strategic/Scheduling.cpp | 6 +++--- TacticalAI/AIMain.cpp | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index ce263774..f9dad5da 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -1383,14 +1383,14 @@ void SecureSleepSpot( SOLDIERTYPE * pSoldier, UINT32 usSleepSpot ) { SOLDIERTYPE *pSoldier2; UINT32 usSleepSpot2; - SoldierID uiLoop; + UINT16 uiLoop; SCHEDULENODE *pSchedule; UINT8 ubDirection; // start after this soldier's ID so we don't duplicate work done in previous passes - for ( uiLoop = pSoldier->ubID + 1; uiLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++uiLoop ) + for ( uiLoop = pSoldier->ubID + 1; uiLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; uiLoop++ ) { - pSoldier2 = uiLoop; + pSoldier2 = MercPtrs[uiLoop]; if ( pSoldier2->bActive && pSoldier2->bInSector && pSoldier2->ubScheduleID != 0 ) { pSchedule = GetSchedule( pSoldier2->ubScheduleID ); diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index f6d32bea..90e7024b 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -874,7 +874,7 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) { - SoldierID ubID; + UINT16 ubID; if (gfTurnBasedAI) { @@ -887,17 +887,19 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) // search for any player merc to say close call quote for ( ubID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubID ) { - if ( OK_INSECTOR_MERC( ubID ) ) + SOLDIERTYPE *pMerc = MercPtrs[ubID]; + + if ( OK_INSECTOR_MERC( pMerc ) ) { - if ( ubID->flags.fCloseCall ) + if ( pMerc->flags.fCloseCall ) { - if ( !gTacticalStatus.fSomeoneHit && ubID->bNumHitsThisTurn == 0 && !(ubID->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) + if ( !gTacticalStatus.fSomeoneHit && pMerc->bNumHitsThisTurn == 0 && !(pMerc->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) { // say close call quote! - TacticalCharacterDialogue( ubID, QUOTE_CLOSE_CALL ); - ubID->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; + TacticalCharacterDialogue( pMerc, QUOTE_CLOSE_CALL ); + pMerc->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; } - ubID->flags.fCloseCall = FALSE; + pMerc->flags.fCloseCall = FALSE; } } } @@ -942,7 +944,7 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) ubID = RemoveFirstAIListEntry(); if (ubID != NOBODY) { - StartNPCAI( ubID ); + StartNPCAI( MercPtrs[ ubID ] ); return; } From c75f57785e586a2cbf2bc69553d9873e65d18d15 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:49:38 +0200 Subject: [PATCH 122/571] Guard against out of bounds access Can't trust a simple != check --- Tactical/Handle Items.cpp | 8 ++++---- Tactical/Interface Items.cpp | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index d95b6157..55679a76 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -4292,7 +4292,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pTempItemPool->iItemIndex].object.ubNumberOfObjects, gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ], gWorldItems[ pTempItemPool->iItemIndex ].object.ubNumberOfObjects ); @@ -4302,7 +4302,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ] ); @@ -4411,7 +4411,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].object.ubNumberOfObjects, gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ], gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects ); @@ -4421,7 +4421,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ] ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index b3f56f6a..bbecd3c6 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -11482,8 +11482,7 @@ void RenderItemPickupMenu( ) !gfStealing && Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID != NOBODY && - gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID) + gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID < NOBODY) //swprintf(pStr, L"%s (%s)", ShortItemNames[pObject->usItem], MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); swprintf(pStr, L"(%s)", gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID->GetName()); else From e62684f0e1e681e16a3c5e34b230b5a786232d61 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:50:20 +0200 Subject: [PATCH 123/571] Convert GetSoldierIDFromMercID() to SoldierID --- Tactical/Soldier Add.cpp | 4 ++-- Tactical/Soldier Add.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index ef769a86..a10c6cc2 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1788,7 +1788,7 @@ BOOLEAN IsMercOnTeam(UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive) // GetSoldierIDFromMercID() Gets the Soldier ID from the Merc Profile ID, else returns -1 -INT16 GetSoldierIDFromMercID(UINT8 ubMercID) +SoldierID GetSoldierIDFromMercID(UINT8 ubMercID) { SOLDIERTYPE *pTeamSoldier = NULL; @@ -1804,7 +1804,7 @@ INT16 GetSoldierIDFromMercID(UINT8 ubMercID) } } - return -1 ; + return NOBODY; } diff --git a/Tactical/Soldier Add.h b/Tactical/Soldier Add.h index 32aa90dd..3f67759a 100644 --- a/Tactical/Soldier Add.h +++ b/Tactical/Soldier Add.h @@ -41,8 +41,8 @@ BOOLEAN IsMercOnTeam( UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive -// GetSoldierIDFromMercID() Gets the Soldier ID from the Merc Profile ID, else returns -1 -INT16 GetSoldierIDFromMercID(UINT8 ubMercID); +// GetSoldierIDFromMercID() Gets the Soldier ID from the Merc Profile ID, else returns NOBODY +SoldierID GetSoldierIDFromMercID(UINT8 ubMercID); INT32 FindGridNoFromSweetSpotWithStructData( SOLDIERTYPE *pSoldier, UINT16 usAnimState, INT32 sSweetGridNo, INT8 ubRadius, UINT8 *pubDirection, BOOLEAN fClosestToMerc ); From 07420ce2453c72043de7ece6c45adff98ab9ed7d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:42:13 +0200 Subject: [PATCH 124/571] Revert "Guard against out of bounds access" This reverts commit c75f57785e586a2cbf2bc69553d9873e65d18d15. --- Tactical/Handle Items.cpp | 8 ++++---- Tactical/Interface Items.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index 55679a76..d95b6157 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -4292,7 +4292,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pTempItemPool->iItemIndex].object.ubNumberOfObjects, gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ], gWorldItems[ pTempItemPool->iItemIndex ].object.ubNumberOfObjects ); @@ -4302,7 +4302,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pTempItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pTempItemPool->iItemIndex ].object.usItem ] ); @@ -4411,7 +4411,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) swprintf(pStr, L"%s (%d) (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].object.ubNumberOfObjects, gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s (%d)", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ], gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects ); @@ -4421,7 +4421,7 @@ BOOLEAN DrawItemPoolList( ITEM_POOL *pItemPool, INT32 sGridNo, UINT8 bCommand, I if (gGameExternalOptions.gfShowBackpackOwner && Item[gWorldItems[pItemPool->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[pItemPool->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[pItemPool->iItemIndex].soldierID < NOBODY) + gWorldItems[pItemPool->iItemIndex].soldierID != NOBODY) swprintf(pStr, L"%s (%s)", ShortItemNames[gWorldItems[pItemPool->iItemIndex].object.usItem], gWorldItems[pItemPool->iItemIndex].soldierID->GetName()); else swprintf( pStr, L"%s", ShortItemNames[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ] ); diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index bbecd3c6..b3f56f6a 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -11482,7 +11482,8 @@ void RenderItemPickupMenu( ) !gfStealing && Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].object.usItem].ubClassIndex].lbeClass == BACKPACK && - gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID < NOBODY) + gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID != NOBODY && + gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID) //swprintf(pStr, L"%s (%s)", ShortItemNames[pObject->usItem], MercPtrs[gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID]->GetName()); swprintf(pStr, L"(%s)", gWorldItems[gItemPickupMenu.ItemPoolSlots[cnt]->iItemIndex].soldierID->GetName()); else From d2388c76b87b69f5d1e62ad0a1c5605712950d31 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 21:43:30 +0200 Subject: [PATCH 125/571] Modify SoldierID constructor to prevent invalid valuels --- Tactical/Overhead Types.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index d4ed672f..eb1a8571 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -388,7 +388,11 @@ typedef struct SoldierID inline operator UINT16() const { return i; } SoldierID(const UINT16 val = 0) : i(val) - {} + { + // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid + if ( i > TOTAL_SOLDIERS ) + i = TOTAL_SOLDIERS; + } SOLDIERTYPE* operator->() { return MercPtrs[i]; } const SOLDIERTYPE* operator->() const { return MercPtrs[i]; } From 3ddc4c2bbd17f06fe2a51d6103b842aff0e00e59 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:24:55 +0200 Subject: [PATCH 126/571] Change to SoldierID --- Tactical/Animation Cache.cpp | 6 +++--- Tactical/Animation Cache.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/Animation Cache.cpp b/Tactical/Animation Cache.cpp index ad1977f6..6f62c86a 100644 --- a/Tactical/Animation Cache.cpp +++ b/Tactical/Animation Cache.cpp @@ -64,7 +64,7 @@ void DeleteAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAn } -BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation ) +BOOLEAN GetCachedAnimationSurface( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation ) { UINT8 cnt; UINT8 ubLowestIndex = 0; @@ -89,7 +89,7 @@ BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType AnimDebugMsg( String( "Anim Cache: Determining Bump Candidate ( Soldier %d )", usSoldierID ) ); // Determine exisiting surface used by merc - usCurrentAnimSurface = DetermineSoldierAnimationSurface( MercPtrs[ usSoldierID ], usCurrentAnimation ); + usCurrentAnimSurface = DetermineSoldierAnimationSurface( usSoldierID, usCurrentAnimation ); // If the surface we are going to bump is our existing animation, reject it as a candidate // If we get here, we need to remove an animation, pick the best one @@ -142,7 +142,7 @@ BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType } return( TRUE ); - } +} diff --git a/Tactical/Animation Cache.h b/Tactical/Animation Cache.h index cbba71c8..635aa1ca 100644 --- a/Tactical/Animation Cache.h +++ b/Tactical/Animation Cache.h @@ -18,7 +18,7 @@ typedef struct extern UINT32 guiCacheSize; -BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation ); +BOOLEAN GetCachedAnimationSurface( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation ); BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ); void DeleteAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ); void DetermineOptimumAnimationCacheSize( ); From 38b710343a4487fe3f8fe6a58f8a0e331430a33d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:38:09 +0200 Subject: [PATCH 127/571] Fix incorrect function argument --- Tactical/Dialogue Control.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 296637c0..e6b12677 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -3118,7 +3118,7 @@ void HandleDialogueEnd( FACETYPE *pFace ) case QUOTE_UNDER_HEAVY_FIRE: case QUOTE_TAKEN_A_BREATING: if( pSoldier->ubPreviousAttackerID != NOBODY && !( pSoldier->ubPreviousAttackerID->bDeafenedCounter > 0 ) ) - PossiblyStartEnemyTaunt( pSoldier->ubPreviousAttackerID, TAUNT_RIPOSTE, gTacticalStatus.ubLastQuoteProfileNUm ); + PossiblyStartEnemyTaunt( pSoldier->ubPreviousAttackerID, TAUNT_RIPOSTE, pSoldier->ubID ); break; default: // select random enemy, who we see, who sees us and isn't deaf @@ -3132,7 +3132,7 @@ void HandleDialogueEnd( FACETYPE *pFace ) } } if( ubSeenEnemiesCnt > 0 ) - PossiblyStartEnemyTaunt( MercPtrs[ubSeenEnemies[ Random(ubSeenEnemiesCnt) ]], TAUNT_RIPOSTE, gTacticalStatus.ubLastQuoteProfileNUm ); + PossiblyStartEnemyTaunt( MercPtrs[ubSeenEnemies[ Random(ubSeenEnemiesCnt) ]], TAUNT_RIPOSTE, pSoldier->ubID ); } break; } From dd2c6f44b24bf7225a5ea2fb54e6e0123570a2e4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 22:38:28 +0200 Subject: [PATCH 128/571] Fix incorrect function arguments --- TileEngine/SmokeEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 91119d53..4d8bb9c2 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -211,7 +211,7 @@ INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, { // let all the other clients know we are spawning this effect // and align them with our random number generator - send_newsmokeeffect(sGridNo,usItem,ubOwner,bLevel,iSmokeIndex); + send_newsmokeeffect(sGridNo, usItem, bLevel, ubOwner, iSmokeIndex); } else if (!fFromRemoteClient) { From ca1112313ae8795c05088924b7ed94cc92f7737f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:11:41 +0200 Subject: [PATCH 129/571] Increase ubUserData2 from UINT8 to UINT16 --- TileEngine/Tile Animation.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TileEngine/Tile Animation.h b/TileEngine/Tile Animation.h index 1a56eaba..b209a7d9 100644 --- a/TileEngine/Tile Animation.h +++ b/TileEngine/Tile Animation.h @@ -68,7 +68,7 @@ typedef struct TAG_anitile UINT32 uiKeyFrame2Code; UINT32 uiUserData; - UINT8 ubUserData2; + UINT16 ubUserData2; // NOTE: Expanded the type due to SoldierID UINT32 uiUserData3; INT8 bFrameCountAfterStart; @@ -99,7 +99,7 @@ typedef struct TAG_anitile_params UINT32 uiKeyFrame2Code; // Key frame code UINT32 uiUserData; - UINT8 ubUserData2; + UINT16 ubUserData2; // NOTE: Expanded the type due to SoldierID UINT32 uiUserData3; INT32 lightSprite; } ANITILE_PARAMS; From 9fb29cf4443f8f9238697bb46e858d65366f22be Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:12:00 +0200 Subject: [PATCH 130/571] Remove UINT8 conversions --- TileEngine/Tile Animation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TileEngine/Tile Animation.cpp b/TileEngine/Tile Animation.cpp index 266bd856..ca2a6138 100644 --- a/TileEngine/Tile Animation.cpp +++ b/TileEngine/Tile Animation.cpp @@ -572,11 +572,11 @@ void UpdateAniTiles( ) { // Do sound.... // PlayJA2Sample( AIR_ESCAPING_1, RATE_11025, SoundVolume( HIGHVOLUME, pNode->sGridNo ), 1, SoundDir( pNode->sGridNo ) ); - NewSmokeEffect( pNode->sGridNo, (UINT16)pNode->uiUserData, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, (UINT8)pNode->ubUserData2 ); + NewSmokeEffect( pNode->sGridNo, (UINT16)pNode->uiUserData, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, pNode->ubUserData2 ); } else { - SpreadEffect( pNode->sGridNo, (UINT8)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, pNode->ubUserData2, FALSE, gExplosionData[ pNode->uiUserData3 ].Params.bLevel, -1 ); } // Forfait any other animations this frame.... return; From e9e80800774d7f86a612443189d862831333acdf Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:12:17 +0200 Subject: [PATCH 131/571] Update merccompare.cpp --- Laptop/merccompare.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Laptop/merccompare.cpp b/Laptop/merccompare.cpp index 413853d5..51c2fd94 100644 --- a/Laptop/merccompare.cpp +++ b/Laptop/merccompare.cpp @@ -433,12 +433,12 @@ void RenderMercCompareAnalyze() BOOLEAN DisplayMercData( UINT8 usProfileA, UINT8 usProfileB ) { - VOBJECT_DESC VObjectDesc; - HVOBJECT hPixHandle; + VOBJECT_DESC VObjectDesc; + HVOBJECT hPixHandle; UINT16 usPosX, usPosY, usPosY2; UINT32 uiInsMercFaceImage; INT32 iCostOfContract = 0; - char sTemp[100]; + char sTemp[100]; CHAR16 sText[800]; BOOLEAN fDisplayMercContractStateTextColorInRed = FALSE; @@ -452,14 +452,14 @@ BOOLEAN DisplayMercData( UINT8 usProfileA, UINT8 usProfileB ) if ( !pProfileA || !pProfileB ) return FALSE; - INT16 idA = GetSoldierIDFromMercID( usProfileA ); - INT16 idB = GetSoldierIDFromMercID( usProfileB ); + SoldierID idA = GetSoldierIDFromMercID( usProfileA ); + SoldierID idB = GetSoldierIDFromMercID( usProfileB ); - if ( idA < 0 || idB < 0 ) + if ( idA == NOBODY || idB == NOBODY ) return FALSE; - SOLDIERTYPE* pSoldierA = MercPtrs[idA]; - SOLDIERTYPE* pSoldierB = MercPtrs[idB]; + SOLDIERTYPE* pSoldierA = idA; + SOLDIERTYPE* pSoldierB = idB; if ( !pSoldierA || !pSoldierB ) return FALSE; From cd83fac928e685f8f522c507e0098bb7e44f89ec Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:12:27 +0200 Subject: [PATCH 132/571] Update Air Raid.cpp --- Tactical/Air Raid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Air Raid.cpp b/Tactical/Air Raid.cpp index 6b9f2ff9..cecc0852 100644 --- a/Tactical/Air Raid.cpp +++ b/Tactical/Air Raid.cpp @@ -107,7 +107,7 @@ typedef struct INT8 bLevel; INT8 bTeam; INT8 bSide; - UINT8 ubAttackerID; + SoldierID ubAttackerID; UINT16 usAttackingWeapon; FLOAT dXPos; FLOAT dYPos; From bc01bdb56da8c9102a6eebd1ba504d0827b6e039 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:12:43 +0200 Subject: [PATCH 133/571] Convert to SoldierID --- Tactical/Handle UI.cpp | 2 +- Tactical/Handle UI.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index c2c624ff..b53d91ba 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -494,7 +494,7 @@ UINT8 GetAdjustedAnimHeight( UINT8 ubAnimHeight, INT8 bChange ); //-------------------------Legion 2 okno----------------------------------------------------------- -void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ) +void GetMercOknoDirection( SoldierID ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ) { INT8 bNewDirection; SOLDIERTYPE *pSoldier; diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index ff74b70c..717ddc8c 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -379,6 +379,6 @@ void PreventFromTheFreezingBug(SOLDIERTYPE* pSoldier); void GetGridNoScreenXY( INT32 sGridNo, INT16 *pScreenX, INT16 *pScreenY ); //Legion by Jazz -void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); +void GetMercOknoDirection( SoldierID ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); #endif From 9bbec030d8a1b5352beb2b2bcc477b5627dddf91 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:14:03 +0200 Subject: [PATCH 134/571] Remove unnecessary casts --- Tactical/Overhead.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 77d5ea2b..863b0864 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -1489,7 +1489,7 @@ BOOLEAN ExecuteOverhead( ) } else if ( pSoldier->aiData.ubPendingAction == MERC_TALK ) { - pSoldier->PlayerSoldierStartTalking( (UINT8)pSoldier->aiData.uiPendingActionData1, TRUE ); + pSoldier->PlayerSoldierStartTalking ( pSoldier->aiData.uiPendingActionData1, TRUE ); pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; } else if ( pSoldier->aiData.ubPendingAction == MERC_DROPBOMB ) @@ -3270,7 +3270,7 @@ void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ) if ( fSoldierFound ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SelectNextAvailSoldier: selectsoldier")); - SelectSoldier( (INT16)cnt, FALSE, FALSE ); + SelectSoldier( cnt, FALSE, FALSE ); } else { @@ -3755,7 +3755,7 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) { if ( !fMissionFailed ) { - SelectSoldier( (INT16)iNewSelectedSoldier, FALSE, FALSE ); + SelectSoldier( iNewSelectedSoldier, FALSE, FALSE ); } else { @@ -4937,14 +4937,14 @@ SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLes // Check for bLife > 0 if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && ( pTeamSoldier->bAssignment < ON_DUTY || pTeamSoldier->bAssignment == VEHICLE ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT16)cnt ); + return( cnt ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT16)cnt ); + return( cnt ); } } } @@ -4967,14 +4967,14 @@ SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLes { if ( pTeamSoldier->stats.bLife > 0 && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bTeam == gbPlayerNum && ( pTeamSoldier->bAssignment < ON_DUTY || pTeamSoldier->bAssignment == VEHICLE ) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT16)cnt ); + return( cnt ); } } else { if ( OK_CONTROLLABLE_MERC( pTeamSoldier) && OK_INTERRUPT_MERC( pTeamSoldier ) && pSoldier->bAssignment == pTeamSoldier->bAssignment ) { - return( (UINT16)cnt ); + return( cnt ); } } } From 924ccd8815c2aa2a39915c75aefa7a937e2bd646 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:14:22 +0200 Subject: [PATCH 135/571] Use ubID instead of cnt --- Tactical/Overhead.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 863b0864..60bcd559 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -3474,10 +3474,8 @@ BOOLEAN ResetAllAnimationCache( ) { if ( pSoldier != NULL ) { - InitAnimationCache( cnt, &(pSoldier->AnimCache) ); - + InitAnimationCache( pSoldier->ubID, &(pSoldier->AnimCache) ); } - } return( TRUE ); From 883ceb2f6f8c5e30f9bfc2d12b0378e2480fb73c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:14:34 +0200 Subject: [PATCH 136/571] Convert to SoldierID --- Tactical/Overhead.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 60bcd559..5ea1d763 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -3624,7 +3624,7 @@ void RebuildAllSoldierShadeTables( ) void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) { INT32 cnt; - INT32 iNewSelectedSoldier = -1; + SoldierID iNewSelectedSoldier; SOLDIERTYPE *pTeamSoldier; BOOLEAN fMissionFailed = TRUE; INT8 bBuddyIndex; From 2387667a2306a4c67deca8239d17568ae7d43918 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:20:04 +0200 Subject: [PATCH 137/571] Initialize SOLDIERTYPE SoldierIDs to NOBODY memset in initialize() function sets them all to zero --- Tactical/Soldier Control.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index a415b2e1..00b02419 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -1142,8 +1142,25 @@ void SOLDIERTYPE::initialize( ) // sevenfm:initialize additional data this->InitializeExtraData(); + + // Initialize all SoldierID fields to NOBODY. 0 is a valid value! + this->ubID = NOBODY; + this->ubOppNum = NOBODY; + this->ubAttackerID = NOBODY; + this->ubPreviousAttackerID = NOBODY; + this->ubServicePartner = NOBODY; + this->ubSuppressorID = NOBODY; + this->ubTargetID = NOBODY; + this->ubAutoBandagingMedic = NOBODY; + this->ubRobotRemoteHolderID = NOBODY; + this->ubCTGTTargetID = NOBODY; + this->bOverrideMoveSpeed = NOBODY; + this->ubNextToPreviousAttackerID = NOBODY; + this->usDragPersonID = NOBODY; + this->usChatPartnerID = NOBODY; } + bool SOLDIERTYPE::exists( ) { if ( this == NULL ) From df01708ac356c8b3b3113dd8b7eba9a2fa7fd490 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:20:14 +0200 Subject: [PATCH 138/571] Update Soldier Control.cpp --- Tactical/Soldier Control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 00b02419..673fbdbf 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -18875,7 +18875,7 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN // if he does not do so, active vox operators will be targetted. Who knows, the vox operator might be doing a heroic last stand for all we know... //BOOLEAN signalshellfired = FALSE; const UINT8 maxFiringMortarsAmount = 5; - SoldierID radiooperatorID = 0; + SoldierID radiooperatorID = NOBODY; UINT8 mortaritemcnt = 0; UINT16 mortararray[maxFiringMortarsAmount] = { 0 }; From 327046925b4b33e0c6836be230652e846ad50e50 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:20:42 +0200 Subject: [PATCH 139/571] Converto to SoldierID --- Tactical/TeamTurns.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 975e4b19..0b8c58e1 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -105,7 +105,7 @@ UINT16 gubOutOfTurnPersons = 0; SoldierID InterruptOnlyGuynum = NOBODY; BOOLEAN InterruptsAllowed = TRUE; BOOLEAN gfHiddenInterrupt = FALSE; -UINT8 gubLastInterruptedGuy = 0; +SoldierID gubLastInterruptedGuy = NOBODY; extern UINT16 gsWhoThrewRock; extern UINT8 gubSightFlags; @@ -118,7 +118,7 @@ typedef struct INT16 sWhoThrewRock; BOOLEAN InterruptsAllowed; BOOLEAN fHiddenInterrupt; - UINT8 ubLastInterruptedGuy; + SoldierID ubLastInterruptedGuy; UINT8 ubFiller[16]; } TEAM_TURN_SAVE_STRUCT; From b718b463c2125892c447cd1a524b4e473af856d1 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:22:00 +0200 Subject: [PATCH 140/571] Use SoldierID --- TacticalAI/AIList.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TacticalAI/AIList.cpp b/TacticalAI/AIList.cpp index e91c48e1..a1700b3b 100644 --- a/TacticalAI/AIList.cpp +++ b/TacticalAI/AIList.cpp @@ -85,7 +85,7 @@ SoldierID RemoveFirstAIListEntry( void ) DeleteAIListEntry( pOldFirstEntry ); // make sure conditions still met - if ( SatisfiesAIListConditions( MercPtrs[ ubID ], NULL, FALSE ) ) + if ( SatisfiesAIListConditions( ubID, NULL, FALSE ) ) { return( ubID ); } From 1e16de30d7c17b64b35c1e923662bb906d065e5d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:22:19 +0200 Subject: [PATCH 141/571] Remove wrong cast --- Tactical/Turn Based Input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index ff479b90..58602825 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -5822,7 +5822,7 @@ void HandleHandCursorClick( INT32 usMapPos, UINT32 *puiNewEvent ) if ( gfUIFullTargetFound ) { // Flugente: allow stealing if the other guy is an enemy, OR if we are on the same team - if ( (( guiUIFullTargetFlags & ENEMY_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC )) || (AllowedToStealFromTeamMate(pSoldier->ubID, (UINT8)gusUIFullTargetID) && guiUIFullTargetFlags & OWNED_MERC) ) + if ( (( guiUIFullTargetFlags & ENEMY_MERC ) && !( guiUIFullTargetFlags & UNCONSCIOUS_MERC )) || (AllowedToStealFromTeamMate(pSoldier->ubID, gusUIFullTargetID) && guiUIFullTargetFlags & OWNED_MERC) ) { sActionGridNo = FindAdjacentGridEx( pSoldier, gusUIFullTargetID->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo == -1 ) From 94a5972a8591061f165e65e0dcb126f3856f58d2 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:38:00 +0200 Subject: [PATCH 142/571] Perform explicit casts from UINT8 to UINT16 for SoldierID --- Strategic/Scheduling.cpp | 2 +- Tactical/Interface Items.h | 2 +- Tactical/Item Types.cpp | 4 ++-- Tactical/Soldier Control.cpp | 26 +++++++++++++------------- TileEngine/physics.cpp | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index f9dad5da..cd9c43d8 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -483,7 +483,7 @@ SCHEDULENODE& SCHEDULENODE::operator=(const _OLD_SCHEDULENODE& src) TranslateArrayFields(usData2, src.usData2, OLD_MAX_SCHEDULE_ACTIONS, INT16_INT32); TranslateArrayFields(ubAction, src.ubAction, OLD_MAX_SCHEDULE_ACTIONS, UINT8_UINT8); ubScheduleID = src.ubScheduleID; - ubSoldierID = src.ubSoldierID; + ubSoldierID = static_cast( src.ubSoldierID ); usFlags = src.usFlags; } return(*this); diff --git a/Tactical/Interface Items.h b/Tactical/Interface Items.h index 05192f76..a221e803 100644 --- a/Tactical/Interface Items.h +++ b/Tactical/Interface Items.h @@ -159,7 +159,7 @@ public: this->fCursorActive = src.fCursorActive; this->ItemPointerInfo = src.ItemPointerInfo; this->ubInvSlot = src.ubInvSlot; - this->ubSoldierID = src.ubSoldierID; + this->ubSoldierID = static_cast(src.ubSoldierID); return *this; } //could use a little tidying up diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index 85e2af84..db19977b 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -1566,7 +1566,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) (*this)[0]->data.misc.bDetonatorType = src.ugYucky.bDetonatorType; (*this)[0]->data.misc.usBombItem = src.ugYucky.usBombItem; (*this)[0]->data.misc.bDelay = src.ugYucky.bDelay; // includes bFrequency - (*this)[0]->data.misc.ubBombOwner = src.ugYucky.ubBombOwner; + (*this)[0]->data.misc.ubBombOwner = static_cast(src.ugYucky.ubBombOwner); (*this)[0]->data.misc.bActionValue = src.ugYucky.bActionValue; (*this)[0]->data.misc.ubTolerance = src.ugYucky.ubTolerance; // includes ubLocationID (*this)[0]->data.ubDirection = DIRECTION_IRRELEVANT; @@ -1658,7 +1658,7 @@ OBJECTTYPE& OBJECTTYPE::operator=(const OLD_OBJECTTYPE_101& src) (*this)[0]->data.misc.bDetonatorType = src.ugYucky.bDetonatorType; (*this)[0]->data.misc.usBombItem = src.ugYucky.usBombItem; (*this)[0]->data.misc.bDelay = src.ugYucky.bDelay; // includes bFrequency - (*this)[0]->data.misc.ubBombOwner = src.ugYucky.ubBombOwner; + (*this)[0]->data.misc.ubBombOwner = static_cast(src.ugYucky.ubBombOwner); (*this)[0]->data.misc.bActionValue = src.ugYucky.bActionValue; (*this)[0]->data.misc.ubTolerance = src.ugYucky.ubTolerance; // includes ubLocationID (*this)[0]->data.ubWireNetworkFlag = TRIPWIRE_NETWORK_OWNER_ENEMY; // it is always assumed that preplated traps are of hostile origin diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 673fbdbf..136973d9 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -632,7 +632,7 @@ void STRUCT_AIData::ConvertFrom_101_To_102( const OLDSOLDIERTYPE_101& src ) this->bMoved = src.bMoved; this->bHunting = src.bHunting; this->ubLastCall = src.ubLastCall; - this->ubCaller = src.ubCaller; + this->ubCaller = static_cast( src.ubCaller ); this->sCallerGridNo = src.sCallerGridNo; this->bCallPriority = src.bCallPriority; this->bCallActedUpon = src.bCallActedUpon; @@ -694,7 +694,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->sLastTwoLocations[0] = src.sLastTwoLocations[0]; this->sLastTwoLocations[1] = src.sLastTwoLocations[1]; - this->ubID = src.ubID; + this->ubID = static_cast( src.ubID ); //this->bReserved1 = src.bReserved1; this->ubBodyType = src.ubBodyType; @@ -717,7 +717,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->ubWaitActionToDo = src.ubWaitActionToDo; this->ubInsertionDirection = src.ubInsertionDirection; this->bGunType = src.bGunType; - this->ubOppNum = src.ubOppNum; + this->ubOppNum = static_cast( src.ubOppNum ); this->bLastRenderVisibleValue = src.bLastRenderVisibleValue; this->ubAttackingHand = src.ubAttackingHand; this->sWeightCarriedAtTurnStart = src.sWeightCarriedAtTurnStart; @@ -756,8 +756,8 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->uiAIDelay = src.uiAIDelay; this->sReloadDelay = src.sReloadDelay; - this->ubAttackerID = src.ubAttackerID; - this->ubPreviousAttackerID = src.ubPreviousAttackerID; + this->ubAttackerID = static_cast( src.ubAttackerID ); + this->ubPreviousAttackerID = static_cast( src.ubPreviousAttackerID ); this->sInsertionGridNo = src.sInsertionGridNo; @@ -808,7 +808,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->pCurrentShade = src.pCurrentShade; this->ubFadeLevel = src.ubFadeLevel; this->ubServiceCount = src.ubServiceCount; - this->ubServicePartner = src.ubServicePartner; + this->ubServicePartner = static_cast( src.ubServicePartner ); this->pThrowParams = src.pThrowParams; this->bReverse = src.bReverse; this->pLevelNode = src.pLevelNode; @@ -931,7 +931,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->ubSoldierClass = src.ubSoldierClass; //admin, elite, troop (creature types?) this->ubAPsLostToSuppression = src.ubAPsLostToSuppression; - this->ubSuppressorID = src.ubSuppressorID; + this->ubSuppressorID = static_cast( src.ubSuppressorID ); this->ubDesiredSquadAssignment = src.ubDesiredSquadAssignment; this->ubNumTraversalsAllowedToMerge = src.ubNumTraversalsAllowedToMerge; @@ -946,7 +946,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->bBlockedByAnotherMercDirection = src.bBlockedByAnotherMercDirection; this->usAttackingWeapon = src.usAttackingWeapon; this->bWeaponMode = src.bWeaponMode; - this->ubTargetID = src.ubTargetID; + this->ubTargetID = static_cast( src.ubTargetID ); this->bAIScheduleProgress = src.bAIScheduleProgress; this->sOffWorldGridNo = src.sOffWorldGridNo; this->pAniTile = src.pAniTile; @@ -966,8 +966,8 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->bOldBattleSnd = src.bOldBattleSnd; this->iBurstSoundID = src.iBurstSoundID; this->bSlotItemTakenFrom = src.bSlotItemTakenFrom; - this->ubAutoBandagingMedic = src.ubAutoBandagingMedic; - this->ubRobotRemoteHolderID = src.ubRobotRemoteHolderID; + this->ubAutoBandagingMedic = static_cast( src.ubAutoBandagingMedic ); + this->ubRobotRemoteHolderID = static_cast( src.ubRobotRemoteHolderID ); this->uiTimeOfLastContractUpdate = src.uiTimeOfLastContractUpdate; this->bTypeOfLastContract = src.bTypeOfLastContract; this->bTurnsCollapsed = src.bTurnsCollapsed; @@ -1003,7 +1003,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->usValueGoneUp = src.usValueGoneUp; this->ubNumLocateCycles = src.ubNumLocateCycles; this->ubDelayedMovementFlags = src.ubDelayedMovementFlags; - this->ubCTGTTargetID = src.ubCTGTTargetID; + this->ubCTGTTargetID = static_cast( src.ubCTGTTargetID ); this->uiMercChecksum = src.uiMercChecksum; @@ -1027,7 +1027,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->pGroup = src.pGroup; this->ubLeaveHistoryCode = src.ubLeaveHistoryCode; - this->bOverrideMoveSpeed = src.bOverrideMoveSpeed; + this->bOverrideMoveSpeed = static_cast( src.bOverrideMoveSpeed ); this->uiTimeSoldierWillArrive = src.uiTimeSoldierWillArrive; this->bVehicleUnderRepairID = src.bVehicleUnderRepairID; @@ -1040,7 +1040,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->iTuringSoundID = src.iTuringSoundID; this->ubLastDamageReason = src.ubLastDamageReason; this->uiTimeSinceLastBleedGrunt = src.uiTimeSinceLastBleedGrunt; - this->ubNextToPreviousAttackerID = src.ubNextToPreviousAttackerID; + this->ubNextToPreviousAttackerID = static_cast( src.ubNextToPreviousAttackerID ); this->bDoAutofire = src.bDoAutofire; this->numFlanks = src.numFlanks; this->lastFlankSpot = src.lastFlankSpot; diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index eb2179a8..f05398c2 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -160,7 +160,7 @@ REAL_OBJECT& REAL_OBJECT::operator =(OLD_REAL_OBJECT_101 &src) this->dLifeSpan = src.dLifeSpan; this->fFirstTimeMoved = src.fFirstTimeMoved; this->sFirstGridNo = src.sFirstGridNo; - this->ubOwner = src.ubOwner; + this->ubOwner = static_cast(src.ubOwner); this->ubActionCode = src.ubActionCode; this->uiActionData = src.uiActionData; this->fDropItem = src.fDropItem; @@ -175,7 +175,7 @@ REAL_OBJECT& REAL_OBJECT::operator =(OLD_REAL_OBJECT_101 &src) this->fPotentialForDebug = src.fPotentialForDebug; this->sLevelNodeGridNo = src.sLevelNodeGridNo; this->iSoundID = src.iSoundID; - this->ubLastTargetTakenDamage = src.ubLastTargetTakenDamage; + this->ubLastTargetTakenDamage = static_cast(src.ubLastTargetTakenDamage); return *this; } @@ -1120,10 +1120,10 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID ) { gTacticalStatus.ubAttackBusyCount++; DebugAttackBusy( String( "Incrementing attack busy because of delayed water explosion. Now %d\n", gTacticalStatus.ubAttackBusyCount ) ); - AniParams.ubKeyFrame1 = 11; + AniParams.ubKeyFrame1 = 11; AniParams.uiKeyFrame1Code = ANI_KEYFRAME_CHAIN_WATER_EXPLOSION; AniParams.uiUserData = pObject->Obj.usItem; - AniParams.ubUserData2 = pObject->ubOwner; + AniParams.ubUserData2 = pObject->ubOwner; } pNode = CreateAnimationTile( &AniParams ); From 191af4da49dff68cb3be738f1b66e5394986ce58 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:38:43 +0200 Subject: [PATCH 143/571] Update SoldierID constructors --- Tactical/Overhead Types.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index eb1a8571..2f0f548c 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -386,14 +386,31 @@ typedef struct SoldierID // Implicit conversion and constructor to provide compatibility with unchanged code // TODO: Remove once SoldierID is used everywhere and these are no longer needed inline operator UINT16() const { return i; } - SoldierID(const UINT16 val = 0) - : i(val) + + SoldierID(const UINT16 val = TOTAL_SOLDIERS) : i(val) + { + // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid + if ( i > TOTAL_SOLDIERS ) + i = TOTAL_SOLDIERS; + } + SoldierID ( const UINT32 val ) : i ( val ) + { + // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid + if ( i > TOTAL_SOLDIERS ) + i = TOTAL_SOLDIERS; + } + SoldierID ( const INT32 val ) : i ( val ) { // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid if ( i > TOTAL_SOLDIERS ) i = TOTAL_SOLDIERS; } + // No conversions from 8-bit integers! + SoldierID ( const UINT8 ) = delete; + SoldierID ( const INT8 ) = delete; + + SOLDIERTYPE* operator->() { return MercPtrs[i]; } const SOLDIERTYPE* operator->() const { return MercPtrs[i]; } inline operator SOLDIERTYPE* () { return MercPtrs[i]; } From 65c4cdd1d73f9b932d85fb4db7d0709d75d02b06 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:43:13 +0200 Subject: [PATCH 144/571] Suppress compiler warnings by using SoldierID::i directly --- Multiplayer/client.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 251f81f5..79d30606 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -2948,7 +2948,7 @@ void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yP #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - send_grenade ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n",gren.usItem, gren.sTargetGridNo , gren.ubID , guiPreRandomIndex ); + sprintf(tmpMPDbgString,"MP - send_grenade ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n",gren.usItem, gren.sTargetGridNo , gren.ubID.i , guiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif @@ -2974,7 +2974,7 @@ void recieveGRENADE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recieveGRENADE ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n",gren->usItem, gren->sTargetGridNo , gren->ubID , guiPreRandomIndex ); + sprintf(tmpMPDbgString,"MP - recieveGRENADE ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n",gren->usItem, gren->sTargetGridNo , gren->ubID.i , guiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif @@ -3021,7 +3021,7 @@ void recieveGRENADE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION char tmpMsg[128]; - sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recieveGRENADE()",gren->ubID); + sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recieveGRENADE()", gren->ubID.i); //ScreenMsg(FONT_RED,MSG_MPSYSTEM,tmpMsg); MPDebugMsg(tmpMsg); #endif @@ -3120,7 +3120,7 @@ void recieveGRENADERESULT (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION char tmpMsg[128]; - sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recieveGRENADERESULT()",gres->ubOwnerID); + sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recieveGRENADERESULT()", gres->ubOwnerID.i); //ScreenMsg(FONT_RED,MSG_MPSYSTEM,tmpMsg); MPDebugMsg(tmpMsg); #endif @@ -3146,7 +3146,7 @@ void send_plant_explosive (SoldierID ubID,UINT16 usItem,UINT8 ubItemStatus,UINT1 #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - send_plant_explosive ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i , uiWorldItemIndex : %i )\n",exp.usItem, exp.sGridNo , exp.ubID , guiPreRandomIndex , uiWorldItemIndex ); + sprintf(tmpMPDbgString,"MP - send_plant_explosive ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i , uiWorldItemIndex : %i )\n",exp.usItem, exp.sGridNo , exp.ubID.i , guiPreRandomIndex , uiWorldItemIndex ); MPDebugMsg(tmpMPDbgString); #endif @@ -3221,7 +3221,7 @@ void recievePLANTEXPLOSIVE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION char tmpMsg[128]; - sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recievePLANTEXPLOSIVE()",exp->ubID); + sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recievePLANTEXPLOSIVE()",exp->ubID.i); //ScreenMsg(FONT_RED,MSG_MPSYSTEM,tmpMsg); MPDebugMsg(tmpMsg); #endif @@ -3304,7 +3304,7 @@ void recieveDETONATEEXPLOSIVE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recieveDETONATEEXPLOSIVE ( MPTeam : %i , uiWorldIndex : %i , uiPreRandomIndex : %i , ubID : %i )\n",det->ubMPTeamIndex, det->uiWorldItemIndex , det->uiPreRandomIndex , det->ubID ); + sprintf(tmpMPDbgString,"MP - recieveDETONATEEXPLOSIVE ( MPTeam : %i , uiWorldIndex : %i , uiPreRandomIndex : %i , ubID : %i )\n",det->ubMPTeamIndex, det->uiWorldItemIndex , det->uiPreRandomIndex , det->ubID.i ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif @@ -3417,7 +3417,7 @@ void recieveDISARMEXPLOSIVE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recieveDISARMEXPLOSIVE ( MPTeam : %i , uiWorldItemIndex : %i , uiPreRandomIndex : %i , ubID : %i , sGridNo : %i )\n",disarm->ubMPTeamIndex, disarm->uiWorldItemIndex , disarm->uiPreRandomIndex , disarm->ubID , disarm->sGridNo ); + sprintf(tmpMPDbgString,"MP - recieveDISARMEXPLOSIVE ( MPTeam : %i , uiWorldItemIndex : %i , uiPreRandomIndex : %i , ubID : %i , sGridNo : %i )\n",disarm->ubMPTeamIndex, disarm->uiWorldItemIndex , disarm->uiPreRandomIndex , disarm->ubID.i, disarm->sGridNo ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif @@ -3480,7 +3480,7 @@ void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, SoldierID #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - send_spreadeffect ( sGridNo : %i , ubRadius : %i , usItem : %i , ubOwner : %i , fSubsequent : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef.sGridNo, sef.ubRadius ,sef.usItem, sef.ubOwner, sef.fSubsequent, sef.bLevel, sef.iSmokeEffectID, sef.uiPreRandomIndex ); + sprintf(tmpMPDbgString,"MP - send_spreadeffect ( sGridNo : %i , ubRadius : %i , usItem : %i , ubOwner : %i , fSubsequent : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef.sGridNo, sef.ubRadius ,sef.usItem, sef.ubOwner.i, sef.fSubsequent, sef.bLevel, sef.iSmokeEffectID, sef.uiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); #endif @@ -3502,7 +3502,7 @@ void recieveSPREADEFFECT (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recieveSPREADEFFECT ( sGridNo : %i , ubRadius : %i , usItem : %i , ubOwner : %i , fSubsequent : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef->sGridNo, sef->ubRadius ,sef->usItem, sef->ubOwner, sef->fSubsequent, sef->bLevel, sef->iSmokeEffectID, sef->uiPreRandomIndex ); + sprintf(tmpMPDbgString,"MP - recieveSPREADEFFECT ( sGridNo : %i , ubRadius : %i , usItem : %i , ubOwner : %i , fSubsequent : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef->sGridNo, sef->ubRadius ,sef->usItem, sef->ubOwner.i, sef->fSubsequent, sef->bLevel, sef->iSmokeEffectID, sef->uiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); #endif @@ -3543,7 +3543,7 @@ void recieveSPREADEFFECT (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION char tmpMsg2[128]; - sprintf(tmpMsg2,"ERROR! - Invalid Soldier pointer from ubID %i in recieveSPREADEFFECT()",sef->ubOwner); + sprintf(tmpMsg2,"ERROR! - Invalid Soldier pointer from ubID %i in recieveSPREADEFFECT()",sef->ubOwner.i ); //ScreenMsg(FONT_RED,MSG_MPSYSTEM,tmpMsg); MPDebugMsg(tmpMsg2); #endif @@ -3564,7 +3564,7 @@ void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ub #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - send_newsmokeeffect ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef.sGridNo, sef.usItem, sef.ubOwner, sef.bLevel, sef.iSmokeEffectID, sef.uiPreRandomIndex ); + sprintf(tmpMPDbgString,"MP - send_newsmokeeffect ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef.sGridNo, sef.usItem, sef.ubOwner.i, sef.bLevel, sef.iSmokeEffectID, sef.uiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); #endif @@ -3586,7 +3586,7 @@ void recieveNEWSMOKEEFFECT (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recieveNEWSMOKEEFFECT ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef->sGridNo, sef->usItem, sef->ubOwner, sef->bLevel, sef->iSmokeEffectID, sef->uiPreRandomIndex ); + sprintf(tmpMPDbgString,"MP - recieveNEWSMOKEEFFECT ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i , uiPreRandomIndex : %i )\n",sef->sGridNo, sef->usItem, sef->ubOwner.i, sef->bLevel, sef->iSmokeEffectID, sef->uiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); #endif @@ -3604,7 +3604,7 @@ void recieveNEWSMOKEEFFECT (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION char tmpMsg[128]; - sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recieveNEWSMOKEEFFECT()",sef->ubOwner); + sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recieveNEWSMOKEEFFECT()",sef->ubOwner.i ); //ScreenMsg(FONT_RED,MSG_MPSYSTEM,tmpMsg); MPDebugMsg(tmpMsg); #endif @@ -3626,7 +3626,7 @@ void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID, INT16 sS #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - send_gasdamage ( ubSoldierID : %i , usExplosiveClassID : %i , sSubsequent : %i , recompileMoveCosts : %i , sWoundAmt : %i , sBreathAmt : %i , ubOwner : %i )\n", exp.ubSoldierID , usExplosiveClassID , sSubsequent , fRecompileMovementCosts , sWoundAmt , sBreathAmt , exp.ubAttackerID ); + sprintf(tmpMPDbgString, "MP - send_gasdamage ( ubSoldierID : %i , usExplosiveClassID : %i , sSubsequent : %i , recompileMoveCosts : %i , sWoundAmt : %i , sBreathAmt : %i , ubOwner : %i )\n", exp.ubSoldierID.i, usExplosiveClassID , sSubsequent , fRecompileMovementCosts , sWoundAmt , sBreathAmt , exp.ubAttackerID.i ); MPDebugMsg(tmpMPDbgString); #endif @@ -3649,7 +3649,7 @@ void send_explosivedamage( SoldierID ubPerson, SoldierID ubOwner, INT32 sBombGri #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - send_explosivedamage ( ubPerson : %i , ubOwner : %i , sBombGridNo : %i , sWoundAmt : %i , sBreathAmt : %i , uiDist : %i , usItem : %i , sSubs : %i )\n",ubPerson, ubOwner , sBombGridNo , sWoundAmt , sBreathAmt , uiDist , usItem , sSubsequent ); + sprintf(tmpMPDbgString, "MP - send_explosivedamage ( ubPerson : %i , ubOwner : %i , sBombGridNo : %i , sWoundAmt : %i , sBreathAmt : %i , uiDist : %i , usItem : %i , sSubs : %i )\n", ubPerson.i, ubOwner.i, sBombGridNo , sWoundAmt , sBreathAmt , uiDist , usItem , sSubsequent ); MPDebugMsg(tmpMPDbgString); #endif @@ -3673,7 +3673,7 @@ void recieveEXPLOSIONDAMAGE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recieveEXPLOSIONDAMAGE ( ubDamageFunc : %i , ubSoldierID : %i , ubAttackerID : %i , usItem : %i , usExplosiveClassID : %i , sWoundAmt : %i , sBreathAmt : %i , uiDist : %i , sSubs : %i , sBombGridNo : %i , uiPreRandomIndex : %i )\n", exp->ubDamageFunc , exp->ubSoldierID , exp->ubAttackerID , exp->usItem , exp->usExplosiveClassID , exp->sWoundAmt , exp->sBreathAmt , exp->uiDist , exp->sSubsequent , exp->sBombGridNo , exp->uiPreRandomIndex ); + sprintf(tmpMPDbgString, "MP - recieveEXPLOSIONDAMAGE ( ubDamageFunc : %i , ubSoldierID : %i , ubAttackerID : %i , usItem : %i , usExplosiveClassID : %i , sWoundAmt : %i , sBreathAmt : %i , uiDist : %i , sSubs : %i , sBombGridNo : %i , uiPreRandomIndex : %i )\n", exp->ubDamageFunc , exp->ubSoldierID.i, exp->ubAttackerID.i, exp->usItem , exp->usExplosiveClassID , exp->sWoundAmt , exp->sBreathAmt , exp->uiDist , exp->sSubsequent , exp->sBombGridNo , exp->uiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); #endif @@ -3698,7 +3698,7 @@ void recieveEXPLOSIONDAMAGE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION char tmpMsg[128]; - sprintf(tmpMsg,"ERROR! - Invalid Soldier pointer from ubID %i in recieveEXPLOSIONDAMAGE()",exp->ubAttackerID); + sprintf(tmpMsg, "ERROR! - Invalid Soldier pointer from ubID %i in recieveEXPLOSIONDAMAGE()", exp->ubAttackerID.i ); //ScreenMsg(FONT_RED,MSG_MPSYSTEM,tmpMsg); MPDebugMsg(tmpMsg); #endif From 47824c97a193846a8a045fb39f96ed4ede184d40 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:58:04 +0200 Subject: [PATCH 145/571] Fix UB compilation --- Tactical/Interface Dialogue.cpp | 4 ++-- Tactical/Interface.cpp | 4 ++-- Tactical/Ja25_Tactical.cpp | 8 ++++---- Tactical/Ja25_Tactical.h | 2 +- Tactical/Overhead Types.h | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index 2ac44952..6bb0bf63 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -5484,7 +5484,7 @@ BOOLEAN IsMineEntranceInSectorI13AtThisGridNo( UINT32 sGridNo ) void HaveBiggensDetonatingExplosivesByTheMine() { SOLDIERTYPE *pSoldier = NULL; - UINT8 ubID=NOBODY; + SoldierID ubID = NOBODY; pSoldier = FindSoldierByProfileID( BIGGENS_UB , FALSE ); //BIGGENS if( pSoldier != NULL ) @@ -5638,7 +5638,7 @@ void HandleRaulBlowingHimselfUp() usItem = HAND_GRENADE; INT16 sX, sY; ConvertGridNoToCenterCellXY(pSoldier->sGridNo, &sX, &sY); - IgniteExplosion( RAUL_UB, sX, sY, 0, pSoldier->sGridNo, usItem, pSoldier->pathing.bLevel ); + IgniteExplosion( pSoldier->ubID, sX, sY, 0, pSoldier->sGridNo, usItem, pSoldier->pathing.bLevel ); SetJa25GeneralFlag( JA_GF__RAUL_BLOW_HIMSELF_UP ); } diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 3d543bf6..615cec5a 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -4338,7 +4338,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_EXPLODE_DOOR], APBPConstants[BP_EXPLODE_DOOR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_EXPLODE ); } @@ -4397,7 +4397,7 @@ void BtnDoorMenuCallback(GUI_BUTTON *btn,INT32 reason) if ( EnoughPoints( gOpenDoorMenu.pSoldier, APBPConstants[AP_USE_CROWBAR], APBPConstants[BP_USE_CROWBAR], FALSE ) ) { // Set UI - SetUIBusy( (UINT8)gOpenDoorMenu.pSoldier->ubID ); + SetUIBusy( gOpenDoorMenu.pSoldier->ubID ); InteractWithClosedDoor( gOpenDoorMenu.pSoldier, HANDLE_DOOR_CROWBAR ); } diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 42cd8ba2..a56d530e 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -544,7 +544,7 @@ SoldierID RandomSoldierIdFromNewMercsOnPlayerTeam() } } -UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ) +UINT8 RandomArrayOfQualifiedMercs( SoldierID *pRandomSoldierIdArray ) { UINT8 usNumMercsPresent; SoldierID SoldierIdArray[NUM_MERCS_WITH_NEW_QUOTES]; @@ -586,9 +586,9 @@ UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ) UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ) { - UINT8 usNumMercs; - UINT8 RandomSoldierIdArray[ NUM_MERCS_WITH_NEW_QUOTES ]; - UINT8 ubNumberDifMercsAssigned=0; + UINT8 usNumMercs; + SoldierID RandomSoldierIdArray[ NUM_MERCS_WITH_NEW_QUOTES ]; + UINT8 ubNumberDifMercsAssigned=0; usNumMercs = RandomArrayOfQualifiedMercs( RandomSoldierIdArray ); diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index b3c56725..5e5c6603 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -47,7 +47,7 @@ BOOLEAN SayQuoteFromAllNewHiredMercButDoGastonLast( UINT8 ubProfile, UINT32 uiQu //Pass in an array of size NUM_MERCS_WITH_NEW_QUOTES, array will be filled with //random soldier IDs of the qualified mercs -UINT8 RandomArrayOfQualifiedMercs( UINT8 *pRandomSoldierIdArray ); +UINT8 RandomArrayOfQualifiedMercs( SoldierID *pRandomSoldierIdArray ); extern UINT8 Get3RandomQualifiedMercs( SoldierID *pSoldierId1, SoldierID *pSoldierId2, SoldierID *pSoldierId3 ); diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 2f0f548c..40d23a03 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -393,13 +393,13 @@ typedef struct SoldierID if ( i > TOTAL_SOLDIERS ) i = TOTAL_SOLDIERS; } - SoldierID ( const UINT32 val ) : i ( val ) + SoldierID( const UINT32 val ) : i( val ) { // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid if ( i > TOTAL_SOLDIERS ) i = TOTAL_SOLDIERS; } - SoldierID ( const INT32 val ) : i ( val ) + constexpr SoldierID( const INT32 val ) : i( val ) { // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid if ( i > TOTAL_SOLDIERS ) @@ -407,8 +407,8 @@ typedef struct SoldierID } // No conversions from 8-bit integers! - SoldierID ( const UINT8 ) = delete; - SoldierID ( const INT8 ) = delete; + SoldierID( const UINT8 ) = delete; + SoldierID( const INT8 ) = delete; SOLDIERTYPE* operator->() { return MercPtrs[i]; } @@ -488,5 +488,5 @@ inline SoldierID operator++(SoldierID lhs) } //TODO: Change this to constexpr after SoldierID is ready and the user defined constructor from uint16 is not needed anymore. -inline const SoldierID NOBODY{ TOTAL_SOLDIERS }; +inline constexpr SoldierID NOBODY{ TOTAL_SOLDIERS }; #endif From 18673f3a29fefe0e102012543dcac0d9c43dde15 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:58:14 +0200 Subject: [PATCH 146/571] Remove compiler warning --- TileEngine/Explosion Control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index ee31dac1..e8f6cc3e 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -250,7 +250,7 @@ void InternalIgniteExplosion( SoldierID ubOwner, INT16 sX, INT16 sY, INT16 sZ, I #ifdef JA2BETAVERSION if (is_networked) { CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"InternalIgniteExplosion ( ubOwner : %i , sX : %i , sY : %i , sZ : %i , sGridNo : %i , usItem : %i , fLocate : %i , bLevel : %i , ubDirection : %i )\n",ubOwner, sX , sY , sZ , sGridNo , usItem , (int)fLocate , bLevel, ubDirection ); + sprintf(tmpMPDbgString,"InternalIgniteExplosion ( ubOwner : %i , sX : %i , sY : %i , sZ : %i , sGridNo : %i , usItem : %i , fLocate : %i , bLevel : %i , ubDirection : %i )\n",ubOwner.i, sX , sY , sZ , sGridNo , usItem , (int)fLocate , bLevel, ubDirection ); MPDebugMsg(tmpMPDbgString); } #endif From 3f448a62fb1a999b171f6ad037d734a6b234c087 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:08:46 +0200 Subject: [PATCH 147/571] Remove unused functions --- Tactical/Overhead.cpp | 19 ------------------- Tactical/Overhead.h | 2 -- 2 files changed, 21 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 5ea1d763..21d70934 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -274,25 +274,6 @@ UINT32 guiNumMercSlots = 0; SOLDIERTYPE* AwaySlots[ TOTAL_SOLDIERS ]; UINT32 guiNumAwaySlots = 0; -SOLDIERTYPE* SoldierFromID(const SoldierID id) -{ - if (id >= TOTAL_SOLDIERS) - { - return nullptr; - } - - return &Menptr[id.i]; -} - -SOLDIERTYPE* SoldierFromID(const SoldierID id, SOLDIERTYPE* Array[TOTAL_SOLDIERS]) -{ - if (id >= TOTAL_SOLDIERS) - { - return nullptr; - } - - return Array[id.i]; -} // DEF: changed to have client wait for gPlayerNum assigned from host UINT8 gbPlayerNum = 0; diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index e9a09bbb..fea2d805 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -433,7 +433,5 @@ BOOLEAN IsCivFactionMemberAliveInSector( UINT8 usCivilianGroup ); BOOLEAN IsFreeSlotAvailable( int aTeam ); void AttemptToCapturePlayerSoldiers(); -SOLDIERTYPE* SoldierFromID(const SoldierID id); -SOLDIERTYPE* SoldierFromID(const SoldierID id, SOLDIERTYPE* Array[TOTAL_SOLDIERS]); #endif From 5b4be9bcdbf6e8e907c6967ae9782beac6afc0d8 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:55:36 +0200 Subject: [PATCH 148/571] Convert to SoldierID --- Laptop/insurance Contract.cpp | 78 ++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index 418df377..ab97fb1b 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -166,8 +166,8 @@ void InsuranceContractUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering ); INT8 CountInsurableMercs(); void DisableInsuranceContractNextPreviousbuttons(); void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate); -void HandleAcceptButton( UINT16 ubSoldierID, UINT8 ubFormID ); -FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue ); +void HandleAcceptButton( SoldierID ubSoldierID, UINT8 ubFormID ); +FLOAT DiffFromNormRatio( INT16 sThisValue, INT16 sNormalValue ); void InsContractNoMercsPopupCallBack( UINT8 bExitValue ); void BuildInsuranceArray(); BOOLEAN MercIsInsurable( SOLDIERTYPE *pSoldier ); @@ -177,8 +177,8 @@ UINT32 GetTimeRemainingOnSoldiersContract( SOLDIERTYPE *pSoldier ); UINT32 GetTimeRemainingOnSoldiersInsuranceContract( SOLDIERTYPE *pSoldier ); void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm1, UINT32 *puiAcceptButton ); BOOLEAN CanSoldierExtendInsuranceContract( SOLDIERTYPE *pSoldier ); -INT32 CalculateSoldiersInsuranceContractLength( SOLDIERTYPE *pSoldier ); -INT32 CalcStartDayOfInsurance( SOLDIERTYPE *pSoldier ); +INT32 CalculateSoldiersInsuranceContractLength( SOLDIERTYPE *pSoldier ); +INT32 CalcStartDayOfInsurance( SOLDIERTYPE *pSoldier ); BOOLEAN AreAnyAimMercsOnTeam( ); //ppp @@ -394,12 +394,14 @@ void RenderInsuranceContract() { sMercID = gubInsuranceMercArray[ sNextMercID ]; - pSoldier = &Menptr[ GetSoldierIDFromMercID( (UINT8) sMercID ) ]; - - if( ( sMercID != -1 ) && MercIsInsurable( pSoldier ) ) + SoldierID ID = GetSoldierIDFromMercID( sMercID ); + if ( ID != NOBODY ) { - DisplayOrderGrid( ubCount, (UINT8)sMercID ); - ubCount++; + if( ( sMercID != -1 ) && MercIsInsurable( ID ) ) + { + DisplayOrderGrid( ubCount, (UINT8)sMercID ); + ubCount++; + } } sNextMercID++; @@ -499,18 +501,22 @@ void BtnInsContractNextButtonCallBack(GUI_BUTTON *btn,INT32 reason) BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ) { - VOBJECT_DESC VObjectDesc; - HVOBJECT hPixHandle; - UINT16 usPosX, usPosY; - UINT32 uiInsMercFaceImage; - INT32 iCostOfContract=0; - char sTemp[100]; - CHAR16 sText[800]; - BOOLEAN fDisplayMercContractStateTextColorInRed = FALSE; - - SOLDIERTYPE *pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ]; + VOBJECT_DESC VObjectDesc; + HVOBJECT hPixHandle; + UINT16 usPosX, usPosY; + UINT32 uiInsMercFaceImage; + INT32 iCostOfContract=0; + char sTemp[100]; + CHAR16 sText[800]; + BOOLEAN fDisplayMercContractStateTextColorInRed = FALSE; + SoldierID usID = GetSoldierIDFromMercID( ubMercID ); + if ( usID == NOBODY ) + { + return(FALSE); + } + SOLDIERTYPE *pSoldier = usID; usPosX=usPosY=0; switch( ubGridNumber ) @@ -747,8 +753,8 @@ void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); - INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm1 ); + UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + SoldierID ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm1 ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -759,7 +765,7 @@ void BtnInsuranceAcceptClearForm1ButtonCallback(GUI_BUTTON *btn,INT32 reason) HandleAcceptButton( ubSoldierID, 1 ); //specify the length of the insurance contract - Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm1InsuranceLengthNumber; + ubSoldierID->iTotalLengthOfInsuranceContract = gsForm1InsuranceLengthNumber; //reset the insurance length gsForm1InsuranceLengthNumber = 0; @@ -791,8 +797,8 @@ void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); - INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm2 ); + UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + SoldierID ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm2 ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -803,7 +809,7 @@ void BtnInsuranceAcceptClearForm2ButtonCallback(GUI_BUTTON *btn,INT32 reason) HandleAcceptButton( ubSoldierID, 2 ); //specify the length of the insurance contract - Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm2InsuranceLengthNumber; + ubSoldierID->iTotalLengthOfInsuranceContract = gsForm2InsuranceLengthNumber; //reset the insurance length gsForm2InsuranceLengthNumber = 0; @@ -836,8 +842,8 @@ void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason) { if (btn->uiFlags & BUTTON_CLICKED_ON) { - UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); - INT16 ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm3 ); + UINT8 ubButton = (UINT8) MSYS_GetBtnUserData( btn, 0 ); + SoldierID ubSoldierID = GetSoldierIDFromMercID( gubMercIDForMercInForm3 ); btn->uiFlags &= (~BUTTON_CLICKED_ON ); @@ -848,7 +854,7 @@ void BtnInsuranceAcceptClearForm3ButtonCallback(GUI_BUTTON *btn,INT32 reason) HandleAcceptButton( ubSoldierID, 3 ); //specify the length of the insurance contract - Menptr[ ubSoldierID ].iTotalLengthOfInsuranceContract = gsForm3InsuranceLengthNumber; + ubSoldierID->iTotalLengthOfInsuranceContract = gsForm3InsuranceLengthNumber; //reset the insurance length gsForm3InsuranceLengthNumber = 0; @@ -1067,12 +1073,12 @@ void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate) -void HandleAcceptButton( UINT16 ubSoldierID, UINT8 ubFormID ) +void HandleAcceptButton( SoldierID ubSoldierID, UINT8 ubFormID ) { //passed in either 1,2,3 should be 0,1,2 ubFormID--; - PurchaseOrExtendInsuranceForSoldier( &Menptr[ ubSoldierID ], CalculateSoldiersInsuranceContractLength( &Menptr[ ubSoldierID ] ) ); + PurchaseOrExtendInsuranceForSoldier( ubSoldierID, CalculateSoldiersInsuranceContractLength( ubSoldierID ) ); RenderInsuranceContract(); } @@ -1139,7 +1145,7 @@ INT32 CalculateInsuranceContractCost( INT32 iLength, UINT8 ubMercID ) SOLDIERTYPE *pSoldier; - pSoldier = &Menptr[ GetSoldierIDFromMercID( ubMercID ) ]; + pSoldier = GetSoldierIDFromMercID( ubMercID ); // only mercs with at least 2 days to go on their employment contract are insurable @@ -1458,7 +1464,7 @@ void EndInsuranceInvestigation( UINT16 ubPayoutID ) void InsuranceContractPayLifeInsuranceForDeadMerc( UINT16 ubPayoutID ) { //if the mercs id number is the same what is in the soldier array - if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID == Menptr[ LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID ].ubID ) + if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID == LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID->ubID ) { // and if the soldier is still active ( player hasn't removed carcass yet ), reset insurance flag if( LaptopSaveInfo.pLifeInsurancePayouts[ ubPayoutID ].ubSoldierID->bActive ) @@ -1552,14 +1558,12 @@ void EnableDisableInsuranceContractAcceptButtons() void EnableDisableIndividualInsuranceContractButton( UINT8 ubMercIDForMercInForm, UINT32 *puiAcceptButton ) { - INT16 sSoldierID = 0; - - sSoldierID = GetSoldierIDFromMercID( ubMercIDForMercInForm ); - if( sSoldierID == - 1) + SoldierID sSoldierID = GetSoldierIDFromMercID( ubMercIDForMercInForm ); + if( sSoldierID == NOBODY) return; // if the soldiers contract can be extended, enable the button - if( CanSoldierExtendInsuranceContract( &Menptr[ sSoldierID ] ) ) + if( CanSoldierExtendInsuranceContract( sSoldierID ) ) EnableButton( *puiAcceptButton ); // else the soldier cant extend their insurance contract, disable the button From ff638a5473415fc3e8673c8e790e857e90dbdcce Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:01:41 +0200 Subject: [PATCH 149/571] Convert to SoldierID --- Laptop/AimMembers.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index aa045033..74a83ee1 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -2397,9 +2397,9 @@ INT8 AimMemberHireMerc() MERC_HIRE_STRUCT HireMercStruct; // UINT8 ubCurrentSoldier = AimMercArray[gbCurrentIndex]; UINT8 ubCurrentSoldier = gAimAvailability[AimMercArray[gbCurrentIndex]].ProfilId; - INT8 bReturnCode; - INT16 sSoldierID=0; - INT8 bTypeOfContract=0; + INT8 bReturnCode; + SoldierID sSoldierID = NOBODY; + INT8 bTypeOfContract=0; if( LaptopSaveInfo.iCurrentBalance < giContractAmount ) @@ -2475,9 +2475,10 @@ INT8 AimMemberHireMerc() //Set the type of contract the merc is on sSoldierID = GetSoldierIDFromMercID( ubCurrentSoldier ); - if( sSoldierID == -1 ) + if( sSoldierID == NOBODY ) return( FALSE ); - Menptr[ sSoldierID ].bTypeOfLastContract = bTypeOfContract; + + sSoldierID->bTypeOfLastContract = bTypeOfContract; //add an entry in the finacial page for the hiring of the merc From 534ce662f3a155519a068149d675cd8efd36bc63 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:08:26 +0200 Subject: [PATCH 150/571] Convert to SoldierID --- Laptop/personnel.cpp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index be713290..4f985494 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -326,7 +326,7 @@ void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ); void CreatePersonnelButtons( void ); void DeletePersonnelButtons( void ); void DisplayHeader( void ); -void DisplayCharName( INT32 iId, INT32 iSlot ); +void DisplayCharName( SoldierID iId, INT32 iSlot ); void DisplayCharStats(INT32 iId, INT32 iSlot); void DisplayCharPersonality( INT32 iId, INT32 iSlot ); void SetPersonnelButtonStates( void ); @@ -1268,7 +1268,7 @@ void DisplayHeader( void ) } -void DisplayCharName( INT32 iId, INT32 iSlot ) +void DisplayCharName( SoldierID Id, INT32 iSlot ) { // get merc's nickName, assignment, and sector location info INT16 sX, sY; @@ -1280,7 +1280,11 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) sTownName[0] = L'\0'; - pSoldier=MercPtrs[iId]; + if ( Id == NOBODY ) + { + return; + } + pSoldier = Id; SetFont(CHAR_NAME_FONT); SetFontForeground(PERS_TEXT_FONT_COLOR); @@ -1291,16 +1295,16 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) return; } - if( Menptr[iId].bAssignment == ASSIGNMENT_POW ) + if( pSoldier->bAssignment == ASSIGNMENT_POW ) { } - else if( Menptr[iId].bAssignment == IN_TRANSIT ) + else if( pSoldier->bAssignment == IN_TRANSIT ) { } else { // name of town, if any - bTownId = GetTownIdForSector( Menptr[iId].sSectorX, Menptr[iId].sSectorY ); + bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); if( bTownId != BLANK_SECTOR ) { @@ -1313,12 +1317,12 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) if( sTownName[0] != L'\0' ) { //nick name - town name - swprintf( sString, L"%s - %s", gMercProfiles[Menptr[iId].ubProfile].zNickname, sTownName ); + swprintf( sString, L"%s - %s", gMercProfiles[pSoldier->ubProfile].zNickname, sTownName ); } else { //nick name - swprintf( sString, L"%s", gMercProfiles[Menptr[iId].ubProfile].zNickname ); + swprintf( sString, L"%s", gMercProfiles[pSoldier->ubProfile].zNickname ); } @@ -1334,10 +1338,10 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) //Display the mercs name mprintf( sX + iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y, sString ); - if ( gGameExternalOptions.fUseXMLSquadNames && Menptr[iId].bAssignment < min(ON_DUTY, gSquadNameVector.size() ) ) - swprintf( sString, L"%s", gSquadNameVector[Menptr[iId].bAssignment].c_str() ); + if ( gGameExternalOptions.fUseXMLSquadNames && pSoldier->bAssignment < min(ON_DUTY, gSquadNameVector.size() ) ) + swprintf( sString, L"%s", gSquadNameVector[pSoldier->bAssignment].c_str() ); else - swprintf( sString, L"%s", pPersonnelAssignmentStrings[Menptr[iId].bAssignment]); + swprintf( sString, L"%s", pPersonnelAssignmentStrings[pSoldier->bAssignment]); // nick name - assignment FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH + 90 , 0,sString,CHAR_NAME_FONT, &sX, &sY ); @@ -1356,36 +1360,36 @@ void DisplayCharName( INT32 iId, INT32 iSlot ) // //first get height of text to be displayed - iHeightOfText = DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[Menptr[iId].ubProfile].zName, 0, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ); + iHeightOfText = DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[pSoldier->ubProfile].zName, 0, FALSE, CENTER_JUSTIFIED | DONT_DISPLAY_TEXT ); //if the string will rap if( ( iHeightOfText - 2 ) > GetFontHeight( PERS_FONT ) ) { //raise where we display it, and rap it - DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y - GetFontHeight( PERS_FONT )), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[Menptr[iId].ubProfile].zName, 0, FALSE, CENTER_JUSTIFIED); + DisplayWrappedString(IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y - GetFontHeight( PERS_FONT )), IMAGE_NAME_WIDTH, 1, PERS_FONT, PERS_FONT_COLOR, gMercProfiles[pSoldier->ubProfile].zName, 0, FALSE, CENTER_JUSTIFIED); } else { - DrawTextToScreen( gMercProfiles[Menptr[iId].ubProfile].zName, IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, PERS_FONT, PERS_FONT_COLOR, 0, FALSE, CENTER_JUSTIFIED ); + DrawTextToScreen( gMercProfiles[pSoldier->ubProfile].zName, IMAGE_BOX_X, (UINT16)(IMAGE_BOX_Y+IMAGE_FULL_NAME_OFFSET_Y), IMAGE_NAME_WIDTH, PERS_FONT, PERS_FONT_COLOR, 0, FALSE, CENTER_JUSTIFIED ); } /* Moved so the name of the town will be in the same line as the name - if( Menptr[iId].bAssignment == ASSIGNMENT_POW ) + if( pSoldier->bAssignment == ASSIGNMENT_POW ) { // FindFontCenterCoordinates(IMAGE_BOX_X-5,0,IMAGE_BOX_WIDTH, 0,pPOWStrings[ 1 ],CHAR_NAME_FONT, &sX, &sY ); // mprintf(sX+iSlot*IMAGE_BOX_WIDTH, CHAR_NAME_Y+20,pPOWStrings[ 1 ] ); } - else if( Menptr[iId].bAssignment == IN_TRANSIT ) + else if( pSoldier->bAssignment == IN_TRANSIT ) { return; } else { // name of town, if any - bTownId = GetTownIdForSector( Menptr[iId].sSectorX, Menptr[iId].sSectorY ); + bTownId = GetTownIdForSector( pSoldier->sSectorX, pSoldier->sSectorY ); if( bTownId != BLANK_SECTOR ) { From be5c4b16018ebf033787dcf996825a88c908a876 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:41:07 +0200 Subject: [PATCH 151/571] Convert to SoldierID --- Laptop/personnel.cpp | 220 ++++++++++++++++++++----------------------- 1 file changed, 104 insertions(+), 116 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 4f985494..4a63b18a 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -388,7 +388,7 @@ void UpDateStateOfStartButton( void ); void HandlePersonnelKeyboard( void ); -void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ); +void DisplayEmploymentinformation( SoldierID iId, INT32 iSlot ); @@ -6992,7 +6992,7 @@ BOOLEAN IsPastMercOther( INT32 iId ) } } -void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) +void DisplayEmploymentinformation( SoldierID iId, INT32 iSlot ) { INT32 iCounter=0; CHAR16 sString[50]; @@ -7011,73 +7011,74 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) } } - if( Menptr[iId].flags.uiStatusFlags & SOLDIER_VEHICLE ) + SOLDIERTYPE *pSoldier = iId; + const MERCPROFILESTRUCT *pMercProfile = &gMercProfiles[pSoldier->ubProfile]; + const STRUCT_Records *pRecords = &pMercProfile->records; + + if( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } // display the stats for a char - for(iCounter=0;iCounter ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC || pSoldier->ubProfile == SLAY ) + { + INT32 iTimeLeftOnContract = CalcTimeLeftOnMercContract( pSoldier ); + + //if the merc is in transit + if( pSoldier->bAssignment == IN_TRANSIT ) { - INT32 iTimeLeftOnContract = CalcTimeLeftOnMercContract( &Menptr[iId] ); - - //if the merc is in transit - if( Menptr[iId ].bAssignment == IN_TRANSIT ) + //and if the time left on the contract is greater than the contract time + if( iTimeLeftOnContract > (INT32)( pSoldier->iTotalContractLength * uiMinutesInDay ) ) { - //and if the ttime left on the cotract is greater then the contract time - if( iTimeLeftOnContract > (INT32)( Menptr[iId].iTotalContractLength * uiMinutesInDay ) ) - { - iTimeLeftOnContract = ( Menptr[iId].iTotalContractLength * uiMinutesInDay ); - } + iTimeLeftOnContract = ( pSoldier->iTotalContractLength * uiMinutesInDay ); } - // if there is going to be a both days and hours left on the contract - if( iTimeLeftOnContract / uiMinutesInDay ) - { - swprintf(sString, L"%d%s %d%s / %d%s",( iTimeLeftOnContract / uiMinutesInDay ), gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], (iTimeLeftOnContract % uiMinutesInDay)/60, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); - } - - //else there is under a day left - else - { - //DEF: removed 2/7/99 - swprintf(sString, L"%d%s / %d%s", (iTimeLeftOnContract % uiMinutesInDay)/60, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); - } - } - else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) + + UINT32 days = iTimeLeftOnContract / uiMinutesInDay; + UINT32 hours = (iTimeLeftOnContract % uiMinutesInDay) / 60; + + // if there is going to be a both days and hours left on the contract + if( days > 0) { -// swprintf(sString, L"%d%s / %d%s",Menptr[iId].iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ], ( GetWorldTotalMin( ) -Menptr[iId].iStartContractTime ) / ( 24 * 60 ), gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); - - wcscpy( sString, gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + swprintf( sString, L"%d%s %d%s / %d%s", days, gpStrategicString[STR_PB_DAYS_ABBREVIATION], hours, gpStrategicString[STR_PB_HOURS_ABBREVIATION], pSoldier->iTotalContractLength, gpStrategicString[STR_PB_DAYS_ABBREVIATION] ); + mprintf( x, y, pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT] ); } + + //else there is under a day left else { - wcscpy( sString, gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT]); + //DEF: removed 2/7/99 + swprintf(sString, L"%d%s / %d%s", hours, gpStrategicString[ STR_PB_HOURS_ABBREVIATION ], pSoldier->iTotalContractLength, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ]); + mprintf( x, y, pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT] ); } + + } + else + { + wcscpy( sString, gpStrategicString[ STR_PB_NOTAPPLICABLE_ABBREVIATION ] ); + mprintf( x, y, pPersonnelScreenStrings[PRSNL_TXT_CURRENT_CONTRACT] ); + } #endif - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + FindFontRightCoordinates( (INT16)(x + Prsnl_DATA_OffSetX), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, y, sString ); } break; @@ -7086,14 +7087,14 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) case 1: // total contract time served - mprintf((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter].y,pPersonnelScreenStrings[PRSNL_TXT_TOTAL_SERVICE]); + mprintf( x, y, pPersonnelScreenStrings[PRSNL_TXT_TOTAL_SERVICE] ); //./DEF 2/4/99: total service days used to be calced as 'days -1' - swprintf(sString, L"%d %s",gMercProfiles[Menptr[iId].ubProfile].usTotalDaysServed, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); + swprintf(sString, L"%d %s",pMercProfile->usTotalDaysServed, gpStrategicString[ STR_PB_DAYS_ABBREVIATION ] ); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf(sX,pPersonnelScreenPoints[iCounter].y,sString); + FindFontRightCoordinates( (INT16)(x + Prsnl_DATA_OffSetX), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); + mprintf(sX,y,sString); break; // case 13: @@ -7101,16 +7102,16 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) // cost (PRSNL_TXT_TOTAL_COST) /* - if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) { UINT32 uiDailyCost = 0; - if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) { // 2 week contract uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiBiWeeklySalary / 14; } - else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) { // 1 week contract uiDailyCost = gMercProfiles[ Menptr[ iId ].ubProfile ].uiWeeklySalary / 7; @@ -7123,7 +7124,7 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) // swprintf( sString, L"%d",uiDailyCost * Menptr[ iId ].iTotalContractLength ); swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); } - else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) + else if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC) { // swprintf( sString, L"%d",gMercProfiles[ Menptr[ iId ].ubProfile ].sSalary * gMercProfiles[ Menptr[ iId ].ubProfile ].iMercMercContractLength ); swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); @@ -7136,7 +7137,7 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); } */ - swprintf( sString, L"%d", gMercProfiles[ Menptr[ iId ].ubProfile ].uiTotalCostToDate ); + swprintf( sString, L"%d", pMercProfile->uiTotalCostToDate ); // insert commas and dollar sign InsertCommasForDollarFigure( sString ); @@ -7144,7 +7145,7 @@ void DisplayEmploymentinformation( INT32 iId, INT32 iSlot ) /* DEF:3/19/99: - if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_UNPAID_AMOUNT ] ); } @@ -7154,69 +7155,54 @@ DEF:3/19/99: swprintf( sStringA, L"%s", pPersonnelScreenStrings[ PRSNL_TXT_TOTAL_COST ] ); } - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter ].y,sStringA); + FindFontRightCoordinates( (INT16)(x + Prsnl_DATA_OffSetX), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( x, y, sStringA ); // print contract cost - mprintf( ( INT16 ) ( sX ) , pPersonnelScreenPoints[iCounter].y,sString); + mprintf( sX, y, sString ); - if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC) { - // daily rate - if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) + if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_2_WEEK ) { // 2 week contract - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiBiWeeklySalary / 14 ); - InsertCommasForDollarFigure( sStringA ); + swprintf( sStringA, L"%d", pMercProfile->uiBiWeeklySalary / 14 ); + InsertCommasForDollarFigure( sStringA ); InsertDollarSignInToString( sStringA ); swprintf( sString, L"%s", sStringA ); } - else if( Menptr[iId].bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) + else if( pSoldier->bTypeOfLastContract == CONTRACT_EXTEND_1_WEEK ) { // 1 week contract - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].uiWeeklySalary / 7 ); - InsertCommasForDollarFigure( sStringA ); + swprintf( sStringA, L"%d", pMercProfile->uiWeeklySalary / 7 ); + InsertCommasForDollarFigure( sStringA ); InsertDollarSignInToString( sStringA ); swprintf( sString, L"%s", sStringA ); } else { - - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + // daily rate + swprintf( sStringA, L"%d", pMercProfile->sSalary ); InsertCommasForDollarFigure( sStringA ); - InsertDollarSignInToString( sStringA ); + InsertDollarSignInToString( sStringA ); swprintf( sString, L"%s", sStringA ); } } - else if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC) - { -//DEF: 99/2/7 -// swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary * Menptr[ iId ].iTotalContractLength); - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); - InsertCommasForDollarFigure( sStringA ); - InsertDollarSignInToString( sStringA ); - swprintf( sString, L"%s", sStringA ); - } - else { - //Display a $0 amount -// swprintf( sString, L"0" ); -// InsertDollarSignInToString( sString ); - swprintf( sStringA, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary ); + swprintf( sStringA, L"%d", pMercProfile->sSalary ); InsertCommasForDollarFigure( sStringA ); InsertDollarSignInToString( sStringA ); swprintf( sString, L"%s", sStringA ); } - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[iCounter].x+(iSlot*TEXT_BOX_WIDTH)+Prsnl_DATA_OffSetX),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); + FindFontRightCoordinates( (INT16)(x + Prsnl_DATA_OffSetX), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); -// iCounter++; iCounter++; - // now print daily rate - mprintf( ( INT16 )( sX ),pPersonnelScreenPoints[ iCounter+1 ].y,sString); - mprintf( (INT16)(pPersonnelScreenPoints[iCounter+1].x +(iSlot*TEXT_BOX_WIDTH) ),pPersonnelScreenPoints[ iCounter +1].y, pPersonnelScreenStrings[PRSNL_TXT_DAILY_COST]); + // now print daily rate + mprintf( sX, pPersonnelScreenPoints[iCounter + 1].y, sString ); + mprintf( pPersonnelScreenPoints[iCounter + 1].x + (iSlot * TEXT_BOX_WIDTH), pPersonnelScreenPoints[iCounter + 1].y, pPersonnelScreenStrings[PRSNL_TXT_DAILY_COST] ); break; @@ -7224,11 +7210,11 @@ DEF:3/19/99: // medical deposit //if its a merc merc, display the salary oweing - if( Menptr[iId].ubWhatKindOfMercAmI == MERC_TYPE__MERC ) + if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__MERC ) { mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_UNPAID_AMOUNT]); - swprintf( sString, L"%d", gMercProfiles[Menptr[ iId ].ubProfile].sSalary * gMercProfiles[Menptr[ iId ].ubProfile ].iMercMercContractLength ); + swprintf( sString, L"%d", pMercProfile->sSalary * gMercProfiles[Menptr[ iId ].ubProfile ].iMercMercContractLength ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); @@ -7239,7 +7225,7 @@ DEF:3/19/99: { mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_MED_DEPOSIT]); - swprintf(sString, L"%d",gMercProfiles[Menptr[iId].ubProfile].sMedicalDepositAmount); + swprintf(sString, L"%d",pMercProfile->sMedicalDepositAmount); // insert commas and dollar sign InsertCommasForDollarFigure( sString ); @@ -7259,7 +7245,7 @@ DEF:3/19/99: // kills mprintf((INT16)(pPersonnelScreenPoints[20].x+(iSlot*TEXT_BOX_WIDTH)),(pPersonnelScreenPoints[20].y - 12),pPersonnelScreenStrings[PRSNL_TXT_KILLS]); - swprintf(sString, L"%d",(gMercProfiles[Menptr[iId].ubProfile].records.usKillsElites + gMercProfiles[Menptr[iId].ubProfile].records.usKillsRegulars + gMercProfiles[Menptr[iId].ubProfile].records.usKillsAdmins + gMercProfiles[Menptr[iId].ubProfile].records.usKillsHostiles + gMercProfiles[Menptr[iId].ubProfile].records.usKillsCreatures + gMercProfiles[Menptr[iId].ubProfile].records.usKillsZombies + gMercProfiles[Menptr[iId].ubProfile].records.usKillsTanks + gMercProfiles[Menptr[iId].ubProfile].records.usKillsOthers)); + swprintf(sString, L"%d",(pRecords->usKillsElites + pRecords->usKillsRegulars + pRecords->usKillsAdmins + pRecords->usKillsHostiles + pRecords->usKillsCreatures + pRecords->usKillsZombies + pRecords->usKillsTanks + pRecords->usKillsOthers)); FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[20].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,(pPersonnelScreenPoints[20].y - 12),sString); @@ -7278,13 +7264,13 @@ DEF:3/19/99: MSYS_AddRegion( &gSkillTraitHelpTextRegion[7] ); fAddedTraitRegion[7] = TRUE; // Assign the text - AssignPersonnelKillsHelpText( Menptr[iId].ubProfile ); + AssignPersonnelKillsHelpText( pSoldier->ubProfile ); break; case 15: // assists mprintf((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),(pPersonnelScreenPoints[21].y - 10),pPersonnelScreenStrings[PRSNL_TXT_ASSISTS]); - swprintf(sString, L"%d",(gMercProfiles[Menptr[iId].ubProfile].records.usAssistsMercs + gMercProfiles[Menptr[iId].ubProfile].records.usAssistsMilitia + gMercProfiles[Menptr[iId].ubProfile].records.usAssistsOthers)); + swprintf(sString, L"%d",(pRecords->usAssistsMercs + pRecords->usAssistsMilitia + pRecords->usAssistsOthers)); FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[21].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,(pPersonnelScreenPoints[21].y - 10),sString); @@ -7302,19 +7288,21 @@ DEF:3/19/99: MSYS_AddRegion( &gSkillTraitHelpTextRegion[8] ); fAddedTraitRegion[8] = TRUE; // Assign the text - AssignPersonnelAssistsHelpText( Menptr[iId].ubProfile ); + AssignPersonnelAssistsHelpText( pSoldier->ubProfile ); break; case 16: + { // shots/hits - mprintf((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),(pPersonnelScreenPoints[22].y - 8),pPersonnelScreenStrings[PRSNL_TXT_HIT_PERCENTAGE]); - uiHits = ( UINT32 )gMercProfiles[Menptr[iId].ubProfile].records.usShotsHit; + mprintf( (INT16)(pPersonnelScreenPoints[22].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[22].y - 8), pPersonnelScreenStrings[PRSNL_TXT_HIT_PERCENTAGE] ); + uiHits = (UINT32)pRecords->usShotsHit; uiHits *= 100; // check we have shot at least once - if( (gMercProfiles[Menptr[iId].ubProfile].records.usShotsFired + gMercProfiles[Menptr[iId].ubProfile].records.usMissilesLaunched + gMercProfiles[Menptr[iId].ubProfile].records.usGrenadesThrown + gMercProfiles[Menptr[iId].ubProfile].records.usKnivesThrown + gMercProfiles[Menptr[iId].ubProfile].records.usBladeAttacks + gMercProfiles[Menptr[iId].ubProfile].records.usHtHAttacks) > 0 ) + UINT32 uiAttacks = pRecords->usShotsFired + pRecords->usMissilesLaunched + pRecords->usGrenadesThrown + pRecords->usKnivesThrown + pRecords->usBladeAttacks + pRecords->usHtHAttacks; + if ( uiAttacks > 0 ) { - uiHits /= ( UINT32 )(gMercProfiles[Menptr[iId].ubProfile].records.usShotsFired + gMercProfiles[Menptr[iId].ubProfile].records.usMissilesLaunched + gMercProfiles[Menptr[iId].ubProfile].records.usGrenadesThrown + gMercProfiles[Menptr[iId].ubProfile].records.usKnivesThrown + gMercProfiles[Menptr[iId].ubProfile].records.usBladeAttacks + gMercProfiles[Menptr[iId].ubProfile].records.usHtHAttacks); + uiHits /= uiAttacks; if ( uiHits > 100 ) uiHits = 100; } @@ -7325,32 +7313,32 @@ DEF:3/19/99: } - swprintf(sString, L"%d %%%%",uiHits); - FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[22].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); - sX += StringPixLength( sSpecialCharacters[0], PERS_FONT ); - mprintf(sX,(pPersonnelScreenPoints[22].y - 8),sString); - - GetVideoObject(&hHandle, guiQMark); - BltVideoObject( FRAME_BUFFER, hHandle, 0,(pPersonnelScreenPoints[22].x + 148), ( pPersonnelScreenPoints[22].y - 9 ), VO_BLT_SRCTRANSPARENCY,NULL ); + swprintf( sString, L"%d %%%%", uiHits ); + FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[22].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); + sX += StringPixLength( sSpecialCharacters[0], PERS_FONT ); + mprintf( sX, (pPersonnelScreenPoints[22].y - 8), sString ); + + GetVideoObject( &hHandle, guiQMark ); + BltVideoObject( FRAME_BUFFER, hHandle, 0, (pPersonnelScreenPoints[22].x + 148), (pPersonnelScreenPoints[22].y - 9), VO_BLT_SRCTRANSPARENCY, NULL ); // Add specific region for fast help window - if( fAddedTraitRegion[9] ) + if ( fAddedTraitRegion[9] ) { MSYS_RemoveRegion( &gSkillTraitHelpTextRegion[9] ); } - MSYS_DefineRegion( &gSkillTraitHelpTextRegion[9], (UINT16)( pPersonnelScreenPoints[22].x + 147 ), (UINT16)( pPersonnelScreenPoints[22].y - 10 ), - (UINT16)( pPersonnelScreenPoints[22].x + 166 ), (UINT16)(pPersonnelScreenPoints[22].y + 1), MSYS_PRIORITY_HIGH, - MSYS_NO_CURSOR, MSYS_NO_CALLBACK, NULL ); + MSYS_DefineRegion( &gSkillTraitHelpTextRegion[9], (UINT16)(pPersonnelScreenPoints[22].x + 147), (UINT16)(pPersonnelScreenPoints[22].y - 10), + (UINT16)(pPersonnelScreenPoints[22].x + 166), (UINT16)(pPersonnelScreenPoints[22].y + 1), MSYS_PRIORITY_HIGH, + MSYS_NO_CURSOR, MSYS_NO_CALLBACK, NULL ); MSYS_AddRegion( &gSkillTraitHelpTextRegion[9] ); fAddedTraitRegion[9] = TRUE; // Assign the text - AssignPersonnelHitPercentageHelpText( Menptr[iId].ubProfile ); - + AssignPersonnelHitPercentageHelpText( pSoldier->ubProfile ); + } break; case 17: // Achievements mprintf((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),(pPersonnelScreenPoints[23].y - 6),pPersonnelScreenStrings[PRSNL_TXT_ACHIEVEMNTS]); - swprintf(sString, L"%d %%%%", CalculateMercsAchievementPercentage( Menptr[iId].ubProfile )); + swprintf(sString, L"%d %%%%", CalculateMercsAchievementPercentage( pSoldier->ubProfile )); FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[23].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); sX += StringPixLength( sSpecialCharacters[0], PERS_FONT ); mprintf(sX,(pPersonnelScreenPoints[23].y - 6),sString); @@ -7369,13 +7357,13 @@ DEF:3/19/99: MSYS_AddRegion( &gSkillTraitHelpTextRegion[10] ); fAddedTraitRegion[10] = TRUE; // Assign the text - AssignPersonnelAchievementsHelpText( Menptr[iId].ubProfile ); + AssignPersonnelAchievementsHelpText( pSoldier->ubProfile ); break; case 18: // battles mprintf((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),(pPersonnelScreenPoints[24].y - 4),pPersonnelScreenStrings[PRSNL_TXT_BATTLES]); - swprintf(sString, L"%d",(gMercProfiles[Menptr[iId].ubProfile].records.usBattlesTactical + gMercProfiles[Menptr[iId].ubProfile].records.usBattlesAutoresolve)); + swprintf(sString, L"%d",(pRecords->usBattlesTactical + pRecords->usBattlesAutoresolve)); FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[24].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,(pPersonnelScreenPoints[24].y - 4),sString); @@ -7393,13 +7381,13 @@ DEF:3/19/99: MSYS_AddRegion( &gSkillTraitHelpTextRegion[11] ); fAddedTraitRegion[11] = TRUE; // Assign the text - AssignPersonnelBattlesHelpText( Menptr[iId].ubProfile ); + AssignPersonnelBattlesHelpText( pSoldier->ubProfile ); break; case 19: // wounds mprintf((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),(pPersonnelScreenPoints[25].y - 2),pPersonnelScreenStrings[PRSNL_TXT_TIMES_WOUNDED]); - swprintf(sString, L"%d",(gMercProfiles[Menptr[iId].ubProfile].records.usTimesWoundedShot + gMercProfiles[Menptr[iId].ubProfile].records.usTimesWoundedStabbed + (gMercProfiles[Menptr[iId].ubProfile].records.usTimesWoundedPunched/2) + gMercProfiles[Menptr[iId].ubProfile].records.usTimesWoundedBlasted)); + swprintf(sString, L"%d",(pRecords->usTimesWoundedShot + pRecords->usTimesWoundedStabbed + (pRecords->usTimesWoundedPunched/2) + pRecords->usTimesWoundedBlasted)); FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[25].x+(iSlot*TEXT_BOX_WIDTH)),0,TEXT_BOX_WIDTH-20,0,sString, PERS_FONT, &sX, &sY); mprintf(sX,(pPersonnelScreenPoints[25].y - 2),sString); @@ -7417,7 +7405,7 @@ DEF:3/19/99: MSYS_AddRegion( &gSkillTraitHelpTextRegion[12] ); fAddedTraitRegion[12] = TRUE; // Assign the text - AssignPersonnelWoundsHelpText( Menptr[iId].ubProfile ); + AssignPersonnelWoundsHelpText( pSoldier->ubProfile ); break; From 8b90c847381633f6e8f35be3239ca6fa1e0a052b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:20:45 +0200 Subject: [PATCH 152/571] Convert DisplayCharStats() to SoldierID Moved two repeated print calls to their own functions Removed compiler warning about exceeding stack size --- Laptop/personnel.cpp | 275 ++++++++++++--------------------- Tactical/Drugs And Alcohol.cpp | 2 +- Tactical/Drugs And Alcohol.h | 2 +- 3 files changed, 102 insertions(+), 177 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 4a63b18a..2afc4075 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -327,7 +327,7 @@ void CreatePersonnelButtons( void ); void DeletePersonnelButtons( void ); void DisplayHeader( void ); void DisplayCharName( SoldierID iId, INT32 iSlot ); -void DisplayCharStats(INT32 iId, INT32 iSlot); +void DisplayCharStats(SoldierID iId, INT32 iSlot); void DisplayCharPersonality( INT32 iId, INT32 iSlot ); void SetPersonnelButtonStates( void ); void CreateDestroyButtonsForPersonnelDepartures( void ); @@ -442,7 +442,7 @@ BOOLEAN fAddedTraitRegion[13] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALS void AssignPersonnelCharacterTraitHelpText( UINT8 ubCharacterNumber ); void AssignPersonnelDisabilityHelpText( UINT8 ubDisabilityNumber ); -void AssignPersonnelMultipleDisabilityHelpText( SOLDIERTYPE* pSoldier ); +void AssignPersonnelMultipleDisabilityHelpText( const SOLDIERTYPE* pSoldier ); void AssignPersonnelKillsHelpText( INT32 ubProfile ); void AssignPersonnelAssistsHelpText( INT32 ubProfile ); void AssignPersonnelHitPercentageHelpText( INT32 ubProfile ); @@ -452,7 +452,7 @@ void AssignPersonnelWoundsHelpText( INT32 ubProfile ); INT8 CalculateMercsAchievementPercentage( INT32 ubProfile ); // Flugente: personality info -void AssignPersonalityHelpText( SOLDIERTYPE* pSoldier, MOUSE_REGION* pMouseregion ); +void AssignPersonalityHelpText( const SOLDIERTYPE* pSoldier, MOUSE_REGION* pMouseregion ); BOOLEAN fShowRecordsIfZero = TRUE; @@ -1402,16 +1402,34 @@ Moved so the name of the town will be in the same line as the name return; } +static void PrintStatChange(const INT16 change, const INT32 x, const INT32 y, const STR16 sString) +{ + if ( change ) + { + INT16 sX, sY; -void DisplayCharStats( INT32 iId, INT32 iSlot ) + swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); + FindFontRightCoordinates( (INT16)(x + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, y, sString ); + } +} + +static void PrintCharStatText(const INT32 x, const INT32 y, const INT32 iCounter, const STR16 sString) { - INT32 iCounter = 0; - CHAR16 sString[50]; - // CHAR16 sStringA[ 50 ]; INT16 sX, sY; - UINT32 uiHits = 0; - SOLDIERTYPE *pSoldier = &Menptr[iId]; - BOOLEAN fAmIaRobot = AM_A_ROBOT( pSoldier ); + mprintf( x, y, pPersonnelScreenStrings[iCounter] ); + FindFontRightCoordinates( x, 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, y, sString ); +} + +void DisplayCharStats( SoldierID iId, INT32 iSlot ) +{ + CHAR16 apStr[5000]; + CHAR16 sString[50]; + INT16 sX, sY; + const SOLDIERTYPE *pSoldier = iId; + const BOOLEAN fAmIaRobot = AM_A_ROBOT( pSoldier ); + const MERCPROFILESTRUCT *pMercProfile = &gMercProfiles[pSoldier->ubProfile]; // SANDRO - remove the regions for ( INT8 i = 0; i < 13; i++ ) @@ -1423,180 +1441,131 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) } } + if ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { return; } + // display the stats for a char - for ( iCounter = 0; iCounter bAssignment != ASSIGNMENT_POW ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bLifeDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_HEALTH]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d/%d", Menptr[iId].stats.bLife, Menptr[iId].stats.bLifeMax ); + const INT16 change = pMercProfile->bLifeDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_HEALTH]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d/%d", pSoldier->stats.bLife, pSoldier->stats.bLifeMax ); } else { swprintf( sString, pPOWStrings[1] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[PRSNL_TXT_HEALTH] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 1: // agility if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bAgilityDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_AGILITY]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bAgility ); + INT16 change = pMercProfile->bAgilityDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_AGILITY]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bAgility ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 2: // dexterity if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bDexterityDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_DEXTERITY]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bDexterity ); + INT16 change = pMercProfile->bDexterityDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_DEXTERITY]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bDexterity ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 3: // strength if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bStrengthDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_STRENGTH]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bStrength ); + INT16 change = pMercProfile->bStrengthDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_STRENGTH]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bStrength ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 4: // leadership if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bLeadershipDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_LEADERSHIP]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bLeadership ); + INT16 change = pMercProfile->bLeadershipDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_LEADERSHIP]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bLeadership ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 5: // wisdom if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bWisdomDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_WISDOM]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bWisdom ); + INT16 change = pMercProfile->bWisdomDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_WISDOM]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bWisdom ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 6: // exper if ( !fAmIaRobot ) { - if ( gMercProfiles[Menptr[iId].ubProfile].bExpLevelDelta > 0 ) + if ( pMercProfile->bExpLevelDelta > 0 ) { - swprintf( sString, L"( %+d )", gMercProfiles[Menptr[iId].ubProfile].bExpLevelDelta ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + swprintf( sString, L"( %+d )", pMercProfile->bExpLevelDelta ); + FindFontRightCoordinates( (INT16)(x + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + mprintf( sX, y, sString ); } //else //{ - swprintf( sString, L"%d", Menptr[iId].stats.bExpLevel ); + swprintf( sString, L"%d", pSoldier->stats.bExpLevel ); //} } else @@ -1605,109 +1574,71 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 7: //mrkmanship if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bMarksmanshipDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MARKSMANSHIP]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bMarksmanship ); + INT16 change = pMercProfile->bMarksmanshipDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MARKSMANSHIP]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bMarksmanship ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 8: // mech if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bMechanicDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MECHANICAL]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bMechanical ); + INT16 change = pMercProfile->bMechanicDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MECHANICAL]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bMechanical ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 9: // exp if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bExplosivesDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_EXPLOSIVES]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bExplosive ); + INT16 change = pMercProfile->bExplosivesDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_EXPLOSIVES]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bExplosive ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; case 10: // med if ( !fAmIaRobot ) { // Flugente: stats can have gone up or down, find out which - INT16 change = gMercProfiles[Menptr[iId].ubProfile].bMedicalDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MEDICAL]); - - if ( change ) - { - swprintf( sString, change > 0 ? L"( +%d )" : L"( %d )", change ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); - } - - swprintf( sString, L"%d", Menptr[iId].stats.bMedical ); + INT16 change = pMercProfile->bMedicalDelta - (INT16)(pSoldier->ubCriticalStatDamage[DAMAGED_STAT_MEDICAL]); + PrintStatChange( change, x, y, sString ); + swprintf( sString, L"%d", pSoldier->stats.bMedical ); } else { swprintf( sString, L"%s", gpStrategicString[STR_PB_NOTAPPLICABLE_ABBREVIATION] ); } - mprintf( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), pPersonnelScreenPoints[iCounter].y, pPersonnelScreenStrings[iCounter] ); - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); - mprintf( sX, pPersonnelScreenPoints[iCounter].y, sString ); + PrintCharStatText( x, y, iCounter, sString ); break; // Added by Flugente @@ -1717,15 +1648,15 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) // display background if (UsingBackGroundSystem()) { - UINT8 loc = 21; - UINT8 regionnr = 12; + const UINT8 loc = 21; + const UINT8 regionnr = 12; mprintf( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), pPersonnelRecordsHelpTexts[47] ); //L"Background:" - if ( !gMercProfiles[pSoldier->ubProfile].usBackground ) + if ( !pMercProfile->usBackground ) swprintf( sString, pwMiscSectorStrings[3] ); //L"unknown" else - swprintf( sString, zBackground[gMercProfiles[pSoldier->ubProfile].usBackground].szShortName ); + swprintf( sString, zBackground[pMercProfile->usBackground].szShortName ); FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); mprintf( sX, (pPersonnelScreenPoints[loc].y + 15), sString ); @@ -1743,7 +1674,7 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) fAddedTraitRegion[regionnr] = TRUE; // Info about our background - AssignBackgroundHelpText( gMercProfiles[pSoldier->ubProfile].usBackground, &(gSkillTraitHelpTextRegion[12]) ); + AssignBackgroundHelpText( pMercProfile->usBackground, &(gSkillTraitHelpTextRegion[12]) ); } break; @@ -1752,8 +1683,8 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) case 17: // sexism, racism, nationalities etc. { - UINT8 loc = 22; - UINT8 regionnr = 8; + const UINT8 loc = 22; + const UINT8 regionnr = 8; mprintf( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), pPersonnelRecordsHelpTexts[48] ); //L"Personality:" @@ -1792,9 +1723,9 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) mprintf( (INT16)(pPersonnelScreenPoints[23].x + (iSlot*TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[23].y + 15), pPersonnelRecordsHelpTexts[45] ); //L"Attitudes:" if ( gGameOptions.fNewTraitSystem ) - swprintf( sString, gzIMPCharacterTraitText[gMercProfiles[Menptr[iId].ubProfile].bCharacterTrait] ); + swprintf( sString, gzIMPCharacterTraitText[pMercProfile->bCharacterTrait] ); else - swprintf( sString, gzIMPAttitudesText[gMercProfiles[Menptr[iId].ubProfile].bAttitude] ); + swprintf( sString, gzIMPAttitudesText[pMercProfile->bAttitude] ); FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[23].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sString, PERS_FONT, &sX, &sY ); mprintf( sX, (pPersonnelScreenPoints[23].y + 15), sString ); @@ -1819,7 +1750,7 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) // Only new traits have help text if ( gGameOptions.fNewTraitSystem ) - AssignPersonnelCharacterTraitHelpText( gMercProfiles[Menptr[iId].ubProfile].bCharacterTrait ); + AssignPersonnelCharacterTraitHelpText( pMercProfile->bCharacterTrait ); break; @@ -1864,7 +1795,7 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) // Assign the text if ( numdisabilities <= 1 ) - AssignPersonnelDisabilityHelpText( gMercProfiles[Menptr[iId].ubProfile].bDisability ); + AssignPersonnelDisabilityHelpText( pMercProfile->bDisability ); else AssignPersonnelMultipleDisabilityHelpText( pSoldier ); } @@ -1899,12 +1830,12 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) // we also get the number of lines (skills) to be displayed for ( UINT8 ubCnt = 1; ubCnt < NUM_SKILLTRAITS_NT; ubCnt++ ) { - if ( ProfileHasSkillTrait( Menptr[iId].ubProfile, ubCnt ) == 2 ) + if ( ProfileHasSkillTrait( pSoldier->ubProfile, ubCnt ) == 2 ) { ubTempSkillArray[bNumSkillTraits] = (ubCnt + NEWTRAIT_MERCSKILL_EXPERTOFFSET); bNumSkillTraits++; } - else if ( ProfileHasSkillTrait( Menptr[iId].ubProfile, ubCnt ) == 1 ) + else if ( ProfileHasSkillTrait( pSoldier->ubProfile, ubCnt ) == 1 ) { ubTempSkillArray[bNumSkillTraits] = ubCnt; bNumSkillTraits++; @@ -1930,7 +1861,6 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) fAddedTraitRegion[0] = TRUE; // Assign the text - CHAR16 apStr[5000]; swprintf( apStr, L"" ); AssignPersonnelSkillTraitHelpText( 0, FALSE, (gMercProfiles[iId].ubBodyType == REGMALE), apStr ); @@ -2003,9 +1933,8 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) if ( fExpert ) traitnr -= NEWTRAIT_MERCSKILL_EXPERTOFFSET; - CHAR16 apStr[5000]; swprintf( apStr, L"" ); - AssignPersonnelSkillTraitHelpText( traitnr, fExpert, (gMercProfiles[Menptr[iId].ubProfile].ubBodyType == REGMALE), apStr ); + AssignPersonnelSkillTraitHelpText( traitnr, fExpert, (pMercProfile->ubBodyType == REGMALE), apStr ); // Set region help text SetRegionFastHelpText( &(gSkillTraitHelpTextRegion[ubCnt]), apStr ); @@ -2046,8 +1975,8 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) else { INT8 bSkill1 = 0, bSkill2 = 0; - bSkill1 = gMercProfiles[Menptr[iId].ubProfile].bSkillTraits[0]; - bSkill2 = gMercProfiles[Menptr[iId].ubProfile].bSkillTraits[1]; + bSkill1 = pMercProfile->bSkillTraits[0]; + bSkill2 = pMercProfile->bSkillTraits[1]; //if the 2 skills are the same, add the '(expert)' at the end if ( bSkill1 == bSkill2 && bSkill1 != 0 ) @@ -2060,7 +1989,7 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) //Perform the potential overrun check if ( sX <= iMinimumX ) { - FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[iCounter].x + (iSlot*TEXT_BOX_WIDTH) + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); + FindFontRightCoordinates( (INT16)(x + TEXT_BOX_WIDTH - 20 + TEXT_DELTA_OFFSET), 0, 30, 0, sString, PERS_FONT, &sX, &sY ); sX = (INT16)max( sX, iMinimumX ); } @@ -2078,7 +2007,6 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) fAddedTraitRegion[0] = TRUE; // Assign the text - CHAR16 apStr[5000]; swprintf( apStr, L"" ); AssignPersonnelSkillTraitHelpText( bSkill1, TRUE, (gMercProfiles[iId].ubBodyType == REGMALE), apStr ); @@ -2112,7 +2040,6 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) fAddedTraitRegion[0] = TRUE; // Assign the text - CHAR16 apStr[5000]; swprintf( apStr, L"" ); AssignPersonnelSkillTraitHelpText( bSkill1, FALSE, (gMercProfiles[iId].ubBodyType == REGMALE), apStr ); @@ -2147,7 +2074,6 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) fAddedTraitRegion[1] = TRUE; // Assign the text - CHAR16 apStr[5000]; swprintf( apStr, L"" ); AssignPersonnelSkillTraitHelpText( bSkill2, FALSE, (gMercProfiles[iId].ubBodyType == REGMALE), apStr ); @@ -2178,7 +2104,6 @@ void DisplayCharStats( INT32 iId, INT32 iSlot ) fAddedTraitRegion[0] = TRUE; // Assign the text - CHAR16 apStr[5000]; swprintf( apStr, L"" ); AssignPersonnelSkillTraitHelpText( bSkill1, FALSE, (gMercProfiles[iId].ubBodyType == REGMALE), apStr ); @@ -8823,7 +8748,7 @@ void AssignPersonnelDisabilityHelpText( UINT8 ubDisabilityNumber ) SetRegionHelpEndCallback( &gSkillTraitHelpTextRegion[6], MSYS_NO_CALLBACK ); } -void AssignPersonnelMultipleDisabilityHelpText( SOLDIERTYPE* pSoldier ) +void AssignPersonnelMultipleDisabilityHelpText( const SOLDIERTYPE* pSoldier ) { CHAR16 apStr[1000]; @@ -9303,7 +9228,7 @@ INT8 CalculateMercsAchievementPercentage( INT32 ubProfile ) } // Flugente: personality info -void AssignPersonalityHelpText( SOLDIERTYPE* pSoldier, MOUSE_REGION* pMouseregion ) +void AssignPersonalityHelpText( const SOLDIERTYPE* pSoldier, MOUSE_REGION* pMouseregion ) { CHAR16 apStr[ 4500 ]; CHAR16 atStr[ 260 ]; diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index 0c7c281c..60a38884 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -319,7 +319,7 @@ INT8 GetDrunkLevel( SOLDIERTYPE *pSoldier ) } // does a merc have a disability/personality, or is he under drugs that simulate this? -BOOLEAN DoesMercHaveDisability( SOLDIERTYPE *pSoldier, UINT8 aVal ) +BOOLEAN DoesMercHaveDisability( const SOLDIERTYPE *pSoldier, UINT8 aVal ) { if ( pSoldier->ubProfile != NO_PROFILE ) { diff --git a/Tactical/Drugs And Alcohol.h b/Tactical/Drugs And Alcohol.h index 887a89b7..b0a7dce0 100644 --- a/Tactical/Drugs And Alcohol.h +++ b/Tactical/Drugs And Alcohol.h @@ -66,7 +66,7 @@ void HandleEndTurnDrugAdjustments_New( SOLDIERTYPE *pSoldier ); INT8 GetDrunkLevel( SOLDIERTYPE *pSoldier ); // does a merc have a disability/personality, or is he under drugs that simulate this? -BOOLEAN DoesMercHaveDisability( SOLDIERTYPE *pSoldier, UINT8 aVal ); +BOOLEAN DoesMercHaveDisability( const SOLDIERTYPE *pSoldier, UINT8 aVal ); BOOLEAN DoesMercHavePersonality( SOLDIERTYPE *pSoldier, UINT8 aVal ); //void HandleEndTurnDrugAdjustments( SOLDIERTYPE *pSoldier ); From 698176e8417fab03423a13c47a4dcc71cd3203fc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:33:11 +0200 Subject: [PATCH 153/571] Convert DisplayCharPersonality() to SoldierID --- Laptop/personnel.cpp | 55 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 2afc4075..f0b3e652 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -328,7 +328,7 @@ void DeletePersonnelButtons( void ); void DisplayHeader( void ); void DisplayCharName( SoldierID iId, INT32 iSlot ); void DisplayCharStats(SoldierID iId, INT32 iSlot); -void DisplayCharPersonality( INT32 iId, INT32 iSlot ); +void DisplayCharPersonality( SoldierID iId, INT32 iSlot ); void SetPersonnelButtonStates( void ); void CreateDestroyButtonsForPersonnelDepartures( void ); void LoadPersonnelScreenBackgroundGraphics( void ); @@ -2124,11 +2124,12 @@ void DisplayCharStats( SoldierID iId, INT32 iSlot ) } } -void DisplayCharPersonality(INT32 iId, INT32 iSlot) +void DisplayCharPersonality(SoldierID iId, INT32 iSlot) { INT32 iCounter=0; INT16 sX, sY; - SOLDIERTYPE *pSoldier = &Menptr[iId]; + SOLDIERTYPE *pSoldier = iId; + const MERCPROFILESTRUCT *pMercProfile = &gMercProfiles[pSoldier->ubProfile]; // SANDRO - remove the regions for( INT8 i = 0; i < 13; ++i ) @@ -2182,7 +2183,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) ++region; } - if ( (gMercProfiles[pSoldier->ubProfile].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) ) + if ( (pMercProfile->ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) ) { CHAR16 sStr1[200]; swprintf( sStr1, szLaptopStatText[LAPTOP_STAT_TEXT_GOOD_GUY] ); @@ -2215,7 +2216,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) if (gGameExternalOptions.fMercGrowthModifiersEnabled) { - if (gMercProfiles[pSoldier->ubProfile].fRegresses) + if (pMercProfile->fRegresses) { CHAR16 sStr2[200]; swprintf(sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_MERC_REGRESSES]); @@ -2236,9 +2237,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_HEALTH_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierLife <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierLife >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2251,9 +2252,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_STRENGTH_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierStrength <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierStrength >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2266,9 +2267,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_AGILITY_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierAgility <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierAgility >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2281,9 +2282,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_DEXTERITY_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierDexterity <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierDexterity >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2296,9 +2297,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_WISDOM_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierWisdom <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierWisdom >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2311,9 +2312,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MARKSMANSHIP_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierMarksmanship <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierMarksmanship >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2326,9 +2327,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPLOSIVES_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierExplosive <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierExplosive >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2341,9 +2342,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_LEADERSHIP_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierLeadership <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierLeadership >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2356,9 +2357,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MEDICAL_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierMedical <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierMedical >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2371,9 +2372,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MECHANICAL_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierMechanical <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierMechanical >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); @@ -2386,9 +2387,9 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot) swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPERIENCE_SPEED]); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt); - if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel <= THRESHOLD_FAST) + if (pMercProfile->bGrowthModifierExpLevel <= THRESHOLD_FAST) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]); - else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel >= THRESHOLD_SLOW) + else if (pMercProfile->bGrowthModifierExpLevel >= THRESHOLD_SLOW) swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]); else swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]); From 648a50f1e8931b1ce82b142c9a879ecd11408f93 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:01:35 +0200 Subject: [PATCH 154/571] Convert currentTeamList to SoldierID --- Laptop/personnel.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index f0b3e652..4b513448 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -306,7 +306,7 @@ BOOLEAN fCreateRegionsForPastCurrentToggle = FALSE; // WDS - make number of mercenaries, etc. be configurable // List of ids of current team members, dea or alive -std::vector currentTeamList (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, -1); +SoldierID currentTeamList[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; // The index of the last current team members int maxCurrentTeamIndex = -1; // The id of currently displayed merc @@ -319,7 +319,7 @@ void LoadPersonnelGraphics( void ); void RemovePersonnelGraphics( void ); void RenderPersonnel( void ); void RenderPersonnelStats(INT32 iId, INT32 iSlot); -void RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ); +void RenderPersonnelFace(SoldierID iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ); void LeftButtonCallBack(GUI_BUTTON *btn,INT32 reason); void RightButtonCallBack(GUI_BUTTON *btn,INT32 reason); void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ); @@ -552,7 +552,7 @@ void EnterPersonnel( void ) // Clear out the current team list for (unsigned idx=0; idx < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; idx++) { - currentTeamList[idx] = -1; + currentTeamList[idx] = NOBODY; } // Fill in the current team list @@ -574,7 +574,7 @@ void EnterPersonnel( void ) } } - if (currentTeamList[0] >= 0) + if (currentTeamList[0] < NOBODY) currentTeamIndex = 0; else currentTeamIndex = -1; @@ -813,11 +813,11 @@ void RenderPersonnelStats( INT32 iId, INT32 iSlot ) // ID -> fortlaufende ID, und nicht die mercID // -> bei aktuellen Merc passt es // -> bei departed Merc wird die MercId anstatt der fortlaufenden ID übergeben!! -void RenderPersonnelFace(INT32 iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ) +void RenderPersonnelFace(SoldierID iId, INT32 iSlot, BOOLEAN fDead, BOOLEAN fFired, BOOLEAN fOther ) { // Get the profile id (from profileId or slotId) INT32 profileId = iId; - if (profileId == -1) + if (profileId == NOBODY) { profileId = MercPtrs[iSlot]->ubProfile; } @@ -2582,7 +2582,7 @@ void DisplayPicturesOfCurrentTeam( void ) return; } // if - SOLDIERTYPE *pSoldier = MercPtrs[currentTeamList[currentOnSreenIndex]]; + SOLDIERTYPE *pSoldier = currentTeamList[currentOnSreenIndex]; if ( pSoldier->ubProfile >= 0 ) { @@ -2639,7 +2639,7 @@ void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ) currentTeamIndex = iPortraitId + currentTeamFirstIndex; fReDrawScreenFlag = TRUE; // if the selected merc is valid, and they are a POW, change to the inventory display - if( currentTeamIndex != -1 && Menptr[currentTeamList[currentTeamIndex]].bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN ) { + if( currentTeamIndex != -1 && currentTeamList[currentTeamIndex]->bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN ) { gubPersonnelInfoState = PERSONNEL_STAT_BTN; } } else { @@ -2683,7 +2683,7 @@ void PersonnelPortraitCallback( MOUSE_REGION * pRegion, INT32 iReason ) guiSliderPosition = 0; //if the selected merc is valid, and they are a POW, change to the inventory display - if( currentTeamIndex != -1 && Menptr[currentTeamList[currentTeamIndex]].bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN) { + if( currentTeamIndex != -1 && currentTeamList[currentTeamIndex]->bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN) { gubPersonnelInfoState = PERSONNEL_STAT_BTN; } } @@ -3048,7 +3048,7 @@ INT32 GetNumberOfInventoryItemsOnCurrentMerc( void ) if (!fCurrentTeamMode) return( 0 ); - SOLDIERTYPE *pSoldier = &Menptr[currentTeamList[currentTeamIndex]]; + SOLDIERTYPE *pSoldier = currentTeamList[currentTeamIndex]; INT32 ubCount = 0; UINT8 invsize = pSoldier->inv.size(); @@ -6177,7 +6177,7 @@ void ATMOtherButtonCallback(GUI_BUTTON *btn,INT32 reason) if (fCurrentTeamMode && currentTeamIndex != -1) { // set soldier - pSoldier = MercPtrs[ currentTeamList[currentTeamIndex] ]; + pSoldier = currentTeamList[currentTeamIndex]; switch( iValue ) { case( OK_ATM ): @@ -6564,11 +6564,11 @@ void UpDateStateOfStartButton( void ) for ( int i = 0; i < PERSONNEL_NUM_BTN; ++i ) EnableButton( giPersonnelATMStartButton[ i ] ); - INT32 iId = currentTeamList[currentTeamIndex]; + SoldierID iId = currentTeamList[currentTeamIndex]; - if (iId != -1) + if (iId != NOBODY) { - if ( Menptr[ iId ].bAssignment == ASSIGNMENT_POW ) + if ( iId->bAssignment == ASSIGNMENT_POW ) { DisableButton( giPersonnelATMStartButton[ PERSONNEL_INV_BTN ] ); @@ -6612,7 +6612,7 @@ void DisplayAmountOnCurrentMerc( void ) pSoldier = NULL; } else { // set soldier - pSoldier = MercPtrs[ currentTeamList[currentTeamIndex] ]; + pSoldier = currentTeamList[currentTeamIndex]; } INT32 iFunds = GetFundsOnMerc( pSoldier ); @@ -6697,7 +6697,7 @@ void HandlePersonnelKeyboard( void ) guiSliderPosition = 0; //if the selected merc is valid, and they are a POW, change to the inventory display - if( currentTeamIndex != -1 && Menptr[currentTeamList[currentTeamIndex]].bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN) + if( currentTeamIndex != -1 && currentTeamList[currentTeamIndex]->bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN) gubPersonnelInfoState = PERSONNEL_EMPLOYMENT_BTN; fPausedReDrawScreenFlag = TRUE; @@ -6718,7 +6718,7 @@ void HandlePersonnelKeyboard( void ) guiSliderPosition = 0; //if the selected merc is valid, and they are a POW, change to the inventory display - if( currentTeamIndex != -1 && Menptr[currentTeamList[currentTeamIndex]].bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN) + if( currentTeamIndex != -1 && currentTeamList[currentTeamIndex]->bAssignment == ASSIGNMENT_POW && gubPersonnelInfoState == PERSONNEL_INV_BTN) gubPersonnelInfoState = PERSONNEL_STAT_BTN; fPausedReDrawScreenFlag = TRUE; From 2a52347198eef2c3cdbdb5a178b1cce1c237d0a9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:04:29 +0200 Subject: [PATCH 155/571] Update personnel.cpp --- Laptop/personnel.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 4b513448..9da05def 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -371,7 +371,7 @@ INT32 GetTheStateOfDepartedMerc( INT32 iId ); void DisplayPersonnelTextOnTitleBar( void ); INT32 GetIdOfDepartedMercWithHighestStat( INT32 iStat ); INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat ); -void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ); +void RenderInventoryForCharacter( SoldierID iId, INT32 iSlot ); void DisplayInventoryForSelectedChar( void ); INT32 GetNumberOfInventoryItemsOnCurrentMerc( void ); void CreateDestroyPersonnelInventoryScrollButtons( void ); @@ -2749,7 +2749,7 @@ void DisplayInventoryForSelectedChar( void ) } } -void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) +void RenderInventoryForCharacter( SoldierID iId, INT32 iSlot ) { UINT8 ubCounter = 0; SOLDIERTYPE *pSoldier; @@ -2786,7 +2786,7 @@ void RenderInventoryForCharacter( INT32 iId, INT32 iSlot ) // render the bar for the character RenderSliderBarForPersonnelInventory( ); - pSoldier = &Menptr[ iId ]; + pSoldier = iId; //if this is a robot, dont display any inventory if( AM_A_ROBOT( pSoldier ) ) @@ -7140,7 +7140,7 @@ DEF:3/19/99: { mprintf((INT16)(pPersonnelScreenPoints[iCounter-1].x+(iSlot*TEXT_BOX_WIDTH)),pPersonnelScreenPoints[iCounter-1].y,pPersonnelScreenStrings[PRSNL_TXT_UNPAID_AMOUNT]); - swprintf( sString, L"%d", pMercProfile->sSalary * gMercProfiles[Menptr[ iId ].ubProfile ].iMercMercContractLength ); + swprintf( sString, L"%d", pMercProfile->sSalary * pMercProfile->iMercMercContractLength ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); From a670aff29c5dbe9d115beef39237c0c1b314a564 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:13:25 +0200 Subject: [PATCH 156/571] Combine loops to check for medics and patients --- Tactical/Auto Bandage.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index a87836e7..1f0f237b 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -553,7 +553,6 @@ void BeginAutoBandageCallBack( UINT8 bExitValue ) void SetUpAutoBandageUpdatePanel( void ) { - INT32 iNumberDoctoring = 0; INT32 iNumberPatienting = 0; INT32 iNumberOnTeam = 0; @@ -574,24 +573,21 @@ void SetUpAutoBandageUpdatePanel( void ) // grab number of potential grunts on players team iNumberOnTeam = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - // run through mercs on squad...if they can doctor, add to list + // run through mercs on squad...if they can be a doctor or patient, add to list for( iCounterA = 0; iCounterA < iNumberOnTeam; iCounterA++ ) { - if( CanCharacterAutoBandageTeammate( &Menptr[ iCounterA ] ) ) + SOLDIERTYPE *pSoldier = &Menptr[iCounterA]; + + if( CanCharacterAutoBandageTeammate( pSoldier )) { // add to list, up the count iDoctorList[ iNumberDoctoring ] = iCounterA; iNumberDoctoring++; } - } - - // run through mercs on squad, if they can patient, add to list - for( iCounterA = 0; iCounterA < iNumberOnTeam; iCounterA++ ) - { - if( CanCharacterBeAutoBandagedByTeammate( &Menptr[ iCounterA ] ) ) + if ( CanCharacterBeAutoBandagedByTeammate( pSoldier ) ) { // add to list, up the count - iPatientList[ iNumberPatienting ] = iCounterA; + iPatientList[iNumberPatienting] = iCounterA; iNumberPatienting++; } } From 235ddfa782d222c6d1a4d62cc4980b42001dd62f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:22:34 +0200 Subject: [PATCH 157/571] Update Game Event Hook.cpp --- Strategic/Game Event Hook.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index 845c0b6a..241faf49 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -255,9 +255,10 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) break; case EVENT_ADDSOLDIER_TO_UPDATE_BOX: // if the grunt is currently active, add to update box - if( Menptr[ pEvent->uiParam ].bActive ) + SoldierID usID = pEvent->uiParam; + if( usID != NOBODY && usID->bActive ) { - AddSoldierToWaitingListQueue( &( Menptr[ pEvent->uiParam ] ) ); + AddSoldierToWaitingListQueue( usID ); } break; case EVENT_SET_MENU_REASON: From c7e654a1d933dfc1189e1b45fbf82d39a0d4ce90 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:28:38 +0200 Subject: [PATCH 158/571] Update Town Militia.cpp --- Strategic/Town Militia.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index 82c3e7df..62ec57e9 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -54,7 +54,7 @@ BOOLEAN gfAreWePromotingRegular = FALSE; //the completed list of sector soldiers for training militia -INT32 giListOfMercsInSectorsCompletedMilitiaTraining[ SIZE_OF_MILITIA_COMPLETED_TRAINING_LIST ]; +SoldierID giListOfMercsInSectorsCompletedMilitiaTraining[ SIZE_OF_MILITIA_COMPLETED_TRAINING_LIST ]; SOLDIERTYPE *pMilitiaTrainerSoldier = NULL; // note that these sector values are STRATEGIC INDEXES, not 0-255! @@ -1421,10 +1421,10 @@ void AddSectorForSoldierToListOfSectorsThatCompletedMilitiaTraining( SOLDIERTYPE // get the sector value sSector = pSoldier->sSectorX + pSoldier->sSectorY * MAP_WORLD_X; - while( giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] != -1 ) + while( giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] != NOBODY ) { // get the current soldier - pCurrentSoldier = &Menptr[ giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] ]; + pCurrentSoldier = giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ]; // get the current sector value sCurrentSector = CALCULATE_STRATEGIC_INDEX( pCurrentSoldier->sSectorX, pCurrentSoldier->sSectorY ); @@ -1455,7 +1455,7 @@ void ClearSectorListForCompletedTrainingOfMilitia( void ) for( iCounter = 0; iCounter < SIZE_OF_MILITIA_COMPLETED_TRAINING_LIST; iCounter++ ) { - giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] = -1; + giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] = NOBODY; } return; @@ -1469,10 +1469,10 @@ void HandleContinueOfTownTraining( void ) BOOLEAN fContinueEventPosted = FALSE; - while( giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] != -1 ) + while( giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] != NOBODY ) { // get the soldier - pSoldier = &Menptr[ giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ] ]; + pSoldier = giListOfMercsInSectorsCompletedMilitiaTraining[ iCounter ]; if( pSoldier->bActive ) { @@ -1552,7 +1552,7 @@ void BuildListOfUnpaidTrainableSectors( UINT8 ubMilitiaType ) else { // handle for tactical - pSoldier = &Menptr[ gusUIFullTargetID ]; + pSoldier = gusUIFullTargetID; iCounter = 0; if (ubMilitiaType == TOWN_MILITIA) From aee7c23aa45f91555110dc52c2af80ec58ee205e Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:35:29 +0200 Subject: [PATCH 159/571] Update Air Raid.cpp --- Tactical/Air Raid.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Tactical/Air Raid.cpp b/Tactical/Air Raid.cpp index cecc0852..5066e3e0 100644 --- a/Tactical/Air Raid.cpp +++ b/Tactical/Air Raid.cpp @@ -79,7 +79,7 @@ typedef struct { BOOLEAN fInAirRaid; BOOLEAN fAirRaidScheduled; - UINT8 ubAirRaidMode; + UINT8 ubAirRaidMode; UINT32 uiSoundSample; UINT32 uiRaidLastUpdate; BOOLEAN fFadingRaidIn; @@ -87,32 +87,32 @@ typedef struct INT8 bNumDives; INT8 bMaxDives; BOOLEAN fFadingRaidOut; - INT16 sDiveX; - INT16 sDiveY; - INT16 sDiveTargetLocation; - UINT8 ubDiveDirection; - INT16 sNumGridNosMoved; - INT32 iNumTurnsSinceLastDive; - INT32 iNumTurnsSinceDiveStarted; - INT32 iNumGridNosMovedThisTurn; + INT16 sDiveX; + INT16 sDiveY; + INT16 sDiveTargetLocation; + UINT8 ubDiveDirection; + INT16 sNumGridNosMoved; + INT32 iNumTurnsSinceLastDive; + INT32 iNumTurnsSinceDiveStarted; + INT32 iNumGridNosMovedThisTurn; BOOLEAN fAirRaidHasHadTurn; - UINT8 ubBeginTeamTurn; + UINT8 ubBeginTeamTurn; BOOLEAN fHaveTBBatton; AIR_RAID_DEFINITION AirRaidDef; - INT16 sRaidSoldierID; + SoldierID sRaidSoldierID; - INT16 sNotLocatedYet; - INT32 iNumFrames; + INT16 sNotLocatedYet; + INT32 iNumFrames; INT8 bLevel; INT8 bTeam; INT8 bSide; SoldierID ubAttackerID; UINT16 usAttackingWeapon; - FLOAT dXPos; - FLOAT dYPos; - INT16 sX; - INT16 sY; + FLOAT dXPos; + FLOAT dYPos; + INT16 sX; + INT16 sY; INT32 sGridNo; @@ -1349,7 +1349,7 @@ BOOLEAN SaveAirRaidInfoToSaveGameFile( HWFILE hFile ) //// sAirRaidSaveStruct.sRaidSoldierID = gpRaidSoldier->ubID; // } // else - sAirRaidSaveStruct.sRaidSoldierID = -1; + sAirRaidSaveStruct.sRaidSoldierID = NOBODY; memcpy( &sAirRaidSaveStruct.AirRaidDef, &gAirRaidDef, sizeof( AIR_RAID_DEFINITION ) ); @@ -1407,9 +1407,9 @@ BOOLEAN LoadAirRaidInfoFromSaveGameFile( HWFILE hFile ) giNumFrames = sAirRaidSaveStruct.iNumFrames; - if( sAirRaidSaveStruct.sRaidSoldierID != -1 ) + if( sAirRaidSaveStruct.sRaidSoldierID != NOBODY ) { - gpRaidSoldier = &Menptr[ sAirRaidSaveStruct.sRaidSoldierID ]; + gpRaidSoldier = sAirRaidSaveStruct.sRaidSoldierID; gpRaidSoldier->pathing.bLevel = sAirRaidSaveStruct.bLevel; gpRaidSoldier->bTeam = sAirRaidSaveStruct.bTeam; From cebd20f5d0c94b34536021193c9fd193d7ebacee Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:47:51 +0200 Subject: [PATCH 160/571] Update ShopKeeper Interface.cpp --- Tactical/ShopKeeper Interface.cpp | 35 +++++++++++++------------------ 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 553a2ad7..d1245983 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -3665,12 +3665,10 @@ void DisplayPlayersOfferArea() //get an updated status from the amount in the pocket if( PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation != -1 && PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem != NO_PROFILE ) { - INT16 sSoldierID; + SoldierID sSoldierID = GetSoldierIDFromMercID( PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem ); + Assert(sSoldierID != NOBODY); - sSoldierID = GetSoldierIDFromMercID( PlayersOfferArea[ sCnt ].ubIdOfMercWhoOwnsTheItem ); - Assert(sSoldierID != -1); - - PlayersOfferArea[ sCnt ].ItemObject[0]->data.money.uiMoneyAmount = Menptr[ sSoldierID ].inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ][0]->data.money.uiMoneyAmount; + PlayersOfferArea[ sCnt ].ItemObject[0]->data.money.uiMoneyAmount = sSoldierID->inv[ PlayersOfferArea[ sCnt ].bSlotIdInOtherLocation ][0]->data.money.uiMoneyAmount; PlayersOfferArea[ sCnt ].uiItemPrice = PlayersOfferArea[ sCnt ].ItemObject[0]->data.money.uiMoneyAmount; } } @@ -6489,23 +6487,21 @@ void ShopkeeperAddItemToPool( INT32 sGridNo, OBJECTTYPE *pObject, INT8 bVisible, void IfMercOwnedCopyItemToMercInv( INVENTORY_IN_SLOT *pInv ) { - INT16 sSoldierID; - //if the item picked up was in a previous location, and that location is on a merc's inventory if ( ( pInv->bSlotIdInOtherLocation != -1 ) && ( pInv->ubIdOfMercWhoOwnsTheItem != NO_PROFILE ) ) { // get soldier - sSoldierID = GetSoldierIDFromMercID( pInv->ubIdOfMercWhoOwnsTheItem ); - Assert( sSoldierID != -1 ); - Assert( CanMercInteractWithSelectedShopkeeper( MercPtrs[ sSoldierID ] ) ); + SoldierID sSoldierID = GetSoldierIDFromMercID( pInv->ubIdOfMercWhoOwnsTheItem ); + Assert( sSoldierID != NOBODY ); + Assert( CanMercInteractWithSelectedShopkeeper( sSoldierID ) ); // then it better be a valid slot # - Assert( pInv->bSlotIdInOtherLocation < (INT8)Menptr[ sSoldierID ].inv.size() ); + Assert( pInv->bSlotIdInOtherLocation < (INT8)(sSoldierID->inv.size()) ); // and it better have a valid merc who owned it Assert( pInv->ubIdOfMercWhoOwnsTheItem != NO_PROFILE ); //Copy the object back into that merc's original inventory slot - Menptr[ sSoldierID ].inv[ pInv->bSlotIdInOtherLocation ] = pInv->ItemObject; + sSoldierID->inv[ pInv->bSlotIdInOtherLocation ] = pInv->ItemObject; } } @@ -6521,15 +6517,15 @@ void IfMercOwnedRemoveItemFromMercInv2( UINT8 ubOwnerProfileId, INT16 bOwnerSlot { // and it better have a valid merc who owned it Assert( ubOwnerProfileId != NO_PROFILE ); - INT16 sSoldierID = GetSoldierIDFromMercID( ubOwnerProfileId ); - Assert( sSoldierID != -1 ); + SoldierID sSoldierID = GetSoldierIDFromMercID( ubOwnerProfileId ); + Assert( sSoldierID != NOBODY ); // then it better be a valid slot # - Assert( bOwnerSlotId < (INT8)Menptr[ sSoldierID ].inv.size() ); + Assert( bOwnerSlotId < (INT8)(sSoldierID->inv.size() )); - Assert( CanMercInteractWithSelectedShopkeeper( MercPtrs[ sSoldierID ] ) ); + Assert( CanMercInteractWithSelectedShopkeeper( sSoldierID ) ); //remove the object from that merc's original inventory slot - DeleteObj(&(Menptr[ sSoldierID ].inv[bOwnerSlotId])); + DeleteObj(&(sSoldierID->inv[bOwnerSlotId])); } } @@ -7087,9 +7083,8 @@ UINT32 EvaluateInvSlot( INVENTORY_IN_SLOT *pInvSlot ) //if the dealer is Micky if( gbSelectedArmsDealerID == ARMS_DEALER_MICKY ) { - INT16 sSoldierID; - sSoldierID = GetSoldierIDFromMercID( armsDealerInfo[ gbSelectedArmsDealerID ].ubShopKeeperID ); - if( ( sSoldierID != -1 ) && ( GetDrunkLevel( &Menptr[ sSoldierID ] ) == DRUNK ) ) + SoldierID sSoldierID = GetSoldierIDFromMercID( armsDealerInfo[ gbSelectedArmsDealerID ].ubShopKeeperID ); + if( ( sSoldierID != NOBODY ) && ( GetDrunkLevel( sSoldierID ) == DRUNK ) ) { //Micky is DRUNK, pays more! dPriceModifier = armsDealerInfo[ gbSelectedArmsDealerID ].dSellModifier; From cabb50a361fb471e4b7c86ce39f72ab2928d1a8a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 00:48:40 +0200 Subject: [PATCH 161/571] Update Game Event Hook.cpp --- Strategic/Game Event Hook.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index 241faf49..14d920d2 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -254,12 +254,14 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) MercsContractIsFinished( (UINT8) pEvent->uiParam ); break; case EVENT_ADDSOLDIER_TO_UPDATE_BOX: + { // if the grunt is currently active, add to update box SoldierID usID = pEvent->uiParam; - if( usID != NOBODY && usID->bActive ) + if ( usID != NOBODY && usID->bActive ) { AddSoldierToWaitingListQueue( usID ); } + } break; case EVENT_SET_MENU_REASON: AddReasonToWaitingListQueue( (UINT8) pEvent->uiParam ); From e4fe066da0aecf75aab0ffa88d4a8629d615bf9c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:56:30 +0200 Subject: [PATCH 162/571] Fix comment --- Tactical/Soldier Add.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index a10c6cc2..61e4494c 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1787,7 +1787,7 @@ BOOLEAN IsMercOnTeam(UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive) } -// GetSoldierIDFromMercID() Gets the Soldier ID from the Merc Profile ID, else returns -1 +// GetSoldierIDFromMercID() Gets the Soldier ID from the Merc Profile ID, else returns NOBODY SoldierID GetSoldierIDFromMercID(UINT8 ubMercID) { SOLDIERTYPE *pTeamSoldier = NULL; From 8e4307b2fb5206d041c84e8ebba0e95ad317cbe4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 19:56:38 +0200 Subject: [PATCH 163/571] Use SoldierID --- Strategic/LuaInitNPCs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index f8ad68eb..b99141c7 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -12034,7 +12034,7 @@ static int l_VisibleTown (lua_State *L) static int l_HireMerc(lua_State *L) { MERC_HIRE_STRUCT HireMercStruct; - INT16 sSoldierID = 0; + SoldierID sSoldierID = NOBODY; INT16 iTotalContract = 7; UINT32 iTimeTillMercArrives = 0; UINT8 n = lua_gettop(L); @@ -12071,8 +12071,8 @@ static int l_HireMerc(lua_State *L) if (!HireMerc(&HireMercStruct)) { sSoldierID = GetSoldierIDFromMercID(ubCurrentSoldier); - if (sSoldierID > -1) - Menptr[sSoldierID].bTypeOfLastContract = CONTRACT_EXTEND_1_WEEK; + if (sSoldierID != NOBODY) + sSoldierID->bTypeOfLastContract = CONTRACT_EXTEND_1_WEEK; gMercProfiles[ubCurrentSoldier].bMercStatus = MERC_OK; From bb1c63d4e8aebc16ac44f21ed4b00c5b314f7607 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:12:05 +0200 Subject: [PATCH 164/571] Convert to SoldierID --- Strategic/Game Event Hook.cpp | 4 ++-- Strategic/Strategic Merc Handler.cpp | 12 ++++-------- Strategic/Strategic Merc Handler.h | 5 +++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index 14d920d2..3a8b9df9 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -251,7 +251,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) break; //When a merc is supposed to leave case EVENT_MERC_CONTRACT_OVER: - MercsContractIsFinished( (UINT8) pEvent->uiParam ); + MercsContractIsFinished( pEvent->uiParam ); break; case EVENT_ADDSOLDIER_TO_UPDATE_BOX: { @@ -432,7 +432,7 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent ) BeginContractRenewalSequence( ); break; case EVENT_RPC_WHINE_ABOUT_PAY: - RPCWhineAboutNoPay( (UINT8) pEvent->uiParam ); + RPCWhineAboutNoPay( pEvent->uiParam ); break; case EVENT_HAVENT_MADE_IMP_CHARACTER_EMAIL: diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index e6cae0b5..f510e653 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -721,11 +721,9 @@ void HandleMercsAboutToLeave( SOLDIERTYPE *pMercList ) // ATE: This function deals with MERC MERC and NPC's leaving because of not getting paid... // NOT AIM renewals.... -void MercsContractIsFinished( UINT16 ubID ) +void MercsContractIsFinished( SoldierID ubID ) { - SOLDIERTYPE *pSoldier; - - pSoldier = &Menptr[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; //if the soldier was removed before getting into this function, return if( !pSoldier->bActive ) @@ -775,11 +773,9 @@ void MercsContractIsFinished( UINT16 ubID ) } // ATE: Called for RPCs who should now complain about no pay... -void RPCWhineAboutNoPay( UINT16 ubID ) +void RPCWhineAboutNoPay( SoldierID ubID ) { - SOLDIERTYPE *pSoldier; - - pSoldier = &Menptr[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; //if the soldier was removed before getting into this function, return if( !pSoldier->bActive ) diff --git a/Strategic/Strategic Merc Handler.h b/Strategic/Strategic Merc Handler.h index 2ea34e9f..4e878f2f 100644 --- a/Strategic/Strategic Merc Handler.h +++ b/Strategic/Strategic Merc Handler.h @@ -3,11 +3,12 @@ //forward declarations of common classes to eliminate includes class SOLDIERTYPE; +struct SoldierID; void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ); void MercDailyUpdate(); -void MercsContractIsFinished( UINT16 ubID ); -void RPCWhineAboutNoPay( UINT16 ubID ); +void MercsContractIsFinished( SoldierID ubID ); +void RPCWhineAboutNoPay( SoldierID ubID ); void MercComplainAboutEquipment( UINT8 ubProfileID ); BOOLEAN SoldierHasWorseEquipmentThanUsedTo( SOLDIERTYPE *pSoldier ); void UpdateBuddyAndHatedCounters( void ); From d826491c83153d3662a253b7ffd272cf74b198a0 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:26:50 +0200 Subject: [PATCH 165/571] Remove unused function parameter --- Multiplayer/client.cpp | 2 +- Multiplayer/connect.h | 2 +- Tactical/Soldier Create.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 79d30606..efeb2479 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -1275,7 +1275,7 @@ UINT8 numenemyLAN( UINT8 ubSectorX, UINT8 ubSectorY ) return ubNumEnemies; } -void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ) +void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct ) { AI_STRUCT send_inv; send_inv.standard_data = *pCreateStruct; diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index 349d524d..a85ea281 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -104,7 +104,7 @@ void send_gui_dir(SOLDIERTYPE *pSoldier, UINT16 usNewDirection); void send_EndTurn( UINT8 ubNextTeam ); -void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ); +void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct ); void send_stop (EV_S_STOP_MERC *SStopMerc); diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index ae841fb4..a5e41fd7 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -603,7 +603,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 } if ( is_server && tbTeam > OUR_TEAM && tbTeam < PLAYER_PLAN ) { - send_AI(pCreateStruct,pubID); + send_AI(pCreateStruct); } if(is_client && !is_server && tfPP==1) { From dbc4135974b235faf43ea4c3b8a05ffa50dc033b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:27:03 +0200 Subject: [PATCH 166/571] Use SoldierID --- Ja2/SaveLoadGame.cpp | 8 +++---- Multiplayer/client.cpp | 8 +++---- Strategic/Auto Resolve.cpp | 2 +- Strategic/Quest Debug System.cpp | 2 +- Tactical/Handle UI Plan.cpp | 10 ++++----- Tactical/Merc Hiring.cpp | 2 +- Tactical/Rotting Corpses.cpp | 16 +++++++------- Tactical/Soldier Create.cpp | 38 ++++++++++++++++---------------- Tactical/Soldier Create.h | 2 +- Tactical/Soldier Init List.cpp | 4 ++-- Tactical/Soldier Profile.cpp | 18 +++++++-------- Tactical/Turn Based Input.cpp | 10 ++++----- 12 files changed, 60 insertions(+), 60 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index a85ad173..34f283fe 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -6926,12 +6926,12 @@ BOOLEAN SaveSoldierStructure( HWFILE hFile ) BOOLEAN LoadSoldierStructure( HWFILE hFile ) { - UINT16 cnt; - UINT32 uiNumBytesRead=0; - UINT16 ubId; + UINT16 cnt; + UINT32 uiNumBytesRead=0; + SoldierID ubId; UINT8 ubOne = 1; UINT8 ubActive = 1; - UINT32 uiPercentage; + UINT32 uiPercentage; SOLDIERTYPE SavedSoldierInfo; //Loop through all the soldier and delete them all diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index efeb2479..e0fbc54a 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -1082,7 +1082,7 @@ void recieveHIRE(RPCParameters *rpcParameters) send_hire_struct* sHireMerc = (send_hire_struct*)rpcParameters->input; SOLDIERTYPE *pSoldier; - UINT16 iNewIndex; + SoldierID iNewIndex; SOLDIERCREATE_STRUCT MercCreateStruct; BOOLEAN fReturn = FALSE; @@ -1097,7 +1097,7 @@ void recieveHIRE(RPCParameters *rpcParameters) TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ; - pSoldier = &Menptr[iNewIndex]; + pSoldier = iNewIndex; pSoldier->flags.uiStatusFlags |= SOLDIER_PC; gMercProfiles[ pSoldier->ubProfile ].ubMiscFlags |= PROFILE_MISC_FLAG_RECRUITED; @@ -1290,7 +1290,7 @@ void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct ) void recieveAI (RPCParameters *rpcParameters) { - UINT16 iNewIndex; + SoldierID iNewIndex; SOLDIERTYPE *pSoldier; AI_STRUCT* send_inv = (AI_STRUCT*)rpcParameters->input; @@ -1354,7 +1354,7 @@ void recieveAI (RPCParameters *rpcParameters) new_standard_data.fPlayerPlan=1; TacticalCreateSoldier( &new_standard_data, &iNewIndex ); - pSoldier = &Menptr[iNewIndex]; + pSoldier = iNewIndex; pSoldier->flags.uiStatusFlags |= SOLDIER_PC; AddSoldierToSector( iNewIndex ); diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index e55eb561..cddd2e02 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -3749,7 +3749,7 @@ void CreateTempPlayerMerc() { SOLDIERCREATE_STRUCT MercCreateStruct; static INT32 iSoldierCount=0; - UINT16 ubID; + SoldierID ubID; //Init the merc create structure with basic information MercCreateStruct.bTeam = SOLDIER_CREATE_AUTO_TEAM; diff --git a/Strategic/Quest Debug System.cpp b/Strategic/Quest Debug System.cpp index 1cd77da1..3b937bb4 100644 --- a/Strategic/Quest Debug System.cpp +++ b/Strategic/Quest Debug System.cpp @@ -2995,7 +2995,7 @@ void AddNPCToGridNo( INT32 iGridNo ) { SOLDIERCREATE_STRUCT MercCreateStruct; INT16 sSectorX, sSectorY; - UINT16 ubID; + SoldierID ubID; GetCurrentWorldSector( &sSectorX, &sSectorY ); MercCreateStruct.bTeam = CIV_TEAM; diff --git a/Tactical/Handle UI Plan.cpp b/Tactical/Handle UI Plan.cpp index de94ba0a..3e2be46a 100644 --- a/Tactical/Handle UI Plan.cpp +++ b/Tactical/Handle UI Plan.cpp @@ -37,12 +37,12 @@ BOOLEAN BeginUIPlan( SOLDIERTYPE *pSoldier ) BOOLEAN AddUIPlan( INT32 sGridNo, UINT8 ubPlanID ) { SOLDIERTYPE *pPlanSoldier; - INT16 sXPos, sYPos; - INT16 sAPCost = 0; - INT8 bDirection; - INT32 iLoop; + INT16 sXPos, sYPos; + INT16 sAPCost = 0; + INT8 bDirection; + INT32 iLoop; SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 ubNewIndex; + SoldierID ubNewIndex; // Depeding on stance and direction facing, add guy! diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 92410d87..5cdb9f00 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -127,7 +127,7 @@ UINT16 GetInitialHeliRandomTime(); INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) { SOLDIERTYPE *pSoldier; - UINT16 iNewIndex; + SoldierID iNewIndex; UINT8 ubCurrentSoldier = pHireMerc->ubProfileID; MERCPROFILESTRUCT *pMerc; SOLDIERCREATE_STRUCT MercCreateStruct; diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 0ca90c94..b1540460 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1155,14 +1155,14 @@ INT16 FindNearestRottingCorpse( SOLDIERTYPE *pSoldier ) void AddCrowToCorpse( ROTTING_CORPSE *pCorpse ) { SOLDIERCREATE_STRUCT MercCreateStruct; - INT8 ubBodyType = CROW; - UINT16 iNewIndex; - INT32 sGridNo; - UINT8 ubDirection; - SOLDIERTYPE *pSoldier; + INT8 ubBodyType = CROW; + SoldierID iNewIndex; + INT32 sGridNo; + UINT8 ubDirection; + SOLDIERTYPE *pSoldier; //DBrot: More Rooms - //UINT8 ubRoomNum; - UINT16 usRoomNum; + //UINT8 ubRoomNum; + UINT16 usRoomNum; // No crows inside :( if ( InARoom( pCorpse->def.sGridNo, &usRoomNum ) ) { @@ -2918,7 +2918,7 @@ void CreateZombiefromCorpse( ROTTING_CORPSE * pCorpse, UINT16 usAnimState ) MercCreateStruct.fVisible = TRUE; - UINT16 iNewIndex; + SoldierID iNewIndex; if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { /* certain values have to be set afterwards - the alternative would be to edit each and every function that gets called from TacticalCreateSoldier() subsequently and diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index a5e41fd7..1a2be1a6 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -571,7 +571,7 @@ void DecideToAssignSniperOrders( SOLDIERCREATE_STRUCT * pp ) // For this reason, we add a little helper variable that stores such a sector. INT16 gsStrategicDiseaseOriginSector = -1; #pragma optimize("", off) -SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ) +SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, SoldierID *pubID ) { SOLDIERTYPE Soldier; INT32 cnt; @@ -3076,7 +3076,7 @@ SOLDIERTYPE* TacticalCreateAdministrator() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3109,7 +3109,7 @@ SOLDIERTYPE* TacticalCreateArmyTroop() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3143,7 +3143,7 @@ SOLDIERTYPE* TacticalCreateEliteEnemy() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3185,7 +3185,7 @@ SOLDIERTYPE* TacticalCreateEnemyTank() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3227,7 +3227,7 @@ SOLDIERTYPE* TacticalCreateEnemyJeep( ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if ( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3270,7 +3270,7 @@ SOLDIERTYPE* TacticalCreateEnemyRobot() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if ( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3313,7 +3313,7 @@ SOLDIERTYPE* TacticalCreateZombie() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3387,7 +3387,7 @@ SOLDIERTYPE* TacticalCreateMilitia( UINT8 ubMilitiaClass, INT16 sX, INT16 sY ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if (gpBattleGroup && @@ -3428,7 +3428,7 @@ SOLDIERTYPE* TacticalCreateCreature( INT8 bCreatureBodyType ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3454,7 +3454,7 @@ SOLDIERTYPE* TacticalCreateArmedCivilian( UINT8 usSoldierClass ) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier = NULL; // this needs the covert ops trait, and thus the new trait system @@ -3503,9 +3503,9 @@ SOLDIERTYPE* TacticalCreateCivilian( INT32 sGridNo, UINT8 usCivilianGroup, INT8 if ( guiCurrentScreen == AUTORESOLVE_SCREEN ) return NULL; - UINT16 ubID = NOBODY; - SOLDIERTYPE* pSoldier = NULL; - SOLDIERCREATE_STRUCT MercCreateStruct; + SoldierID ubID = NOBODY; + SOLDIERTYPE* pSoldier = NULL; + SOLDIERCREATE_STRUCT MercCreateStruct; MercCreateStruct.initialize( ); MercCreateStruct.bTeam = CIV_TEAM; @@ -3602,7 +3602,7 @@ SOLDIERTYPE* TacticalCreateEnemyAssassin(UINT8 disguisetype) { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; // this needs the covert ops trait, and thus the new trait system @@ -3667,7 +3667,7 @@ SOLDIERTYPE* TacticalCreateBandit() { BASIC_SOLDIERCREATE_STRUCT bp; SOLDIERCREATE_STRUCT pp; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; if ( guiCurrentScreen == AUTORESOLVE_SCREEN && !gfPersistantPBI ) @@ -3858,7 +3858,7 @@ void CreatePrisonerOfWar() } SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 ubID; + SoldierID ubID; static INT8 bPowBodyType = REGMALE; @@ -3940,7 +3940,7 @@ void CreateDownedPilot( ) while ( TileIsOutOfBounds( sGridNo ) || FindStructure( sGridNo, STRUCTURE_BLOCKSMOVES ) || TERRAIN_IS_WATER( gpWorldLevelData[sGridNo].ubTerrainID ) || GridNoNearPlayerMercs( sGridNo, 25 ) ); SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 ubID; + SoldierID ubID; MercCreateStruct.initialize( ); MercCreateStruct.bTeam = CIV_TEAM; @@ -4102,7 +4102,7 @@ void QuickCreateProfileMerc( INT8 bTeam, UINT8 ubProfileID ) // Create guy # X SOLDIERCREATE_STRUCT MercCreateStruct; INT16 sWorldX, sWorldY, sSectorX, sSectorY, sGridX, sGridY; - UINT16 ubID; + SoldierID ubID; INT32 usMapPos; if ( GetMouseXY( &sGridX, &sGridY ) ) diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index 03d42673..a7b5037c 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -460,7 +460,7 @@ void RandomizeNewSoldierStats( SOLDIERCREATE_STRUCT *pCreateStruct ); //Kris: //Modified return type from BOOLEAN to SOLDIERTYPE* -SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT16 * pubID ); +SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, SoldierID *pubID ); //Randomly generated enemies used by strategic AI. SOLDIERTYPE* TacticalCreateAdministrator(); diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 3db1f288..9568210e 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -582,7 +582,7 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL ) UINT8 ubProfile; SOLDIERCREATE_STRUCT tempDetailedPlacement; SOLDIERTYPE *pSoldier; - UINT16 ubID; + SoldierID ubID; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("AddPlacementToWorld")); // First check if this guy has a profile and if so check his location such that it matches! @@ -2659,7 +2659,7 @@ void AddProfilesUsingProfileInsertionData() if( !pSoldier ) { //Create a new soldier, as this one doesn't exist SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 ubID; + SoldierID ubID; //Set up the create struct so that we can properly create the profile soldier. MercCreateStruct.initialize(); diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 449277c2..f5d9a379 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1559,19 +1559,19 @@ SOLDIERTYPE * FindSoldierByProfileID( UINT8 ubProfileID, BOOLEAN fPlayerMercsOnl SOLDIERTYPE *ChangeSoldierTeam( SOLDIERTYPE *pSoldier, UINT8 ubTeam ) { - UINT16 ubID; - SOLDIERTYPE *pNewSoldier = NULL; + SoldierID ubID; + SOLDIERTYPE *pNewSoldier = NULL; SOLDIERCREATE_STRUCT MercCreateStruct; - UINT32 cnt; - INT32 sOldGridNo; + UINT32 cnt; + INT32 sOldGridNo; - UINT16 ubOldID; - UINT32 uiOldUniqueId; + SoldierID ubOldID; + UINT32 uiOldUniqueId; - UINT32 uiSlot; - SOLDIERTYPE *pGroupMember; + UINT32 uiSlot; + SOLDIERTYPE *pGroupMember; - BOOLEAN success; + BOOLEAN success; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("ChangeSoldierTeam")); diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 58602825..4572c033 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -5471,7 +5471,7 @@ void CreateNextCivType() MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); - UINT16 iNewIndex; + SoldierID iNewIndex; if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5518,7 +5518,7 @@ void CreateCow() MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); - UINT16 iNewIndex; + SoldierID iNewIndex; if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5547,7 +5547,7 @@ void CreateBloodCat() MercCreateStruct.sInsertionGridNo = usMapPos; RandomizeNewSoldierStats( &MercCreateStruct ); - UINT16 iNewIndex; + SoldierID iNewIndex; if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5577,7 +5577,7 @@ void CreatePlayerControlledCow() RandomizeNewSoldierStats( &MercCreateStruct ); - UINT16 iNewIndex; + SoldierID iNewIndex; if ( TacticalCreateSoldier( &MercCreateStruct, &iNewIndex ) ) { AddSoldierToSector( iNewIndex ); @@ -5642,7 +5642,7 @@ void CreatePlayerControlledMonster() if ( GetMouseMapPos( &usMapPos ) ) { SOLDIERCREATE_STRUCT MercCreateStruct; - UINT16 iNewIndex; + SoldierID iNewIndex; MercCreateStruct.ubProfile = NO_PROFILE; MercCreateStruct.sSectorX = gWorldSectorX; From 8856813768dfacc9ae15116b469a64a06e36d245 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:03:54 +0200 Subject: [PATCH 167/571] Lessen copy & paste --- Tactical/Auto Bandage.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index 1f0f237b..4f2cd888 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -1024,7 +1024,7 @@ BOOLEAN AddFacesToAutoBandageBox( void ) INT32 iCounter = 0; INT32 iNumberOfDoctors = 0; VOBJECT_DESC VObjectDesc; - + const MERCPROFILESTRUCT *profile; // WDS - make number of mercenaries, etc. be configurable // reset @@ -1040,21 +1040,24 @@ BOOLEAN AddFacesToAutoBandageBox( void ) // find a free slot if( iDoctorList[ iCounter ] != -1 ) { - if( gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) + profile = &gMercProfiles[(Menptr[iDoctorList[iCounter]]).ubProfile]; + const UINT8 face = profile->ubFaceIndex; + + if( face < 100 ) { // grab filename of face - if ((iDoctorList[ iCounter ] != -1) && gMercProfiles[( Menptr[iDoctorList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + if ( profile->Type == PROFILETYPE_IMP ) + sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", face ); else - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", face ); } else { // grab filename of face - if ((iDoctorList[ iCounter ] != -1) && gMercProfiles[( Menptr[iDoctorList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + if ( profile->Type == PROFILETYPE_IMP ) + sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", face ); else - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iDoctorList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", face ); } // load the face @@ -1073,21 +1076,24 @@ BOOLEAN AddFacesToAutoBandageBox( void ) // find a free slot if( iPatientList[ iCounter ] != -1 ) { - if( gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex < 100 ) + profile = &gMercProfiles[(Menptr[iPatientList[iCounter]]).ubProfile]; + const UINT8 face = profile->ubFaceIndex; + + if( face < 100 ) { // grab filename of face - if ((iPatientList[ iCounter ] != -1) && gMercProfiles[( Menptr[iPatientList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + if ( profile->Type == PROFILETYPE_IMP ) + sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%02d.sti", face ); else - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%02d.sti", face ); } else { // grab filename of face - if ( (iPatientList[ iCounter ] != -1) && gMercProfiles[( Menptr[iPatientList[iCounter]] ).ubProfile].Type == PROFILETYPE_IMP ) - sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + if ( profile->Type == PROFILETYPE_IMP ) + sprintf( VObjectDesc.ImageFile, "IMPFaces\\65Face\\%03d.sti", face ); else - sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", gMercProfiles[ ( Menptr[ iPatientList[ iCounter ] ] ).ubProfile ].ubFaceIndex ); + sprintf( VObjectDesc.ImageFile, "Faces\\65Face\\%03d.sti", face ); } // load the face From 3f4c94642e01d2bbe5a0cbc449334b4764de0aaf Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:04:12 +0200 Subject: [PATCH 168/571] Fix compiler warnings --- Multiplayer/client.cpp | 6 +++--- Multiplayer/server.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index e0fbc54a..8e1229d4 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -3050,7 +3050,7 @@ void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, Sol #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - send_grenade_result ( RealObjectID : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n",gres.RealObjectID, gres.sGridNo , gres.ubOwnerID , guiPreRandomIndex ); + sprintf( tmpMPDbgString, "MP - send_grenade_result ( RealObjectID : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n", gres.RealObjectID, gres.sGridNo, gres.ubOwnerID.i, guiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif @@ -3074,7 +3074,7 @@ void recieveGRENADERESULT (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recieveGRENADERESULT ( RealObjectID : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n",gres->RealObjectID, gres->sGridNo , gres->ubOwnerID , gres->uiPreRandomIndex ); + sprintf( tmpMPDbgString, "MP - recieveGRENADERESULT ( RealObjectID : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n", gres->RealObjectID, gres->sGridNo, gres->ubOwnerID.i, gres->uiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif @@ -3167,7 +3167,7 @@ void recievePLANTEXPLOSIVE (RPCParameters *rpcParameters) { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"MP - recievePLANTEXPLOSIVE ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n",exp->usItem, exp->sGridNo , exp->ubID , guiPreRandomIndex ); + sprintf( tmpMPDbgString, "MP - recievePLANTEXPLOSIVE ( usItem : %i , sGridNo : %i , ubSoldierID : %i , uiPreRandomIndex : %i )\n", exp->usItem, exp->sGridNo, exp->ubID.i, guiPreRandomIndex ); MPDebugMsg(tmpMPDbgString); #endif diff --git a/Multiplayer/server.cpp b/Multiplayer/server.cpp index c1829415..7f5b4eba 100644 --- a/Multiplayer/server.cpp +++ b/Multiplayer/server.cpp @@ -365,7 +365,7 @@ void sendDEATH(RPCParameters *rpcParameters) _itow(iCLnum,clnum,10); ScreenMsg( FONT_LTBLUE, MSG_MPSYSTEM, L"DEBUG: Soldier Killed : Attacking team %s , Soldier Team %s, Sender %s",ateam,steam,clnum); char logmsg[100]; - sprintf(logmsg, "MP DEBUG: Soldier Killed #%i : Attacking team %i , Soldier Team %i, Sender %i\n",nDeath->soldier_id,nDeath->attacker_team,nDeath->soldier_team,iCLnum); + sprintf( logmsg, "MP DEBUG: Soldier Killed #%i : Attacking team %i , Soldier Team %i, Sender %i\n", nDeath->soldier_id.i, nDeath->attacker_team, nDeath->soldier_team, iCLnum ); MPDebugMsg( logmsg ); #endif } From 63fe0be512396e2a6b3dcfd0c45c1fc9f35acce7 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:10:44 +0200 Subject: [PATCH 169/571] Use SoldierID Rename function parameter to make it clear it needs to be profileID Change the parameter type to UINT8 --- Strategic/Quest Debug System.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Strategic/Quest Debug System.cpp b/Strategic/Quest Debug System.cpp index 3b937bb4..589a853b 100644 --- a/Strategic/Quest Debug System.cpp +++ b/Strategic/Quest Debug System.cpp @@ -665,19 +665,19 @@ void ChangeFactState( INT32 iNumber ); void DisplayCurrentGridNo(); void EnableQDSButtons(); -BOOLEAN DoQDSMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback ); +BOOLEAN DoQDSMessageBox( UINT8 ubStyle, STR16 zString, UINT32 uiExitScreen, UINT8 ubFlags, MSGBOX_CALLBACK ReturnCallback ); void IncrementActiveDropDownBox( INT16 sIncrementValue ); -INT16 IsMercInTheSector( UINT16 usMercID ); +SoldierID IsMercInTheSector( UINT8 ubMercProfileID ); void RefreshAllNPCInventory(); void SetQDSMercProfile(); void HandleQDSTalkingMerc(); void DisplayQDSCurrentlyQuoteNum( ); void SetTalkingMercPauseState( BOOLEAN fState ); -UINT8 WhichPanelShouldTalkingMercUse( ); +UINT8 WhichPanelShouldTalkingMercUse( ); void EndMercTalking(); void EnableFactMouseRegions(); void DisableFactMouseRegions(); -INT32 GetMaxNumberOfQuotesToPlay( ); +INT32 GetMaxNumberOfQuotesToPlay( ); void GetDebugLocationString( UINT16 usProfileID, STR16 pzText ); //ppp @@ -3270,7 +3270,7 @@ void BtnQuestDebugAllOrSectorNPCToggleCallback( GUI_BUTTON *btn, INT32 reason ) DisableButton( guiQuestDebugStartMercTalkingButtonButton ); } - if( IsMercInTheSector( gNpcListBox.sCurSelectedItem ) == -1 ) + if( IsMercInTheSector( gNpcListBox.sCurSelectedItem ) == NOBODY ) DisableButton( guiQuestDebugViewNPCInvButton ); EnableQDSButtons(); @@ -3567,7 +3567,7 @@ void EnableQDSButtons() if( gfUseLocalNPCs ) { - if( IsMercInTheSector( gubCurrentNpcInSector[ gNpcListBox.sCurSelectedItem ] ) != -1 ) + if( IsMercInTheSector( gubCurrentNpcInSector[ gNpcListBox.sCurSelectedItem ] ) != NOBODY ) { EnableButton( guiQuestDebugViewNPCInvButton ); EnableButton( guiQuestDebugNPCRefreshButtonButton ); @@ -3664,20 +3664,20 @@ void IncrementActiveDropDownBox( INT16 sIncrementValue ) } -INT16 IsMercInTheSector( UINT16 usMercID ) +SoldierID IsMercInTheSector( UINT8 ubMercProfileID ) { UINT16 cnt; for ( cnt=0; cnt < TOTAL_SOLDIERS; cnt++ ) { //if the merc is active - if( Menptr[ cnt ].ubProfile == usMercID ) + if( Menptr[ cnt ].ubProfile == ubMercProfileID ) { if( Menptr[ cnt ].bActive ) return( Menptr[ cnt ].ubID ); } } - return( -1 ); + return( NOBODY ); } From 29354135dc1776338310c09b009741b2eb38af29 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:14:10 +0200 Subject: [PATCH 170/571] Use SoldierID --- Editor/EditorMercs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index d53bb201..7a82931a 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -559,7 +559,7 @@ void AddMercToWorld( INT32 iMapIndex ) if( IsLocationSittable( iMapIndex, gfRoofPlacement ) ) { - UINT16 ubID; + SoldierID ubID; INT16 sSectorX, sSectorY; SOLDIERINITNODE *pNode; @@ -3783,7 +3783,7 @@ void PasteMercPlacement( INT32 iMapIndex ) if( IsLocationSittable( iMapIndex, gfRoofPlacement ) ) { - UINT16 ubID; + SoldierID ubID; INT16 sSectorX, sSectorY; SOLDIERINITNODE *pNode; From 9d0ec49e88cb00db71ecd0a7372c20a77b84989e Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:17:19 +0200 Subject: [PATCH 171/571] Use SoldierID --- Strategic/Strategic Movement.cpp | 18 +++++++++--------- Strategic/Strategic Movement.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 323f9100..426a8832 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -4310,12 +4310,12 @@ BOOLEAN LoadPlayerGroupList( HWFILE hFile, GROUP **pGroup ) { PLAYERGROUP *pTemp=NULL; PLAYERGROUP *pHead=NULL; - UINT32 uiNumberOfNodes=0; - UINT32 uiProfileID=0; - UINT32 uiNumBytesRead; - UINT32 cnt=0; - INT16 sTempID; - GROUP *pTempGroup = *pGroup; + UINT32 uiNumberOfNodes=0; + UINT32 uiProfileID=0; + UINT32 uiNumBytesRead; + UINT32 cnt=0; + SoldierID sTempID; + GROUP *pTempGroup = *pGroup; // pTemp = pGroup; @@ -4350,10 +4350,10 @@ BOOLEAN LoadPlayerGroupList( HWFILE hFile, GROUP **pGroup ) sTempID = GetSoldierIDFromMercID( pTemp->ubProfileID ); //Should never happen - Assert( sTempID != -1 ); - pTemp->ubID = (UINT16) sTempID; + Assert( sTempID != NOBODY ); + pTemp->ubID = sTempID; - pTemp->pSoldier = &Menptr[ pTemp->ubID ]; + pTemp->pSoldier = pTemp->ubID; pTemp->next = NULL; diff --git a/Strategic/Strategic Movement.h b/Strategic/Strategic Movement.h index 1acd86d3..6f29c969 100644 --- a/Strategic/Strategic Movement.h +++ b/Strategic/Strategic Movement.h @@ -52,10 +52,10 @@ typedef struct WAYPOINT typedef struct PLAYERGROUP { - UINT8 ubProfileID; //SAVE THIS VALUE ONLY. The others are temp (for quick access) - UINT16 ubID; //index in the Menptr array + UINT8 ubProfileID; //SAVE THIS VALUE ONLY. The others are temp (for quick access) + SoldierID ubID; //index in the Menptr array SOLDIERTYPE *pSoldier; //direct access to the soldier pointer - UINT8 bFlags; //flags referring to individual player soldiers + UINT8 bFlags; //flags referring to individual player soldiers struct PLAYERGROUP *next; //next player in list }PLAYERGROUP; From 65a8b4fd7712af6f2895c4cdf089ac71ec2831d0 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:19:28 +0200 Subject: [PATCH 172/571] Use SoldierID --- Tactical/Merc Hiring.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 5cdb9f00..9cc5525b 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -211,18 +211,18 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) // make an objecttype CreateItem(LETTER, 100, &gTempObject); // Give it - fReturn = AutoPlaceObject( MercPtrs[iNewIndex], &gTempObject, FALSE ); + fReturn = AutoPlaceObject( iNewIndex, &gTempObject, FALSE ); // CHRISL: This condition should resolve the issue of the letter not being issued to the first merc if(!fReturn) { if (UsingNewInventorySystem()) { - (MercPtrs[iNewIndex]->inv[NUM_INV_SLOTS-1]) = gTempObject; + (iNewIndex->inv[NUM_INV_SLOTS-1]) = gTempObject; fReturn=TRUE; } else { - (MercPtrs[iNewIndex]->inv[SMALLPOCK8POS]) = gTempObject; + (iNewIndex->inv[SMALLPOCK8POS]) = gTempObject; fReturn = TRUE; } } @@ -239,7 +239,7 @@ INT8 HireMerc( MERC_HIRE_STRUCT *pHireMerc) //record how long the merc will be gone for pMerc->bMercStatus = (UINT8)pHireMerc->iTotalContractLength; - pSoldier = &Menptr[iNewIndex]; + pSoldier = iNewIndex; //Copy over insertion data.... pSoldier->ubStrategicInsertionCode = pHireMerc->ubInsertionCode; From 7fffcd295c2fe1dc81e118f30240ff685126a40b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:27:18 +0200 Subject: [PATCH 173/571] Simplify function --- Tactical/Overhead.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 21d70934..76d72e56 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -8602,14 +8602,15 @@ BOOLEAN KillIncompacitatedEnemyInSector( ) { // KIll...... // SANDRO - if the soldier is bleeding out, consider this damage as done by the last attacker + SoldierID usAttacker = NOBODY; if ( pTeamSoldier->ubAttackerID != NOBODY ) - pTeamSoldier->SoldierTakeDamage( ANIM_CROUCH, pTeamSoldier->stats.bLife, 100, TAKE_DAMAGE_BLOODLOSS, pTeamSoldier->ubAttackerID, NOWHERE, 0, TRUE ); + usAttacker = pTeamSoldier->ubAttackerID; else if ( pTeamSoldier->ubPreviousAttackerID != NOBODY ) - pTeamSoldier->SoldierTakeDamage( ANIM_CROUCH, pTeamSoldier->stats.bLife, 100, TAKE_DAMAGE_BLOODLOSS, pTeamSoldier->ubPreviousAttackerID, NOWHERE, 0, TRUE ); + usAttacker = pTeamSoldier->ubPreviousAttackerID; else if ( pTeamSoldier->ubNextToPreviousAttackerID != NOBODY ) - pTeamSoldier->SoldierTakeDamage( ANIM_CROUCH, pTeamSoldier->stats.bLife, 100, TAKE_DAMAGE_BLOODLOSS, pTeamSoldier->ubNextToPreviousAttackerID, NOWHERE, 0, TRUE ); - else - pTeamSoldier->SoldierTakeDamage( ANIM_CROUCH, pTeamSoldier->stats.bLife, 100, TAKE_DAMAGE_BLOODLOSS, NOBODY, NOWHERE, 0, TRUE ); + usAttacker = pTeamSoldier->ubNextToPreviousAttackerID; + + pTeamSoldier->SoldierTakeDamage( ANIM_CROUCH, pTeamSoldier->stats.bLife, 100, TAKE_DAMAGE_BLOODLOSS, usAttacker, NOWHERE, 0, TRUE ); fReturnVal = TRUE; } From 58bfffff5519541a43945b378a6b87d0e962bc42 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:27:46 +0200 Subject: [PATCH 174/571] Simplify if checks --- Tactical/Overhead.cpp | 71 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 76d72e56..0b28c4e0 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6411,9 +6411,9 @@ void CommonEnterCombatModeCode( ) // Loop through all mercs and make go for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, ++cnt ) { - if ( pSoldier && pSoldier->bActive ) + if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->bInSector && pSoldier->ubBodyType != CROW ) + if ( pSoldier->ubBodyType != CROW ) { // Set some flags for quotes pSoldier->usQuoteSaidFlags &= (~SOLDIER_QUOTE_SAID_IN_SHIT ); @@ -6606,45 +6606,42 @@ void ExitCombatMode( ) // Loop through all mercs and make go for ( pSoldier = Menptr, cnt = 0; cnt < TOTAL_SOLDIERS; pSoldier++, cnt++ ) { - if ( pSoldier->bActive ) + if ( pSoldier->bActive && pSoldier->bInSector ) { - if ( pSoldier->bInSector ) + // Reset some flags + if ( pSoldier->flags.fNoAPToFinishMove && pSoldier->stats.bLife >= OKLIFE ) { - // Reset some flags - if ( pSoldier->flags.fNoAPToFinishMove && pSoldier->stats.bLife >= OKLIFE ) + pSoldier->AdjustNoAPToFinishMove( FALSE ); + + // ary-05/05/2009 : fix lower ready weapons + //previously "ready weapon" state was being dropped in a couple of cases + //the fix involves bypassing the reset animation state for the various "ready weapon" types + //since this is a reset animation function, we should be VERY specific about when and what we dont reset + + UINT16 test; + test = pSoldier->usAnimState; + if (!( test == AIM_RIFLE_STAND || test == AIM_RIFLE_CROUCH || + test == AIM_RIFLE_PRONE || test == AIM_DUAL_STAND || + test == AIM_DUAL_CROUCH || test == AIM_DUAL_PRONE + )) { - pSoldier->AdjustNoAPToFinishMove( FALSE ); - - // ary-05/05/2009 : fix lower ready weapons - //previously "ready weapon" state was being dropped in a couple of cases - //the fix involves bypassing the reset animation state for the various "ready weapon" types - //since this is a reset animation function, we should be VERY specific about when and what we dont reset - - UINT16 test; - test = pSoldier->usAnimState; - if (!( test == AIM_RIFLE_STAND || test == AIM_RIFLE_CROUCH || - test == AIM_RIFLE_PRONE || test == AIM_DUAL_STAND || - test == AIM_DUAL_CROUCH || test == AIM_DUAL_PRONE - )) - { - pSoldier->SoldierGotoStationaryStance( ); - } - } - - //Cancel pending events - pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; - pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; - pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; - - // Reset moved flag - pSoldier->aiData.bMoved = FALSE; - - // Set final destination - pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; - - // remove AI controlled flag - pSoldier->flags.uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; + pSoldier->SoldierGotoStationaryStance( ); + } } + + //Cancel pending events + pSoldier->usPendingAnimation = NO_PENDING_ANIMATION; + pSoldier->ubPendingDirection = NO_PENDING_DIRECTION; + pSoldier->aiData.ubPendingAction = NO_PENDING_ACTION; + + // Reset moved flag + pSoldier->aiData.bMoved = FALSE; + + // Set final destination + pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; + + // remove AI controlled flag + pSoldier->flags.uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; } } From 99703fa8b6a945aea01d60c5b94eda3427af7dc9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:52:28 +0200 Subject: [PATCH 175/571] Use SoldierID --- Tactical/opplist.cpp | 93 ++++++++++++++++++++++---------------------- Tactical/opplist.h | 4 +- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index b13ed1b2..0b05cb5a 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -70,12 +70,12 @@ extern void SetSoldierAniSpeed( SOLDIERTYPE *pSoldier ); // HEADROCK HAM 3.6: Moved to header //void MakeBloodcatsHostile( void ); -void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ); -void TheirNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); -void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void OurNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ); +void TheirNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void ProcessNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT8 ubNoiseType, UINT8 ubBaseVolume, UINT8 ubTerrType1, UINT8 ubTerrType2); -void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen); -void TellPlayerAboutNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage = NULL ); +void HearNoise(SOLDIERTYPE *pSoldier, SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen); +void TellPlayerAboutNoise(SOLDIERTYPE *pSoldier, SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage = NULL ); void OurTeamSeesSomeone( SOLDIERTYPE * pSoldier, INT8 bNumReRevealed, INT8 bNumNewEnemies ); void IncrementWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel ); @@ -5564,7 +5564,7 @@ void MakeNoise(SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT { if (ubNoiseMaker < TOTAL_SOLDIERS) { - if (Menptr[ubNoiseMaker].controller == Net.pnum) + if (ubNoiseMaker->controller == Net.pnum) { bWeControlNoise = TRUE; } @@ -5624,7 +5624,7 @@ void MakeNoise(SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT } -void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) +void OurNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { #ifdef BYPASSNOISE return; @@ -5649,13 +5649,13 @@ void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType // interrupts are possible, resolve them now (we're in control here) // (you can't interrupt NOBODY, even if you hear the noise) - ResolveInterruptsVs(MercPtrs[ubNoiseMaker],NOISEINTERRUPT); + ResolveInterruptsVs(ubNoiseMaker, NOISEINTERRUPT); } } -void TheirNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, +void TheirNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { @@ -5686,7 +5686,7 @@ void TheirNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrTyp if (ubNoiseMaker < TOTAL_SOLDIERS) { /* - pSoldier = MercPtrs[ubNoiseMaker]; + pSoldier = ubNoiseMaker; //stopAction = TRUE; // prevent real-time events from passing us by MarkTime(&LoopTime); @@ -5716,7 +5716,7 @@ void TheirNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrTyp // else if noiseMaker's NOBODY, no opplist changes or interrupts are possible } -void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) +void ProcessNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { SOLDIERTYPE *pSoldier; UINT16 bLoop; @@ -5726,7 +5726,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT UINT8 ubSourceTerrType; UINT16 ubSource; INT8 bTellPlayer = FALSE, bHeard, bSeen; - UINT16 ubHeardLoudestBy = NOBODY; + SoldierID ubHeardLoudestBy = NOBODY; UINT8 ubNoiseDir = 0xff, ubLoudestNoiseDir = 0xff; @@ -5749,8 +5749,8 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT if ((ubNoiseMaker < TOTAL_SOLDIERS) && (ubNoiseType != NOISE_EXPLOSION)) { // inactive/not in sector/dead soldiers, shouldn't be making noise! - if (!Menptr[ubNoiseMaker].bActive || !Menptr[ubNoiseMaker].bInSector || - Menptr[ubNoiseMaker].flags.uiStatusFlags & SOLDIER_DEAD) + if (!ubNoiseMaker->bActive || !ubNoiseMaker->bInSector || + ubNoiseMaker->flags.uiStatusFlags & SOLDIER_DEAD) { #ifdef BETAVERSION NumMessage("ProcessNoise: ERROR - Noisemaker is inactive/not in sector/dead, Guy #",ubNoiseMaker); @@ -5759,7 +5759,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT } // if he's out of life, and this isn't just his "dying scream" which is OK - if (!Menptr[ubNoiseMaker].stats.bLife && (ubNoiseType != NOISE_SCREAM)) + if (!ubNoiseMaker->stats.bLife && (ubNoiseType != NOISE_SCREAM)) { #ifdef BETAVERSION NumMessage("ProcessNoise: ERROR - Noisemaker is lifeless, Guy #",ubNoiseMaker); @@ -5824,7 +5824,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT // CJC: changed to if the side is the same side as the noise maker's! // CJC: changed back! - if (bTeam == Menptr[ubNoiseMaker].bTeam) + if (bTeam == ubNoiseMaker->bTeam) { continue; } @@ -5894,7 +5894,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT bTellPlayer = FALSE; } /* - else if ( (Menptr[ubNoiseMaker].bVisible == TRUE) && (bTeam == gbPlayerNum) ) + else if ( (ubNoiseMaker->bVisible == TRUE) && (bTeam == gbPlayerNum) ) { ScreenMsg( MSG_FONT_YELLOW, MSG_TESTVERSION, L"Handling noise from person not currently seen in player's public opplist" ); } @@ -5906,7 +5906,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT bTellPlayer = TRUE; } - if ( MercPtrs[ ubNoiseMaker ]->stats.bLife == 0 ) + if ( ubNoiseMaker->stats.bLife == 0 ) { // this guy is dead (just dying) so don't report to player bTellPlayer = FALSE; @@ -5964,7 +5964,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT } // screen out allied militia from hearing us - switch( MercPtrs[ ubNoiseMaker ]->bTeam ) + switch( ubNoiseMaker->bTeam ) { case OUR_TEAM: // if the listener is militia and still on our side, ignore noise from us @@ -5998,8 +5998,8 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT case MILITIA_TEAM: // if the noisemaker is militia and still on our side, ignore noise if we're listening // sevenfm: allow taunts from militia - if (pSoldier->bTeam == OUR_TEAM && MercPtrs[ubNoiseMaker]->bSide == 0 && (ubNoiseType != NOISE_VOICE || !gTauntsSettings.fTauntVoice)) - //if ( pSoldier->bTeam == OUR_TEAM && MercPtrs[ ubNoiseMaker ]->bSide == 0 ) + if (pSoldier->bTeam == OUR_TEAM && ubNoiseMaker->bSide == 0 && (ubNoiseType != NOISE_VOICE || !gTauntsSettings.fTauntVoice)) + //if ( pSoldier->bTeam == OUR_TEAM && ubNoiseMaker->bSide == 0 ) { continue; } @@ -6029,11 +6029,11 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT //if (gBloodcatPlacements[ ubSectorID ][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation == QUEENS_CIV_GROUP) { // skip noises between army & bloodcats - if ( pSoldier->bTeam == ENEMY_TEAM && MercPtrs[ ubNoiseMaker ]->ubBodyType == BLOODCAT && MercPtrs[ ubNoiseMaker ]->bTeam == CREATURE_TEAM ) + if ( pSoldier->bTeam == ENEMY_TEAM && ubNoiseMaker->ubBodyType == BLOODCAT && ubNoiseMaker->bTeam == CREATURE_TEAM ) { continue; } - if ( pSoldier->bTeam == CREATURE_TEAM && pSoldier->ubBodyType == BLOODCAT && MercPtrs[ ubNoiseMaker ]->bTeam == ENEMY_TEAM ) + if ( pSoldier->bTeam == CREATURE_TEAM && pSoldier->ubBodyType == BLOODCAT && ubNoiseMaker->bTeam == ENEMY_TEAM ) { continue; } @@ -6041,7 +6041,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT else if (gBloodcatPlacements[ ubSectorID ][ DiffLevel-1 ].ubFactionAffiliation > NON_CIV_GROUP) //else if (gBloodcatPlacements[ ubSectorID ][ gGameOptions.ubDifficultyLevel-1 ].ubFactionAffiliation > NON_CIV_GROUP) { - if ( MercPtrs[ ubNoiseMaker ]->ubBodyType == BLOODCAT && MercPtrs[ ubNoiseMaker ]->bTeam == CREATURE_TEAM && pSoldier->bSide != gbPlayerNum) + if ( ubNoiseMaker->ubBodyType == BLOODCAT && ubNoiseMaker->bTeam == CREATURE_TEAM && pSoldier->bSide != gbPlayerNum) { // Target is a bloodcat. He can't be heard by civilians no matter what. { @@ -6051,7 +6051,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT else if ( pSoldier->bTeam == CREATURE_TEAM && pSoldier->ubBodyType == BLOODCAT ) { // Source is a bloodcat. He can only hear player-side soldiers, and only if hostile. - if ( MercPtrs[ ubNoiseMaker ]->bSide != gbPlayerNum || pSoldier->aiData.bNeutral ) + if ( ubNoiseMaker->bSide != gbPlayerNum || pSoldier->aiData.bNeutral ) { continue; } @@ -6149,7 +6149,7 @@ void ProcessNoise(UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrT else if(bTeam == OUR_TEAM && ubNoiseType == NOISE_CREAKING) { //shadooow: this will indicate doors not to make animation/sound of doors opening or closing - Menptr[ubNoiseMaker].ubDoorOpeningNoise = 0; + ubNoiseMaker->ubDoorOpeningNoise = 0; } // if the listening team is human-controlled AND // the noise's source is another soldier @@ -6358,7 +6358,7 @@ UINT8 CalcEffVolume(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT8 ubN -void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, +void HearNoise(SOLDIERTYPE *pSoldier, SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 *ubSeen) { INT16 sNoiseX, sNoiseY; @@ -6389,14 +6389,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b // is he close enough to see that gridno if he turns his head? // ignore muzzle flashes when turning head to see noise - if ( ubNoiseType == NOISE_GUNFIRE && ubNoiseMaker != NOBODY && MercPtrs[ ubNoiseMaker ]->flags.fMuzzleFlash ) + if ( ubNoiseType == NOISE_GUNFIRE && ubNoiseMaker != NOBODY && ubNoiseMaker->flags.fMuzzleFlash ) { ConvertGridNoToCenterCellXY(sGridNo, &sNoiseX, &sNoiseY); bDirection = atan8(pSoldier->sX,pSoldier->sY,sNoiseX,sNoiseY); if ( pSoldier->ubDirection != bDirection && pSoldier->ubDirection != gOneCDirection[ bDirection ] && pSoldier->ubDirection != gOneCCDirection[ bDirection ] ) { // temporarily turn off muzzle flash so DistanceVisible can be calculated without it - MercPtrs[ ubNoiseMaker ]->flags.fMuzzleFlash = FALSE; + ubNoiseMaker->flags.fMuzzleFlash = FALSE; fMuzzleFlash = TRUE; } } @@ -6406,7 +6406,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b if ( fMuzzleFlash ) { // turn flash on again - MercPtrs[ ubNoiseMaker ]->flags.fMuzzleFlash = TRUE; + ubNoiseMaker->flags.fMuzzleFlash = TRUE; } if (PythSpacesAway(pSoldier->sGridNo,sGridNo) <= sDistVisible ) @@ -6448,7 +6448,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b fprintf(OpplistFile,"HN: %s by %2d(g%4d,x%3d,y%3d) at %2d(g%4d,x%3d,y%3d), hTT=%d\n", (bSourceSeen) ? "SCS" : "FLR", pSoldier->guynum,pSoldier->sGridNo,pSoldier->sX,pSoldier->sY, - ubNoiseMaker,sGridNo,sNoiseX,sNoiseY, + ubNoiseMaker.i,sGridNo,sNoiseX,sNoiseY, bHadToTurn); #endif } @@ -6463,7 +6463,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b if (bSourceSeen) { - ManSeesMan(pSoldier,MercPtrs[ubNoiseMaker],Menptr[ubNoiseMaker].sGridNo,Menptr[ubNoiseMaker].pathing.bLevel,HEARNOISE,CALLER_UNKNOWN); + ManSeesMan( pSoldier, ubNoiseMaker, ubNoiseMaker->sGridNo, ubNoiseMaker->pathing.bLevel, HEARNOISE, CALLER_UNKNOWN ); // if it's an AI soldier, he is not allowed to automatically radio any // noise heard, but manSeesMan has set his newOppCnt, so clear it here @@ -6519,15 +6519,14 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b } // remember that the soldier has been heard and his new location - UpdatePersonal(pSoldier,ubNoiseMaker,HEARD_THIS_TURN,sGridNo, bLevel); + UpdatePersonal( pSoldier, ubNoiseMaker, HEARD_THIS_TURN, sGridNo, bLevel ); // sevenfm: increment watched location when soldier hears enemy if ((ubNoiseType == NOISE_GUNFIRE || ubNoiseType == NOISE_MOVEMENT || ubNoiseType == NOISE_SCREAM || ubNoiseType == NOISE_VOICE) && !TileIsOutOfBounds(sGridNo) && !(pSoldier->flags.uiStatusFlags & SOLDIER_PC) && !pSoldier->aiData.bNeutral && - MercPtrs[ubNoiseMaker] && - !MercPtrs[ubNoiseMaker]->aiData.bNeutral && + !ubNoiseMaker->aiData.bNeutral && !pSoldier->IsFlanking()) { // check that we can see enemy if we raise weapon @@ -6574,13 +6573,13 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b } // FIRST REQUIRE MUTUAL HOSTILES! - if (!CONSIDERED_NEUTRAL( MercPtrs[ ubNoiseMaker ], pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, MercPtrs[ ubNoiseMaker ] ) && (pSoldier->bSide != MercPtrs[ ubNoiseMaker ]->bSide)) + if (!CONSIDERED_NEUTRAL( ubNoiseMaker, pSoldier ) && !CONSIDERED_NEUTRAL( pSoldier, ubNoiseMaker ) && (pSoldier->bSide != ubNoiseMaker->bSide)) { // regardless of whether the noisemaker (who's not NOBODY) was seen or not, // as long as listener meets minimum interrupt conditions if ( gfDelayResolvingBestSightingDueToDoor) { - if ( bSourceSeen && (!( (gTacticalStatus.uiFlags & TURNBASED) && ( gTacticalStatus.uiFlags & INCOMBAT ) ) || (gubSightFlags & SIGHTINTERRUPT && StandardInterruptConditionsMet(pSoldier,ubNoiseMaker,bOldOpplist)) ) ) + if ( bSourceSeen && (!( (gTacticalStatus.uiFlags & TURNBASED) && ( gTacticalStatus.uiFlags & INCOMBAT ) ) || (gubSightFlags & SIGHTINTERRUPT && StandardInterruptConditionsMet(pSoldier, ubNoiseMaker, bOldOpplist)) ) ) { // we should be adding this to the array for the AllTeamLookForAll to handle // since this is a door opening noise, add a bonus equal to half the door volume @@ -6591,7 +6590,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b { // require the enemy not to be dying if we are the sighter; in other words, // always add for AI guys, and always add for people with life >= OKLIFE - if ( pSoldier->bTeam != gbPlayerNum || MercPtrs[ ubNoiseMaker ]->stats.bLife >= OKLIFE ) + if ( pSoldier->bTeam != gbPlayerNum || ubNoiseMaker->stats.bLife >= OKLIFE ) { ReevaluateBestSightingPosition( pSoldier, (UINT8) (ubPoints + (ubVolume / 2)) ); } @@ -6602,10 +6601,10 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b { if ( (gTacticalStatus.uiFlags & TURNBASED) && ( gTacticalStatus.uiFlags & INCOMBAT ) ) { - if (StandardInterruptConditionsMet(pSoldier,ubNoiseMaker,bOldOpplist)) + if ( StandardInterruptConditionsMet( pSoldier, ubNoiseMaker, bOldOpplist ) ) { // he gets a chance to interrupt the noisemaker - pSoldier->aiData.bInterruptDuelPts = CalcInterruptDuelPts(pSoldier,ubNoiseMaker, TRUE ); + pSoldier->aiData.bInterruptDuelPts = CalcInterruptDuelPts( pSoldier, ubNoiseMaker, TRUE ); DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "Calculating int duel pts in noise code, %d has %d points", pSoldier->ubID, pSoldier->aiData.bInterruptDuelPts ) ); } else @@ -6712,7 +6711,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 b plan_lib->update_plan(pSoldier->bAIIndex, pSoldier, ai_input); } -void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage ) +void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubVolume, UINT8 ubNoiseType, UINT8 ubNoiseDir, STR16 zNoiseMessage ) { UINT8 ubVolumeIndex; @@ -6737,11 +6736,11 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGr // display a message about a noise... // e.g. Sidney hears a loud splash from/to? the north. - if ( ubNoiseMaker != NOBODY && pSoldier->bTeam == gbPlayerNum && pSoldier->bTeam == Menptr[ubNoiseMaker].bTeam ) + if ( ubNoiseMaker != NOBODY && pSoldier->bTeam == gbPlayerNum && pSoldier->bTeam == ubNoiseMaker->bTeam ) { #ifdef JA2BETAVERSION ScreenMsg( MSG_FONT_RED, MSG_ERROR, L"ERROR! TAKE SCREEN CAPTURE AND TELL CAMFIELD NOW!" ); - ScreenMsg( MSG_FONT_RED, MSG_ERROR, L"%s (%d) heard noise from %s (%d), noise at %dL%d, type %d", pSoldier->name, pSoldier->ubID, Menptr[ubNoiseMaker].name, ubNoiseMaker, sGridNo, bLevel, ubNoiseType ); + ScreenMsg( MSG_FONT_RED, MSG_ERROR, L"%s (%d) heard noise from %s (%d), noise at %dL%d, type %d", pSoldier->name, pSoldier->ubID, ubNoiseMaker->name, ubNoiseMaker, sGridNo, bLevel, ubNoiseType ); #endif } @@ -6751,7 +6750,7 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGr // information about direction etc. only displayed if we don't see noise maker // sevenfm: don't show noise messages from militia (if on our side) if (gbPublicOpplist[gbPlayerNum][ubNoiseMaker] != SEEN_CURRENTLY && pSoldier->aiData.bOppList[ubNoiseMaker] != SEEN_CURRENTLY && - !(MercPtrs[ubNoiseMaker]->bTeam == MILITIA_TEAM && MercPtrs[ubNoiseMaker]->bSide == 0)) + !(ubNoiseMaker->bTeam == MILITIA_TEAM && ubNoiseMaker->bSide == 0)) //if( gbPublicOpplist[gbPlayerNum][ubNoiseMaker] != SEEN_CURRENTLY && pSoldier->aiData.bOppList[ubNoiseMaker] != SEEN_CURRENTLY ) { if (bLevel == pSoldier->pathing.bLevel) @@ -6794,14 +6793,14 @@ void TellPlayerAboutNoise( SOLDIERTYPE *pSoldier, UINT16 ubNoiseMaker, INT32 sGr if (gbPublicOpplist[gbPlayerNum][ubNoiseMaker] == SEEN_CURRENTLY || pSoldier->aiData.bOppList[ubNoiseMaker] == SEEN_CURRENTLY) { if (gTauntsSettings.fTauntShowPopupBox == TRUE) - ShowTauntPopupBox(MercPtrs[ubNoiseMaker], zNoiseMessage); + ShowTauntPopupBox(ubNoiseMaker, zNoiseMessage); if (gTauntsSettings.fTauntShowInLog == TRUE) - ScreenMsg(FONT_GRAY2, MSG_INTERFACE, L"%s: %s", MercPtrs[ubNoiseMaker]->GetName(), zNoiseMessage); + ScreenMsg(FONT_GRAY2, MSG_INTERFACE, L"%s: %s", ubNoiseMaker->GetName(), zNoiseMessage); } else { if (gTauntsSettings.fTauntShowPopupBox == TRUE && gTauntsSettings.fTauntShowPopupBoxIfHeard == TRUE) - ShowTauntPopupBox(MercPtrs[ubNoiseMaker], zNoiseMessage); + ShowTauntPopupBox(ubNoiseMaker, zNoiseMessage); if (gTauntsSettings.fTauntShowInLog == TRUE && gTauntsSettings.fTauntShowInLogIfHeard == TRUE) ScreenMsg(FONT_GRAY2, MSG_INTERFACE, L"%s: %s", pTauntUnknownVoice[0], zNoiseMessage); } diff --git a/Tactical/opplist.h b/Tactical/opplist.h index c49a8eab..bce76a29 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -139,8 +139,8 @@ void DebugSoldierPage4( ); UINT8 MovementNoise( SOLDIERTYPE *pSoldier ); UINT8 DoorOpeningNoise( SOLDIERTYPE *pSoldier ); -void MakeNoise(SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); -void OurNoise( UINT16 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void MakeNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); +void OurNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubVolume, UINT8 ubNoiseType, STR16 zNoiseMessage = NULL ); void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType); From 845d784bff65a8f61eb8507d3b1410848326c9e4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:33:33 +0200 Subject: [PATCH 176/571] Use SoldierID --- Laptop/mercs.cpp | 5 +- Laptop/personnel.cpp | 146 +++++++++++++++++++------------------------ 2 files changed, 67 insertions(+), 84 deletions(-) diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp index 0f96750a..b9428656 100644 --- a/Laptop/mercs.cpp +++ b/Laptop/mercs.cpp @@ -980,7 +980,8 @@ void BtnFileBoxButtonCallback(GUI_BUTTON *btn,INT32 reason) void DailyUpdateOfMercSite( UINT16 usDate) { SOLDIERTYPE *pSoldier; - INT16 sSoldierID, i; + SoldierID sSoldierID; + INT16 i; UINT8 ubMercID; INT32 iNumDays; @@ -1006,7 +1007,7 @@ void DailyUpdateOfMercSite( UINT16 usDate) // continue; sSoldierID = GetSoldierIDFromMercID( ubMercID ); - pSoldier = MercPtrs[ sSoldierID ]; + pSoldier = sSoldierID; //if the merc is dead, dont advance the contract length if( !IsMercDead( pSoldier->ubProfile ) ) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 9da05def..775ff5f4 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -3724,11 +3724,10 @@ INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat ) } -INT32 GetIdOfMercWithHighestStat( INT32 iStat ) +SoldierID GetIdOfMercWithHighestStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error - INT32 iId = -1; + INT32 iId = NOBODY; INT32 iValue =0; SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt=0; @@ -3847,11 +3846,10 @@ INT32 GetIdOfMercWithHighestStat( INT32 iStat ) return( iId ); } -INT32 GetIdOfMercWithLowestStat( INT32 iStat ) +SoldierID GetIdOfMercWithLowestStat( INT32 iStat ) { // will return the id value of the merc on the players team with highest in this stat - // -1 means error - INT32 iId = -1; + SoldierID iId = NOBODY; INT32 iValue =999999; SOLDIERTYPE *pTeamSoldier, *pSoldier; INT32 cnt=0; @@ -3924,7 +3922,7 @@ INT32 GetIdOfMercWithLowestStat( INT32 iStat ) break; case 6: // exper - if( pTeamSoldier->stats.bExpLevel <= iValue ) + if( pTeamSoldier->stats.bExpLevel <= iValue ) { iId = cnt; iValue = pTeamSoldier->stats.bExpLevel; @@ -4304,12 +4302,12 @@ void DisplayAverageStatValuesForCurrentTeam( void ) void DisplayLowestStatValuesForCurrentTeam( void ) { // will display the average values for stats for the current team - INT16 sX, sY; - INT32 iCounter = 0; - CHAR16 sString[ 32 ]; - INT32 iStat = 0; - INT32 iDepartedId=0; - INT32 iId = 0; + INT16 sX, sY; + INT32 iCounter = 0; + CHAR16 sString[ 32 ]; + INT32 iStat = 0; + INT32 iDepartedId = -1; + SoldierID iId; // set up font SetFont( FONT10ARIAL ); @@ -4338,7 +4336,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) { if (fCurrentTeamMode) { iId = GetIdOfMercWithLowestStat( iCounter ); - if( iId == -1 ) + if( iId == NOBODY ) continue; } else { iDepartedId = GetIdOfDepartedMercWithLowestStat( iCounter ); @@ -4354,11 +4352,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) } if (fCurrentTeamMode) { - // get name - /*if( iId == -1 ) - swprintf( sString, L"%s", pPOWStrings[1] ); - else*/ - swprintf( sString, L"%s", MercPtrs[ iId ]->GetName() ); + swprintf( sString, L"%s", iId->GetName() ); } else { // get name swprintf( sString, L"%s", gMercProfiles[ iDepartedId ].zNickname ); @@ -4370,10 +4364,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 0: // health if (fCurrentTeamMode) { - /*if( iId == -1 ) - iStat = -1; - else*/ - iStat = MercPtrs[ iId ]->stats.bLifeMax; + iStat = iId->stats.bLifeMax; } else { iStat = gMercProfiles[ iDepartedId ] . bLife; } @@ -4381,7 +4372,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 1: // agility if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bAgility; + iStat = iId->stats.bAgility; } else { iStat = gMercProfiles[ iDepartedId ] . bAgility; } @@ -4389,7 +4380,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 2: // dexterity if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bDexterity; + iStat = iId->stats.bDexterity; } else { iStat = gMercProfiles[ iDepartedId ] . bDexterity; } @@ -4397,7 +4388,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 3: // strength if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bStrength; + iStat = iId->stats.bStrength; } else { iStat = gMercProfiles[ iDepartedId ] . bStrength; } @@ -4405,7 +4396,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 4: // leadership if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bLeadership; + iStat = iId->stats.bLeadership; } else { iStat = gMercProfiles[ iDepartedId ] . bLeadership; } @@ -4413,7 +4404,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 5: // wisdom if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bWisdom; + iStat = iId->stats.bWisdom; } else { iStat = gMercProfiles[ iDepartedId ] . bWisdom; } @@ -4421,7 +4412,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 6: // exper if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bExpLevel; + iStat = iId->stats.bExpLevel; } else { iStat = gMercProfiles[ iDepartedId ] . bExpLevel; } @@ -4429,7 +4420,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 7: //mrkmanship if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bMarksmanship; + iStat = iId->stats.bMarksmanship; } else { iStat = gMercProfiles[ iDepartedId ] . bMarksmanship; } @@ -4437,7 +4428,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 8: // mech if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bMechanical; + iStat = iId->stats.bMechanical; } else { iStat = gMercProfiles[ iDepartedId ] . bMechanical; } @@ -4445,7 +4436,7 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 9: // exp if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bExplosive; + iStat = iId->stats.bExplosive; } else { iStat = gMercProfiles[ iDepartedId ] . bExplosive; } @@ -4453,17 +4444,14 @@ void DisplayLowestStatValuesForCurrentTeam( void ) case 10: // med if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bMedical; + iStat = iId->stats.bMedical; } else { iStat = gMercProfiles[ iDepartedId ] . bMedical; } break; - } + } - /*if( iStat == -1 ) - swprintf( sString, L"%s", pPOWStrings[1] ); - else*/ - swprintf( sString, L"%d", iStat ); + swprintf( sString, L"%d", iStat ); // right justify FindFontRightCoordinates( PERS_STAT_LOWEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); @@ -4479,7 +4467,8 @@ void DisplayHighestStatValuesForCurrentTeam( void ) INT32 iCounter = 0; CHAR16 sString[ 32 ]; INT32 iStat = 0; - INT32 iId=0; + SoldierID iId; + INT32 iDepartedId = -1; // set up font SetFont( FONT10ARIAL ); @@ -4506,13 +4495,18 @@ void DisplayHighestStatValuesForCurrentTeam( void ) for( iCounter = 0; iCounter < 11; iCounter++ ) { - if (fCurrentTeamMode) + if ( fCurrentTeamMode ) + { iId = GetIdOfMercWithHighestStat( iCounter ); + if ( iId == NOBODY ) + continue; + } else - iId = GetIdOfDepartedMercWithHighestStat( iCounter ); - - if( iId == -1 ) - continue; + { + iDepartedId = GetIdOfDepartedMercWithHighestStat( iCounter ); + if ( iDepartedId == -1 ) + continue; + } // even or odd?..color black or yellow? if( iCounter % 2 == 0 ) @@ -4526,18 +4520,12 @@ void DisplayHighestStatValuesForCurrentTeam( void ) if (fCurrentTeamMode) { - // get name - /*if( iId == -1 ) - { - swprintf( sString, L"%s", pPOWStrings[1] ); - } - else*/ - swprintf( sString, L"%s", MercPtrs[ iId ]->GetName() ); + swprintf( sString, L"%s", iId->GetName() ); } else { // get name - swprintf( sString, L"%s", gMercProfiles[ iId ].zNickname ); + swprintf( sString, L"%s", gMercProfiles[ iDepartedId ].zNickname ); } // print name mprintf( PERS_STAT_HIGHEST_X, PERS_STAT_AVG_Y + ( iCounter + 1 ) * ( GetFontHeight( FONT10ARIAL ) + 3 ), sString ); @@ -4546,100 +4534,94 @@ void DisplayHighestStatValuesForCurrentTeam( void ) case 0: // health if (fCurrentTeamMode) { - /*if( iId == -1 ) - iStat = -1; - else*/ - iStat = MercPtrs[ iId ]->stats.bLifeMax; + iStat = iId->stats.bLifeMax; } else { - iStat = gMercProfiles[ iId ] . bLife; + iStat = gMercProfiles[ iDepartedId ] . bLife; } break; case 1: // agility if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bAgility; + iStat = iId->stats.bAgility; } else { - iStat = gMercProfiles[ iId ] . bAgility; + iStat = gMercProfiles[ iDepartedId ] . bAgility; } break; case 2: // dexterity if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bDexterity; + iStat = iId->stats.bDexterity; } else { - iStat = gMercProfiles[ iId ] . bDexterity; + iStat = gMercProfiles[ iDepartedId ] . bDexterity; } break; case 3: // strength if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bStrength; + iStat = iId->stats.bStrength; } else { - iStat = gMercProfiles[ iId ] . bStrength; + iStat = gMercProfiles[ iDepartedId ] . bStrength; } break; case 4: // leadership if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bLeadership; + iStat = iId->stats.bLeadership; } else { - iStat = gMercProfiles[ iId ] . bLeadership; + iStat = gMercProfiles[ iDepartedId ] . bLeadership; } break; case 5: // wisdom if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bWisdom; + iStat = iId->stats.bWisdom; } else { - iStat = gMercProfiles[ iId ] . bWisdom; + iStat = gMercProfiles[ iDepartedId ] . bWisdom; } break; case 6: // exper if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bExpLevel; + iStat = iId->stats.bExpLevel; } else { - iStat = gMercProfiles[ iId ] . bExpLevel; + iStat = gMercProfiles[ iDepartedId ] . bExpLevel; } break; case 7: //mrkmanship if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bMarksmanship; + iStat = iId->stats.bMarksmanship; } else { - iStat = gMercProfiles[ iId ] . bMarksmanship; + iStat = gMercProfiles[ iDepartedId ] . bMarksmanship; } break; case 8: // mech if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bMechanical; + iStat = iId->stats.bMechanical; } else { - iStat = gMercProfiles[ iId ] . bMechanical; + iStat = gMercProfiles[ iDepartedId ] . bMechanical; } break; case 9: // exp if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bExplosive; + iStat = iId->stats.bExplosive; } else { - iStat = gMercProfiles[ iId ] . bExplosive; + iStat = gMercProfiles[ iDepartedId ] . bExplosive; } break; case 10: // med if (fCurrentTeamMode) { - iStat = MercPtrs[ iId ]->stats.bMedical; + iStat = iId->stats.bMedical; } else { - iStat = gMercProfiles[ iId ] . bMedical; + iStat = gMercProfiles[ iDepartedId ] . bMedical; } break; - } + } - /*if( iStat == -1 ) - swprintf( sString, L"%s", pPOWStrings[1] ); - else*/ - swprintf( sString, L"%d", iStat ); + swprintf( sString, L"%d", iStat ); // right justify FindFontRightCoordinates( PERS_STAT_HIGHEST_X, 0 ,PERS_STAT_LOWEST_WIDTH, 0 , sString, FONT10ARIAL , &sX, &sY ); From a50a6de1b5483e486003a863811f04f19d0b9c40 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:34:30 +0200 Subject: [PATCH 177/571] Make fewer calls to MercPtrs --- Strategic/Auto Resolve.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index cddd2e02..c5e0010f 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -1854,12 +1854,14 @@ void RenderAutoResolve() case BATTLE_CAPTURED: for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ i ] ) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) ) { //Merc is active and alive, and not a vehicle or robot - if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) ) + if ( PlayerMercInvolvedInThisCombat( pSoldier ) ) { // This morale event is PER INDIVIDUAL SOLDIER - HandleMoraleEvent( MercPtrs[ i ], MORALE_MERC_CAPTURED, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); + HandleMoraleEvent( pSoldier, MORALE_MERC_CAPTURED, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); } } } @@ -5959,10 +5961,12 @@ void CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors() unsigned mercCnt = 0; for( int i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[ i ] ) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) ) { //Merc is active and alive, and not a vehicle or robot - if ((MercPtrs[ i ]->sSectorX == sX) &&(MercPtrs[ i ]->sSectorY == sY) && (MercPtrs[ i ]->bSectorZ == 0)) + if ( (pSoldier->sSectorX == sX) && (pSoldier->sSectorY == sY) && (pSoldier->bSectorZ == 0) ) { ++mercCnt; } From a9120ef984f30a0695ebd81b6b89938dfb43c56f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:35:55 +0200 Subject: [PATCH 178/571] Remove unused function --- Strategic/LuaInitNPCs.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index b99141c7..ce76428c 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -2969,25 +2969,6 @@ SOLDIERTYPE * FindSoldierByProfileID2( UINT8 ubProfileID, BOOLEAN fPlayerMercsOn return( NULL ); } -BOOLEAN FindSoldier(SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex, BOOLEAN fPlayerMercsOnly) -{ - *ppSoldier = NULL; - - if (usSoldierIndex >= TOTAL_SOLDIERS) - { - return(FALSE); - } - - if (MercPtrs[usSoldierIndex]->bActive) - { - *ppSoldier = MercPtrs[usSoldierIndex]; - return(TRUE); - } - else - { - return(FALSE); - } -} //-------------------------------- From 1ec2867ced7484dfb158aae849d4e8e6b1939aa9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:59:56 +0200 Subject: [PATCH 179/571] Use SoldierID Fixed if conditions as well SOLDIERTYPE::ubProfile would never match with values above NOBODY --- Strategic/LuaInitNPCs.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index ce76428c..e2c431e4 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -7562,12 +7562,11 @@ static int l_EVENT_InitNewSoldierAnim (lua_State *L) if ( lua_gettop(L) >= 3 ) { UINT16 ubTargetNPC = lua_tointeger(L,1); - //if (i == 2 ) BodyType = lua_tointeger(L,i); UINT32 ANIM = lua_tointeger(L,2); - INT32 cnt = lua_tointeger(L,3); - //if (i == 4 ) PlayerControl = lua_tointeger(L,i); + SoldierID solID = lua_tointeger(L,3); - if (ubTargetNPC > NOBODY) + // This is not my favorite, but now it will at least work. -Asdow + if (ubTargetNPC != NOBODY) { SOLDIERTYPE* pSoldier = FindSoldierByProfileID ( ubTargetNPC, TRUE ); if ( pSoldier )//&& pSoldier->ubBodyType == BodyType ) @@ -7576,10 +7575,10 @@ static int l_EVENT_InitNewSoldierAnim (lua_State *L) pSoldier->EVENT_InitNewSoldierAnim( ANIM, 0, TRUE ); } } - else if (ubTargetNPC == NOBODY) + else { - if ( MercPtrs[ cnt ]->bInSector ) - MercPtrs[ cnt ]->EVENT_InitNewSoldierAnim( ANIM, 0, TRUE ); + if ( solID != NOBODY && solID->bInSector ) + solID->EVENT_InitNewSoldierAnim( ANIM, 0, TRUE ); } } @@ -8049,12 +8048,12 @@ static int l_ChangeMercPtrsTeam (lua_State *L) { if ( lua_gettop(L) >= 2 ) { - UINT16 UID = lua_tointeger(L,1); + SoldierID UID = lua_tointeger(L,1); INT8 Side = lua_tointeger(L,2); - if ( MercPtrs[UID] && MercPtrs[ UID ]->bInSector && MercPtrs[ UID ]->bActive ) + if ( UID != NOBODY && UID->bInSector && UID->bActive ) { - MercPtrs[UID]->bSide = Side; + UID->bSide = Side; } } From 0dc2ceabb239c011fc0c08a68c73a7bbbbbeecbc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 21 Nov 2024 19:48:54 +0200 Subject: [PATCH 180/571] Use SoldierID --- Strategic/LuaInitNPCs.cpp | 1049 ++++++++++++------------------------- 1 file changed, 338 insertions(+), 711 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index e2c431e4..ee32f9e8 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -7617,7 +7617,7 @@ static int l_SetEnterCombatMode (lua_State *L) if ( lua_gettop(L) >= 2 ) { UINT16 group = lua_tointeger(L,1); - UINT16 ubID = lua_tointeger(L,2); + SoldierID ubID = lua_tointeger(L,2); if ( ubID == NOBODY ) return 0; @@ -7656,9 +7656,12 @@ static int l_MakeMercPtrsHostile (lua_State *L) { if ( lua_gettop(L) >= 1 ) { - UINT16 ubID = lua_tointeger(L,1); + SoldierID ubID = lua_tointeger(L,1); - MakeCivHostile(MercPtrs[ ubID ]); + if ( ubID != NOBODY ) + { + MakeCivHostile(ubID); + } } return 0; @@ -7741,13 +7744,13 @@ BOOLEAN Bool; if (i == 2 ) bNewSide = lua_tointeger(L,i); } - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive ) + if ( ubID->bInSector && ubID->bActive ) Bool = TRUE; else Bool = FALSE; if ( Bool == TRUE ) - { pSoldier = MercPtrs[ ubID ]; + { pSoldier = ubID; if (pSoldier) { pSoldier->bSide = bNewSide; @@ -8450,20 +8453,17 @@ static int l_CreateItemInvOrFloor( lua_State *L ) { if ( lua_gettop( L ) >= 2 ) { - UINT16 ubID = lua_tointeger( L, 1 ); + SoldierID ubID = lua_tointeger( L, 1 ); UINT16 usItem = lua_tointeger( L, 2 ); - if ( ubID < TOTAL_SOLDIERS ) + if ( ubID != NOBODY) { - SOLDIERTYPE* pSoldier = MercPtrs[ubID]; - if ( pSoldier ) - { - CreateItem( usItem, 100, &gTempObject ); + SOLDIERTYPE* pSoldier = ubID; + CreateItem( usItem, 100, &gTempObject ); - if ( !AutoPlaceObject( pSoldier, &gTempObject, TRUE ) ) - { - AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); - } + if ( !AutoPlaceObject( pSoldier, &gTempObject, TRUE ) ) + { + AddItemToPool( pSoldier->sGridNo, &gTempObject, 1, pSoldier->pathing.bLevel, 0, -1 ); } } } @@ -8475,12 +8475,12 @@ static int l_DestroyOneItemInInventory( lua_State *L ) { if ( lua_gettop( L ) >= 2 ) { - UINT16 ubID = lua_tointeger( L, 1 ); + SoldierID ubID = lua_tointeger( L, 1 ); UINT16 usItem = lua_tointeger( L, 2 ); if ( ubID < TOTAL_SOLDIERS ) { - MercPtrs[ubID]->DestroyOneItemInInventory( usItem ); + ubID->DestroyOneItemInInventory( usItem ); } } @@ -8493,12 +8493,12 @@ static int l_HasItemInInventory( lua_State *L ) if ( lua_gettop( L ) >= 2 ) { - UINT16 ubID = lua_tointeger( L, 1 ); + SoldierID ubID = lua_tointeger( L, 1 ); UINT16 usItem = lua_tointeger( L, 2 ); if ( ubID < TOTAL_SOLDIERS ) { - Bool = MercPtrs[ubID]->HasItemInInventory( usItem ); + Bool = ubID->HasItemInInventory( usItem ); } } @@ -8509,36 +8509,25 @@ static int l_HasItemInInventory( lua_State *L ) static int l_CreateKeyProfInvAndAddItemToPool(lua_State *L) { - UINT8 n = lua_gettop(L); - int i; - OBJECTTYPE Object; - UINT8 ubNumberOfKeys; - UINT8 ubKeyIdValue; - UINT8 ubTargetNPC; - SOLDIERTYPE *pSoldier; - INT32 iWorldItem; - INT32 sGridNo; - UINT8 bLevel; - - for (i = 1; i <= n; i++) + if ( lua_gettop( L ) >= 5 ) { - if (i == 1) ubTargetNPC = lua_tointeger(L, i); - if (i == 2) ubNumberOfKeys = lua_tointeger(L, i); - if (i == 3) ubKeyIdValue = lua_tointeger(L, i); - if (i == 4) sGridNo = lua_tointeger(L, i); - if (i == 5) bLevel = lua_tointeger(L, i); + INT32 iWorldItem; + UINT8 ubTargetNPC = lua_tointeger( L, 1 ); + UINT8 ubNumberOfKeys = lua_tointeger( L, 2 ); + UINT8 ubKeyIdValue = lua_tointeger( L, 3 ); + INT32 sGridNo = lua_tointeger( L, 4 ); + UINT8 bLevel = lua_tointeger( L, 5 ); + + SOLDIERTYPE *pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); + + if ( pSoldier ) + { + OBJECTTYPE Key; + CreateKeyObject( &Key, ubNumberOfKeys, ubKeyIdValue ); + AutoPlaceObject( pSoldier, &Key, TRUE ); + AddItemToPoolAndGetIndex( sGridNo, &Key, -1, bLevel, 0, 0, -1, &iWorldItem ); + } } - - pSoldier = FindSoldierByProfileID(ubTargetNPC, FALSE); - - if (pSoldier) - { - OBJECTTYPE Key; - CreateKeyObject(&Key, ubNumberOfKeys, ubKeyIdValue); - AutoPlaceObject(pSoldier, &Key, TRUE); - AddItemToPoolAndGetIndex(sGridNo, &Key, -1, bLevel, 0, 0, -1, &iWorldItem); - } - return 0; } @@ -8928,145 +8917,111 @@ static int l_SetCivGroupHostile (lua_State *L) //Merc static int l_CheckMercPtrsAssignment (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0; - - INT32 squad = 0; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + + if ( ubID != NOBODY ) + { + INT32 squad = ubID->bAssignment; + + lua_pushinteger( L, squad ); + } } - - squad = MercPtrs[ ubID ]->bAssignment; - - lua_pushinteger(L, squad); - + return 1; } static int l_CheckMercPtrsActive (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0; - - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + BOOLEAN Bool = FALSE; + + if ( ubID != NOBODY && ubID->bActive ) + Bool = TRUE; + else + Bool = FALSE; + + lua_pushboolean( L, Bool ); } - - if ( MercPtrs[ ubID ]->bActive ) - Bool = TRUE; - else - Bool = FALSE; - - lua_pushboolean(L, Bool); - + return 1; } static int l_CheckMercPtsrInSector (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0; - - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - lua_pushboolean(L, Bool); + SoldierID ubID = lua_tointeger( L, 1 ); + BOOLEAN Bool = FALSE; + if ( ubID != NOBODY && ubID->bInSector ) + Bool = TRUE; + else + Bool = FALSE; + + lua_pushboolean( L, Bool ); + } return 1; } static int l_GetMercPtsrProfileID (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0; - - UINT8 profil = 0; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - } - - profil = MercPtrs[ ubID ]->ubProfile; - - lua_pushinteger(L, profil); + SoldierID ubID = lua_tointeger( L, 1 ); + if ( ubID != NOBODY ) + { + UINT8 profil = ubID->ubProfile; + lua_pushinteger( L, profil ); + } + } return 1; } static int l_CheckMercPtrsLife (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0; - - UINT8 life = 0; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - } - - life = MercPtrs[ ubID ]->stats.bLife; - - lua_pushinteger(L, life); + SoldierID ubID = lua_tointeger( L, 1 ); + if ( ubID != NOBODY ) + { + INT8 life = ubID->stats.bLife; + + lua_pushinteger( L, life ); + } + } return 1; } static int l_SoldierGiveItem (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID1 = 0; - UINT32 ubID2 = 0; - -SOLDIERTYPE *pSoldier; -SOLDIERTYPE *pSoldier2; -BOOLEAN bol = FALSE; -UINT32 item; - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 3 ) { - if (i == 1 ) ubID1 = lua_tointeger(L,i); - if (i == 2 ) ubID2 = lua_tointeger(L,i); - if (i == 3 ) item = lua_tointeger(L,i); - } - + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier2; + BOOLEAN bol = FALSE; + + SoldierID ubID1 = lua_tointeger( L, 1 ); + SoldierID ubID2 = lua_tointeger( L, 2 ); + UINT32 item = lua_tointeger( L, 3 ); + + if ( ubID1 != NOBODY && ubID2 != NOBODY) + { pSoldier = FindSoldierByProfileID( ubID1, FALSE ); - pSoldier2 = FindSoldierByProfileID( ubID2, FALSE ); - - if ( !pSoldier || !pSoldier2 ) - bol = FALSE; - else - bol = TRUE; - - if ( bol == TRUE ) - { + + if ( !pSoldier || !pSoldier2 ) + bol = FALSE; + else + bol = TRUE; + + if ( bol == TRUE ) + { // Look for letter.... { INT8 bInvPos; @@ -9076,81 +9031,64 @@ UINT32 item; AssertMsg( bInvPos != NO_SLOT, "Interface Dialogue.C: Gift item does not exist in NPC." ); - SoldierGiveItem( pSoldier, pSoldier2, &(pSoldier->inv[ bInvPos ] ), bInvPos ); + SoldierGiveItem( pSoldier, pSoldier2, &(pSoldier->inv[bInvPos]), bInvPos ); } } - + } + } return 0; } static int l_CheckMercPtsrTeleportToSector (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0; - - INT16 SectorX = 0; - INT16 SectorY = 0; - INT8 SectorZ = 0; - UINT32 GridNo = 0; - SOLDIERTYPE * pSoldier; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 5 ) { - if (i == 1 ) SectorX = lua_tointeger(L,i); - if (i == 2 ) SectorY = lua_tointeger(L,i); - if (i == 3 ) SectorZ = lua_tointeger(L,i); - if (i == 4 ) GridNo = lua_tointeger(L,i); - if (i == 5 ) ubID = lua_tointeger(L,i); - } - - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; + SoldierID ubID = NOBODY; + INT16 SectorX = 0; + INT16 SectorY = 0; + INT8 SectorZ = 0; + UINT32 GridNo = 0; + SOLDIERTYPE *pSoldier; - if (pSoldier) + SectorX = lua_tointeger( L, 1 ); + SectorY = lua_tointeger( L, 2 ); + SectorZ = lua_tointeger( L, 3 ); + GridNo = lua_tointeger( L, 4 ); + ubID = lua_tointeger( L, 5 ); + + + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - pSoldier->sSectorX = SectorX; - pSoldier->sSectorY = SectorY; - pSoldier->bSectorZ = SectorZ; + pSoldier = ubID; - // Set gridno - pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; - pSoldier->usStrategicInsertionData = GridNo; + if ( pSoldier ) + { + pSoldier->sSectorX = SectorX; + pSoldier->sSectorY = SectorY; + pSoldier->bSectorZ = SectorZ; + + // Set gridno + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; + pSoldier->usStrategicInsertionData = GridNo; + } } } - return 0; } static int l_GetMercPtrsGroup (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0; - - UINT8 GroupID = 0; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + + if ( ubID != NOBODY) + { + UINT8 GroupID = ubID->ubGroupID; + lua_pushinteger( L, GroupID ); + } } - - GroupID = MercPtrs[ ubID ]->ubGroupID; - - - lua_pushinteger(L, GroupID); - return 1; } @@ -9158,11 +9096,11 @@ static int l_WearGasMaskIfAvailable(lua_State *L) { if ( lua_gettop( L ) >= 1 ) { - UINT16 ubID = lua_tointeger( L, 1 ); + SoldierID ubID = lua_tointeger( L, 1 ); - if ( MercPtrs[ubID] && MercPtrs[ubID]->bInSector && MercPtrs[ubID]->bActive ) + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - WearGasMaskIfAvailable( MercPtrs[ubID] ); + WearGasMaskIfAvailable( ubID ); } } @@ -9171,29 +9109,13 @@ static int l_WearGasMaskIfAvailable(lua_State *L) static int l_SetNewSituationMercPtsr(lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; + if ( lua_gettop( L ) >= 1 ) + { + SoldierID ubID = lua_tointeger( L, 1 ); - for (i= 1; i<=n; i++ ) - { - if (i == 1 ) ubID = lua_tointeger(L,i); - } - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - SetNewSituation(pSoldier); + SetNewSituation( ubID); } } @@ -9241,388 +9163,253 @@ static int l_gubPublicNoiseVolume(lua_State *L) static int l_AnimMercPtsrInSector (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - - UINT32 ubID = 0,Anim = 0; - - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) Anim = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + UINT16 Anim = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID->bInSector ) + ubID->EVENT_InitNewSoldierAnim( Anim, 0, TRUE ); } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->EVENT_InitNewSoldierAnim( Anim, 0, TRUE ); - return 0; } static int l_AnimMercPtsrfAIFlags(lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + + if ( ubID != NOBODY && ubID->bInSector ) + ubID->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->aiData.fAIFlags |= AI_HANDLE_EVERY_FRAME; - return 0; } static int l_AnimMercPtsrusStrategicInsertionData(lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,GridNo = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) GridNo = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + INT32 GridNo = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID->bInSector ) + ubID->usStrategicInsertionData = GridNo; } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->usStrategicInsertionData = GridNo; - return 0; } static int l_AnimMercPtsrubStrategicInsertionCode (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,GridNo = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) GridNo = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + INT32 GridNo = lua_tointeger( L, 2 ); + + + if ( ubID != NOBODY && ubID->bInSector ) + ubID->ubStrategicInsertionCode = GridNo; } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->ubStrategicInsertionCode = GridNo; - return 0; } static int l_WhichBuddy (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID1 = 0,ubID2 = 0,bBuddyIndex = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID1 = lua_tointeger(L,i); - if (i == 2 ) ubID2 = lua_tointeger(L,i); + INT8 bBuddyIndex; + + SoldierID ubID1 = lua_tointeger( L, 1 ); + SoldierID ubID2 = lua_tointeger( L, 2 ); + + + if ( (ubID1 != NOBODY && ubID1->bInSector) && (ubID2 != NOBODY && ubID2->bInSector) ) + bBuddyIndex = WhichBuddy( ubID1->ubProfile, ubID2->ubProfile ); + + lua_pushinteger( L, bBuddyIndex ); } - - if ( MercPtrs[ ubID1 ]->bInSector && MercPtrs[ ubID2 ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - bBuddyIndex = WhichBuddy( ubID1, ubID2 ); - - lua_pushinteger(L, bBuddyIndex); - return 1; } static int l_AnimMercPtsrsAbsoluteFinalDestination (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,GridNo = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) GridNo = lua_tointeger(L,i); + SoldierID ubID; + INT32 GridNo = NOWHERE; + + ubID = lua_tointeger( L, 1 ); + GridNo = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID->bInSector && GridNo != NOWHERE) + ubID->sAbsoluteFinalDestination = GridNo; } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->sAbsoluteFinalDestination = GridNo; - return 0; } static int l_AnimMercPtsrusNextActionData (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,GridNo = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) GridNo = lua_tointeger(L,i); + SoldierID ubID; + INT32 GridNo = NOWHERE; + + ubID = lua_tointeger( L, 1 ); + GridNo = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID->bInSector && GridNo != NOWHERE ) + ubID->aiData.usNextActionData = GridNo; } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->aiData.usNextActionData = GridNo; - return 0; } static int l_AnimMercPtsrbNextAction (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,AI_ACTION = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) AI_ACTION = lua_tointeger(L,i); + SoldierID ubID; + INT8 AI_ACTION = 0; + + ubID = lua_tointeger( L, 1 ); + AI_ACTION = lua_tointeger( L, 2 ); + + + if ( ubID != NOBODY && ubID->bInSector ) + ubID->aiData.bNextAction = AI_ACTION; } - - if ( MercPtrs[ ubID ]->bInSector ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->aiData.bNextAction = AI_ACTION; - return 0; } static int l_SetSoldierBodyType (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,Anim = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) Anim = lua_tointeger(L,i); + SoldierID ubID; + UINT8 Anim = 0; + + ubID = lua_tointeger( L, 1 ); + Anim = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) + ubID->ubBodyType = Anim; } - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - MercPtrs[ ubID ]->ubBodyType = Anim; - return 0; } static int l_GetSoldierBodyType (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,Anim = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); + SoldierID ubID; + UINT8 Anim = 0; + + ubID = lua_tointeger( L, 1 ); + + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) + Anim = ubID->ubBodyType; + + lua_pushinteger( L, Anim ); } - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - Anim = MercPtrs[ ubID ]->ubBodyType; - - lua_pushinteger(L, Anim); - return 1; } static int l_CheckSoldierBodyType (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,Anim = 0; - BOOLEAN Bool = FALSE, Bool2 = FALSE; + if ( lua_gettop( L ) >= 2 ) + { + SoldierID ubID; + UINT8 Anim = 0; - for (i= 1; i<=n; i++ ) - { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) Anim = lua_tointeger(L,i); - } - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive ) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - if ( MercPtrs[ ubID ]->ubBodyType == Anim ) - Bool2 = TRUE; + ubID = lua_tointeger( L, 1 ); + Anim = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive && ubID->ubBodyType == Anim ) + { + lua_pushboolean( L, true ); + } else - Bool2 = FALSE; + { + lua_pushboolean( L, false ); + } } - - lua_pushboolean(L, Bool2); - return 1; } static int l_IS_CIV_BODY_TYPE (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0; - BOOLEAN Bool = FALSE; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive && IS_CIV_BODY_TYPE( ubID ) ) + lua_pushboolean( L, true ); + else + lua_pushboolean( L, false ); } - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive && IS_CIV_BODY_TYPE (MercPtrs[ ubID ]) == TRUE ) - Bool = TRUE; - else - Bool = FALSE; - - lua_pushboolean(L, Bool); - return 1; } static int l_SetOffBombsInGridNo (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT16 ubID = 0; - INT32 sGridNo = 0; - BOOLEAN fAllBombs = FALSE; - INT8 bLevel = 0; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 4 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) sGridNo = lua_tointeger(L,i); - if (i == 3 ) fAllBombs = lua_toboolean(L,i); - if (i == 4 ) bLevel = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + INT32 sGridNo = lua_tointeger( L, 2 ); + BOOLEAN fAllBombs = lua_toboolean( L, 3 ); + INT8 bLevel = lua_tointeger( L, 4 ); + + SetOffBombsInGridNo( ubID, sGridNo, fAllBombs, bLevel ); } - - SetOffBombsInGridNo( ubID, sGridNo, fAllBombs,bLevel ); return 0; } static int l_AnimMercPtsrSoldierGotHit (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0; - BOOLEAN Bool = FALSE; + if ( lua_gettop( L ) >= 1 ) + { + SoldierID ubID = lua_tointeger( L, 1 ); - for (i= 1; i<=n; i++ ) - { - if (i == 1 ) ubID = lua_tointeger(L,i); - //if (i == 2 ) Anim = lua_tointeger(L,i); - } - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - if ( MercPtrs[ ubID ]->stats.bLife >= 0 ) + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - MercPtrs[ ubID ]->EVENT_SoldierGotHit( 1, 100, 10, MercPtrs[ ubID ]->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); + if ( ubID->stats.bLife >= 0 ) + { + ubID->EVENT_SoldierGotHit( 1, 100, 10, ubID->ubDirection, 320, NOBODY, FIRE_WEAPON_NO_SPECIAL, AIM_SHOT_TORSO, 0, NOWHERE ); + } } } - return 0; } -static int l_CheckMercPtsrubIDSeenubID2 (lua_State *L) +static int l_CheckMercPtsrubIDSeenubID2( lua_State *L ) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT32 ubID = 0,ubID2 = 0; - UINT16 seen = 0; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 2 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); - if (i == 2 ) ubID2 = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + SoldierID ubID2 = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID2 != NOBODY ) + { + INT8 seen = ubID->aiData.bOppList[ubID2]; + lua_pushinteger( L, seen ); + } } - - seen = MercPtrs[ ubID ]->aiData.bOppList[ ubID2 ]; - - lua_pushinteger(L, seen); - return 1; } static int l_CheckMercPtrsInCivilianGroup (lua_State *L) { - UINT8 n = lua_gettop(L); - int i = 0; - UINT8 group = 0; - UINT32 ubID = 0; - - for (i= 1; i<=n; i++ ) + if ( lua_gettop( L ) >= 1 ) { - if (i == 1 ) ubID = lua_tointeger(L,i); + SoldierID ubID = lua_tointeger( L, 1 ); + + if ( ubID != NOBODY ) + { + UINT8 group = ubID->ubCivilianGroup; + lua_pushinteger( L, group ); + } } - - group = MercPtrs[ ubID ]->ubCivilianGroup; - - lua_pushinteger(L, group); return 1; } @@ -12350,286 +12137,126 @@ return 0; static int l_SetMercPtsrSectorZ(lua_State *L) { - - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - INT8 SectorZ; - if ( lua_gettop(L) >= 2 ) { - ubID = lua_tointeger(L,1); - SectorZ = lua_tointeger(L,2); + SoldierID ubID = lua_tointeger(L,1); + INT8 SectorZ = lua_tointeger(L,2); - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive) { - pSoldier->bSectorZ = SectorZ; + ubID->bSectorZ = SectorZ; } } - - } - return 0; } static int l_SetMercPtsrSectorX(lua_State *L) { - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - INT16 SectorX; + if ( lua_gettop( L ) >= 2 ) + { + SoldierID ubID = lua_tointeger( L, 1 ); + INT16 SectorX = lua_tointeger( L, 2 ); - if ( lua_gettop(L) >= 2 ) - { - ubID = lua_tointeger(L,1); - SectorX = lua_tointeger(L,2); - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - pSoldier->sSectorX = SectorX; + ubID->sSectorX = SectorX; } } - - } - return 0; } static int l_SetMercPtsrSectorY(lua_State *L) { - - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - INT16 SectorY; - - if ( lua_gettop(L) >= 2 ) + if ( lua_gettop( L ) >= 2 ) { - ubID = lua_tointeger(L,1); - SectorY = lua_tointeger(L,2); - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) + SoldierID ubID = lua_tointeger( L, 1 ); + INT16 SectorY = lua_tointeger( L, 2 ); + + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - pSoldier->sSectorY = SectorY; + ubID->sSectorY = SectorY; } } - - } - return 0; } static int l_SetMercPtsrubGroupID(lua_State *L) { - - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - INT8 GroupID; - - if ( lua_gettop(L) >= 2 ) + if ( lua_gettop( L ) >= 2 ) { - ubID = lua_tointeger(L,1); - GroupID = lua_tointeger(L,2); - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) - { - pSoldier->ubGroupID = GroupID; - } - } + SoldierID ubID = lua_tointeger( L, 1 ); + INT8 GroupID = lua_tointeger( L, 2 ); - + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) + ubID->ubGroupID = GroupID; } return 0; } static int l_CheckMercPtsrSectorY(lua_State *L) { - - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - INT16 SectorY; - - if ( lua_gettop(L) >= 1 ) + if ( lua_gettop( L ) >= 1 ) { - ubID = lua_tointeger(L,1); - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) - { - SectorY = pSoldier->sSectorY; - } - } - else - { - SectorY = 0; - } - - lua_pushinteger(L, SectorY); - - } + SoldierID ubID = lua_tointeger( L, 1 ); + INT16 SectorY = 0; + + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) + SectorY = ubID->sSectorY; + + lua_pushinteger( L, SectorY ); + } return 1; } static int l_CheckMercPtsrSectorX(lua_State *L) { - - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - INT16 SectorX; - - if ( lua_gettop(L) >= 1 ) + if ( lua_gettop( L ) >= 1 ) { - ubID = lua_tointeger(L,1); + SoldierID ubID = lua_tointeger( L, 1 ); + INT16 SectorX = 0; - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - SectorX = pSoldier->sSectorX; + SectorX = ubID->sSectorX; } - } - else - { - SectorX = 0; - } - - lua_pushinteger(L, SectorX); - - } + lua_pushinteger( L, SectorX ); + } return 1; } -static int l_CheckMercPtsrSectorZ(lua_State *L) +static int l_CheckMercPtsrSectorZ( lua_State *L ) { - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - INT16 SectorZ; - - if ( lua_gettop(L) >= 1 ) + if ( lua_gettop( L ) >= 1 ) { - ubID = lua_tointeger(L,1); + SoldierID ubID = lua_tointeger( L, 1 ); + INT8 SectorZ = 0; - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) { - SectorZ = pSoldier->bSectorZ; + SectorZ = ubID->bSectorZ; } - } - else - { - SectorZ = 0; - } - - lua_pushinteger(L, SectorZ); + lua_pushinteger( L, SectorZ ); } - return 1; } static int l_CheckMercPtsrubGroupID(lua_State *L) { - UINT16 ubID = 0; - BOOLEAN Bool = FALSE; - SOLDIERTYPE * pSoldier; - UINT8 GroupID; - - if ( lua_gettop(L) >= 1 ) + if ( lua_gettop( L ) >= 1 ) { - ubID = lua_tointeger(L,1); - - if ( MercPtrs[ ubID ]->bInSector && MercPtrs[ ubID ]->bActive) - Bool = TRUE; - else - Bool = FALSE; - - if ( Bool == TRUE ) - { - pSoldier = MercPtrs[ ubID ]; - - if (pSoldier) - { - GroupID = pSoldier->ubGroupID; - } - else - { - GroupID = NUMBER_OF_SQUADS; - } - } - else - GroupID = NUMBER_OF_SQUADS; - - lua_pushinteger(L, GroupID); - - } + SoldierID ubID = lua_tointeger( L, 1 ); + UINT8 GroupID = NUMBER_OF_SQUADS; + if ( ubID != NOBODY && ubID->bInSector && ubID->bActive ) + { + GroupID = ubID->ubGroupID; + } + + lua_pushinteger( L, GroupID ); + } return 1; } From 67c808110425a930b9474a254ed7796eaa9c64a8 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 21 Nov 2024 21:29:28 +0200 Subject: [PATCH 181/571] Use SoldierID --- Strategic/Merc Contract.cpp | 8 ++++---- Strategic/Merc Contract.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index c0f4e4e2..848213e9 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -282,9 +282,9 @@ void EndCurrentContractRenewal( ) } } -void HandleMercIsWillingToRenew( UINT16 ubID ) +void HandleMercIsWillingToRenew( SoldierID ubID ) { - SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; // We wish to lock interface SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1,MAP_SCREEN,0,0,0 ); @@ -302,9 +302,9 @@ void HandleMercIsWillingToRenew( UINT16 ubID ) } -void HandleMercIsNotWillingToRenew( UINT16 ubID ) +void HandleMercIsNotWillingToRenew( SoldierID ubID ) { - SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; // We wish to lock interface SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_LOCK_INTERFACE,1,MAP_SCREEN,0,0,0 ); diff --git a/Strategic/Merc Contract.h b/Strategic/Merc Contract.h index abfc0ec5..dd6ccf4f 100644 --- a/Strategic/Merc Contract.h +++ b/Strategic/Merc Contract.h @@ -68,8 +68,8 @@ void FindOutIfAnyMercAboutToLeaveIsGonnaRenew( void ); void BeginContractRenewalSequence( ); void HandleContractRenewalSequence( ); void EndCurrentContractRenewal( ); -void HandleMercIsWillingToRenew( UINT16 ubID ); -void HandleMercIsNotWillingToRenew( UINT16 ubID ); +void HandleMercIsWillingToRenew( SoldierID ubID ); +void HandleMercIsNotWillingToRenew( SoldierID ubID ); BOOLEAN ContractIsExpiring( SOLDIERTYPE *pSoldier ); UINT32 GetHourWhenContractDone( SOLDIERTYPE *pSoldier ); From 94f2e830e030741e12b6ed954f782346e6b8736d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 21 Nov 2024 21:53:36 +0200 Subject: [PATCH 182/571] Lessen repetition --- Strategic/PreBattle Interface.cpp | 75 ++++++++++++++++--------------- Strategic/Queen Command.cpp | 8 ++-- 2 files changed, 45 insertions(+), 38 deletions(-) diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 5aed8f36..73bb1cd8 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -602,9 +602,10 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) guiNumInvolved = 0; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) ) + if ( PlayerMercInvolvedInThisCombat( pSoldier ) ) { // involved if( !ubGroupID ) @@ -613,13 +614,13 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) //can detect it by comparing the first value with future values. If we do, then //we set a flag which determines whether to use the singular help text or plural version //for the retreat button. - ubGroupID = MercPtrs[ i ]->ubGroupID; + ubGroupID = pSoldier->ubGroupID; if( !gpBattleGroup ) gpBattleGroup = GetGroup( ubGroupID ); - //if( bBestExpLevel > MercPtrs[ i ]->stats.bExpLevel ) // SANDRO - WTF!! This is a bug! - if( bBestExpLevel < MercPtrs[ i ]->stats.bExpLevel ) // SANDRO - WTF!! This is a bug! - bBestExpLevel = MercPtrs[ i ]->stats.bExpLevel; - if( MercPtrs[ i ]->ubPrevSectorID == 255 ) + //if( bBestExpLevel > pSoldier->stats.bExpLevel ) // SANDRO - WTF!! This is a bug! + if( bBestExpLevel < pSoldier->stats.bExpLevel ) // SANDRO - WTF!! This is a bug! + bBestExpLevel = pSoldier->stats.bExpLevel; + if( pSoldier->ubPrevSectorID == 255 ) { //Not able to retreat (calculate it for group) GROUP *pTempGroup; pTempGroup = GetGroup( ubGroupID ); @@ -627,7 +628,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) CalculateGroupRetreatSector( pTempGroup ); } } - else if( ubGroupID != MercPtrs[ i ]->ubGroupID ) + else if( ubGroupID != pSoldier->ubGroupID ) { fUsePluralVersion = TRUE; } @@ -635,23 +636,23 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) ++guiNumInvolved; // SANDRO - added check if we have a scout in group, needed later - if( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( MercPtrs[ i ], SCOUTING_NT ) && gSkillTraitValues.fSCPreventsTheEnemyToAmbushMercs ) + if( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pSoldier, SCOUTING_NT ) && gSkillTraitValues.fSCPreventsTheEnemyToAmbushMercs ) { fScoutPresent = TRUE; } - if ( MercPtrs[i]->usSoldierFlagMask & SOLDIER_AIRDROP ) + if ( pSoldier->usSoldierFlagMask & SOLDIER_AIRDROP ) { fAirDrop = TRUE; } - UINT16 deploymentleadership = EffectiveLeadership( MercPtrs[i] ); - FLOAT ambushradiusmodifier = 10 * EffectiveExpLevel( MercPtrs[i] ) + MercPtrs[i]->GetBackgroundValue( BG_AMBUSH_RADIUS ); + UINT16 deploymentleadership = EffectiveLeadership( pSoldier ); + FLOAT ambushradiusmodifier = 10 * EffectiveExpLevel( pSoldier ) + pSoldier->GetBackgroundValue( BG_AMBUSH_RADIUS ); if ( gGameOptions.fNewTraitSystem ) { - deploymentleadership += 50 * NUM_SKILL_TRAITS( MercPtrs[i], SQUADLEADER_NT ); + deploymentleadership += 50 * NUM_SKILL_TRAITS( pSoldier, SQUADLEADER_NT ); - ambushradiusmodifier += 50 * NUM_SKILL_TRAITS( MercPtrs[i], SCOUTING_NT ); + ambushradiusmodifier += 50 * NUM_SKILL_TRAITS( pSoldier, SCOUTING_NT ); } // bonus with old traits, so that the check can be won else @@ -664,7 +665,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gAmbushRadiusModifier = max( gAmbushRadiusModifier, ambushradiusmodifier / 100 ); // Flugente: if a merc is inserted from concealed state, retreat is forbidden, as at least this merc will have to extract manually - if ( MercPtrs[i]->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION ) + if ( pSoldier->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION ) fRetreatAnOption = FALSE; } else @@ -890,14 +891,15 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) { for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - if ( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) && MercPtrs[ i ]->ubProfile != NO_PROFILE ) + if ( PlayerMercInvolvedInThisCombat( pSoldier ) && pSoldier->ubProfile != NO_PROFILE ) { if ( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE || GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE ) - gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usAmbushesExperienced++; - else if ( fAmbushPrevented && HAS_SKILL_TRAIT( MercPtrs[ i ], SCOUTING_NT ) ) // Scouts actually get this as number of prevented ambushes - gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usAmbushesExperienced++; + gMercProfiles[ pSoldier->ubProfile ].records.usAmbushesExperienced++; + else if ( fAmbushPrevented && HAS_SKILL_TRAIT( pSoldier, SCOUTING_NT ) ) // Scouts actually get this as number of prevented ambushes + gMercProfiles[ pSoldier->ubProfile ].records.usAmbushesExperienced++; } } } @@ -1577,20 +1579,21 @@ void RenderPreBattleInterface() y = TOP_Y + TOP_Y_TEXT_BUFFER - bListOffset; for( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++) { - if( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife && !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - if( PlayerMercInvolvedInThisCombat( MercPtrs[ i ] ) ) + if( PlayerMercInvolvedInThisCombat( pSoldier ) ) { //NAME - wcscpy( str, MercPtrs[ i ]->name ); + wcscpy( str, pSoldier->name ); x = 17 + (52 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf( x + xOffset, y + yOffset, str ); //ASSIGN - GetMapscreenMercAssignmentString( MercPtrs[ i ], str ); + GetMapscreenMercAssignmentString( pSoldier, str ); x = 72 + (54 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf( x + xOffset, y + yOffset, str ); //COND - GetSoldierConditionInfo( MercPtrs[ i ], str, &ubHPPercent, &ubBPPercent ); + GetSoldierConditionInfo( pSoldier, str, &ubHPPercent, &ubBPPercent ); x = 129 + (58 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf( x + xOffset, y + yOffset, str ); //HP @@ -1622,31 +1625,32 @@ void RenderPreBattleInterface() y = TOP_Y + TOP_Y_TEXT_BUFFER + ubUninvolvedStartY + UNINVOLVED_RELEVANT_HEIGHT - bListOffset; for( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - if( !PlayerMercInvolvedInThisCombat(MercPtrs[ i ]) ) + if( !PlayerMercInvolvedInThisCombat(pSoldier) ) { //NAME - wcscpy( str, MercPtrs[ i ]->name ); + wcscpy( str, pSoldier->name ); x = 17 + (52 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf( x + xOffset, y + yOffset, str ); //ASSIGN - GetMapscreenMercAssignmentString( MercPtrs[ i ], str ); + GetMapscreenMercAssignmentString( pSoldier, str ); x = 72 + (54 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf( x + xOffset, y + yOffset, str ); //LOC - GetMapscreenMercLocationString( MercPtrs[ i ], str ); + GetMapscreenMercLocationString( pSoldier, str ); x = 128 + (33 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf( x + xOffset, y + yOffset, str ); //DEST - GetMapscreenMercDestinationString( MercPtrs[ i ], str ); + GetMapscreenMercDestinationString( pSoldier, str ); if (wcslen(str) > 0) { x = 164 + (41 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf( x + xOffset, y + yOffset, str ); } //DEP - GetMapscreenMercDepartureString( MercPtrs[ i ], str, &ubJunk ); + GetMapscreenMercDepartureString( pSoldier, str, &ubJunk ); x = 208 + (34 - StringPixLength(str, BLOCKFONT2)) / 2; mprintf(x + xOffset, y + yOffset, str); @@ -1814,10 +1818,11 @@ void RetreatMercsCallback( GUI_BUTTON *btn, INT32 reason ) // SANDRO - merc records - times retreated counter for( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) { - if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife >= OKLIFE ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { - if ( PlayerMercInvolvedInThisCombat( MercPtrs[i] ) && MercPtrs[i]->ubProfile != NO_PROFILE ) - gMercProfiles[ MercPtrs[i]->ubProfile ].records.usBattlesRetreated++; + if ( PlayerMercInvolvedInThisCombat( pSoldier ) && pSoldier->ubProfile != NO_PROFILE ) + gMercProfiles[ pSoldier->ubProfile ].records.usBattlesRetreated++; } } ///////////////////////////////////////////////////////////////////////////////// diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 487ee8fe..89a282dd 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -560,12 +560,14 @@ void EndTacticalBattleForEnemy() //severe loyalty blow. for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++i ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife >= OKLIFE ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE ) { //found one live militia, so look for any enemies/creatures. // NOTE: this is relying on ENEMY_TEAM being immediately followed by CREATURE_TEAM - for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++i ) + for(UINT16 j = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; j <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++i ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife >= OKLIFE ) + SOLDIERTYPE *pEnemy = MercPtrs[j]; + if( pEnemy->bActive && pEnemy->bInSector && pEnemy->stats.bLife >= OKLIFE ) { //confirmed at least one enemy here, so do the loyalty penalty. HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_ABANDON_MILITIA, gWorldSectorX, gWorldSectorY, 0 ); break; From d687956cf1c084a3214d0709addc5c236c56ec23 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 21 Nov 2024 21:53:48 +0200 Subject: [PATCH 183/571] Remove unused function --- Strategic/Queen Command.cpp | 83 ------------------------------------- Strategic/Queen Command.h | 1 - 2 files changed, 84 deletions(-) diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 89a282dd..1ee6eaef 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -2948,89 +2948,6 @@ void EnemyCapturesPlayerSoldier( SOLDIERTYPE *pSoldier ) } -void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap() -{ - INT32 i; - BOOLEAN fMadeCorpse; - INT8 bKilledEnemies = 0, bKilledCreatures = 0, bKilledRebels = 0, bKilledCivilians = 0; - return; - //If any of the soldiers are dying, kill them now. - for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; i++ ) - { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) - { - MercPtrs[ i ]->stats.bLife = 0; - MercPtrs[ i ]->iHealableInjury = 0; // added just for sure - SANDRO - HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); - bKilledEnemies++; - } - } - //Do the same for the creatures. - for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ ) - { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) - { - MercPtrs[ i ]->stats.bLife = 0; - HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); - bKilledCreatures++; - } - } - //Militia - for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ ) - { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) - { - MercPtrs[ i ]->stats.bLife = 0; - MercPtrs[ i ]->iHealableInjury = 0; // added just for sure - SANDRO - HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); - bKilledRebels++; - } - } - //Civilians - for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; i++ ) - { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife < OKLIFE && MercPtrs[ i ]->stats.bLife ) - { - MercPtrs[ i ]->stats.bLife = 0; - MercPtrs[ i ]->iHealableInjury = 0; // added just for sure - SANDRO - HandleSoldierDeath( MercPtrs[ i ], &fMadeCorpse ); - bKilledCivilians++; - } - } - -// TEST MESSAGES ONLY! - if( bKilledCivilians ) - ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d civilians died after you left the sector.", bKilledCivilians ); - if( bKilledRebels ) - ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d militia died after you left the sector.", bKilledRebels ); - if( bKilledEnemies ) - ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d enemies died after you left the sector.", bKilledEnemies ); - if( bKilledCreatures ) - ScreenMsg( FONT_BLUE, MSG_TESTVERSION, L"%d creatures died after you left the sector.", bKilledCreatures ); - - if( !gbWorldSectorZ ) - { - SECTORINFO *pSector; - pSector = &SectorInfo[ SECTOR(gWorldSectorX, gWorldSectorY) ]; - pSector->ubAdminsInBattle = 0; - pSector->ubTroopsInBattle = 0; - pSector->ubElitesInBattle = 0; - pSector->ubCreaturesInBattle = 0; - //RecalculateSectorWeight( - } - else if( gbWorldSectorZ > 0 ) - { - UNDERGROUND_SECTORINFO *pSector; - pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); - if( !pSector ) - return; - pSector->ubAdminsInBattle = 0; - pSector->ubTroopsInBattle = 0; - pSector->ubElitesInBattle = 0; - pSector->ubCreaturesInBattle = 0; - } -} - BOOLEAN PlayerSectorDefended( UINT8 ubSectorID ) { if ( NumNonPlayerTeamMembersInSector( SECTORX( ubSectorID ), SECTORY( ubSectorID ), MILITIA_TEAM ) ) diff --git a/Strategic/Queen Command.h b/Strategic/Queen Command.h index ead2f97e..e2131429 100644 --- a/Strategic/Queen Command.h +++ b/Strategic/Queen Command.h @@ -46,7 +46,6 @@ void EndTacticalBattleForEnemy(); void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ); -void HandleEnemyStatusInCurrentMapBeforeLoadingNewMap(); BOOLEAN SaveUnderGroundSectorInfoToSaveGame( HWFILE hFile ); BOOLEAN LoadUnderGroundSectorInfoFromSavedGame( HWFILE hFile ); From 1ac5d153fb683d6f37168136847784b6e08013a8 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:55:51 +0200 Subject: [PATCH 184/571] Correct inc/dec operator overloads --- Tactical/Overhead Types.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 40d23a03..65e6ec04 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -415,6 +415,16 @@ typedef struct SoldierID const SOLDIERTYPE* operator->() const { return MercPtrs[i]; } inline operator SOLDIERTYPE* () { return MercPtrs[i]; } inline operator const SOLDIERTYPE*() const { return MercPtrs[i]; } + inline SoldierID &operator++() + { + i++; + return *this; + } + inline SoldierID &operator--() + { + i--; + return *this; + } } SoldierID; inline bool operator==(const SoldierID lhs, const SoldierID rhs) { return lhs.i == rhs.i; } @@ -475,17 +485,6 @@ inline SoldierID operator+(const SoldierID lhs, const UINT16 rhs) { return Soldi inline SoldierID operator+(const unsigned int lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs + rhs.i) }; } inline SoldierID operator+(const INT16 lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs + rhs.i) }; } -inline SoldierID operator--(SoldierID lhs) -{ - lhs.i -= 1; - return lhs; -} - -inline SoldierID operator++(SoldierID lhs) -{ - lhs.i += 1; - return lhs; -} //TODO: Change this to constexpr after SoldierID is ready and the user defined constructor from uint16 is not needed anymore. inline constexpr SoldierID NOBODY{ TOTAL_SOLDIERS }; From 0d97e36c3456ed012dcd3e0324cd3aeb59707e49 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:56:44 +0200 Subject: [PATCH 185/571] Use SoldierID --- Strategic/MilitiaIndividual.cpp | 5 +- Strategic/Quests.cpp | 13 +++-- Strategic/Strategic Movement.cpp | 31 +++++----- Strategic/Strategic Transport Groups.cpp | 33 ++++++----- Strategic/strategicmap.cpp | 73 +++++++++++++----------- Strategic/strategicmap.h | 10 ++-- Tactical/Interface Dialogue.cpp | 16 +++--- Tactical/Interface Items.cpp | 32 +++++------ Tactical/Interface Panels.cpp | 9 +-- Tactical/LOS.cpp | 22 +++---- Tactical/Morale.cpp | 3 +- Tactical/PATHAI.cpp | 4 +- Tactical/ShopKeeper Interface.cpp | 8 +-- Tactical/Soldier Ani.cpp | 31 +++++----- Tactical/Soldier Find.cpp | 8 +-- Tactical/Soldier Tile.cpp | 47 +++++++-------- Tactical/Squads.cpp | 11 ++-- Tactical/Strategic Exit GUI.cpp | 24 ++++---- Tactical/Tactical Save.cpp | 10 ++-- Tactical/TeamTurns.cpp | 19 +++--- Tactical/Turn Based Input.cpp | 4 +- Tactical/opplist.cpp | 9 +-- 22 files changed, 218 insertions(+), 204 deletions(-) diff --git a/Strategic/MilitiaIndividual.cpp b/Strategic/MilitiaIndividual.cpp index 28cd25af..d40759af 100644 --- a/Strategic/MilitiaIndividual.cpp +++ b/Strategic/MilitiaIndividual.cpp @@ -284,9 +284,10 @@ SOLDIERTYPE* GetUsedSoldierToIndividualMilitia( UINT32 aMilitiaId ) { for ( UINT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; ++cnt ) { - if ( MercPtrs[cnt] && MercPtrs[cnt]->bActive && MercPtrs[cnt]->usIndividualMilitiaID == aMilitiaId ) + SOLDIERTYPE *pSoldier = MercPtrs[cnt]; + if ( pSoldier && pSoldier->bActive && pSoldier->usIndividualMilitiaID == aMilitiaId ) { - return MercPtrs[cnt]; + return pSoldier; } } diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index 51e5b27a..c125bda6 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -1716,16 +1716,17 @@ void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpR for ( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife >= CONSCIOUSNESS && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && MercPtrs[ i ]->ubProfile != NO_PROFILE && - MercPtrs[ i ]->sSectorX == sQuestSectorX && MercPtrs[ i ]->sSectorY == sQuestsSectorY && !MercPtrs[ i ]->flags.fBetweenSectors && MercPtrs[ i ]->bTeam == gbPlayerNum && - MercPtrs[ i ]->bAssignment != IN_TRANSIT && MercPtrs[ i ]->bAssignment != ASSIGNMENT_DEAD && gMercProfiles[ MercPtrs[ i ]->ubProfile ].ubBodyType != 21 ) // != ROBOTNOWEAPON ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife >= CONSCIOUSNESS && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && pSoldier->ubProfile != NO_PROFILE && + pSoldier->sSectorX == sQuestSectorX && pSoldier->sSectorY == sQuestsSectorY && !pSoldier->flags.fBetweenSectors && pSoldier->bTeam == gbPlayerNum && + pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD && gMercProfiles[ pSoldier->ubProfile ].ubBodyType != 21 ) // != ROBOTNOWEAPON ) { - if ( MercPtrs[ i ]->ubProfile != bException ) + if ( pSoldier->ubProfile != bException ) { - gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.ubQuestsHandled++; + gMercProfiles[ pSoldier->ubProfile ].records.ubQuestsHandled++; if ( bExpReward > 0 && gGameExternalOptions.usAwardSpecialExpForQuests > 0 ) - StatChange( MercPtrs[ i ], EXPERAMT, (bExpReward * gGameExternalOptions.usAwardSpecialExpForQuests), FALSE ); + StatChange( pSoldier, EXPERAMT, (bExpReward * gGameExternalOptions.usAwardSpecialExpForQuests), FALSE ); } } } diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 426a8832..8ebeaf87 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -5458,13 +5458,14 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup ) { for( UINT16 i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { - if ( MercPtrs[ i ]->sSectorX == pGroup->ubSectorX && MercPtrs[ i ]->sSectorY == pGroup->ubSectorY && MercPtrs[ i ]->bAssignment != ASSIGNMENT_POW && MercPtrs[ i ]->bAssignment != ASSIGNMENT_MINIEVENT && MercPtrs[i]->bAssignment != ASSIGNMENT_REBELCOMMAND && MercPtrs[ i ]->stats.bLife >= OKLIFE ) + if ( pSoldier->sSectorX == pGroup->ubSectorX && pSoldier->sSectorY == pGroup->ubSectorY && pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND && pSoldier->stats.bLife >= OKLIFE ) { - if( HAS_SKILL_TRAIT( MercPtrs[ i ], SCOUTING_NT ) && MercPtrs[ i ]->ubProfile != NO_PROFILE ) + if( HAS_SKILL_TRAIT( pSoldier, SCOUTING_NT ) && pSoldier->ubProfile != NO_PROFILE ) { - gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usAmbushesExperienced++; + gMercProfiles[ pSoldier->ubProfile ].records.usAmbushesExperienced++; } } } @@ -5943,13 +5944,14 @@ BOOLEAN ScoutIsPresentInSquad( INT16 ubSectorNumX, INT16 ubSectorNumY ) // sevenfm: scout should not be sleeping, in vehicle or on assignment for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && - MercPtrs[ i ]->stats.bLife >= OKLIFE && - MercPtrs[ i ]->sSectorX == ubSectorNumX && - MercPtrs[ i ]->sSectorY == ubSectorNumY && - MercPtrs[ i ]->bAssignment < ON_DUTY && - !MercPtrs[ i ]->flags.fMercAsleep && - HAS_SKILL_TRAIT( MercPtrs[ i ], SCOUTING_NT ) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && + pSoldier->stats.bLife >= OKLIFE && + pSoldier->sSectorX == ubSectorNumX && + pSoldier->sSectorY == ubSectorNumY && + pSoldier->bAssignment < ON_DUTY && + !pSoldier->flags.fMercAsleep && + HAS_SKILL_TRAIT( pSoldier, SCOUTING_NT ) ) { fScoutPresent = TRUE; } @@ -5982,11 +5984,12 @@ BOOLEAN ConcealedMercInSector( INT16 ubSectorNumX, INT16 ubSectorNumY, BOOLEAN a for ( int i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i ) { - if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife >= OKLIFE && SPY_LOCATION( MercPtrs[i]->bAssignment ) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && SPY_LOCATION( pSoldier->bAssignment ) ) { - if ( MercPtrs[i]->sSectorX == ubSectorNumX && MercPtrs[i]->sSectorY == ubSectorNumY && MercPtrs[i]->bSectorZ == 10 ) + if ( pSoldier->sSectorX == ubSectorNumX && pSoldier->sSectorY == ubSectorNumY && pSoldier->bSectorZ == 10 ) { - if ( !aScoutsOnly || HAS_SKILL_TRAIT( MercPtrs[i], SCOUTING_NT ) ) + if ( !aScoutsOnly || HAS_SKILL_TRAIT( pSoldier, SCOUTING_NT ) ) { return TRUE; } diff --git a/Strategic/Strategic Transport Groups.cpp b/Strategic/Strategic Transport Groups.cpp index ccd981d0..5cc85f3d 100644 --- a/Strategic/Strategic Transport Groups.cpp +++ b/Strategic/Strategic Transport Groups.cpp @@ -224,27 +224,29 @@ void FillMapColoursForTransportGroups(INT32(&colorMap)[MAXIMUM_VALID_Y_COORDINAT std::map monitoredTowns; for( INT16 i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && - MercPtrs[ i ]->stats.bLife >= OKLIFE && - (MercPtrs[ i ]->bAssignment < ON_DUTY || MercPtrs[ i ]->bAssignment == GATHERINTEL) && - !MercPtrs[ i ]->flags.fMercAsleep) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + + if( pSoldier->bActive && + pSoldier->stats.bLife >= OKLIFE && + (pSoldier->bAssignment < ON_DUTY || pSoldier->bAssignment == GATHERINTEL) && + !pSoldier->flags.fMercAsleep) { if (gGameOptions.fNewTraitSystem) { - if (HAS_SKILL_TRAIT(MercPtrs[i], SCOUTING_NT)) + if (HAS_SKILL_TRAIT(pSoldier, SCOUTING_NT)) { - detectionMap[std::pair(MercPtrs[i]->sSectorX, MercPtrs[i]->sSectorY)] = DETECTION_RANGE_SCOUT; + detectionMap[std::pair(pSoldier->sSectorX, pSoldier->sSectorY)] = DETECTION_RANGE_SCOUT; } - else if (HAS_SKILL_TRAIT(MercPtrs[i], RADIO_OPERATOR_NT) && MercPtrs[i]->CanUseRadio(FALSE)) + else if (HAS_SKILL_TRAIT(pSoldier, RADIO_OPERATOR_NT) && pSoldier->CanUseRadio(FALSE)) { - detectionMap[std::pair(MercPtrs[i]->sSectorX, MercPtrs[i]->sSectorY)] = DETECTION_RANGE_RADIO; + detectionMap[std::pair(pSoldier->sSectorX, pSoldier->sSectorY)] = DETECTION_RANGE_RADIO; } - else if (HAS_SKILL_TRAIT(MercPtrs[i], COVERT_NT)) + else if (HAS_SKILL_TRAIT(pSoldier, COVERT_NT)) { - if (MercPtrs[i]->bAssignment == GATHERINTEL) + if (pSoldier->bAssignment == GATHERINTEL) { - detectionMap[std::pair(MercPtrs[i]->sSectorX, MercPtrs[i]->sSectorY)] = DETECTION_RANGE_COVERT; - monitoredTowns[GetTownIdForSector(MercPtrs[i]->sSectorX, MercPtrs[i]->sSectorY)] = MonitoredSectorState::Monitored; + detectionMap[std::pair(pSoldier->sSectorX, pSoldier->sSectorY)] = DETECTION_RANGE_COVERT; + monitoredTowns[GetTownIdForSector(pSoldier->sSectorX, pSoldier->sSectorY)] = MonitoredSectorState::Monitored; } } } @@ -481,11 +483,12 @@ void UpdateTransportGroupInventory() std::set playerCalibres; for (INT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++) { - if (MercPtrs[i]->bActive && !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_VEHICLE)) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if (pSoldier->bActive && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) { - for (int j = 0 ; j < MercPtrs[i]->inv.size(); ++j) + for (int j = 0 ; j < pSoldier->inv.size(); ++j) { - OBJECTTYPE& obj = MercPtrs[i]->inv[j]; + OBJECTTYPE& obj = pSoldier->inv[j]; if (obj.exists() && Item[obj.usItem].usItemClass == IC_GUN) { diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index cca5a3ee..b5908ecf 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -184,8 +184,8 @@ BOOLEAN fUsingEdgePointsForStrategicEntry = FALSE; BOOLEAN gfInvalidTraversal = FALSE; BOOLEAN gfLoneEPCAttemptingTraversal = FALSE; BOOLEAN gfRobotWithoutControllerAttemptingTraversal = FALSE; -BOOLEAN gubLoneMercAttemptingToAbandonEPCs = 0; -INT8 gbPotentiallyAbandonedEPCSlotID = -1; +BOOLEAN gubLoneMercAttemptingToAbandonEPCs = 0; +SoldierID gbPotentiallyAbandonedEPCSlotID = NOBODY; INT8 gbGreenToElitePromotions = 0; INT8 gbGreenToRegPromotions = 0; @@ -2140,10 +2140,12 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // GridNo = NOWHERE, which causes this assertion to fail //CHRISL: There's also an issue with vehicles. Soldiers in any vehicle are considered to be in sGridNo = NOWHERE // This will result in an assertion error, so let's skip the assertion if the merc is assigned to a vehicle - if (!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE && !SPY_LOCATION(MercPtrs[i]->bAssignment) && MercPtrs[i]->bAssignment != ASSIGNMENT_POW) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_DEAD) && pSoldier->bAssignment != VEHICLE && !SPY_LOCATION(pSoldier->bAssignment) && pSoldier->bAssignment != ASSIGNMENT_POW) { - //Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE || MercPtrs[i]->bVehicleID == iHelicopterVehicleId ); - Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || !TileIsOutOfBounds( MercPtrs[i]->sGridNo ) || MercPtrs[i]->bVehicleID == iHelicopterVehicleId ); + //Assert( !pSoldier->bActive || !pSoldier->bInSector || pSoldier->sGridNo != NOWHERE || pSoldier->bVehicleID == iHelicopterVehicleId ); + Assert( !pSoldier->bActive || !pSoldier->bInSector || !TileIsOutOfBounds( pSoldier->sGridNo ) || pSoldier->bVehicleID == iHelicopterVehicleId ); } } @@ -2190,10 +2192,11 @@ BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) // GridNo = NOWHERE, which causes this assertion to fail //CHRISL: There's also an issue with vehicles. Soldiers in any vehicle are considered to be in sGridNo = NOWHERE // This will result in an assertion error, so let's skip the assertion if the merc is assigned to a vehicle - if (!(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_DEAD) && MercPtrs[i]->bAssignment != VEHICLE && MercPtrs[i]->bAssignment != ASSIGNMENT_POW) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if (!(pSoldier->flags.uiStatusFlags & SOLDIER_DEAD) && pSoldier->bAssignment != VEHICLE && pSoldier->bAssignment != ASSIGNMENT_POW) { - //Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || MercPtrs[i]->sGridNo != NOWHERE || MercPtrs[i]->bVehicleID == iHelicopterVehicleId ); - Assert( !MercPtrs[i]->bActive || !MercPtrs[i]->bInSector || !TileIsOutOfBounds( MercPtrs[i]->sGridNo ) || MercPtrs[i]->bVehicleID == iHelicopterVehicleId ); + //Assert( !pSoldier->bActive || !pSoldier->bInSector || pSoldier->sGridNo != NOWHERE || pSoldier->bVehicleID == iHelicopterVehicleId ); + Assert( !pSoldier->bActive || !pSoldier->bInSector || !TileIsOutOfBounds( pSoldier->sGridNo ) || pSoldier->bVehicleID == iHelicopterVehicleId ); } } @@ -2967,9 +2970,10 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { for ( i = gTacticalStatus.Team[CIV_TEAM].bFirstID; i <= gTacticalStatus.Team[CIV_TEAM].bLastID; i++ ) { - if ( MercPtrs[i]->bActive && MercPtrs[i]->bInSector ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if ( pSoldier->bActive && pSoldier->bInSector ) { - SetupProfileInsertionDataForSoldier( MercPtrs[i] ); + SetupProfileInsertionDataForSoldier( pSoldier ); } } } @@ -4869,7 +4873,7 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu gfInvalidTraversal = FALSE; gfLoneEPCAttemptingTraversal = FALSE; gubLoneMercAttemptingToAbandonEPCs = 0; - gbPotentiallyAbandonedEPCSlotID = -1; + gbPotentiallyAbandonedEPCSlotID = NOBODY; // Look through all mercs and check if they are within range of east end.... cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; @@ -4894,7 +4898,7 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu { ubNumEPCs++; //Also record the EPC's slot ID incase we later build a string using the EPC's name. - gbPotentiallyAbandonedEPCSlotID = (INT8)cnt; + gbPotentiallyAbandonedEPCSlotID = cnt; if ( AM_A_ROBOT( pSoldier ) && !pSoldier->CanRobotBeControlled( ) ) { gfRobotWithoutControllerAttemptingTraversal = TRUE; @@ -6491,9 +6495,10 @@ BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode ) //@@@Evaluate for ( i = gTacticalStatus.Team[CIV_TEAM].bFirstID; i <= gTacticalStatus.Team[CIV_TEAM].bLastID; i++ ) { - if ( MercPtrs[i]->bActive && MercPtrs[i]->bInSector ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if ( pSoldier->bActive && pSoldier->bInSector ) { - SetupProfileInsertionDataForSoldier( MercPtrs[i] ); + SetupProfileInsertionDataForSoldier( pSoldier ); } } @@ -6511,19 +6516,21 @@ BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( int pSectorX, int pSect //co-exist in the sector, then make them fight for control of the sector via autoresolve. for ( int i = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; i <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; i++ ) { - if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife ) + SOLDIERTYPE *pEnemy = MercPtrs[i]; + if ( pEnemy->bActive && pEnemy->stats.bLife ) { - if ( MercPtrs[i]->sSectorX == pSectorX && - MercPtrs[i]->sSectorY == pSectorY && - MercPtrs[i]->bSectorZ == pSectorZ ) + if ( pEnemy->sSectorX == pSectorX && + pEnemy->sSectorY == pSectorY && + pEnemy->bSectorZ == pSectorZ ) { //We have enemies, now look for militia! for ( i = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; i <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; i++ ) { - if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife && MercPtrs[i]->bSide == OUR_TEAM ) + SOLDIERTYPE *pMilitia = MercPtrs[i]; + if ( pMilitia->bActive && pMilitia->stats.bLife && pMilitia->bSide == OUR_TEAM ) { - if ( MercPtrs[i]->sSectorX == pSectorX && - MercPtrs[i]->sSectorY == pSectorY && - MercPtrs[i]->bSectorZ == pSectorZ ) + if ( pMilitia->sSectorX == pSectorX && + pMilitia->sSectorY == pSectorY && + pMilitia->bSectorZ == pSectorZ ) { //We have militia and enemies and no mercs! Let's finish this battle in autoresolve. gfEnteringMapScreen = TRUE; gfEnteringMapScreenToEnterPreBattleInterface = TRUE; @@ -6587,14 +6594,15 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( ) { for ( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++ ) { //If we have a live and valid soldier - if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife && !MercPtrs[i]->flags.fBetweenSectors && !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[i] ) && !AM_AN_EPC( MercPtrs[i] ) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if ( pSoldier->bActive && pSoldier->stats.bLife && !pSoldier->flags.fBetweenSectors && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) ) { - if ( MercPtrs[i]->sSectorX == gWorldSectorX && - MercPtrs[i]->sSectorY == gWorldSectorY && - MercPtrs[i]->bSectorZ == gbWorldSectorZ ) + if ( pSoldier->sSectorX == gWorldSectorX && + pSoldier->sSectorY == gWorldSectorY && + pSoldier->bSectorZ == gbWorldSectorZ ) { - MercPtrs[i]->RemoveSoldierFromGridNo( ); - InitSoldierOppList( MercPtrs[i] ); + pSoldier->RemoveSoldierFromGridNo( ); + InitSoldierOppList( pSoldier ); } } } @@ -6604,11 +6612,12 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( ) { //Check and see if we have any live mercs in the sector. for ( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++ ) { //If we have a live and valid soldier - if ( MercPtrs[i]->bActive && MercPtrs[i]->stats.bLife && !MercPtrs[i]->flags.fBetweenSectors && !(MercPtrs[i]->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( MercPtrs[i] ) && !AM_AN_EPC( MercPtrs[i] ) ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if ( pSoldier->bActive && pSoldier->stats.bLife && !pSoldier->flags.fBetweenSectors && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) ) { - if ( MercPtrs[i]->sSectorX == gWorldSectorX && - MercPtrs[i]->sSectorY == gWorldSectorY && - MercPtrs[i]->bSectorZ == gbWorldSectorZ ) + if ( pSoldier->sSectorX == gWorldSectorX && + pSoldier->sSectorY == gWorldSectorY && + pSoldier->bSectorZ == gbWorldSectorZ ) { return FALSE; } diff --git a/Strategic/strategicmap.h b/Strategic/strategicmap.h index e43191c5..1a74e8fc 100644 --- a/Strategic/strategicmap.h +++ b/Strategic/strategicmap.h @@ -210,11 +210,11 @@ BOOLEAN EscapeDirectionIsValid( INT8 * pbDirection ); bool IsEscapeDirectionValid(WorldDirections pbDirection); //Used for determining the type of error message that comes up when you can't traverse to //an adjacent sector. THESE VALUES DO NOT NEED TO BE SAVED! -extern BOOLEAN gfInvalidTraversal; -extern BOOLEAN gfLoneEPCAttemptingTraversal; -extern BOOLEAN gfRobotWithoutControllerAttemptingTraversal; -extern UINT8 gubLoneMercAttemptingToAbandonEPCs; -extern INT8 gbPotentiallyAbandonedEPCSlotID; +extern BOOLEAN gfInvalidTraversal; +extern BOOLEAN gfLoneEPCAttemptingTraversal; +extern BOOLEAN gfRobotWithoutControllerAttemptingTraversal; +extern UINT8 gubLoneMercAttemptingToAbandonEPCs; +extern SoldierID gbPotentiallyAbandonedEPCSlotID; extern INT8 gbGreenToElitePromotions; extern INT8 gbGreenToRegPromotions; diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index 6bb0bf63..a47e6402 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -3224,7 +3224,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( pSoldier ) { INT32 sNearestPC; - UINT16 ubID; + SoldierID ubID; INT8 bMoneySlot; INT8 bEmptySlot; @@ -3235,7 +3235,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ubID = WhoIsThere2( sNearestPC, 0 ); if (ubID != NOBODY) { - pSoldier2 = MercPtrs[ ubID ]; + pSoldier2 = ubID; } } @@ -3357,7 +3357,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - UINT16 ubTargetID; + SoldierID ubTargetID; SOLDIERTYPE *pTarget; // Target a different merc.... @@ -3384,7 +3384,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum } else { - pTarget = MercPtrs[ ubTargetID ]; + pTarget = ubTargetID; } // Use a different approach.... @@ -3477,7 +3477,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if (pSoldier) { - UINT16 ubTargetID; + SoldierID ubTargetID; SOLDIERTYPE *pTarget; INT32 cnt; BOOLEAN fGoodTarget = FALSE; @@ -3491,7 +3491,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum } else { - pTarget = MercPtrs[ ubTargetID ]; + pTarget = ubTargetID; } pSoldier->aiData.uiPendingActionData4 = APPROACH_DONE_PUNCH_1; @@ -3901,7 +3901,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum if ( !gfInTalkPanel ) { INT32 sNearestPC; - UINT16 ubID; + SoldierID ubID; pSoldier = FindSoldierByProfileID( ubTargetNPC, FALSE ); if ( pSoldier ) @@ -3914,7 +3914,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ubID = WhoIsThere2( sNearestPC, 0 ); if (ubID != NOBODY) { - pSoldier2 = MercPtrs[ ubID ]; + pSoldier2 = ubID; } } diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index b3f56f6a..ed3ee63b 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -9185,10 +9185,10 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) usItem = gpItemPointer->usItem; // If the target is a robot, - if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) + if ( ubSoldierID->flags.uiStatusFlags & SOLDIER_ROBOT ) { // Charge APs to reload robot! - sAPCost = GetAPsToReloadRobot( gpItemPointerSoldier, MercPtrs[ ubSoldierID ] ); + sAPCost = GetAPsToReloadRobot( gpItemPointerSoldier, ubSoldierID ); } else { @@ -9208,12 +9208,12 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) // } /* //if the user just clicked on an arms dealer - if( IsMercADealer( MercPtrs[ ubSoldierID ]->ubProfile ) ) + if( IsMercADealer( ubSoldierID->ubProfile ) ) { if ( EnoughPoints( gpItemPointerSoldier, sAPCost, 0, TRUE ) ) { //Enter the shopkeeper interface - EnterShopKeeperInterfaceScreen( MercPtrs[ ubSoldierID ]->ubProfile ); + EnterShopKeeperInterfaceScreen( ubSoldierID->ubProfile ); EndItemPointer( ); } @@ -9225,10 +9225,10 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) if ( EnoughPoints( gpItemPointerSoldier, sAPCost, 0, TRUE ) ) { // If we are a robot, check if this is proper item to reload! - if ( MercPtrs[ ubSoldierID ]->flags.uiStatusFlags & SOLDIER_ROBOT ) + if ( ubSoldierID->flags.uiStatusFlags & SOLDIER_ROBOT ) { // Check if we can reload robot.... - if ( IsValidAmmoToReloadRobot( MercPtrs[ ubSoldierID ], &gTempObject ) ) + if ( IsValidAmmoToReloadRobot( ubSoldierID, &gTempObject ) ) { INT32 sActionGridNo; UINT8 ubDirection; @@ -9236,7 +9236,7 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) // Walk up to him and reload! // See if we can get there to stab - sActionGridNo = FindAdjacentGridEx( gpItemPointerSoldier, MercPtrs[ ubSoldierID ]->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); + sActionGridNo = FindAdjacentGridEx( gpItemPointerSoldier, ubSoldierID->sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE ); if ( sActionGridNo != -1 && gbItemPointerSrcSlot != NO_SLOT ) { @@ -9279,16 +9279,16 @@ BOOLEAN HandleItemPointerClick( INT32 usMapPos ) //if (gbItemPointerSrcSlot != NO_SLOT ) { // Give guy this item..... - SoldierGiveItem( gpItemPointerSoldier, MercPtrs[ ubSoldierID ], &gTempObject, gbItemPointerSrcSlot ); + SoldierGiveItem( gpItemPointerSoldier, ubSoldierID, &gTempObject, gbItemPointerSrcSlot ); gfDontChargeAPsToPickup = FALSE; EndItemPointer( ); // If we are giving it to somebody not on our team.... - if ( gMercProfiles[MercPtrs[ubSoldierID]->ubProfile].Type == PROFILETYPE_AIM || - gMercProfiles[MercPtrs[ubSoldierID]->ubProfile].Type == PROFILETYPE_MERC || - gMercProfiles[MercPtrs[ubSoldierID]->ubProfile].Type == PROFILETYPE_IMP - || RPC_RECRUITED( MercPtrs[ubSoldierID] ) ) + if ( gMercProfiles[ubSoldierID->ubProfile].Type == PROFILETYPE_AIM || + gMercProfiles[ubSoldierID->ubProfile].Type == PROFILETYPE_MERC || + gMercProfiles[ubSoldierID->ubProfile].Type == PROFILETYPE_IMP + || RPC_RECRUITED( ubSoldierID ) ) { } @@ -10533,7 +10533,7 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) { UINT32 uiItemPos; UINT32 iItemCap; - INT32 ubID; + SoldierID ubID; CHAR16 sString[ 128 ]; uiItemPos = MSYS_GetRegionUserData( pRegion, 0 ); @@ -10625,11 +10625,11 @@ void ItemPopupRegionCallback( MOUSE_REGION * pRegion, INT32 iReason ) fTeamPanelDirty=TRUE; // remember which gridno the object came from - sObjectSourceGridNo = MercPtrs[ubID]->sGridNo; + sObjectSourceGridNo = ubID->sGridNo; // and who owned it last - gpItemPointerSoldier = MercPtrs[ubID]; + gpItemPointerSoldier = ubID; - ReevaluateItemHatches( MercPtrs[ubID], FALSE ); + ReevaluateItemHatches( ubID, FALSE ); } //Dirty interface diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index ae0ed4cc..8f039637 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -4513,17 +4513,18 @@ void BtnDropPackCallback(GUI_BUTTON *btn,INT32 reason) INT8 bAssignment = gpSMCurrentMerc->bAssignment; for( int x = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; x <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; x++ ) { + SOLDIERTYPE *pSoldier = MercPtrs[x]; /* Is DropPackFlag currently false and is there something in the backpack pocket? If so, we haven't dropped a pack yet and apparently want to*/ - if(MercPtrs[x]->bAssignment == bAssignment && MercPtrs[x]->inv[BPACKPOCKPOS].exists() == true && !MercPtrs[x]->flags.DropPackFlag) + if(pSoldier->bAssignment == bAssignment && pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.DropPackFlag) { - ChangeDropPackStatus(MercPtrs[x], TRUE); + ChangeDropPackStatus(pSoldier, TRUE); } /* Is DropPackFlag currently true, is nothing in the backpack pocket and have we dropped a pack? If so, we must want to retreive a backpack we previously dropped.*/ - else if(MercPtrs[x]->bAssignment == bAssignment && MercPtrs[x]->inv[BPACKPOCKPOS].exists() == false && MercPtrs[x]->flags.DropPackFlag) + else if(pSoldier->bAssignment == bAssignment && pSoldier->inv[BPACKPOCKPOS].exists() == false && pSoldier->flags.DropPackFlag) { - ChangeDropPackStatus(MercPtrs[x], FALSE); + ChangeDropPackStatus(pSoldier, FALSE); } } } diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 3513e580..044e99fc 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -7223,8 +7223,10 @@ void MoveBullet( INT32 iBullet ) } else if (pStructure->fFlags & STRUCTURE_PERSON) { + SOLDIERTYPE *pSoldier = MercPtrs[pStructure->usStructureID]; + // HEADROCK HAM 5: Fragments can hit the shooter. - if ( MercPtrs[ pStructure->usStructureID ] != pBullet->pFirer || pBullet->fFragment == TRUE ) + if ( pSoldier != pBullet->pFirer || pBullet->fFragment == TRUE ) { // in actually moving the bullet, we consider only count friends as targets if the bullet is unaimed // (buckshot), if they are the intended target, or beyond the range of automatic friendly fire hits @@ -7243,13 +7245,13 @@ void MoveBullet( INT32 iBullet ) else if ( pBullet->pFirer->flags.uiStatusFlags & SOLDIER_MONSTER ) { // monsters firing will always accidentally hit people but never accidentally hit each other. - if ( !(MercPtrs[ pStructure->usStructureID ]->flags.uiStatusFlags & SOLDIER_MONSTER) ) + if ( !(pSoldier->flags.uiStatusFlags & SOLDIER_MONSTER) ) { gpLocalStructure[iNumLocalStructures] = pStructure; iNumLocalStructures++; } } - else if (MercPtrs[pStructure->usStructureID]->bVisible == TRUE && + else if (pSoldier->bVisible == TRUE && PositionAllowsHit(pBullet, pStructure) && (pBullet->fAimed && pBullet->iLoop > MIN_DIST_FOR_HIT_FRIENDS || !pBullet->fAimed && pBullet->iLoop > MIN_DIST_FOR_HIT_FRIENDS_UNAIMED || @@ -7261,16 +7263,16 @@ void MoveBullet( INT32 iBullet ) } // this might be a close call - if ( pBullet->ubFirerID != NOBODY && MercPtrs[ pStructure->usStructureID ]->bTeam == gbPlayerNum && pBullet->pFirer->bTeam != gbPlayerNum && sDesiredLevel == MercPtrs[ pStructure->usStructureID ]->pathing.bLevel ) + if ( pBullet->ubFirerID != NOBODY && pSoldier->bTeam == gbPlayerNum && pBullet->pFirer->bTeam != gbPlayerNum && sDesiredLevel == pSoldier->pathing.bLevel ) { - MercPtrs[ pStructure->usStructureID ]->flags.fCloseCall = TRUE; + pSoldier->flags.fCloseCall = TRUE; } - if ( IS_MERC_BODY_TYPE( MercPtrs[pStructure->usStructureID] ) ) + if ( IS_MERC_BODY_TYPE( pSoldier ) ) { // apply suppression, regardless of friendly or enemy // except if friendly, not within a few tiles of shooter - if (pBullet->ubFirerID == NOBODY || MercPtrs[pStructure->usStructureID]->bSide != pBullet->pFirer->bSide || pBullet->iLoop > gGameExternalOptions.usMinDistanceFriendlySuppression) + if (pBullet->ubFirerID == NOBODY || pSoldier->bSide != pBullet->pFirer->bSide || pBullet->iLoop > gGameExternalOptions.usMinDistanceFriendlySuppression) { // buckshot has only a 1 in 2 chance of applying a suppression point // HEADROCK HAM 5: For NCTH, make pellets as effective as any other bullet. @@ -7279,7 +7281,7 @@ void MoveBullet( INT32 iBullet ) if (!(pBullet->usFlags & BULLET_FLAG_BUCKSHOT) || Chance(gGameExternalOptions.ubBuckshotSuppressionEffectiveness)) { // bullet goes whizzing by this guy! - switch ( gAnimControl[ MercPtrs[pStructure->usStructureID]->usAnimState ].ubEndHeight ) + switch ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) { case ANIM_PRONE: // two 1/4 chances of avoiding suppression pt - one below @@ -7296,8 +7298,8 @@ void MoveBullet( INT32 iBullet ) } // else fall through default: - MercPtrs[pStructure->usStructureID]->ubSuppressionPoints++; - MercPtrs[pStructure->usStructureID]->ubSuppressorID = pBullet->ubFirerID; + pSoldier->ubSuppressionPoints++; + pSoldier->ubSuppressorID = pBullet->ubFirerID; break; } } diff --git a/Tactical/Morale.cpp b/Tactical/Morale.cpp index 9ff5e12f..bd2924cb 100644 --- a/Tactical/Morale.cpp +++ b/Tactical/Morale.cpp @@ -315,7 +315,8 @@ void DecayTacticalMoraleModifiers( void ) fHandleNervous = TRUE; for ( ubLoop2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop2++ ) { - if ( MercPtrs[ ubLoop2 ] != pSoldier && MercPtrs[ ubLoop2 ]->bActive && MercPtrs[ ubLoop2 ]->sSectorX == pSoldier->sSectorX && MercPtrs[ ubLoop2 ]->sSectorY == pSoldier->sSectorY && MercPtrs[ ubLoop2 ]->bSectorZ == pSoldier->bSectorZ ) + SOLDIERTYPE *pSoldier = MercPtrs[ubLoop2]; + if ( pSoldier != pSoldier && pSoldier->bActive && pSoldier->sSectorX == pSoldier->sSectorX && pSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pSoldier->bSectorZ ) { // found someone! fHandleNervous = FALSE; diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 478c4f1a..f564fe7f 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -2198,7 +2198,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT32 sDestination, INT8 bLevel, INT16 usMov INT8 bLoopState = LOOPING_CLOCKWISE; //BOOLEAN fLoopForwards = FALSE; BOOLEAN fCheckedBehind = FALSE; - UINT16 ubMerc; + SoldierID ubMerc; INT32 iDestX,iDestY, iLocX, iLocY, dx, dy; INT32 newLoc,curLoc; //INT32 curY; @@ -3145,7 +3145,7 @@ if(!GridNoOnVisibleWorldTile(iDestination)) // sevenfm: for player mercs, ignore invisible opponents if (ubMerc < TOTAL_SOLDIERS && ubMerc != s->ubID && - (!(s->flags.uiStatusFlags & SOLDIER_PC) || MercPtrs[ubMerc]->bSide == s->bSide || MercPtrs[ubMerc]->aiData.bNeutral || MercPtrs[ubMerc]->bVisible >= 0 || SoldierToSoldierLineOfSightTest(s, MercPtrs[ubMerc], TRUE, CALC_FROM_ALL_DIRS))) + (!(s->flags.uiStatusFlags & SOLDIER_PC) || ubMerc->bSide == s->bSide || ubMerc->aiData.bNeutral || ubMerc->bVisible >= 0 || SoldierToSoldierLineOfSightTest(s, ubMerc, TRUE, CALC_FROM_ALL_DIRS))) //if ( ubMerc < TOTAL_SOLDIERS && ubMerc != s->ubID ) { goto NEXTDIR; diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index d1245983..67805e08 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -6537,9 +6537,7 @@ BOOLEAN SKITryToReturnInvToOwnerOrCurrentMerc( INVENTORY_IN_SLOT *pInv ) // if it does have an owner if( pInv->ubIdOfMercWhoOwnsTheItem != NO_PROFILE ) { - INT16 sSoldierID; - - sSoldierID = GetSoldierIDFromMercID( pInv->ubIdOfMercWhoOwnsTheItem ); + SoldierID sSoldierID = GetSoldierIDFromMercID( pInv->ubIdOfMercWhoOwnsTheItem ); // if that soldier is not in player's hire any longer if ( sSoldierID == -1 ) { @@ -6548,13 +6546,13 @@ BOOLEAN SKITryToReturnInvToOwnerOrCurrentMerc( INVENTORY_IN_SLOT *pInv ) // For owners of repaired items, this checks that owner is still hired, in sector, // on current squad, close enough to the shopkeeper, etc. - if ( !CanMercInteractWithSelectedShopkeeper( MercPtrs[ sSoldierID ] ) ) + if ( !CanMercInteractWithSelectedShopkeeper( sSoldierID ) ) { return(FALSE); } // Try to find a place to put in its owner's inventory (regardless of which merc is currently displayed!) - if ( SKITryToAddInvToMercsInventory( pInv, MercPtrs[ sSoldierID ] ) ) + if ( SKITryToAddInvToMercsInventory( pInv, sSoldierID ) ) { return( TRUE ); } diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 51a097d5..b06980a4 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -3126,15 +3126,11 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Reload robot.... { - UINT16 ubPerson; - SOLDIERTYPE *pRobot; + SoldierID ubPerson = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); - // Get pointer... - ubPerson = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); - - if ( ubPerson != NOBODY && MercPtrs[ ubPerson ]->flags.uiStatusFlags & SOLDIER_ROBOT ) + if ( ubPerson != NOBODY && ubPerson->flags.uiStatusFlags & SOLDIER_ROBOT ) { - pRobot = MercPtrs[ ubPerson ]; + SOLDIERTYPE *pRobot = ubPerson; ReloadGun( pRobot, &(pRobot->inv[ HANDPOS ] ), pSoldier->pTempObject ); @@ -3658,50 +3654,51 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, if ( ubNumMercs > 0 ) { ubChosenMerc = (UINT16)Random( ubNumMercs ); + SOLDIERTYPE *pChosen = MercPtrs[ubMercsInSector[ubChosenMerc]]; switch( bBuddyIndex[ ubChosenMerc ] ) { case 0: usQuoteNum = QUOTE_BUDDY_1_GOOD; - MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_1_WITNESSED; + pChosen->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_1_WITNESSED; break; case 1: usQuoteNum = QUOTE_BUDDY_2_GOOD; - MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_2_WITNESSED; + pChosen->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_2_WITNESSED; break; case 2: - if( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) + if( pChosen->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) usQuoteNum = QUOTE_AIM_BUDDY_3_GOOD; else usQuoteNum = QUOTE_NON_AIM_BUDDY_3_GOOD; - MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_3_WITNESSED; + pChosen->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_3_WITNESSED; break; case 3: - if( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) + if( pChosen->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) usQuoteNum = QUOTE_AIM_BUDDY_4_GOOD; else usQuoteNum = QUOTE_NON_AIM_BUDDY_4_GOOD; - MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_4_WITNESSED; + pChosen->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_4_WITNESSED; break; case 4: - if( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) + if( pChosen->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) usQuoteNum = QUOTE_AIM_BUDDY_5_GOOD; else usQuoteNum = QUOTE_NON_AIM_BUDDY_5_GOOD; - MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_5_WITNESSED; + pChosen->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_5_WITNESSED; break; case 5: usQuoteNum = QUOTE_LEARNED_TO_LIKE_WITNESSED; - MercPtrs[ ubMercsInSector[ ubChosenMerc ] ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_6_WITNESSED; + pChosen->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_BUDDY_6_WITNESSED; break; } - TacticalCharacterDialogue( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ], usQuoteNum ); + TacticalCharacterDialogue( pChosen, usQuoteNum ); buddyquoteused = TRUE; } diff --git a/Tactical/Soldier Find.cpp b/Tactical/Soldier Find.cpp index 50e6b05e..77d19f39 100644 --- a/Tactical/Soldier Find.cpp +++ b/Tactical/Soldier Find.cpp @@ -116,13 +116,13 @@ BOOLEAN SelectiveFindSoldierFromMouse( SoldierID *pusSoldierIndex, UINT32 *pMerc } -UINT32 GetSoldierFindFlags( const SoldierID ubID ) +UINT32 GetSoldierFindFlags( SoldierID ubID ) { UINT32 MercFlags = 0; SOLDIERTYPE *pSoldier; // Get pSoldier! - pSoldier = MercPtrs[ ubID ]; + pSoldier = ubID; // Find out and set flags if ( ubID == gusSelectedSoldier ) @@ -530,13 +530,13 @@ SOLDIERTYPE * SimpleFindSoldier( INT32 sGridNo, INT8 bLevel ) } else { - return( MercPtrs[ ubID ] ); + return( ubID ); } } BOOLEAN IsValidTargetMerc( SoldierID ubSoldierID ) { - SOLDIERTYPE *pSoldier = MercPtrs[ ubSoldierID ]; + SOLDIERTYPE *pSoldier = ubSoldierID; // CHECK IF ACTIVE! diff --git a/Tactical/Soldier Tile.cpp b/Tactical/Soldier Tile.cpp index 05be45f9..5b5172c2 100644 --- a/Tactical/Soldier Tile.cpp +++ b/Tactical/Soldier Tile.cpp @@ -96,8 +96,6 @@ void OutputDebugInfoForTurnBasedNextTileWaiting( SOLDIERTYPE * pSoldier ) void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT32 sCauseGridNo, INT8 bValue ) { - UINT16 ubPerson; - // Cancel AI Action // CancelAIAction( pSoldier, TRUE ); @@ -108,7 +106,7 @@ void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT32 sCauseGridNo, INT8 bVal // ATE: Now update realtime movement speed.... // check if guy exists here... - ubPerson = WhoIsThere2( sCauseGridNo, pSoldier->pathing.bLevel ); + SoldierID ubPerson = WhoIsThere2( sCauseGridNo, pSoldier->pathing.bLevel ); // There may not be anybody there, but it's reserved by them! if ( ( gpWorldLevelData[ sCauseGridNo ].uiFlags & MAPELEMENT_MOVEMENT_RESERVED ) ) @@ -119,7 +117,7 @@ void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT32 sCauseGridNo, INT8 bVal if ( ubPerson != NOBODY ) { // if they are our own team members ( both ) - if ( MercPtrs[ ubPerson ]->bTeam == gbPlayerNum && pSoldier->bTeam == gbPlayerNum ) + if ( ubPerson->bTeam == gbPlayerNum && pSoldier->bTeam == gbPlayerNum ) { // Here we have another guy.... save his stats so we can use them for // speed determinations.... @@ -205,7 +203,6 @@ void UnMarkMovementReserved( SOLDIERTYPE *pSoldier ) INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 bLevel ) { - UINT16 ubPerson; INT32 sTempDestGridNo; INT32 sNewGridNo; BOOLEAN fSwapInDoor = FALSE; @@ -225,7 +222,7 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b return( MOVE_TILE_CLEAR ); } - ubPerson = WhoIsThere2( sGridNo, bLevel ); + SoldierID ubPerson = WhoIsThere2( sGridNo, bLevel ); if ( ubPerson != NOBODY ) @@ -243,7 +240,7 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b // Are we only temporarily blocked? // Check if our final destination is = our gridno - if ( ( MercPtrs[ ubPerson ]->pathing.sFinalDestination == MercPtrs[ ubPerson ]->sGridNo ) ) + if ( ( ubPerson->pathing.sFinalDestination == ubPerson->sGridNo ) ) { return( MOVE_TILE_STATIONARY_BLOCKED ); } @@ -251,12 +248,12 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b { // OK, if buddy who is blocking us is trying to move too... // And we are in opposite directions... - if ( MercPtrs[ ubPerson ]->flags.fBlockedByAnotherMerc && MercPtrs[ ubPerson ]->bBlockedByAnotherMercDirection == gOppositeDirection[ bDirection ] ) + if ( ubPerson->flags.fBlockedByAnotherMerc && ubPerson->bBlockedByAnotherMercDirection == gOppositeDirection[ bDirection ] ) { // OK, try and get a path around buddy.... // We have to temporarily make buddy stopped... - sTempDestGridNo = MercPtrs[ ubPerson ]->pathing.sFinalDestination; - MercPtrs[ ubPerson ]->pathing.sFinalDestination = MercPtrs[ ubPerson ]->sGridNo; + sTempDestGridNo = ubPerson->pathing.sFinalDestination; + ubPerson->pathing.sFinalDestination = ubPerson->sGridNo; if ( PlotPath( pSoldier, pSoldier->pathing.sFinalDestination, NO_COPYROUTE, NO_PLOT, TEMPORARY, pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints ) ) { @@ -264,7 +261,7 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b // OK, make guy go here... pSoldier->EVENT_GetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode ); // Restore final dest.... - MercPtrs[ ubPerson ]->pathing.sFinalDestination = sTempDestGridNo; + ubPerson->pathing.sFinalDestination = sTempDestGridNo; pSoldier->flags.fBlockedByAnotherMerc = FALSE; // Is the next tile blocked too? @@ -288,18 +285,18 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b // Swap now! - MercPtrs[ ubPerson ]->flags.fBlockedByAnotherMerc = FALSE; + ubPerson->flags.fBlockedByAnotherMerc = FALSE; // Restore final dest.... - MercPtrs[ ubPerson ]->pathing.sFinalDestination = sTempDestGridNo; + ubPerson->pathing.sFinalDestination = sTempDestGridNo; // Swap merc positions..... - SwapMercPositions( pSoldier, MercPtrs[ ubPerson ] ); + SwapMercPositions( pSoldier, ubPerson ); // With these two guys swapped, they should try and continue on their way.... // Start them both again along their way... pSoldier->EVENT_GetNewSoldierPath( pSoldier->pathing.sFinalDestination, pSoldier->usUIMovementMode ); - MercPtrs[ ubPerson ]->EVENT_GetNewSoldierPath( MercPtrs[ ubPerson ]->pathing.sFinalDestination, MercPtrs[ ubPerson ]->usUIMovementMode ); + ubPerson->EVENT_GetNewSoldierPath( ubPerson->pathing.sFinalDestination, ubPerson->usUIMovementMode ); } } } @@ -311,14 +308,14 @@ INT8 TileIsClear( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, INT8 b //return( MOVE_TILE_STATIONARY_BLOCKED ); // ATE: OK, put some smartshere... // If we are waiting for more than a few times, change to stationary... - if ( MercPtrs[ ubPerson ]->flags.fDelayedMovement >= 105 ) + if ( ubPerson->flags.fDelayedMovement >= 105 ) { // Set to special 'I want to walk through people' value pSoldier->flags.fDelayedMovement = 150; return( MOVE_TILE_STATIONARY_BLOCKED ); } - if ( MercPtrs[ ubPerson ]->sGridNo == MercPtrs[ ubPerson ]->pathing.sFinalDestination ) + if ( ubPerson->sGridNo == ubPerson->pathing.sFinalDestination ) { return( MOVE_TILE_STATIONARY_BLOCKED ); } @@ -495,11 +492,11 @@ BOOLEAN HandleNextTile( SOLDIERTYPE *pSoldier, INT8 bDirection, INT32 sGridNo, I BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) { // Buddy is waiting to continue his path - INT8 bBlocked, bPathBlocked; + INT8 bBlocked, bPathBlocked; INT32 sCost; - INT32 sNewGridNo, sCheckGridNo; + INT32 sNewGridNo, sCheckGridNo; UINT8 ubDirection, bCauseDirection; - UINT16 ubPerson; + SoldierID ubPerson; UINT8 fFlags = 0; @@ -659,16 +656,16 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) ubPerson = WhoIsThere2( pSoldier->sDelayedMovementCauseGridNo, pSoldier->pathing.bLevel ); // if either on a mission from god, or two AI guys not on stationary... - if ( ubPerson != NOBODY && ( pSoldier->ubQuoteRecord != 0 || ( pSoldier->bTeam != gbPlayerNum && pSoldier->aiData.bOrders != STATIONARY && MercPtrs[ ubPerson ]->bTeam != gbPlayerNum && MercPtrs[ ubPerson ]->aiData.bOrders != STATIONARY ) || (pSoldier->bTeam == gbPlayerNum && gTacticalStatus.fAutoBandageMode && !(MercPtrs[ ubPerson ]->bTeam == CIV_TEAM && MercPtrs[ ubPerson ]->aiData.bOrders == STATIONARY ) ) ) ) + if ( ubPerson != NOBODY && ( pSoldier->ubQuoteRecord != 0 || ( pSoldier->bTeam != gbPlayerNum && pSoldier->aiData.bOrders != STATIONARY && ubPerson->bTeam != gbPlayerNum && ubPerson->aiData.bOrders != STATIONARY ) || (pSoldier->bTeam == gbPlayerNum && gTacticalStatus.fAutoBandageMode && !(ubPerson->bTeam == CIV_TEAM && ubPerson->aiData.bOrders == STATIONARY ) ) ) ) { // Swap now! - //MercPtrs[ ubPerson ]->flags.fBlockedByAnotherMerc = FALSE; + //ubPerson->flags.fBlockedByAnotherMerc = FALSE; // Restore final dest.... - //MercPtrs[ ubPerson ]->pathing.sFinalDestination = sTempDestGridNo; + //ubPerson->pathing.sFinalDestination = sTempDestGridNo; // Swap merc positions..... - SwapMercPositions( pSoldier, MercPtrs[ ubPerson ] ); + SwapMercPositions( pSoldier, ubPerson ); // With these two guys swapped, we should try to continue on our way.... pSoldier->flags.fDelayedMovement = FALSE; @@ -693,7 +690,7 @@ BOOLEAN HandleNextTileWaiting( SOLDIERTYPE *pSoldier ) pSoldier->pathing.bPathStored = TRUE; pSoldier->EVENT_GetNewSoldierPath( pSoldier->sAbsoluteFinalDestination, pSoldier->usUIMovementMode ); - //EVENT_GetNewSoldierPath( MercPtrs[ ubPerson ], MercPtrs[ ubPerson ]->pathing.sFinalDestination, MercPtrs[ ubPerson ]->usUIMovementMode ); + //EVENT_GetNewSoldierPath( ubPerson, ubPerson->pathing.sFinalDestination, ubPerson->usUIMovementMode ); } } diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index fe88875d..5b96f8a2 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -995,16 +995,13 @@ void RebuildCurrentSquad( void ) void ExamineCurrentSquadLights( void ) { - // rebuilds current squad to reset faces in tactical - UINT16 ubLoop; - // OK, we should add lights for any guy currently bInSector who is not bad OKLIFE... - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++) + SoldierID usID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; usID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++usID) { - if ( MercPtrs[ ubLoop ]->bInSector && MercPtrs[ ubLoop ]->stats.bLife >= OKLIFE ) + if ( usID->bInSector && usID->stats.bLife >= OKLIFE ) { - MercPtrs[ ubLoop ]->PositionSoldierLight( ); + usID->PositionSoldierLight( ); } } diff --git a/Tactical/Strategic Exit GUI.cpp b/Tactical/Strategic Exit GUI.cpp index c8b87e8d..eb8192fc 100644 --- a/Tactical/Strategic Exit GUI.cpp +++ b/Tactical/Strategic Exit GUI.cpp @@ -119,7 +119,6 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// { UINT32 uiTraverseTimeInMinutes; SOLDIERTYPE *pSoldier; - INT32 i; SGPRect aRect; UINT16 usTextBoxWidth, usTextBoxHeight; INT32 usMapPos = 0; @@ -189,10 +188,10 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// if ( gTacticalStatus.uiFlags & INCOMBAT ) { - INT32 i, cnt = 0; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + INT32 cnt = 0; + for( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id ) { - if( OK_INSECTOR_MERC( MercPtrs[ i ] ) ) + if( OK_INSECTOR_MERC( id ) ) cnt++; } if( cnt != 1 ) @@ -220,13 +219,14 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// gExitDialog.ubNumPeopleOnSquad = NumberOfPlayerControllableMercsInSquad( gusSelectedSoldier->bAssignment ); //Determine - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id ) { - pSoldier = MercPtrs[ i ]; - if( i == gusSelectedSoldier ) + if( id == gusSelectedSoldier ) { continue; } + + pSoldier = id; if( !pSoldier->flags.fBetweenSectors && pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && pSoldier->stats.bLife >= OKLIFE && @@ -262,21 +262,21 @@ BOOLEAN InternalInitSectorExitMenu( UINT8 ubDirection, INT32 sAdditionalData )// //Assuming that the matching squad assignment is in the same sector. UINT16 ubNumMercs = 1; //selected soldier is a merc UINT16 ubNumEPCs = 0; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id ) { - if( i == gusSelectedSoldier ) + if( id == gusSelectedSoldier ) { continue; } - if( MercPtrs[ i ]->bAssignment == gusSelectedSoldier->bAssignment ) + if( id->bAssignment == gusSelectedSoldier->bAssignment ) { - if( AM_AN_EPC( MercPtrs[ i ] ) ) + if( AM_AN_EPC( id ) ) { ubNumEPCs++; //record the slot of the epc. If there are more than one EPCs, then //it doesn't matter. This is used in building the text message explaining //why the selected merc can't leave. This is how we extract the EPC's name. - gExitDialog.bSingleMoveWillIsolateEPC = (INT16)i; + gExitDialog.bSingleMoveWillIsolateEPC = id; } else { //We have more than one merc, so we will allow the selected merc to leave alone if diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index fc4562cb..852032d0 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -2556,11 +2556,13 @@ BOOLEAN SetSectorFlag( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, UINT32 uiFlagToSet for ( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !(MercPtrs[ i ]->flags.uiStatusFlags & SOLDIER_VEHICLE) && MercPtrs[ i ]->ubProfile != NO_PROFILE && - MercPtrs[ i ]->sSectorX == sMapX && MercPtrs[ i ]->sSectorY == sMapY && MercPtrs[ i ]->bSectorZ == bMapZ && !MercPtrs[ i ]->flags.fBetweenSectors && - MercPtrs[ i ]->bAssignment != IN_TRANSIT && MercPtrs[ i ]->bAssignment != ASSIGNMENT_DEAD ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + + if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && pSoldier->ubProfile != NO_PROFILE && + pSoldier->sSectorX == sMapX && pSoldier->sSectorY == sMapY && pSoldier->bSectorZ == bMapZ && !pSoldier->flags.fBetweenSectors && + pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD ) { - gMercProfiles[ MercPtrs[ i ]->ubProfile ].records.usSectorsDiscovered++; + gMercProfiles[ pSoldier->ubProfile ].records.usSectorsDiscovered++; } } } diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 0b8c58e1..d67d782d 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -506,7 +506,7 @@ void BeginTeamTurn( UINT8 ubTeam ) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"BeginTeamTurn"); INT32 cnt; - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE *pSoldier; //rain @@ -657,7 +657,7 @@ void BeginTeamTurn( UINT8 ubTeam ) { AddTopMessage( COMPUTER_TURN_MESSAGE, TeamTurnString[ ubTeam ] ); } - StartNPCAI( MercPtrs[ ubID ] ); + StartNPCAI( ubID ); /*if(is_server && !net_turn) send_EndTurn(ubTeam); if(net_turn == true) net_turn = false;*/ if(is_server) send_EndTurn(ubTeam); @@ -983,22 +983,23 @@ void StartInterrupt( void ) // report any close call quotes for us here for ( iCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; iCounter <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; iCounter++ ) { - if ( OK_INSECTOR_MERC( MercPtrs[ iCounter ] ) ) + SOLDIERTYPE *pSoldier = MercPtrs[iCounter]; + + if ( OK_INSECTOR_MERC( pSoldier ) ) { - if ( MercPtrs[ iCounter ]->flags.fCloseCall ) + if ( pSoldier->flags.fCloseCall ) { - if ( MercPtrs[ iCounter ]->bNumHitsThisTurn == 0 && !(MercPtrs[ iCounter ]->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) + if ( pSoldier->bNumHitsThisTurn == 0 && !(pSoldier->usQuoteSaidExtFlags & SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL) && Random( 3 ) == 0 ) { // say close call quote! - TacticalCharacterDialogue( MercPtrs[ iCounter ], QUOTE_CLOSE_CALL ); - MercPtrs[ iCounter ]->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; + TacticalCharacterDialogue( pSoldier, QUOTE_CLOSE_CALL ); + pSoldier->usQuoteSaidExtFlags |= SOLDIER_QUOTE_SAID_EXT_CLOSE_CALL; } - MercPtrs[ iCounter ]->flags.fCloseCall = FALSE; + pSoldier->flags.fCloseCall = FALSE; } } } } - } else { diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 4572c033..84c4c2ce 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -4890,12 +4890,12 @@ BOOLEAN HandleCheckForExitArrowsInput( BOOLEAN fAdjustConfirm ) if( gMercProfiles[ gusSelectedSoldier->ubProfile ].bSex == MALE ) { //male singular swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_MALE_SINGULAR ], gusSelectedSoldier->GetName(), - MercPtrs[ gbPotentiallyAbandonedEPCSlotID ]->GetName() ); + gbPotentiallyAbandonedEPCSlotID->GetName() ); } else { //female singular swprintf( str, pExitingSectorHelpText[ EXIT_GUI_MERC_CANT_ISOLATE_EPC_HELPTEXT_FEMALE_SINGULAR ], gusSelectedSoldier->GetName(), - MercPtrs[ gbPotentiallyAbandonedEPCSlotID ]->GetName() ); + gbPotentiallyAbandonedEPCSlotID->GetName() ); } } else diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 0b05cb5a..3a880361 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -3151,7 +3151,7 @@ void UpdatePublic(UINT8 ubTeam, SoldierID ubID, INT8 bNewOpplist, INT32 sGridNo, // if soldier isn't aware of guynum, give him another chance to see if (pSoldier->aiData.bOppList[ubID] == NOT_HEARD_OR_SEEN) { - if (ManLooksForMan(pSoldier,MercPtrs[ubID],UPDATEPUBLIC)) + if ( ManLooksForMan( pSoldier, ubID, UPDATEPUBLIC ) ) // then he actually saw guynum because of our new public knowledge ubMadeDifference = TRUE; @@ -7624,16 +7624,17 @@ INT8 GetHighestWatchedLocPoints( UINT16 ubID ) } -void CommunicateWatchedLoc( UINT16 ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoints ) +void CommunicateWatchedLoc( SoldierID ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoints ) { UINT16 ubLoop; INT8 bTeam, bLoopPoint, bPoint; - bTeam = MercPtrs[ ubID ]->bTeam; + bTeam = ubID->bTeam; for ( ubLoop = gTacticalStatus.Team[ bTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ bTeam ].bLastID; ubLoop++ ) { - if ( ubLoop == ubID || MercPtrs[ ubLoop ]->bActive == FALSE || MercPtrs[ ubLoop ]->bInSector == FALSE || MercPtrs[ ubLoop ]->stats.bLife < OKLIFE ) + SOLDIERTYPE *pSoldier = MercPtrs[ubLoop]; + if ( ubLoop == ubID || pSoldier->bActive == FALSE || pSoldier->bInSector == FALSE || pSoldier->stats.bLife < OKLIFE ) { continue; } From d96040351445995a133a77c93e95bc949fb6019b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:56:57 +0200 Subject: [PATCH 186/571] Use SoldierID --- TacticalAI/AIInternals.h | 10 +++++----- TacticalAI/Attacks.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/TacticalAI/AIInternals.h b/TacticalAI/AIInternals.h index b3293287..2e049958 100644 --- a/TacticalAI/AIInternals.h +++ b/TacticalAI/AIInternals.h @@ -154,14 +154,14 @@ public: class UnderFire { private: - BOOLEAN fEnable; - UINT16 usUnderFireCnt; - UINT16 usUnderFireID[MAXUNDERFIRE]; - UINT8 ubUnderFireCTH[MAXUNDERFIRE]; + BOOLEAN fEnable; + UINT16 usUnderFireCnt; + SoldierID usUnderFireID[MAXUNDERFIRE]; + UINT8 ubUnderFireCTH[MAXUNDERFIRE]; public: UnderFire(void){ Clear(); fEnable = FALSE; } void Clear(void); - void Add(UINT16 usID, UINT8 ubCTH); + void Add(SoldierID usID, UINT8 ubCTH); void Enable(void){ fEnable=TRUE; } void Disable(void){ fEnable=FALSE; } UINT16 GetUnderFireCnt(void){ return(usUnderFireCnt); } diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 703cc950..481c1f0a 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -3417,11 +3417,11 @@ UnderFire gUnderFire; void UnderFire::Clear(void) { usUnderFireCnt = 0; - memset(usUnderFireID, 0, sizeof(usUnderFireID)); + memset(usUnderFireID, TOTAL_SOLDIERS, sizeof(usUnderFireID)); memset(ubUnderFireCTH, 0, sizeof(ubUnderFireCTH)); } -void UnderFire::Add(UINT16 usID, UINT8 ubCTH) +void UnderFire::Add(SoldierID usID, UINT8 ubCTH) { if (!fEnable) return; @@ -3448,7 +3448,7 @@ UINT16 UnderFire::Count(INT8 bTeam) UINT16 cnt = 0; for (UINT16 i = 0; i < usUnderFireCnt; i++) { - if (MercPtrs[usUnderFireID[i]]->bTeam == bTeam) + if (usUnderFireID[i]->bTeam == bTeam) ++cnt; } return(cnt); @@ -3459,7 +3459,7 @@ UINT8 UnderFire::Chance(INT8 bTeam, INT8 bSide, BOOLEAN fCheckNeutral) UINT8 cth = 0; for (UINT16 i = 0; i < usUnderFireCnt; i++) { - if ((MercPtrs[usUnderFireID[i]]->bTeam == bTeam || MercPtrs[usUnderFireID[i]]->bSide == bSide || fCheckNeutral && MercPtrs[usUnderFireID[i]]->aiData.bNeutral) && + if ((usUnderFireID[i]->bTeam == bTeam || usUnderFireID[i]->bSide == bSide || fCheckNeutral && usUnderFireID[i]->aiData.bNeutral) && ubUnderFireCTH[i] > cth) { cth = ubUnderFireCTH[i]; From 24656f28107fb8d7a2453503de3a895046da1afa Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 15:20:18 +0200 Subject: [PATCH 187/571] Use SoldierID --- Strategic/ASD.cpp | 4 +- Tactical/Points.cpp | 8 +- Tactical/Real Time Input.cpp | 16 ++-- Tactical/Rotting Corpses.cpp | 2 +- Tactical/ShopKeeper Interface.cpp | 2 +- Tactical/Soldier Ani.cpp | 16 ++-- Tactical/TeamTurns.cpp | 4 +- Tactical/TeamTurns.h | 2 +- Tactical/Turn Based Input.cpp | 22 ++--- TacticalAI/AIUtils.cpp | 14 ++-- TacticalAI/DecideAction.cpp | 133 ++++++++++++++---------------- TacticalAI/ai.h | 8 +- 12 files changed, 113 insertions(+), 118 deletions(-) diff --git a/Strategic/ASD.cpp b/Strategic/ASD.cpp index 443c4d89..bd41dabc 100644 --- a/Strategic/ASD.cpp +++ b/Strategic/ASD.cpp @@ -1142,9 +1142,9 @@ void EnemyHeliSAMCheck( INT16 id ) if ( ubBestSAMOperatorID != NOBODY ) { if ( fHit ) - StatChange( MercPtrs[ubBestSAMOperatorID], EXPERAMT, fDestroyed ? 30 : 10, TRUE ); + StatChange( ubBestSAMOperatorID, EXPERAMT, fDestroyed ? 30 : 10, TRUE ); - StatChange( MercPtrs[ubBestSAMOperatorID], MECHANAMT, 5, TRUE ); + StatChange( ubBestSAMOperatorID, MECHANAMT, 5, TRUE ); } } } diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 2ca80a77..7a63a973 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -2018,7 +2018,7 @@ void GetAPChargeForShootOrStabWRTGunRaises( SOLDIERTYPE *pSoldier, INT32 sGridNo // Given a gridno here, check if we are on a guy - if so - get his gridno if ( FindSoldier( sGridNo, &usTargID, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { - sGridNo = MercPtrs[ usTargID ]->sGridNo; + sGridNo = usTargID->sGridNo; } ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier ); @@ -2230,7 +2230,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime, // Given a gridno here, check if we are on a guy - if so - get his gridno if ( FindSoldier( sGridNo, &usTargID, &uiMercFlags, FIND_SOLDIER_GRIDNO ) ) { - sGridNo = MercPtrs[ usTargID ]->sGridNo; + sGridNo = usTargID->sGridNo; } //usRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, sGridNo ); } @@ -2473,12 +2473,12 @@ INT16 MinAPsToPunch(SOLDIERTYPE *pSoldier, INT32 sGridNo) // sevenfm: check enemy only if we have correct gridNo if( !TileIsOutOfBounds(sGridNo) ) { - UINT16 usTargID = WhoIsThere2(sGridNo, pSoldier->bTargetLevel); + SoldierID usTargID = WhoIsThere2(sGridNo, pSoldier->bTargetLevel); // Given a gridno here, check if we are on a guy - if so - get his gridno if(usTargID != NOBODY) { // Check if target is prone, if so, calc cost... - if(gAnimControl[MercPtrs[usTargID]->usAnimState].ubEndHeight == ANIM_PRONE) + if(gAnimControl[usTargID->usAnimState].ubEndHeight == ANIM_PRONE) bAPCost += GetAPsToChangeStance(pSoldier, ANIM_CROUCH); else bAPCost += GetAPsToChangeStance(pSoldier, ANIM_STAND); diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index 10928e46..02141ace 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -190,7 +190,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) static BOOLEAN fValidDoubleClickPossible = FALSE; static BOOLEAN fCanCheckForSpeechAdvance = FALSE; static INT32 sMoveClickGridNo = 0; - UINT16 usSubjectSoldier = gusSelectedSoldier; + SoldierID usSubjectSoldier = gusSelectedSoldier; // LEFT MOUSE BUTTON if ( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA ) @@ -208,7 +208,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) } if ( gusSelectedSoldier->flags.uiStatusFlags & SOLDIER_DRIVER ) { - pVehicle = GetSoldierStructureForVehicle( MercPtrs[ usSubjectSoldier ]->iVehicleId ); + pVehicle = GetSoldierStructureForVehicle( usSubjectSoldier->iVehicleId ); usSubjectSoldier = pVehicle->ubID; } } @@ -313,7 +313,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( usSubjectSoldier != NOBODY ) { - if ( ( fResult = UIOKMoveDestination( MercPtrs[ usSubjectSoldier ], usMapPos ) ) == 1 ) + if ( ( fResult = UIOKMoveDestination( usSubjectSoldier, usMapPos ) ) == 1 ) { if ( gsCurrentActionPoints != 0 ) { @@ -365,7 +365,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if( FindSoldierFromMouse( &usSoldierIndex, &uiMercFlags ) ) { // Select guy - if ( (uiMercFlags & SELECTED_MERC) && !( uiMercFlags & UNCONSCIOUS_MERC ) && !( MercPtrs[ usSoldierIndex ]->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) + if ( (uiMercFlags & SELECTED_MERC) && !( uiMercFlags & UNCONSCIOUS_MERC ) && !( usSoldierIndex->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { *puiNewEvent = M_CHANGE_TO_ADJPOS_MODE; } @@ -451,7 +451,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) //if ( gAnimControl[ gusSelectedSoldier->usAnimState ].uiFlags & ANIM_STATIONARY ) //if ( gusSelectedSoldier->usAnimState == WALKING ) { - MercPtrs[ usSubjectSoldier ]->flags.fUIMovementFast = TRUE; + usSubjectSoldier->flags.fUIMovementFast = TRUE; *puiNewEvent = C_MOVE_MERC; } } @@ -595,13 +595,13 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( usSubjectSoldier != NOBODY ) { - if ( MercPtrs[ usSubjectSoldier ]->usAnimState != RUNNING ) + if ( usSubjectSoldier->usAnimState != RUNNING ) { *puiNewEvent = C_MOVE_MERC; } else { - MercPtrs[ usSubjectSoldier ]->flags.fUIMovementFast = 2; + usSubjectSoldier->flags.fUIMovementFast = 2; *puiNewEvent = C_MOVE_MERC; } } @@ -792,7 +792,7 @@ void QueryRTLeftButton( UINT32 *puiNewEvent ) if ( usSubjectSoldier != NOBODY ) { - if ( ( fResult = UIOKMoveDestination( MercPtrs[ usSubjectSoldier ], usMapPos ) ) == 1 ) + if ( ( fResult = UIOKMoveDestination( usSubjectSoldier, usMapPos ) ) == 1 ) { if ( gfUIAllMoveOn ) { diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index b1540460..7749051f 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -2924,7 +2924,7 @@ void CreateZombiefromCorpse( ROTTING_CORPSE * pCorpse, UINT16 usAnimState ) /* certain values have to be set afterwards - the alternative would be to edit each and every function that gets called from TacticalCreateSoldier() subsequently and * make an exception for zombies every time... */ - SOLDIERTYPE* pNewSoldier = MercPtrs[ iNewIndex ]; + SOLDIERTYPE* pNewSoldier = iNewIndex; pNewSoldier->bActionPoints = 60; pNewSoldier->bInitialActionPoints = 60; diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 67805e08..1986893f 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -6625,7 +6625,7 @@ BOOLEAN CanMercInteractWithSelectedShopkeeper( SOLDIERTYPE *pSoldier ) Assert( gbSelectedArmsDealerID != -1 ); if ( gusIDOfCivTrader != NOBODY ) - pShopkeeper = MercPtrs[gusIDOfCivTrader]; + pShopkeeper = gusIDOfCivTrader; else pShopkeeper = FindSoldierByProfileID( armsDealerInfo[gbSelectedArmsDealerID].ubShopKeeperID, FALSE ); diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index b06980a4..2ef15f57 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -3299,17 +3299,17 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // REFUELING A VEHICLE // THE GAS_CAN IS IN THE MERCS MAIN HAND AT THIS TIME { - UINT16 ubPerson; - SOLDIERTYPE *pVehicle; - // Get pointer to vehicle... - ubPerson = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); - pVehicle = MercPtrs[ ubPerson ]; + SoldierID ubPerson = WhoIsThere2( pSoldier->aiData.sPendingActionData2, pSoldier->pathing.bLevel ); + if ( ubPerson != NOBODY ) + { + SOLDIERTYPE *pVehicle = ubPerson; - // this is a ubID for soldiertype.... - AddFuelToVehicle( pSoldier, pVehicle ); + // this is a ubID for soldiertype.... + AddFuelToVehicle( pSoldier, pVehicle ); - fInterfacePanelDirty = DIRTYLEVEL2; + fInterfacePanelDirty = DIRTYLEVEL2; + } } break; diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index d67d782d..964bbdf4 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -1496,7 +1496,7 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) } -BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, INT8 bOldOppList) +BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, SoldierID ubOpponentID, INT8 bOldOppList) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StandardInterruptConditionsMet"); // UINT8 ubAniType; @@ -1540,7 +1540,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponen return(FALSE); } - pOpponent = MercPtrs[ ubOpponentID ]; + pOpponent = ubOpponentID; } else // no opponent, so controller of 'ptr' makes the call instead { diff --git a/Tactical/TeamTurns.h b/Tactical/TeamTurns.h index 828e445b..d592ed02 100644 --- a/Tactical/TeamTurns.h +++ b/Tactical/TeamTurns.h @@ -10,7 +10,7 @@ extern BOOLEAN gfHiddenTurnbased; #define INTERRUPT_QUEUED (gubOutOfTurnPersons > 0) -extern BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT16 ubOpponentID, INT8 bOldOppList); +extern BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, SoldierID ubOpponentID, INT8 bOldOppList); extern INT8 CalcInterruptDuelPts( SOLDIERTYPE * pSoldier, SoldierID ubOpponentID, BOOLEAN fUseWatchSpots ); extern void EndAITurn( void ); extern void DisplayHiddenInterrupt( SOLDIERTYPE * pSoldier ); diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 84c4c2ce..f4c6c575 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -7233,12 +7233,12 @@ void SwapMercPortraits ( SOLDIERTYPE *pSoldier, INT8 bDirection ) if ( gpCurrentTalkingFace != NULL ) return; - UINT16 ubSourceMerc = gusSelectedSoldier; - UINT16 ubTargetMerc; + SoldierID ubSourceMerc = gusSelectedSoldier; + SoldierID ubTargetMerc; INT32 iSourceFace; INT32 iTargetFace; UINT8 ubGroupID = pSoldier->ubGroupID; - INT8 bOldPosition = GetTeamSlotFromPlayerID ( MercPtrs[ ubSourceMerc ]->ubID ); + INT8 bOldPosition = GetTeamSlotFromPlayerID ( ubSourceMerc ); INT8 bNewPosition = bOldPosition + bDirection; SOLDIERTYPE TempMenptr = Menptr[ ubSourceMerc ]; @@ -7266,15 +7266,15 @@ void SwapMercPortraits ( SOLDIERTYPE *pSoldier, INT8 bDirection ) ubTargetMerc = gTeamPanel[ bNewPosition ].ubID; // Hey, you're dead. I don't want to swap with you. - if ( MercPtrs[ubTargetMerc]->stats.bLife <= 0 ) + if ( ubTargetMerc->stats.bLife <= 0 ) { RebuildCurrentSquad( ); return; } // store face indexes - iSourceFace = MercPtrs[ ubSourceMerc ]->iFaceIndex; - iTargetFace = MercPtrs[ ubTargetMerc ]->iFaceIndex; + iSourceFace = ubSourceMerc->iFaceIndex; + iTargetFace = ubTargetMerc->iFaceIndex; FACETYPE TempFace = gFacesData[ iSourceFace ]; // swap the data @@ -7299,11 +7299,11 @@ void SwapMercPortraits ( SOLDIERTYPE *pSoldier, INT8 bDirection ) Menptr[ ubTargetMerc ].iFaceIndex = iTargetFace; // update group info - RemovePlayerFromGroup( ubGroupID, MercPtrs[ ubSourceMerc ] ); - RemovePlayerFromGroup( ubGroupID, MercPtrs[ ubTargetMerc ] ); - AddPlayerToGroup( ubGroupID, MercPtrs[ ubSourceMerc ] ); - AddPlayerToGroup( ubGroupID, MercPtrs[ ubTargetMerc ] ); - SortSquadByID( MercPtrs[ ubSourceMerc ]->bAssignment ); + RemovePlayerFromGroup( ubGroupID, ubSourceMerc ); + RemovePlayerFromGroup( ubGroupID, ubTargetMerc ); + AddPlayerToGroup( ubGroupID, ubSourceMerc ); + AddPlayerToGroup( ubGroupID, ubTargetMerc ); + SortSquadByID( ubSourceMerc->bAssignment ); RebuildCurrentSquad( ); // don't forget to renew selection of merc diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 4b4d0357..8e1b8968 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -1378,7 +1378,7 @@ INT32 ClosestReachableDisturbance(SOLDIERTYPE *pSoldier, BOOLEAN * pfChangeLevel } -INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, UINT16 * pubOpponentID) +INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, SoldierID * pubOpponentID) { INT32 *psLastLoc,sGridNo, sClosestOpponent = NOWHERE; UINT32 uiLoop; @@ -3445,9 +3445,9 @@ INT32 CalcStraightThreatValue( SOLDIERTYPE *pEnemy ) } // Flugente: get the id of the closest soldier with a specific flag that we can currently see -UINT16 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight ) +SoldierID GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight ) { - UINT16 id = NOBODY; + SoldierID id = NOBODY; UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; @@ -3498,9 +3498,9 @@ UINT16 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 a } // get the id of the closest soldier (closer than x tiles) of a specific team that is wounded that we can currently see -UINT16 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) +SoldierID GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) { - UINT16 id = NOBODY; + SoldierID id = NOBODY; UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; @@ -3547,9 +3547,9 @@ UINT16 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 a } // get the id of the closest medic (closer than x tiles) of a specific team -UINT16 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) +SoldierID GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) { - UINT16 id = NOBODY; + SoldierID id = NOBODY; UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index 25f1016e..578bfa29 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -933,7 +933,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // Flugente: if we see one of our buddies in handcuffs, its a clear sign of enemy activity! if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM && !gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition ) { - UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); + SoldierID ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); if ( ubPerson != NOBODY ) { @@ -945,7 +945,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // if we are a doctor with medical gear, we might be able to help a wounded ally if ( pSoldier->CanMedicAI() ) { - UINT16 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); + SoldierID ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); // are we ourselves the patient? if ( ubPerson == pSoldier->ubID ) @@ -962,10 +962,10 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } else if ( ubPerson != NOBODY ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) < 2 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) < 2 ) { // see if we are facing this person - UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo); + UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, ubPerson->sGridNo); // if not already facing in that direction, if ( pSoldier->ubDirection != ubDesiredMercDir ) @@ -987,7 +987,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) } else { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -999,13 +999,13 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) // if we are not a medic, but are wounded, seek a medic else if ( pSoldier->iHealableInjury >= gGameExternalOptions.sEnemyMedicsWoundMinAmount ) { - UINT16 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); + SoldierID ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); if ( ubPerson != NOBODY ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) > 1 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) > 1 ) { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -1019,14 +1019,14 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) if ( pSoldier->usSoldierFlagMask & SOLDIER_BODYGUARD ) { // is VIP still alive? - UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 100, pSoldier->bTeam, SOLDIER_VIP, FALSE ); + SoldierID ubPerson = GetClosestFlaggedSoldierID( pSoldier, 100, pSoldier->bTeam, SOLDIER_VIP, FALSE ); if ( ubPerson != NOBODY ) { // we want to stay close to him, but still be able to function properly... stay withing a 7-tile radius - if ( SpacesAway( pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo ) > 7 ) + if ( SpacesAway( pSoldier->sGridNo, ubPerson->sGridNo ) > 7 ) { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards( pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0 ); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards( pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0 ); if ( !TileIsOutOfBounds( pSoldier->aiData.usActionData ) ) { @@ -1655,18 +1655,18 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // Flugente: if we see one of our buddies captured, it is a clear sign of enemy activity! if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM ) { - UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); + SoldierID ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); if ( ubPerson != NOBODY ) { // if we are close, we can release this guy // possible only if not handcuffed (binders can be opened, handcuffs not) - if ( !HasItemFlag( (&(MercPtrs[ubPerson]->inv[HANDPOS]))->usItem, HANDCUFFS ) ) + if ( !HasItemFlag( (&(ubPerson->inv[HANDPOS]))->usItem, HANDCUFFS ) ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) < 2 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) < 2 ) { // see if we are facing this person - UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo); + UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, ubPerson->sGridNo); // if not already facing in that direction, if ( pSoldier->ubDirection != ubDesiredMercDir ) @@ -1680,7 +1680,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } else { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -1699,7 +1699,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // if we are a doctor with medical gear, we might be able to help a wounded ally if ( pSoldier->CanMedicAI() ) { - UINT16 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); + SoldierID ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); // are we ourselves the patient? if ( ubPerson == pSoldier->ubID ) @@ -1716,10 +1716,10 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } else if ( ubPerson != NOBODY ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) < 2 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) < 2 ) { // see if we are facing this person - UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo); + UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, ubPerson->sGridNo); // if not already facing in that direction, if ( pSoldier->ubDirection != ubDesiredMercDir ) @@ -1741,7 +1741,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) } else { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -1753,13 +1753,13 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) // if we are not a medic, but are wounded, seek a medic else if ( pSoldier->iHealableInjury >= gGameExternalOptions.sEnemyMedicsWoundMinAmount ) { - UINT16 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); + SoldierID ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); if ( ubPerson != NOBODY ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) > 1 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) > 1 ) { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -1773,14 +1773,14 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier) if ( pSoldier->usSoldierFlagMask & SOLDIER_BODYGUARD ) { // is VIP still alive? - UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 100, pSoldier->bTeam, SOLDIER_VIP, FALSE ); + SoldierID ubPerson = GetClosestFlaggedSoldierID( pSoldier, 100, pSoldier->bTeam, SOLDIER_VIP, FALSE ); if ( ubPerson != NOBODY ) { // we want to stay close to him, but still be able to function properly... stay withing a 7-tile radius - if ( SpacesAway( pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo ) > 7 ) + if ( SpacesAway( pSoldier->sGridNo, ubPerson->sGridNo ) > 7 ) { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards( pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0 ); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards( pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0 ); if ( !TileIsOutOfBounds( pSoldier->aiData.usActionData ) ) { @@ -2883,10 +2883,10 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) DebugAI(AI_MSG_INFO, pSoldier, String("prepare throw at spot %d level %d aimtime %d", BestThrow.sTarget, BestThrow.bTargetLevel, BestThrow.ubAimTime)); // start retreating for several turns - if (BestThrow.ubOpponent != NOBODY && !MercPtrs[BestThrow.ubOpponent]->IsFlanking()) + if (BestThrow.ubOpponent != NOBODY && !BestThrow.ubOpponent->IsFlanking()) { DebugAI(AI_MSG_INFO, pSoldier, String("start retreat counter for %d", BestThrow.ubOpponent)); - MercPtrs[BestThrow.ubOpponent]->RetreatCounterStart(2); + BestThrow.ubOpponent->RetreatCounterStart(2); } // if necessary, swap the usItem from holster into the hand position @@ -3028,8 +3028,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) // check valid target !TileIsOutOfBounds(BestShot.sTarget) && BestShot.ubOpponent != NOBODY && - MercPtrs[BestShot.ubOpponent] && - Chance(100 - MercPtrs[BestShot.ubOpponent]->ShockLevelPercent() / 2) && + Chance(100 - BestShot.ubOpponent->ShockLevelPercent() / 2) && // check weapon/ammo requirements IsGunAutofireCapable(&pSoldier->inv[BestShot.bWeaponIn]) && GetMagSize(&pSoldier->inv[BestShot.bWeaponIn]) >= gGameExternalOptions.ubAISuppressionMinimumMagSize && @@ -3046,16 +3045,16 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) !fCanBeSeen && NightLight() && CountFriendsFlankSameSpot(pSoldier, sClosestOpponent) && Chance(50) || ARMED_VEHICLE(pSoldier) || // tanks don't need cover ENEMYROBOT(pSoldier) || // robots don't try to be in cover - pSoldier->aiData.bUnderFire && (pSoldier->ubPreviousAttackerID == BestShot.ubOpponent || pSoldier->ubNextToPreviousAttackerID == BestShot.ubOpponent || MercPtrs[BestShot.ubOpponent]->sLastTarget == pSoldier->sGridNo) || // return fire + pSoldier->aiData.bUnderFire && (pSoldier->ubPreviousAttackerID == BestShot.ubOpponent || pSoldier->ubNextToPreviousAttackerID == BestShot.ubOpponent || BestShot.ubOpponent->sLastTarget == pSoldier->sGridNo) || // return fire Chance((BestShot.ubChanceToReallyHit + 100) / 2) || // 50% chance to fire without cover - //SoldierToSoldierLineOfSightTest(pSoldier, MercPtrs[BestShot.ubOpponent], TRUE, CALC_FROM_ALL_DIRS)) && // can see target after turning - LOS_Raised(pSoldier, MercPtrs[BestShot.ubOpponent], CALC_FROM_ALL_DIRS)) && // can see target after turning + //SoldierToSoldierLineOfSightTest(pSoldier, BestShot.ubOpponent, TRUE, CALC_FROM_ALL_DIRS)) && // can see target after turning + LOS_Raised(pSoldier, BestShot.ubOpponent, CALC_FROM_ALL_DIRS)) && // can see target after turning // reduce chance to shoot if target is beyond weapon range (AICheckIsMachinegunner(pSoldier) || ARMED_VEHICLE(pSoldier) || ENEMYROBOT(pSoldier) || AnyCoverAtSpot(pSoldier, pSoldier->sGridNo) || - pSoldier->aiData.bUnderFire && (pSoldier->ubPreviousAttackerID == BestShot.ubOpponent || pSoldier->ubNextToPreviousAttackerID == BestShot.ubOpponent || MercPtrs[BestShot.ubOpponent]->sLastTarget == pSoldier->sGridNo) || // return fire + pSoldier->aiData.bUnderFire && (pSoldier->ubPreviousAttackerID == BestShot.ubOpponent || pSoldier->ubNextToPreviousAttackerID == BestShot.ubOpponent || BestShot.ubOpponent->sLastTarget == pSoldier->sGridNo) || // return fire Chance(100 * (GunRange(&pSoldier->inv[BestShot.bWeaponIn], pSoldier) / CELL_X_SIZE) / PythSpacesAway(pSoldier->sGridNo, BestShot.sTarget))) && // check that we have spare ammo (fExtraClip || pSoldier->inv[BestShot.bWeaponIn][0]->data.gun.ubGunShotsLeft >= gGameExternalOptions.ubAISuppressionMinimumMagSize)) @@ -3149,7 +3148,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) DebugAI(AI_MSG_INFO, pSoldier, String("Change stance before shooting")); // show "suppression fire" message only if opponent cannot be seen after turning - if (!LOS_Raised(pSoldier, MercPtrs[BestShot.ubOpponent], CALC_FROM_ALL_DIRS)) + if (!LOS_Raised(pSoldier, BestShot.ubOpponent, CALC_FROM_ALL_DIRS)) ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_SUPPRESSIONFIRE]); return(AI_ACTION_CHANGE_STANCE); @@ -3159,7 +3158,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) pSoldier->aiData.usActionData = BestShot.sTarget; // show "suppression fire" message only if opponent cannot be seen after turning - if (!LOS_Raised(pSoldier, MercPtrs[BestShot.ubOpponent], CALC_FROM_ALL_DIRS)) + if (!LOS_Raised(pSoldier, BestShot.ubOpponent, CALC_FROM_ALL_DIRS)) ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_SUPPRESSIONFIRE]); return(AI_ACTION_FIRE_GUN); @@ -3281,18 +3280,18 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) // Flugente: if we see one of our buddies captured, it is a clear sign of enemy activity! if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM ) { - UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); + SoldierID ubPerson = GetClosestFlaggedSoldierID( pSoldier, 20, ENEMY_TEAM, SOLDIER_POW, TRUE ); if ( ubPerson != NOBODY ) { // if we are close, we can release this guy // possible only if not handcuffed (binders can be opened, handcuffs not) - if ( !HasItemFlag( (&(MercPtrs[ubPerson]->inv[HANDPOS]))->usItem, HANDCUFFS ) ) + if ( !HasItemFlag( (&(ubPerson->inv[HANDPOS]))->usItem, HANDCUFFS ) ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) < 2 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) < 2 ) { // see if we are facing this person - UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo); + UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, ubPerson->sGridNo); // if not already facing in that direction, if ( pSoldier->ubDirection != ubDesiredMercDir ) @@ -3306,7 +3305,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) } else { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -3320,7 +3319,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) // if we are a doctor with medical gear, we might be able to help a wounded ally if ( pSoldier->CanMedicAI() ) { - UINT16 ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); + SoldierID ubPerson = GetClosestWoundedSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius, pSoldier->bTeam); // are we ourselves the patient? if ( ubPerson == pSoldier->ubID ) @@ -3337,10 +3336,10 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) } else if ( ubPerson != NOBODY ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) < 2 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) < 2 ) { // see if we are facing this person - UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo); + UINT8 ubDesiredMercDir = GetDirectionFromCenterCellXYGridNo(pSoldier->sGridNo, ubPerson->sGridNo); // if not already facing in that direction, if ( pSoldier->ubDirection != ubDesiredMercDir ) @@ -3362,7 +3361,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) } else { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -3374,13 +3373,13 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) // if we are not a medic, but are wounded, seek a medic else if ( pSoldier->iHealableInjury >= gGameExternalOptions.sEnemyMedicsWoundMinAmount ) { - UINT16 ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); + SoldierID ubPerson = GetClosestMedicSoldierID( pSoldier, gGameExternalOptions.sEnemyMedicsSearchRadius / 2, pSoldier->bTeam); if ( ubPerson != NOBODY ) { - if ( PythSpacesAway(pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo) > 1 ) + if ( PythSpacesAway(pSoldier->sGridNo, ubPerson->sGridNo) > 1 ) { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards(pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0); if (!TileIsOutOfBounds(pSoldier->aiData.usActionData)) { @@ -3413,14 +3412,14 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) if ( pSoldier->usSoldierFlagMask & SOLDIER_BODYGUARD ) { // is VIP still alive? - UINT16 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 100, pSoldier->bTeam, SOLDIER_VIP, FALSE ); + SoldierID ubPerson = GetClosestFlaggedSoldierID( pSoldier, 100, pSoldier->bTeam, SOLDIER_VIP, FALSE ); if ( ubPerson != NOBODY ) { // we want to stay close to him, but still be able to function properly... stay withing a 7-tile radius - if ( SpacesAway( pSoldier->sGridNo, MercPtrs[ubPerson]->sGridNo ) > 7 ) + if ( SpacesAway( pSoldier->sGridNo, ubPerson->sGridNo ) > 7 ) { - pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards( pSoldier, MercPtrs[ubPerson]->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0 ); + pSoldier->aiData.usActionData = InternalGoAsFarAsPossibleTowards( pSoldier, ubPerson->sGridNo, 20, AI_ACTION_SEEK_FRIEND, 0 ); if ( !TileIsOutOfBounds( pSoldier->aiData.usActionData ) ) { @@ -5764,10 +5763,9 @@ INT16 ubMinAPCost; (pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) && SpacesAway(pSoldier->sGridNo, BestStab.sTarget) > 2 && BestStab.ubOpponent != NOBODY && - MercPtrs[BestStab.ubOpponent] && - AIDirection(pSoldier->sGridNo, MercPtrs[BestStab.ubOpponent]->sGridNo) != MercPtrs[BestStab.ubOpponent]->ubDirection && - AIDirection(pSoldier->sGridNo, MercPtrs[BestStab.ubOpponent]->sGridNo) != gOneCDirection[MercPtrs[BestStab.ubOpponent]->ubDirection] && - AIDirection(pSoldier->sGridNo, MercPtrs[BestStab.ubOpponent]->sGridNo) != gOneCCDirection[MercPtrs[BestStab.ubOpponent]->ubDirection] && + AIDirection(pSoldier->sGridNo, BestStab.ubOpponent->sGridNo) != BestStab.ubOpponent->ubDirection && + AIDirection(pSoldier->sGridNo, BestStab.ubOpponent->sGridNo) != gOneCDirection[BestStab.ubOpponent->ubDirection] && + AIDirection(pSoldier->sGridNo, BestStab.ubOpponent->sGridNo) != gOneCCDirection[BestStab.ubOpponent->ubDirection] && pSoldier->bInitialActionPoints >= 2 * MinAPsToAttack(pSoldier, pSoldier->sLastTarget, FALSE, 0, 0) + APBPConstants[AP_MOVEMENT_FLAT] + APBPConstants[AP_MODIFIER_WALK] && pSoldier->bActionPoints < BestStab.ubAPCost + MinAPsToAttack(pSoldier, pSoldier->sLastTarget, FALSE, 0, 0)) { @@ -5781,10 +5779,9 @@ INT16 ubMinAPCost; (pSoldier->flags.uiStatusFlags & SOLDIER_BOXER) && SpacesAway(pSoldier->sGridNo, BestStab.sTarget) > 1 && BestStab.ubOpponent != NOBODY && - MercPtrs[BestStab.ubOpponent] && - gAnimControl[MercPtrs[BestStab.ubOpponent]->usAnimState].ubEndHeight == ANIM_STAND && - MercPtrs[BestStab.ubOpponent]->bActionPoints > 0 && - Chance(EffectiveAgility(MercPtrs[BestStab.ubOpponent], FALSE) * (100 + MercPtrs[BestStab.ubOpponent]->bBreath) * EffectiveWisdom(pSoldier) / (100 * 200))) + gAnimControl[BestStab.ubOpponent->usAnimState].ubEndHeight == ANIM_STAND && + BestStab.ubOpponent->bActionPoints > 0 && + Chance(EffectiveAgility(BestStab.ubOpponent, FALSE) * (100 + BestStab.ubOpponent->bBreath) * EffectiveWisdom(pSoldier) / (100 * 200))) { // find closest spot around opponent, avoid front direction UINT8 ubMovementCost; @@ -5804,7 +5801,7 @@ INT16 ubMinAPCost; if (ubMovementCost < TRAVELCOST_BLOCKED && NewOKDestination(pSoldier, sTempGridNo, FALSE, pSoldier->pathing.bLevel) && - AIDirection(BestStab.sTarget, sTempGridNo) != MercPtrs[BestStab.ubOpponent]->ubDirection) + AIDirection(BestStab.sTarget, sTempGridNo) != BestStab.ubOpponent->ubDirection) { sPathCost = PlotPath(pSoldier, sTempGridNo, FALSE, FALSE, FALSE, DetermineMovementMode(pSoldier, AI_ACTION_GET_CLOSER), pSoldier->bStealthMode, pSoldier->bReverse, 0); if (TileIsOutOfBounds(sBestSpot) || sPathCost < sBestPathCost) @@ -5842,7 +5839,7 @@ INT16 ubMinAPCost; // SANDRO - added a chance to try to steal merc's gun from hands else { - if (AIDetermineStealingWeaponAttempt( pSoldier, MercPtrs[BestStab.ubOpponent] ) == TRUE) + if (AIDetermineStealingWeaponAttempt( pSoldier, BestStab.ubOpponent ) == TRUE) { ubBestAttackAction = AI_ACTION_STEAL_MOVE; DebugAI(AI_MSG_INFO, pSoldier, String("best action = move to steal weapon, iAttackValue = %d", BestStab.iAttackValue)); @@ -6832,13 +6829,11 @@ L_NEWAIM: { DebugAI(AI_MSG_TOPIC, pSoldier, String("[Make boxer close if possible]")); - UINT16 ubOpponentID; + SoldierID ubOpponentID; sClosestOpponent = ClosestKnownOpponent(pSoldier, NULL, NULL, &ubOpponentID); DebugAI(AI_MSG_INFO, pSoldier, String("boxer: found closest opponent [%d] at %d", ubOpponentID, sClosestOpponent)); - if (!TileIsOutOfBounds(sClosestOpponent) && - ubOpponentID != NOBODY && - MercPtrs[ubOpponentID]) + if ( !TileIsOutOfBounds(sClosestOpponent) && ubOpponentID != NOBODY ) { if (pSoldier->bActionPoints > 0) { @@ -6875,7 +6870,7 @@ L_NEWAIM: if (!TileIsOutOfBounds(pSoldier->aiData.usActionData) && (pSoldier->bBreath < OKBREATH || pSoldier->bBreath < pSoldier->bBreathMax && - pSoldier->bBreath < MercPtrs[ubOpponentID]->bBreath && + pSoldier->bBreath < ubOpponentID->bBreath && Chance((100 - pSoldier->bBreath) * (100 - pSoldier->bBreath) / (2 * 100 * 100)))) { DebugAI(AI_MSG_INFO, pSoldier, String("boxer: restore breath")); @@ -6899,7 +6894,7 @@ L_NEWAIM: } else if (pSoldier->bBreath < OKBREATH || pSoldier->bBreath < pSoldier->bBreathMax && - (pSoldier->bBreath < MercPtrs[ubOpponentID]->bBreath || !pSoldier->aiData.bLastAttackHit && pSoldier->TakenLargeHit())) + (pSoldier->bBreath < ubOpponentID->bBreath || !pSoldier->aiData.bLastAttackHit && pSoldier->TakenLargeHit())) { // maybe move away from opponent UINT8 ubOpponentDir = AIDirection(pSoldier->sGridNo, sClosestOpponent); @@ -8579,9 +8574,9 @@ INT8 ArmedVehicleDecideActionRed( SOLDIERTYPE *pSoldier) //&& Menptr[BestShot.ubOpponent].pathing.bLevel == 0 && pSoldier->aiData.bOrders != SNIPER && BestShot.ubFriendlyFireChance < 5 && - !MercPtrs[BestShot.ubOpponent]->IsCowering() && + !BestShot.ubOpponent->IsCowering() && !AICheckIsFlanking( pSoldier ) && - LocationToLocationLineOfSightTest( pSoldier->sGridNo, pSoldier->pathing.bLevel, MercPtrs[BestShot.ubOpponent]->sGridNo, MercPtrs[BestShot.ubOpponent]->pathing.bLevel, TRUE, NO_DISTANCE_LIMIT ) && + LocationToLocationLineOfSightTest( pSoldier->sGridNo, pSoldier->pathing.bLevel, BestShot.ubOpponent->sGridNo, BestShot.ubOpponent->pathing.bLevel, TRUE, NO_DISTANCE_LIMIT ) && //Weapon[pSoldier->inv[BestShot.bWeaponIn].usItem].ubWeaponType == GUN_LMG ) && //Weapon[usInHand].ubWeaponClass == MGCLASS (fExtraClip || pSoldier->inv[BestShot.bWeaponIn][0]->data.gun.ubGunShotsLeft > gGameExternalOptions.ubAISuppressionMinimumMagSize) ) { diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index 70a211ec..c3e7f404 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -175,7 +175,7 @@ void CheckForChangingOrders(SOLDIERTYPE *pSoldier ); INT8 ClosestPanicTrigger( SOLDIERTYPE * pSoldier ); -INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, UINT16 * pubOpponentID = NULL); +INT32 ClosestKnownOpponent(SOLDIERTYPE *pSoldier, INT32 * psGridNo, INT8 * pbLevel, SoldierID *pubOpponentID = NULL); INT32 ClosestPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ); INT32 ClosestUnDisguisedPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ); // Flugente: like ClosestPC(...), but does not account for covert or not visible mercs BOOLEAN CanAutoBandage( BOOLEAN fDoFullCheck ); @@ -277,13 +277,13 @@ INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, SoldierID ubOppID, INT3 UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo ); // Flugente: get the id of the closest soldier (coser than x tiles) of a specific team with a specific flag that we can currently see -UINT16 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight = TRUE ); +SoldierID GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight = TRUE ); // get the id of the closest soldier (closer than x tiles) of a specific team that is wounded that we can currently see -UINT16 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); +SoldierID GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); // get the id of the closest medic (closer than x tiles) of a specific team -UINT16 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); +SoldierID GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ); // sevenfm: BOOLEAN NightLight(void); From d244ef4c912aa1a08086a4b0a5d64ac0dc3d5379 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 15:25:48 +0200 Subject: [PATCH 188/571] use SoldierID --- Multiplayer/server.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Multiplayer/server.cpp b/Multiplayer/server.cpp index 7f5b4eba..5ddd60f7 100644 --- a/Multiplayer/server.cpp +++ b/Multiplayer/server.cpp @@ -227,7 +227,7 @@ void sendHIT(RPCParameters *rpcParameters) { EV_S_WEAPONHIT* hit = (EV_S_WEAPONHIT*)rpcParameters->input; - int team = MercPtrs[ hit->ubAttackerID ]->bTeam; + int team = hit->ubAttackerID->bTeam; // AI if (team == 1) @@ -373,10 +373,9 @@ void sendhitSTRUCT(RPCParameters *rpcParameters) { EV_S_STRUCTUREHIT* miss = (EV_S_STRUCTUREHIT*)rpcParameters->input; - SOLDIERTYPE* pAttacker = MercPtrs[ miss->ubAttackerID ]; - if (pAttacker != NULL) + if ( miss->ubAttackerID != NOBODY) { - int team = MercPtrs[ miss->ubAttackerID ]->bTeam; + int team = miss->ubAttackerID->bTeam; // AI if (team == 1) @@ -398,10 +397,9 @@ void sendhitWINDOW(RPCParameters *rpcParameters) EV_S_WINDOWHIT* miss = (EV_S_WINDOWHIT*)rpcParameters->input; - SOLDIERTYPE* pAttacker = MercPtrs[ miss->ubAttackerID ]; - if (pAttacker != NULL) + if ( miss->ubAttackerID != NOBODY) { - int team = MercPtrs[ miss->ubAttackerID ]->bTeam; + int team = miss->ubAttackerID->bTeam; // AI if (team == 1) @@ -422,10 +420,9 @@ void sendMISS(RPCParameters *rpcParameters) { EV_S_MISS* miss = (EV_S_MISS*)rpcParameters->input; - SOLDIERTYPE* pAttacker = MercPtrs[ miss->ubAttackerID ]; - if (pAttacker != NULL) + if ( miss->ubAttackerID != NOBODY) { - int team = MercPtrs[ miss->ubAttackerID ]->bTeam; + int team = miss->ubAttackerID->bTeam; // AI if (team == 1) From 4645a09722b33ff01cd318bb0e41858287606141 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 16:07:36 +0200 Subject: [PATCH 189/571] Use SoldierID --- Tactical/DynamicDialogue.cpp | 10 ++--- Tactical/Soldier Control.cpp | 32 ++++++------- TacticalAI/Movement.cpp | 20 +++++---- TacticalAI/NPC.cpp | 8 ++-- TacticalAI/ai.h | 2 +- TileEngine/SmokeEffects.cpp | 4 +- TileEngine/Tactical Placement GUI.cpp | 65 ++++++++++++++------------- TileEngine/pits.cpp | 4 +- TileEngine/pits.h | 6 ++- 9 files changed, 79 insertions(+), 72 deletions(-) diff --git a/Tactical/DynamicDialogue.cpp b/Tactical/DynamicDialogue.cpp index 2767bed8..9df30c38 100644 --- a/Tactical/DynamicDialogue.cpp +++ b/Tactical/DynamicDialogue.cpp @@ -2001,14 +2001,14 @@ UINT8 GetFittingInterjectorProfile( UINT8 usEvent, UINT8 usProfileVictim, UINT8 if ( usEvent >= OPINIONEVENT_MAX ) return NO_PROFILE; - INT16 idVictim = GetSoldierIDFromMercID( usProfileVictim ); - INT16 idCause = GetSoldierIDFromMercID( usProfileCause ); + SoldierID idVictim = GetSoldierIDFromMercID( usProfileVictim ); + SoldierID idCause = GetSoldierIDFromMercID( usProfileCause ); - if ( idVictim < 0 || idCause < 0 ) + if ( idVictim == NOBODY || idCause == NOBODY ) return NO_PROFILE; - SOLDIERTYPE* pSoldierVictim = MercPtrs[idVictim]; - SOLDIERTYPE* pSoldierCause = MercPtrs[idCause]; + SOLDIERTYPE* pSoldierVictim = idVictim; + SOLDIERTYPE* pSoldierCause = idCause; if ( !pSoldierVictim || !pSoldierCause ) return NO_PROFILE; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 136973d9..bffbc8eb 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -24251,7 +24251,7 @@ BOOLEAN SOLDIERTYPE::CanStartDrag(void) for (UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt) { if (cnt != this->ubID && - MercPtrs[cnt] && + cnt != NOBODY && MercPtrs[cnt]->sGridNo == sNewGridNo && this->CanDragPerson(cnt)) { @@ -24494,31 +24494,32 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe // loop through all soldiers around for ( cnt = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; cnt <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; cnt++ ) { + SOLDIERTYPE *pSquadLeader = MercPtrs[cnt]; // Get active conscious soldier - if ( MercPtrs[cnt] != pSoldier && MercPtrs[cnt]->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 && - MercPtrs[cnt]->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( MercPtrs[cnt], SQUADLEADER_NT ) ) + if ( pSquadLeader != pSoldier && pSquadLeader->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 && + pSquadLeader->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( pSquadLeader, SQUADLEADER_NT ) ) { // check if within distance // if both have extended ear, the distance is bigger and they don't need to sea each other // note that enemy always get the bonus if within distance, regardless of extended ears // Flugente: moved around arguments for speed reason if ( fDontCheckDistance || - (PythSpacesAway( pSoldier->sGridNo, MercPtrs[cnt]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) || + (PythSpacesAway( pSoldier->sGridNo, pSquadLeader->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) || //((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) || //SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) && - ((pSoldier->bTeam == ENEMY_TEAM || (HasExtendedEarOn( pSoldier ) && HasExtendedEarOn( MercPtrs[cnt] ))) && PythSpacesAway( pSoldier->sGridNo, MercPtrs[cnt]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) + ((pSoldier->bTeam == ENEMY_TEAM || (HasExtendedEarOn( pSoldier ) && HasExtendedEarOn( pSquadLeader ))) && PythSpacesAway( pSoldier->sGridNo, pSquadLeader->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) ) { // If checking for higher level SL // also count in already aquired level increses from other SLs if ( fWithHigherLevel ) { - if ( MercPtrs[cnt]->stats.bExpLevel > (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius)) ) - ubNumberSL += min( (max( 0, (MercPtrs[cnt]->stats.bExpLevel - (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius))) )), (NUM_SKILL_TRAITS( MercPtrs[cnt], SQUADLEADER_NT )) ); + if ( pSquadLeader->stats.bExpLevel > (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius)) ) + ubNumberSL += min( (max( 0, (pSquadLeader->stats.bExpLevel - (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius))) )), (NUM_SKILL_TRAITS( pSquadLeader, SQUADLEADER_NT )) ); } else { - ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[cnt], SQUADLEADER_NT ); + ubNumberSL += NUM_SKILL_TRAITS( pSquadLeader, SQUADLEADER_NT ); } if ( ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses ) @@ -24532,29 +24533,30 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe { for ( cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) { + SOLDIERTYPE *pSquadLeader = MercPtrs[cnt]; // Get active conscious soldier - if ( MercPtrs[cnt] != pSoldier && MercPtrs[cnt]->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 && - MercPtrs[cnt]->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( MercPtrs[cnt], SQUADLEADER_NT ) ) + if ( pSquadLeader != pSoldier && pSquadLeader->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 && + pSquadLeader->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( pSquadLeader, SQUADLEADER_NT ) ) { // check if within distance // Flugente: moved around arguments for speed reason if ( fDontCheckDistance || - (PythSpacesAway( pSoldier->sGridNo, MercPtrs[cnt]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) || + (PythSpacesAway( pSoldier->sGridNo, pSquadLeader->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) || //((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) || //SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) && - ((HasExtendedEarOn( MercPtrs[cnt] ) && PythSpacesAway( pSoldier->sGridNo, MercPtrs[cnt]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar)) + ((HasExtendedEarOn( pSquadLeader ) && PythSpacesAway( pSoldier->sGridNo, pSquadLeader->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar)) ) { // If checking for higher level SL // also count in already aquired level increses from other SLs if ( fWithHigherLevel ) { - if ( MercPtrs[cnt]->stats.bExpLevel > (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius)) ) - ubNumberSL += min( (max( 0, (MercPtrs[cnt]->stats.bExpLevel - (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius))) )), (NUM_SKILL_TRAITS( MercPtrs[cnt], SQUADLEADER_NT )) ); + if ( pSquadLeader->stats.bExpLevel > (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius)) ) + ubNumberSL += min( (max( 0, (pSquadLeader->stats.bExpLevel - (pSoldier->stats.bExpLevel + (ubNumberSL*gSkillTraitValues.ubSLEffectiveLevelInRadius))) )), (NUM_SKILL_TRAITS( pSquadLeader, SQUADLEADER_NT )) ); } else { - ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[cnt], SQUADLEADER_NT ); + ubNumberSL += NUM_SKILL_TRAITS( pSquadLeader, SQUADLEADER_NT ); } if ( ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses ) diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index ec5daaaf..08a974a8 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -881,12 +881,14 @@ void HaltMoveForSoldierOutOfPoints(SOLDIERTYPE *pSoldier) } } -void SetCivilianDestination(UINT8 ubWho, INT32 sGridNo) +void SetCivilianDestination(SoldierID ubWho, INT32 sGridNo) { - SOLDIERTYPE *pSoldier; + if ( ubWho == NOBODY ) + { + return; + } - - pSoldier = MercPtrs[ubWho]; + SOLDIERTYPE *pSoldier = ubWho; /* // if we control the civilian @@ -896,12 +898,12 @@ void SetCivilianDestination(UINT8 ubWho, INT32 sGridNo) // if the destination is different from what he has now if (pSoldier->aiData.usActionData != sGridNo) { - // store his new destination - pSoldier->aiData.usActionData = sGridNo; + // store his new destination + pSoldier->aiData.usActionData = sGridNo; - // and cancel any movement in progress that he was still engaged in - pSoldier->aiData.bAction = AI_ACTION_NONE; - pSoldier->aiData.bActionInProgress = FALSE; + // and cancel any movement in progress that he was still engaged in + pSoldier->aiData.bAction = AI_ACTION_NONE; + pSoldier->aiData.bActionInProgress = FALSE; } // only set the underEscort flag once you give him a destination diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index fcd67cb1..727d0e83 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -904,12 +904,12 @@ UINT8 CalcDesireToTalk( UINT8 ubNPC, UINT8 ubMerc, INT8 bApproach ) // SANDRO - bonus for communication with people for assertive people if ( gGameOptions.fNewTraitSystem && bApproach != APPROACH_THREATEN) { - INT16 id = GetSoldierIDFromMercID( ubMerc ); - if ( id > -1 ) + SoldierID id = GetSoldierIDFromMercID( ubMerc ); + if ( id != NOBODY ) { - if ( DoesMercHavePersonality( MercPtrs[id], CHAR_TRAIT_ASSERTIVE ) ) + if ( DoesMercHavePersonality( id, CHAR_TRAIT_ASSERTIVE ) ) iPersonalVal += 50; - else if ( DoesMercHavePersonality( MercPtrs[id], CHAR_TRAIT_MALICIOUS ) ) + else if ( DoesMercHavePersonality( id, CHAR_TRAIT_MALICIOUS ) ) iPersonalVal -= 50; } } diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index c3e7f404..72af7137 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -252,7 +252,7 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier); INT16 RoamingRange(SOLDIERTYPE *pSoldier, INT32 *pFromGridNo); -void SetCivilianDestination(UINT8 ubWho, INT32 sGridNo); +void SetCivilianDestination(SoldierID ubWho, INT32 sGridNo); void SetNewSituation( SOLDIERTYPE * pSoldier ); UINT8 SoldierDifficultyLevel( SOLDIERTYPE * pSoldier ); diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 4d8bb9c2..28170ec6 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -192,7 +192,7 @@ UINT16 FromSmokeTypeToWorldFlags( INT8 bType ) -INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, BOOL fFromRemoteClient ) +INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwner, BOOL fFromRemoteClient ) { SMOKEEFFECT *pSmoke; INT32 iSmokeIndex; @@ -222,7 +222,7 @@ INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT16 ubOwner, } #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"NewSmokeEffect ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i )\n",sGridNo, usItem , ubOwner , bLevel , iSmokeIndex ); + sprintf(tmpMPDbgString,"NewSmokeEffect ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i )\n",sGridNo, usItem , ubOwner.i , bLevel , iSmokeIndex ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif diff --git a/TileEngine/Tactical Placement GUI.cpp b/TileEngine/Tactical Placement GUI.cpp index 7b6c1daa..3c4fe0bd 100644 --- a/TileEngine/Tactical Placement GUI.cpp +++ b/TileEngine/Tactical Placement GUI.cpp @@ -327,15 +327,15 @@ void InitTacticalPlacementGUI() giPlacements = 0; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - - if( MercPtrs[ i ]->bActive && !MercPtrs[ i ]->flags.fBetweenSectors && - CurrentBattleSectorIs( MercPtrs[i]->sSectorX, MercPtrs[i]->sSectorY, MercPtrs[i]->bSectorZ ) && - !( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) ) && // ATE Ignore vehicles - MercPtrs[ i ]->bAssignment != ASSIGNMENT_POW && - MercPtrs[ i ]->bAssignment != ASSIGNMENT_MINIEVENT && - MercPtrs[ i ]->bAssignment != ASSIGNMENT_REBELCOMMAND && - !( MercPtrs[i]->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION ) && - MercPtrs[ i ]->bAssignment != IN_TRANSIT ) + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && !pSoldier->flags.fBetweenSectors && + CurrentBattleSectorIs( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && + !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) ) && // ATE Ignore vehicles + pSoldier->bAssignment != ASSIGNMENT_POW && + pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && + pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND && + !( pSoldier->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION ) && + pSoldier->bAssignment != IN_TRANSIT ) { ++giPlacements; } @@ -347,58 +347,59 @@ void InitTacticalPlacementGUI() giPlacements = 0; for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->stats.bLife && !MercPtrs[ i ]->flags.fBetweenSectors && - CurrentBattleSectorIs( MercPtrs[i]->sSectorX, MercPtrs[i]->sSectorY, MercPtrs[i]->bSectorZ ) && - MercPtrs[ i ]->bAssignment != ASSIGNMENT_POW && - MercPtrs[ i ]->bAssignment != ASSIGNMENT_MINIEVENT && - MercPtrs[ i ]->bAssignment != ASSIGNMENT_REBELCOMMAND && - !( MercPtrs[i]->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION ) && - MercPtrs[ i ]->bAssignment != IN_TRANSIT && - !( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) ) ) // ATE Ignore vehicles + SOLDIERTYPE *pSoldier = MercPtrs[i]; + if( pSoldier->bActive && pSoldier->stats.bLife && !pSoldier->flags.fBetweenSectors && + CurrentBattleSectorIs( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && + pSoldier->bAssignment != ASSIGNMENT_POW && + pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && + pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND && + !( pSoldier->usSoldierFlagMask2 & SOLDIER_CONCEALINSERTION ) && + pSoldier->bAssignment != IN_TRANSIT && + !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) ) ) // ATE Ignore vehicles { // Flugente: if options allow it and we entered this sector - in combat - via helicopter, then allow us free selection of our entry point, and drop us from the helicopter - if ( MercPtrs[ i ]->bTeam == gbPlayerNum && (gGameExternalOptions.ubSkyriderHotLZ == 1 || gGameExternalOptions.ubSkyriderHotLZ == 3) && MercPtrs[ i ]->usSoldierFlagMask & SOLDIER_AIRDROP ) + if ( pSoldier->bTeam == gbPlayerNum && (gGameExternalOptions.ubSkyriderHotLZ == 1 || gGameExternalOptions.ubSkyriderHotLZ == 3) && pSoldier->usSoldierFlagMask & SOLDIER_AIRDROP ) { - AddMercToHeli( MercPtrs[ i ]->ubID ); + AddMercToHeli( pSoldier->ubID ); DisableButton(iTPButtons[SPREAD_BUTTON]); gMercPlacement[ giPlacements ].ubStrategicInsertionCode = INSERTION_CODE_CHOPPER; - MercPtrs[ i ]->ubStrategicInsertionCode = INSERTION_CODE_CHOPPER; + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CHOPPER; gfCenter = TRUE; } if ( GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE ) { gMercPlacement[giPlacements].ubStrategicInsertionCode = INSERTION_CODE_CENTER; - MercPtrs[i]->ubStrategicInsertionCode = INSERTION_CODE_CENTER; + pSoldier->ubStrategicInsertionCode = INSERTION_CODE_CENTER; gfCenter = TRUE; } // WANNE - MP: Check if the desired insertion direction is valid on the map. If not, choose another entry direction! if (is_networked) { - MercPtrs[ i ]->ubStrategicInsertionCode = GetValidInsertionDirectionForMP(MercPtrs[ i ]->ubStrategicInsertionCode); + pSoldier->ubStrategicInsertionCode = GetValidInsertionDirectionForMP(pSoldier->ubStrategicInsertionCode); } // ATE: If we are in a vehicle - remove ourselves from it! - //if ( MercPtrs[ i ]->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) + //if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_DRIVER | SOLDIER_PASSENGER ) ) //{ - // RemoveSoldierFromVehicle( MercPtrs[ i ], MercPtrs[ i ]->bVehicleID ); + // RemoveSoldierFromVehicle( pSoldier, pSoldier->bVehicleID ); //} - if( MercPtrs[ i ]->ubStrategicInsertionCode == INSERTION_CODE_PRIMARY_EDGEINDEX || - MercPtrs[ i ]->ubStrategicInsertionCode == INSERTION_CODE_SECONDARY_EDGEINDEX ) + if( pSoldier->ubStrategicInsertionCode == INSERTION_CODE_PRIMARY_EDGEINDEX || + pSoldier->ubStrategicInsertionCode == INSERTION_CODE_SECONDARY_EDGEINDEX ) { - MercPtrs[ i ]->ubStrategicInsertionCode = (UINT8)MercPtrs[ i ]->usStrategicInsertionData; + pSoldier->ubStrategicInsertionCode = (UINT8)pSoldier->usStrategicInsertionData; } - gMercPlacement[ giPlacements ].pSoldier = MercPtrs[ i ]; - gMercPlacement[ giPlacements ].ubStrategicInsertionCode = MercPtrs[ i ]->ubStrategicInsertionCode; + gMercPlacement[ giPlacements ].pSoldier = pSoldier; + gMercPlacement[ giPlacements ].ubStrategicInsertionCode = pSoldier->ubStrategicInsertionCode; gMercPlacement[ giPlacements ].fPlaced = FALSE; // WANNE: We always want to have edgepoints - CheckForValidMapEdge( &MercPtrs[ i ]->ubStrategicInsertionCode ); + CheckForValidMapEdge( &pSoldier->ubStrategicInsertionCode ); // Flugente: campaign stats - switch( MercPtrs[ i ]->ubStrategicInsertionCode ) + switch( pSoldier->ubStrategicInsertionCode ) { case INSERTION_CODE_NORTH: gCurrentIncident.usIncidentFlags |= INCIDENT_ATTACKDIR_NORTH; @@ -415,7 +416,7 @@ void InitTacticalPlacementGUI() } // WANNE - MP: Center - if (is_networked && MercPtrs[ i ]->ubStrategicInsertionCode == INSERTION_CODE_CENTER) + if (is_networked && pSoldier->ubStrategicInsertionCode == INSERTION_CODE_CENTER) { gfCenter = TRUE; } diff --git a/TileEngine/pits.cpp b/TileEngine/pits.cpp index 86f0e548..6b8de13e 100644 --- a/TileEngine/pits.cpp +++ b/TileEngine/pits.cpp @@ -237,9 +237,9 @@ void SearchForOtherMembersWithinPitRadiusAndMakeThemFall( INT32 sGridNo, INT16 s } } -void HandleFallIntoPitFromAnimation( UINT16 ubID ) +void HandleFallIntoPitFromAnimation( SoldierID ubID ) { - SOLDIERTYPE *pSoldier = MercPtrs[ ubID ]; + SOLDIERTYPE *pSoldier = ubID; EXITGRID ExitGrid; INT32 sPitGridNo; // OK, get exit grid... diff --git a/TileEngine/pits.h b/TileEngine/pits.h index 5050fe6f..b9a81154 100644 --- a/TileEngine/pits.h +++ b/TileEngine/pits.h @@ -1,6 +1,8 @@ #ifndef __PITS_H #define __PITS_H +#include "overhead types.h" + void Add3X3Pit( INT32 iMapIndex ); void Add5X5Pit( INT32 iMapIndex ); void Remove3X3Pit( INT32 iMapIndex ); @@ -14,7 +16,7 @@ void RemoveAllPits(); extern BOOLEAN gfShowPits; extern BOOLEAN gfLoadPitsWithoutArming; -void HandleFallIntoPitFromAnimation( UINT16 ubID ); +void HandleFallIntoPitFromAnimation( SoldierID ubID ); -#endif \ No newline at end of file +#endif From 66f5156f03a8952c30dd4d95489ed66f3bb89e21 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 16:52:18 +0200 Subject: [PATCH 190/571] Use SoldierID --- Tactical/Auto Bandage.cpp | 98 ++++++++++++++++-------------------- Tactical/Auto Bandage.h | 4 +- Tactical/DynamicDialogue.cpp | 8 +-- Tactical/Overhead.h | 4 +- 4 files changed, 52 insertions(+), 62 deletions(-) diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index 4f2cd888..c6b76901 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -89,10 +89,8 @@ extern UINT16 NumEnemyInSector( ); void BeginAutoBandage( ) { - INT32 cnt; - BOOLEAN fFoundAGuy = FALSE; - SOLDIERTYPE * pSoldier; - BOOLEAN fFoundAMedKit = FALSE; + BOOLEAN fFoundAGuy = FALSE; + BOOLEAN fFoundAMedKit = FALSE; // If we are in combat, we con't... if ( (gTacticalStatus.uiFlags & INCOMBAT) || (NumEnemyInSector() != 0) ) @@ -101,21 +99,21 @@ void BeginAutoBandage( ) return; } - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID soldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // check for anyone needing bandages - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, ++pSoldier ) + for ( ; soldier <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++soldier ) { // if the soldier isn't active or in sector, we have problems..leave - if ( !(pSoldier->bActive) || !(pSoldier->bInSector) || ( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pSoldier->bAssignment == VEHICLE ) ) + if ( !(soldier->bActive) || !(soldier->bInSector) || ( soldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (soldier->bAssignment == VEHICLE ) ) { continue; } // can this character be helped out by a teammate? - if ( CanCharacterBeAutoBandagedByTeammate( pSoldier ) ) + if ( CanCharacterBeAutoBandagedByTeammate( soldier ) ) fFoundAGuy = TRUE; - if ( FindObjClass( pSoldier, IC_MEDKIT ) != NO_SLOT ) + if ( FindObjClass( soldier, IC_MEDKIT ) != NO_SLOT ) fFoundAMedKit = TRUE; if ( fFoundAGuy && fFoundAMedKit ) @@ -155,9 +153,6 @@ void BeginAutoBandage( ) void HandleAutoBandagePending( ) { - INT32 cnt; - SOLDIERTYPE *pSoldier = NULL; - // OK, if we have a pending autobandage.... // check some conditions if ( gTacticalStatus.fAutoBandagePending ) @@ -176,15 +171,15 @@ void HandleAutoBandagePending( ) } // Do any guys have pending actions...? - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt, ++pSoldier) + SoldierID soldier = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( ; soldier <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++soldier) { // Are we in sector? - if ( pSoldier->bActive ) + if ( soldier->bActive ) { - if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && !pSoldier->flags.fBetweenSectors ) + if ( soldier->sSectorX == gWorldSectorX && soldier->sSectorY == gWorldSectorY && soldier->bSectorZ == gbWorldSectorZ && !soldier->flags.fBetweenSectors ) { - if ( pSoldier->aiData.ubPendingAction != NO_PENDING_ACTION ) + if ( soldier->aiData.ubPendingAction != NO_PENDING_ACTION ) { return; } @@ -246,14 +241,14 @@ BOOLEAN HandleAutoBandage( ) ShadowVideoSurfaceRect( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); InvalidateScreen( ); RefreshScreen( NULL ); - INT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - SOLDIERTYPE *pSoldier = NULL; - for (pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier) + + SoldierID soldier = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; soldier <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++soldier) { - if(pSoldier->bActive && pSoldier->bInSector && pSoldier->aiData.bAction != 0) + if(soldier->bActive && soldier->bInSector && soldier->aiData.bAction != 0) { //shadooow: this fixes autobandaging sometimes hang indefinitely - pSoldier->aiData.bAction = 0; + soldier->aiData.bAction = 0; } } } @@ -310,15 +305,13 @@ BOOLEAN HandleAutoBandage( ) BOOLEAN CreateAutoBandageString( void ) { - INT32 cnt; // WDS - make number of mercenaries, etc. be configurable UINT16 ubDoctor[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS], ubDoctors = 0; UINT32 uiDoctorNameStringLength = 1; // for end-of-string character STR16 sTemp; - SOLDIERTYPE * pSoldier; - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt, ++pSoldier) + SoldierID pSoldier = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( ; pSoldier <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++pSoldier ) { if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && !(pSoldier->bCollapsed) && pSoldier->stats.bMedical > 0 && FindObjClass( pSoldier, IC_MEDKIT ) != NO_SLOT) { @@ -364,7 +357,7 @@ BOOLEAN CreateAutoBandageString( void ) return( FALSE ); } wcscpy( sTemp, L"" ); - for (cnt = 0; cnt < ubDoctors - 1; ++cnt) + for (UINT16 cnt = 0; cnt < ubDoctors - 1; ++cnt) { wcscat( sTemp, MercPtrs[ubDoctor[cnt]]->name ); if (ubDoctors > 2) @@ -394,10 +387,7 @@ void SetAutoBandageComplete( void ) void AutoBandage( BOOLEAN fStart ) { - SGPRect aRect; - UINT16 ubLoop; - INT32 cnt; - SOLDIERTYPE * pSoldier; + SGPRect aRect; if ( fStart ) { @@ -417,8 +407,8 @@ void AutoBandage( BOOLEAN fStart ) // Compress time... //SetGameTimeCompressionLevel( TIME_COMPRESS_5MINS ); - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt, ++pSoldier) + SoldierID pSoldier = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( ; pSoldier <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++pSoldier) { if ( pSoldier->bActive ) { @@ -456,11 +446,11 @@ void AutoBandage( BOOLEAN fStart ) gTacticalStatus.uiFlags &= ( ~OUR_MERCS_AUTO_MOVE ); // make sure anyone under AI control has their action cancelled - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier ) + SoldierID pSoldier = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( ; pSoldier <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++pSoldier ) { // 0verhaul: Make sure the merc is also in the sector before making him stand up! - if (pSoldier && pSoldier->bActive && pSoldier->bInSector) + if (pSoldier->bActive && pSoldier->bInSector) { ActionDone( pSoldier ); if ( pSoldier->bSlotItemTakenFrom != NO_SLOT ) @@ -480,11 +470,10 @@ void AutoBandage( BOOLEAN fStart ) } } - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop) + pSoldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; pSoldier <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++pSoldier ) { - pSoldier = MercPtrs[ubLoop]; - if (pSoldier && pSoldier->bActive && pSoldier->bInSector) + if ( pSoldier->bActive && pSoldier->bInSector) { ActionDone(pSoldier); @@ -1235,15 +1224,15 @@ BOOLEAN RetreatBandagingPending() } // return the ID of best doctor that has a medkit and is travelling with pPatient -UINT16 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ) +SoldierID GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ) { // if this is a travelling, bleeding merc, can somebody who travels with him bandage him/her? if ( pPatient && pPatient->bActive && pPatient->flags.fBetweenSectors && pPatient->bBleeding ) { - UINT16 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - SOLDIERTYPE* pSoldier = NULL; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier ) + SoldierID ID = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; ID <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++ID ) { + SOLDIERTYPE *pSoldier = ID; // this requires mercs to travel and thus NOT be in a sector // also we need to be in a specific sector if ( pSoldier->bActive && pSoldier->flags.fBetweenSectors && pSoldier->sSectorX == pPatient->sSectorX && pSoldier->sSectorY == pPatient->sSectorY ) @@ -1251,7 +1240,7 @@ UINT16 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ) // find the best conscious doctor that has a medkit if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->stats.bMedical > 0 && FindObjClass( pSoldier, IC_MEDKIT ) != NO_SLOT ) { - return cnt; + return ID; } } } @@ -1280,12 +1269,12 @@ void HandleRetreatBandaging() BOOLEAN needhelpinsector = FALSE; INT16 sX = -1; INT16 sY = -1; - UINT16 possiblepatient = NOBODY; + SoldierID possiblepatient = NOBODY; - UINT16 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - SOLDIERTYPE* pSoldier = NULL; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier ) + SoldierID ID = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; ID <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++ID ) { + SOLDIERTYPE* pSoldier = ID; // this requires mercs to travel and thus NOT be in a sector // are we bleeding? if ( pSoldier->bActive && pSoldier->flags.fBetweenSectors && pSoldier->bBleeding ) @@ -1329,7 +1318,7 @@ void HandleRetreatBandaging() needhelpinsector = TRUE; sX = pSoldier->sSectorX; sY = pSoldier->sSectorY; - possiblepatient = cnt; + possiblepatient = ID; } } } @@ -1338,16 +1327,17 @@ void HandleRetreatBandaging() if ( needhelpinsector && possiblepatient != NOBODY) { // find the best doctor here - UINT16 bestdoctorid = GetBestRetreatingMercDoctor( MercPtrs[possiblepatient] ); + SoldierID bestdoctorid = GetBestRetreatingMercDoctor( MercPtrs[possiblepatient] ); if ( bestdoctorid != NOBODY ) { // have the doctor treat people - SOLDIERTYPE* pDoctor = MercPtrs[bestdoctorid]; + SOLDIERTYPE* pDoctor = bestdoctorid; - cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pSoldier ) + SoldierID ID = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; ID <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++ID) { + SOLDIERTYPE *pSoldier = ID; // this requires mercs to travel and thus NOT be in a sector // also we need to be in a specific sector // treat bleeding people only diff --git a/Tactical/Auto Bandage.h b/Tactical/Auto Bandage.h index 796e9dff..ebcdbc88 100644 --- a/Tactical/Auto Bandage.h +++ b/Tactical/Auto Bandage.h @@ -21,8 +21,8 @@ void SetRetreatBandaging( BOOLEAN aVal ); BOOLEAN RetreatBandagingPending( ); // return the ID of best doctor that has a medkit and is travelling with pPatient -UINT16 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ); +SoldierID GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ); void HandleRetreatBandaging( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/DynamicDialogue.cpp b/Tactical/DynamicDialogue.cpp index 9df30c38..6b197ae3 100644 --- a/Tactical/DynamicDialogue.cpp +++ b/Tactical/DynamicDialogue.cpp @@ -1749,11 +1749,11 @@ void HandleDynamicOpinionOnContractExtension( UINT8 ubCode, UINT8 usProfile ) oldcontract -= 14 * 1440; // someones contract got extended. Other mercs who have less time on their contract will be annoyed by this, as they feel they should have been paid first - SOLDIERTYPE* pSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pSoldier++ ) + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + SOLDIERTYPE *pSoldier = bMercID; if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != usProfile && !(pSoldier->bAssignment == IN_TRANSIT || pSoldier->bAssignment == ASSIGNMENT_DEAD) ) diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index fea2d805..87b5034a 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -23,8 +23,8 @@ enum // TACTICAL ENGINE STATUS FLAGS typedef struct { - UINT16 bFirstID; - UINT16 bLastID; + SoldierID bFirstID; + SoldierID bLastID; COLORVAL RadarColor; INT8 bSide; INT16 bMenInSector; From 5bbbec18bbbab2fe90ce5e6c383460d6df9d31cc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 17:06:11 +0200 Subject: [PATCH 191/571] Use SoldierID --- Ja2/SaveLoadGame.cpp | 38 ++++++++++++++++++++------------------ Ja2/gamescreen.cpp | 30 +++++++++++------------------- Strategic/strategicmap.cpp | 10 +++++----- 3 files changed, 36 insertions(+), 42 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 34f283fe..18270276 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -6731,9 +6731,9 @@ BOOLEAN LoadSavedGame( int ubSavedGameID ) // player team character fixes SOLDIERTYPE *pTeamSoldier; - for (UINT16 bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++) + for (SoldierID bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop) { - pTeamSoldier=MercPtrs[bLoop]; + pTeamSoldier = bLoop; // silversurfer: added additional check to only remove the flags when there is no boxing activity going on at the moment. // WANNE: This should fix the bug if any merc are still under PC control. This could happen after boxing in SAN MONA. @@ -9277,20 +9277,20 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile ) gCamoFace[i].gSnowCamoface = FALSE; } - SOLDIERTYPE * pSoldier; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID,pSoldier++) + SoldierID Soldier = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; Soldier <= bLastTeamID; ++Soldier) { - if ( pSoldier ) + if ( Soldier ) { - gCamoFace[pSoldier->ubProfile].gCamoface = ( pSoldier->bCamo > 0 ); - gCamoFace[pSoldier->ubProfile].gUrbanCamoface = ( pSoldier->urbanCamo > 0 ); - gCamoFace[pSoldier->ubProfile].gDesertCamoface = ( pSoldier->desertCamo > 0 ); - gCamoFace[pSoldier->ubProfile].gSnowCamoface = ( pSoldier->snowCamo > 0 ); + UINT8 profile = Soldier->ubProfile; + gCamoFace[profile].gCamoface = ( Soldier->bCamo > 0 ); + gCamoFace[profile].gUrbanCamoface = ( Soldier->urbanCamo > 0 ); + gCamoFace[profile].gDesertCamoface = ( Soldier->desertCamo > 0 ); + gCamoFace[profile].gSnowCamoface = ( Soldier->snowCamo > 0 ); - DeleteSoldierFace( pSoldier ); - pSoldier->iFaceIndex = InitSoldierFace( pSoldier ); + DeleteSoldierFace( Soldier ); + Soldier->iFaceIndex = InitSoldierFace( Soldier ); } } } @@ -9511,18 +9511,19 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p } else { - UINT16 sSoldierCnt; + SoldierID sSoldierCnt; + SoldierID bLastTeamID; SOLDIERTYPE *pSoldier; - UINT16 bLastTeamID; - BOOLEAN fFoundAMerc=FALSE; + BOOLEAN fFoundAMerc = FALSE; // Set locator to first merc sSoldierCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop through all the mercs on the players team to find the one that is not moving - for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++) + for ( ; sSoldierCnt <= bLastTeamID; ++sSoldierCnt ) { + pSoldier = sSoldierCnt; // test for !NULL (if initilization fails and MercPtrs contains 'NULL's) if( pSoldier && pSoldier->bActive ) { @@ -9546,8 +9547,9 @@ void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *p bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop through all the mercs and find one that is moving - for ( pSoldier = MercPtrs[ sSoldierCnt ]; sSoldierCnt <= bLastTeamID; sSoldierCnt++,pSoldier++) + for ( ; sSoldierCnt <= bLastTeamID; ++sSoldierCnt ) { + pSoldier = sSoldierCnt; if( pSoldier && pSoldier->bActive ) { //we found an alive, merc that is not moving diff --git a/Ja2/gamescreen.cpp b/Ja2/gamescreen.cpp index e4f9046d..89b01fb7 100644 --- a/Ja2/gamescreen.cpp +++ b/Ja2/gamescreen.cpp @@ -1030,10 +1030,7 @@ void DisableFPSOverlay( BOOLEAN fEnable ) void TacticalScreenLocateToSoldier( ) { - INT32 cnt; - SOLDIERTYPE *pSoldier; - UINT16 bLastTeamID; - BOOLEAN fPreferedGuyUsed = FALSE; + BOOLEAN fPreferedGuyUsed = FALSE; if ( gubPreferredInitialSelectedGuy != NOBODY ) { @@ -1050,14 +1047,14 @@ void TacticalScreenLocateToSoldier( ) if ( !fPreferedGuyUsed ) { // Set locator to first merc - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + SoldierID Soldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + for ( ; Soldier <= bLastTeamID; ++Soldier) { - if ( OK_CONTROLLABLE_MERC( pSoldier ) && OK_INTERRUPT_MERC( pSoldier ) ) + if ( OK_CONTROLLABLE_MERC( Soldier ) && OK_INTERRUPT_MERC( Soldier ) ) { - LocateSoldier( pSoldier->ubID, 10 ); - SelectSoldier( pSoldier->ubID, FALSE, TRUE ); + LocateSoldier( Soldier, 10 ); + SelectSoldier( Soldier, FALSE, TRUE ); break; } } @@ -1075,22 +1072,17 @@ void EnterMapScreen( ) void UpdateTeamPanelAssignments( ) { - INT32 cnt; - SOLDIERTYPE *pSoldier; - UINT16 bLastTeamID; - // Remove all players RemoveAllPlayersFromSlot( ); // Set locator to first merc - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + SoldierID Soldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + for ( ; Soldier <= bLastTeamID; ++Soldier) { // Setup team interface - CheckForAndAddMercToTeamPanel( pSoldier ); + CheckForAndAddMercToTeamPanel( Soldier ); } - } diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index b5908ecf..ff7e2edc 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -7541,16 +7541,15 @@ void HandleMovingTheEnemiesToBeNearPlayerWhenEnteringComplexMap( ) //if the player made a 'noise' going through the gate at the end of the tunnel sector if ( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__DID_PLAYER_MAKE_SOUND_GOING_THROUGH_TUNNEL_GATE ) { - UINT8 cnt; - // //Move some of the enemies to be 'near' them player when the enter the room // // Loop through the list and move some of the enemies - cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; cnt++, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; ++cnt) { + pSoldier = cnt; //if the soldier is active, if ( pSoldier->bActive ) { @@ -7581,8 +7580,9 @@ void HandleMovingTheEnemiesToBeNearPlayerWhenEnteringComplexMap( ) while ( ubNumEnemiesMoved < 3 ) { cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; ++cnt ) { + pSoldier = cnt; //if the soldier is active, if ( pSoldier->bActive && pSoldier->sGridNo != 15705 && pSoldier->sGridNo != 15712 && pSoldier->sGridNo != 15233 ) { From 2eb16c583c82fddf842a76f64ee1698aaf237b28 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 17:18:04 +0200 Subject: [PATCH 192/571] Use SoldierID --- Laptop/insurance Contract.cpp | 66 ++++++++++++++--------------------- Laptop/laptop.cpp | 6 ++-- Laptop/merccompare.cpp | 51 ++++++++++++--------------- Laptop/personnel.cpp | 7 ++-- 4 files changed, 57 insertions(+), 73 deletions(-) diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index ab97fb1b..c031f41f 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -163,7 +163,7 @@ BOOLEAN DisplayOrderGrid( UINT8 ubGridNumber, UINT8 ubMercID ); INT8 GetNumberOfHireMercsStartingFromID( UINT8 ubStartMercID ); //INT32 CalculateInsuranceCost( SOLDIERTYPE *pSoldier, BOOLEAN fHaveInsurance ); void InsuranceContractUserTextFieldCallBack( UINT8 ubID, BOOLEAN fEntering ); -INT8 CountInsurableMercs(); +UINT16 CountInsurableMercs(); void DisableInsuranceContractNextPreviousbuttons(); void CreateDestroyInsuranceContractFormButtons( BOOLEAN fCreate); void HandleAcceptButton( SoldierID ubSoldierID, UINT8 ubFormID ); @@ -943,20 +943,17 @@ void SelectInsuranceContractRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason } } -INT8 CountInsurableMercs() +UINT16 CountInsurableMercs() { - UINT16 cnt; - SOLDIERTYPE *pSoldier; - UINT16 bLastTeamID; - INT8 bCount=0; + UINT16 bCount = 0; // Set locator to first merc - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + SoldierID Soldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + for ( ; Soldier <= bLastTeamID; ++Soldier) { - if (MercIsInsurable(pSoldier)) + if (MercIsInsurable(Soldier)) { bCount++; } @@ -1094,33 +1091,29 @@ void HandleAcceptButton( SoldierID ubSoldierID, UINT8 ubFormID ) // determines if a merc will run out of their insurance contract void DailyUpdateOfInsuredMercs() { - INT16 cnt; - INT16 bLastTeamID; - SOLDIERTYPE *pSoldier; + SoldierID Soldier = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + for ( ; Soldier <= bLastTeamID; ++Soldier) { //if the soldier is in the team array - if( pSoldier->bActive ) + if( Soldier->bActive ) { //if the merc has life insurance - if( pSoldier->usLifeInsurance ) + if( Soldier->usLifeInsurance ) { //if the merc wasn't just hired - if( (INT16)GetWorldDay() != pSoldier->iStartOfInsuranceContract ) + if( (INT16)GetWorldDay() != Soldier->iStartOfInsuranceContract ) { //if the contract has run out of time - if( GetTimeRemainingOnSoldiersInsuranceContract( pSoldier ) <= 0 ) + if( GetTimeRemainingOnSoldiersInsuranceContract( Soldier ) <= 0 ) { //if the soldier isn't dead - if( !IsMercDead( pSoldier->ubProfile ) ) + if( !IsMercDead( Soldier->ubProfile ) ) { - pSoldier->usLifeInsurance = 0; - pSoldier->iTotalLengthOfInsuranceContract = 0; - pSoldier->iStartOfInsuranceContract = 0; + Soldier->usLifeInsurance = 0; + Soldier->iTotalLengthOfInsuranceContract = 0; + Soldier->iStartOfInsuranceContract = 0; } } } @@ -1254,20 +1247,16 @@ void InsContractNoMercsPopupCallBack( UINT8 bExitValue ) void BuildInsuranceArray() { - INT16 cnt; - SOLDIERTYPE *pSoldier; - INT16 bLastTeamID; - - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + SoldierID Soldier = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; gsMaxPlayersOnTeam = 0; // store profile #s of all insurable mercs in an array - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + for ( ; Soldier <= bLastTeamID; ++Soldier) { - if( MercIsInsurable(pSoldier) ) + if( MercIsInsurable(Soldier) ) { - gubInsuranceMercArray[ gsMaxPlayersOnTeam ] = pSoldier->ubProfile; + gubInsuranceMercArray[ gsMaxPlayersOnTeam ] = Soldier->ubProfile; gsMaxPlayersOnTeam++; } } @@ -1787,14 +1776,13 @@ INT32 CalcStartDayOfInsurance( SOLDIERTYPE *pSoldier ) BOOLEAN AreAnyAimMercsOnTeam( ) { - SOLDIERTYPE *pSoldier = NULL; + SoldierID Soldier = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for( int cnt = 0; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) + for( ; Soldier <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++Soldier) { - pSoldier = MercPtrs[cnt]; - //check to see if any of the mercs are AIM mercs - if( pSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) + if( Soldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) { return TRUE; } diff --git a/Laptop/laptop.cpp b/Laptop/laptop.cpp index 00c2f161..9809622f 100644 --- a/Laptop/laptop.cpp +++ b/Laptop/laptop.cpp @@ -6243,7 +6243,7 @@ void PrintNumberOnTeam( void ) { CHAR16 pString[ 32 ]; SOLDIERTYPE *pSoldier, *pTeamSoldier; - INT32 cnt=0; + SoldierID cnt = 0; INT32 iCounter=0; UINT16 usPosX, usPosY, usFontHeight, usStrLength; @@ -6256,9 +6256,9 @@ void PrintNumberOnTeam( void ) // grab number on team pSoldier = MercPtrs[0]; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++cnt ) { - pTeamSoldier = MercPtrs[ cnt ]; + pTeamSoldier = cnt; if( ( pTeamSoldier->bActive)&&( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) ) { diff --git a/Laptop/merccompare.cpp b/Laptop/merccompare.cpp index 51c2fd94..4219df61 100644 --- a/Laptop/merccompare.cpp +++ b/Laptop/merccompare.cpp @@ -340,13 +340,12 @@ BOOLEAN EnterMercCompareAnalyze() // We fill two dropdowns with all mercs on our team std::vector > mercvector; - SOLDIERTYPE* pSoldier = NULL; - UINT16 id = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pSoldier = MercPtrs[id]; id <= lastid; ++id, pSoldier++ ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id) { - if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE ) - mercvector.push_back( std::make_pair( pSoldier->ubProfile, gMercProfiles[pSoldier->ubProfile].zNickname ) ); + if ( id->bActive && id->ubProfile != NO_PROFILE ) + mercvector.push_back( std::make_pair( id->ubProfile, gMercProfiles[id->ubProfile].zNickname ) ); } DropDownTemplate::getInstance( ).SetEntries( mercvector ); @@ -976,17 +975,16 @@ BOOLEAN EnterMercCompareMatrix( ) // create a map of all current squads with at least 2 members std::map squadmap; - SOLDIERTYPE* pSoldier = NULL; - UINT16 id = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pSoldier = MercPtrs[id]; id <= lastid; ++id, pSoldier++ ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { - if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bAssignment < ON_DUTY ) + if ( id->bActive && id->ubProfile != NO_PROFILE && id->bAssignment < ON_DUTY ) { - if ( squadmap.find( pSoldier->bAssignment ) == squadmap.end() ) - squadmap[pSoldier->bAssignment] = 1; + if ( squadmap.find( id->bAssignment ) == squadmap.end() ) + squadmap[id->bAssignment] = 1; else - ++squadmap[pSoldier->bAssignment]; + ++squadmap[id->bAssignment]; } } @@ -1079,15 +1077,14 @@ void RenderMercCompareMatrix( ) // display a table with all squadmembers std::vector squadvector; - SOLDIERTYPE* pSoldier = NULL; - UINT16 id = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pSoldier = MercPtrs[id]; id <= lastid; ++id, pSoldier++ ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { - if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bAssignment == gSquadToShow ) + if ( id->bActive && id->ubProfile != NO_PROFILE && id->bAssignment == gSquadToShow ) { // remember squamember - squadvector.push_back( pSoldier->ubProfile ); + squadvector.push_back( id->ubProfile ); } } @@ -1117,13 +1114,12 @@ void RenderMercCompareMatrix( ) for ( std::vector::iterator it = squadvector.begin(); it != itend; ++it ) { - INT16 idA = GetSoldierIDFromMercID( (*it) ); + SoldierID idA = GetSoldierIDFromMercID( (*it) ); - if ( idA < 0 ) + if ( idA == NOBODY ) continue; - SOLDIERTYPE* pSoldierA = MercPtrs[idA]; - + SOLDIERTYPE* pSoldierA = idA; if ( !pSoldierA ) continue; @@ -1140,9 +1136,9 @@ void RenderMercCompareMatrix( ) for ( std::vector::iterator it2 = squadvector.begin( ); it2 != itend; ++it2 ) { - INT16 idB = GetSoldierIDFromMercID( (*it2) ); + SoldierID idB = GetSoldierIDFromMercID( (*it2) ); - if ( idB < 0 ) + if ( idB == NOBODY ) continue; if ( idA == idB ) @@ -1151,8 +1147,7 @@ void RenderMercCompareMatrix( ) continue; } - SOLDIERTYPE* pSoldierB = MercPtrs[idB]; - + SOLDIERTYPE* pSoldierB = idB; if ( !pSoldierB ) continue; diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 775ff5f4..65aabfe2 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -558,10 +558,11 @@ void EnterPersonnel( void ) // Fill in the current team list maxCurrentTeamIndex = -1; SOLDIERTYPE *pTeamSoldier = MercPtrs[ 0 ]; - for (int idx = gTacticalStatus.Team[ pTeamSoldier->bTeam ].bFirstID; + for (SoldierID idx = gTacticalStatus.Team[ pTeamSoldier->bTeam ].bFirstID; idx <= gTacticalStatus.Team[ pTeamSoldier->bTeam ].bLastID; - ++idx) { - pTeamSoldier = MercPtrs[ idx ]; + ++idx) + { + pTeamSoldier = idx; // WANNE: Bugfix: Also show the roboter in ther personnel screen. This bug was introduced in revision 2498, when Many Mercenary was included. //if ((pTeamSoldier->bActive) && From c2b1ac01098cb80811a72895cd8ffc7055b1c19c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:29:17 +0200 Subject: [PATCH 193/571] use SoldierID --- Strategic/AI Viewer.cpp | 7 +- Strategic/Assignments.cpp | 182 ++++++++++++++++++-------------------- Tactical/End Game.cpp | 9 +- 3 files changed, 92 insertions(+), 106 deletions(-) diff --git a/Strategic/AI Viewer.cpp b/Strategic/AI Viewer.cpp index 9f2006f0..ddb07bc7 100644 --- a/Strategic/AI Viewer.cpp +++ b/Strategic/AI Viewer.cpp @@ -649,7 +649,7 @@ void RenderInfoInSector() { UINT8 ubSectorX, ubSectorY; UINT16 ubMercs=0, ubActive=0, ubUnconcious=0, ubCollapsed=0; - INT32 i, xp, yp; + INT32 xp, yp; if( gfViewEnemies && !gbViewLevel ) { @@ -694,11 +694,10 @@ void RenderInfoInSector() //Count the number of mercs and their states (even for underground sectors) - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id ) { - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier = id; - pSoldier = MercPtrs[ i ]; if( pSoldier->bActive && pSoldier->sSectorX == ubSectorX && pSoldier->sSectorY == ubSectorY && pSoldier->bSectorZ == gbViewLevel ) { if( pSoldier->stats.bLife ) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index bed21b31..ffb5db4f 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -1223,16 +1223,16 @@ BOOLEAN IsAnythingAroundForSoldierToClean( SOLDIERTYPE * pSoldier ) } // now the other merc's stuff - for(UINT16 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) + for(SoldierID teamMember = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamMember <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamMember) { // Ignore self, mercs in other sectors, etc. - if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) + if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, teamMember)) { // Iterate over all pocket slots and add items in need of repair for (UINT8 pocketIndex = HANDPOS; pocketIndex < NUM_INV_SLOTS; ++pocketIndex) { - const OBJECTTYPE* pObj = &(const_cast(MercPtrs[teamIndex])->inv[pocketIndex]); + const OBJECTTYPE* pObj = &(const_cast(MercPtrs[teamMember])->inv[pocketIndex]); if(pObj == NULL || pObj->ubNumberOfObjects == NOTHING || pObj->usItem == NOTHING) continue; @@ -1337,18 +1337,16 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP if ( bHighestPass != - 1 ) { // now look for items to repair on other mercs - for( UINT16 bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) + for( SoldierID OtherSoldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; OtherSoldier <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++OtherSoldier ) { - SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ]; - - if ( CanCharacterRepairAnotherSoldiersStuff( pSoldier, pOtherSoldier ) ) + if ( CanCharacterRepairAnotherSoldiersStuff( pSoldier, OtherSoldier ) ) { // okay, seems like a candidate! Check if he has anything that needs unjamming or repairs // CHRISL: Changed to dynamically determine max inventory locations. for ( bPocket = HANDPOS; bPocket < NUM_INV_SLOTS; ++bPocket ) { // the object a weapon? and jammed? - if ( ( Item[ pOtherSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( pOtherSoldier->inv[ bPocket ][0]->data.gun.bGunAmmoStatus < 0 ) ) + if ( ( Item[ OtherSoldier->inv[ bPocket ].usItem ].usItemClass == IC_GUN ) && ( OtherSoldier->inv[ bPocket ][0]->data.gun.bGunAmmoStatus < 0 ) ) { return( TRUE ); } @@ -1356,7 +1354,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP // repair everyone's hands and armor slots first, then headgear, and pockets last for ( ubPassType = REPAIR_HANDS_AND_ARMOR; ubPassType <= ( UINT8 ) bHighestPass; ubPassType++ ) { - if (FindRepairableItemOnOtherSoldier( pSoldier, pOtherSoldier, ubPassType )) { + if (FindRepairableItemOnOtherSoldier( pSoldier, OtherSoldier, ubPassType )) { return( TRUE ); } } @@ -2054,17 +2052,16 @@ BOOLEAN DoesSectorMercIsInHaveSufficientLoyaltyToTrainMilitia( SOLDIERTYPE *pSol INT8 CountMilitiaTrainersInSoldiersSector( SOLDIERTYPE * pSoldier, UINT8 ubMilitiaType ) { - INT8 bCount = 0; + INT8 bCount = 0; AssertNotNIL(pSoldier); - for ( UINT16 bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) + for ( SoldierID OtherSoldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; OtherSoldier <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++OtherSoldier ) { - SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ]; - if ( pSoldier != pOtherSoldier && pOtherSoldier->bActive && pOtherSoldier->stats.bLife >= OKLIFE && pOtherSoldier->sSectorX == pSoldier->sSectorX && pOtherSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pOtherSoldier->bSectorZ ) + if ( pSoldier != OtherSoldier && OtherSoldier->bActive && OtherSoldier->stats.bLife >= OKLIFE && OtherSoldier->sSectorX == pSoldier->sSectorX && OtherSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == OtherSoldier->bSectorZ ) { // Count depends on Militia Type requested - if (ubMilitiaType == TOWN_MILITIA && pOtherSoldier->bAssignment == TRAIN_TOWN ) + if (ubMilitiaType == TOWN_MILITIA && OtherSoldier->bAssignment == TRAIN_TOWN ) { ++bCount; } @@ -3638,15 +3635,13 @@ UINT32 CalculateAllGuardsValueInPrison( INT16 sMapX, INT16 sMapY, INT8 bZ ) UINT32 prisonguardvalue = 0; // count any mercs found here, and sum up their guard values - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID Soldier = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + for ( ; Soldier <= lastid; ++Soldier) { - if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) ) + if( Soldier->bActive && ( Soldier->sSectorX == sMapX ) && ( Soldier->sSectorY == sMapY ) && ( Soldier->bSectorZ == bZ) ) { - prisonguardvalue += CalculatePrisonGuardValue(pSoldier ); + prisonguardvalue += CalculatePrisonGuardValue( Soldier ); } } @@ -3661,15 +3656,13 @@ UINT32 CalculateAllSnitchesGuardValueInPrison( INT16 sMapX, INT16 sMapY, INT8 bZ UINT32 prisonguardvalue = 0; // count any mercs found here, and sum up their guard values - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID Soldier = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + for ( ; Soldier <= lastid; ++Soldier) { - if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && pSoldier->flags.fMercAsleep == FALSE ) + if( Soldier->bActive && ( Soldier->sSectorX == sMapX ) && ( Soldier->sSectorY == sMapY ) && ( Soldier->bSectorZ == bZ) && Soldier->flags.fMercAsleep == FALSE ) { - prisonguardvalue += CalculateSnitchGuardValue(pSoldier ); + prisonguardvalue += CalculateSnitchGuardValue(Soldier ); } } @@ -3684,16 +3677,14 @@ UINT32 CalculateAllGuardsNumberInPrison( INT16 sMapX, INT16 sMapY, INT8 bZ ) UINT8 numprisonguards = 0; // count any mercs found here - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID Soldier = gTacticalStatus.Team[OUR_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; Soldier <= lastid; ++Soldier) { - if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && pSoldier->flags.fMercAsleep == FALSE ) + if( Soldier->bActive && ( Soldier->sSectorX == sMapX ) && ( Soldier->sSectorY == sMapY ) && ( Soldier->bSectorZ == bZ) && Soldier->flags.fMercAsleep == FALSE ) { // anv: undercover snitches don't count as guards as they don't guard in traditional sense - if ( !(pSoldier->bAssignment == FACILITY_PRISON_SNITCH) ) + if ( !(Soldier->bAssignment == FACILITY_PRISON_SNITCH) ) ++numprisonguards; } } @@ -5483,12 +5474,12 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) // first our own stuff CollectCleanableItems(pSoldier, pSoldier, itemsToClean); // then other mercs' stuff - for(UINT16 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) + for(SoldierID teamMember = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamMember <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamMember) { // Ignore self, mercs in other sectors, etc. - if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) + if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, teamMember)) // silversurfer: This function now needs the guy that does the repairs and the one that owns the stuff. - CollectCleanableItems(pSoldier, MercPtrs[teamIndex], itemsToClean); + CollectCleanableItems(pSoldier, teamMember, itemsToClean); } while (!itemsToClean.empty() && ubCleaningPtsLeft > 0) @@ -5528,12 +5519,12 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier ) // silversurfer: Looks strange? It's not. This function now needs the guy that does the repairs and the one that owns the stuff. CollectRepairableItems(pSoldier, pSoldier, itemsToFix); - for(UINT16 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) + for(SoldierID teamMember = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamMember <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamMember) { // Ignore self, mercs in other sectors, etc. - if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) + if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, teamMember)) // silversurfer: This function now needs the guy that does the repairs and the one that owns the stuff. - CollectRepairableItems(pSoldier, MercPtrs[teamIndex], itemsToFix); + CollectRepairableItems(pSoldier, teamMember, itemsToFix); } // Step through items, starting with the highest priority item @@ -6708,17 +6699,15 @@ void HandleStrategicDiseaseAndBurial() // Flugente: handle militia command void HandleMilitiaCommand() { - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID soldier = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; soldier <= lastid; ++soldier) { - if( pSoldier && pSoldier->bAssignment == FACILITY_STRATEGIC_MILITIA_MOVEMENT && pSoldier->flags.fMercAsleep == FALSE ) + if( soldier->bAssignment == FACILITY_STRATEGIC_MILITIA_MOVEMENT && soldier->flags.fMercAsleep == FALSE ) { // every commander gets a bit of leadership and wisdom - StatChange( pSoldier, LDRAMT, 2, TRUE ); - StatChange( pSoldier, WISDOMAMT, 1, TRUE ); + StatChange( soldier, LDRAMT, 2, TRUE ); + StatChange( soldier, WISDOMAMT, 1, TRUE ); } } } @@ -6741,12 +6730,11 @@ void HandleSpyAssignments() std::vector vector_uncoveredmercs; FLOAT intelgained = 0.0f; - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id) { + SOLDIERTYPE *pSoldier = id; if ( pSoldier ) { if ( SPY_LOCATION( pSoldier->bAssignment ) ) @@ -6781,7 +6769,7 @@ void HandleSpyAssignments() { // if we are already in hiding, we will be uncovered if ( pSoldier->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] > 10 ) - vector_uncoveredmercs.push_back( uiCnt ); + vector_uncoveredmercs.push_back( id ); // we get a penalty, and a chance to be uncovered pSoldier->usSkillCooldown[SOLDIER_COOLDOWN_INTEL_PENALTY] += 20 + Random( 30 ); @@ -6845,16 +6833,14 @@ struct admintmpstruct UINT16 GetNumberofAdministratableMercs( INT16 sX, INT16 sY ) { UINT16 num = 0; - UINT8 townid_origin = GetTownIdForSector( sX, sY ); - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { - if ( pSoldier + SOLDIERTYPE *pSoldier = id; + if ( pSoldier && !pSoldier->flags.fMercAsleep && !pSoldier->bSectorZ && EnoughTimeOnAssignment( pSoldier ) @@ -6887,12 +6873,11 @@ FLOAT GetAdministrationPercentage( INT16 sX, INT16 sY ) data.townid = GetTownIdForSector( sX, sY ); // loop over all soldiers with this assignment, determine percentage applied, determine how much of total that is, award exp points - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { + SOLDIERTYPE *pSoldier = id; if ( pSoldier && pSoldier->bAssignment == ADMINISTRATION && !pSoldier->flags.fMercAsleep && EnoughTimeOnAssignment( pSoldier ) ) { // sum up the points for towns, if not a town, for sectors @@ -6918,12 +6903,11 @@ void HandleAdministrationAssignments() std::vector helpervec; // loop over all soldiers with this assignment, determine percentage applied, determine how much of total that is, award exp points - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { + SOLDIERTYPE *pSoldier = id; if ( pSoldier && pSoldier->bAssignment == ADMINISTRATION && !pSoldier->flags.fMercAsleep && EnoughTimeOnAssignment( pSoldier ) ) { // sum up the points for towns, if not a town, for sectors @@ -6967,8 +6951,10 @@ void HandleAdministrationAssignments() } } - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= lastid; ++id ) { + SOLDIERTYPE *pSoldier = id; if ( pSoldier && pSoldier->bAssignment == ADMINISTRATION && !pSoldier->flags.fMercAsleep && EnoughTimeOnAssignment( pSoldier ) ) { UINT8 sector = SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ); @@ -7010,12 +6996,11 @@ void HandleAdministrationAssignments() // Flugente: handle exploration assignments void HandleExplorationAssignments() { - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { + SOLDIERTYPE *pSoldier = id; if ( pSoldier && pSoldier->bAssignment == EXPLORATION && !pSoldier->flags.fMercAsleep && EnoughTimeOnAssignment( pSoldier ) ) { UINT32 pts = pSoldier->GetExplorationPoints(); @@ -7099,13 +7084,13 @@ void HandleExplorationAssignments() void HandleMiniEventAssignments() { - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - const UINT32 firstid = gTacticalStatus.Team[gbPlayerNum].bFirstID; - const UINT32 lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + for ( ; id <= lastid; ++id ) { + SOLDIERTYPE *pSoldier = id; + if ( pSoldier && pSoldier->bAssignment == ASSIGNMENT_MINIEVENT && EnoughTimeOnAssignment( pSoldier ) ) { if (--pSoldier->ubHoursRemainingOnMiniEvent == 0) @@ -8802,12 +8787,11 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ ) if ( (gWorldSectorX == sMapX) && (gWorldSectorY == sMapY) && (gbWorldSectorZ == bZ) ) sDropOffGridNo = gMapInformation.sCenterGridNo; - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && pSoldier->flags.fMercAsleep == FALSE ) { if( ( pSoldier->bAssignment == MOVE_EQUIPMENT ) && ( EnoughTimeOnAssignment( pSoldier ) ) ) @@ -9048,8 +9032,11 @@ void HandleEquipmentMove( INT16 sMapX, INT16 sMapY, INT8 bZ ) // award a bit of experience to the movers UINT16 itemsperperson = moveditems / pair.first; UINT16 weightperperson = movedweight / pair.first; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= lastid; ++id) { + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && pSoldier->flags.fMercAsleep == FALSE ) { if( ( pSoldier->bAssignment == MOVE_EQUIPMENT ) && ( EnoughTimeOnAssignment( pSoldier ) ) ) @@ -9074,12 +9061,11 @@ void HandleTrainWorkers() { INT32 totalworkersadded = 0; - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; id <= lastid; ++id) { + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && !pSoldier->bSectorZ && !pSoldier->flags.fMercAsleep ) { if( ( pSoldier->bAssignment == TRAIN_WORKERS ) && ( EnoughTimeOnAssignment( pSoldier ) ) ) @@ -9507,13 +9493,13 @@ void HandleHealingByNaturalCauses( SOLDIERTYPE *pSoldier ) // SANDRO - experimental - increase health regeneration of soldiers when doctors are around if ( gGameOptions.fNewTraitSystem ) { - SOLDIERTYPE * pMedic = NULL; - UINT16 cnt; UINT16 bRegenerationBonus = 0; - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pMedic = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt, pMedic++) + SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; id <= lastid; ++id ) { + SOLDIERTYPE *pMedic = id; if ( !(pMedic->bActive) || !(pMedic->bInSector) || ( pMedic->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pMedic->bAssignment == VEHICLE ) ) { continue; // NEXT!!! diff --git a/Tactical/End Game.cpp b/Tactical/End Game.cpp index d937d62e..795ec9cc 100644 --- a/Tactical/End Game.cpp +++ b/Tactical/End Game.cpp @@ -175,8 +175,7 @@ void BeginHandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt; - UINT16 ubKillerSoldierID = NOBODY; + SoldierID ubKillerSoldierID = NOBODY; // Start victory music here... SetMusicMode( MUSIC_TACTICAL_VICTORY ); @@ -189,11 +188,13 @@ void HandleDeidrannaDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLev // STEP 1 ) START ALL QUOTES GOING! // OK - loop through all witnesses and see if they want to say something abou this... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; + if ( cnt != ubKillerSoldierID ) { if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) From 79b57c326e205239c2d433808053de4eae3e2962 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:29:55 +0200 Subject: [PATCH 194/571] Move check for surgery into its own function --- Strategic/Assignments.cpp | 201 ++++++++++++++------------------------ 1 file changed, 71 insertions(+), 130 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index ffb5db4f..3df48d31 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -13754,6 +13754,75 @@ void PrisonerMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) } } +static void CheckForSurgery(SOLDIERTYPE *pSoldier) +{ + if ( pSoldier->iHealableInjury >= 100 && gGameOptions.fNewTraitSystem ) // if we can heal at least one life point + { + SOLDIERTYPE *pBestMedic = NULL; + INT8 bSlot; + + // Find the best doctor + SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; id <= lastid; ++id ) + { + SOLDIERTYPE *pMedic = id; + if ( !(pMedic->bActive) || !(pMedic->bInSector) || (pMedic->flags.uiStatusFlags & SOLDIER_VEHICLE) || (pMedic->bAssignment == VEHICLE) ) + continue; // is nowhere around! + + if ( (pSoldier->ubID == pMedic->ubID) || !IS_DOCTOR( pMedic->bAssignment ) ) + continue; // cannot make surgery on self or not on the right assignment! + + bSlot = FindMedKit( pMedic ); + if ( bSlot == NO_SLOT ) + continue;// no medical kit! + + if ( pMedic->stats.bLife >= OKLIFE && !(pMedic->bCollapsed) && pMedic->stats.bMedical > 0 && (NUM_SKILL_TRAITS( pMedic, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery) ) + { + if ( pBestMedic != NULL ) + { + if ( NUM_SKILL_TRAITS( pMedic, DOCTOR_NT ) > NUM_SKILL_TRAITS( pBestMedic, DOCTOR_NT ) ) + pBestMedic = pMedic; + } + else + { + pBestMedic = pMedic; + } + } + } + + if ( pBestMedic != NULL ) + { + CHAR16 zStr[200]; + pAutomaticSurgeryDoctor = pBestMedic; + pAutomaticSurgeryPatient = pSoldier; + + INT32 healwithout_bloodbag = pAutomaticSurgeryPatient->iHealableInjury * (gSkillTraitValues.ubDOSurgeryHealPercentBase + gSkillTraitValues.ubDOSurgeryHealPercentOnTop * NUM_SKILL_TRAITS( pAutomaticSurgeryDoctor, DOCTOR_NT )) / 10000; + + // Flugente: check whether we have a bloodbag we can use + INT32 healwith_bloodbag = -1; + if ( gSkillTraitValues.ubDOSurgeryHealPercentBloodbag > 0 && pAutomaticSurgeryDoctor->GetObjectWithItemFlag( BLOOD_BAG ) != NULL ) + healwith_bloodbag = pAutomaticSurgeryPatient->iHealableInjury * (gSkillTraitValues.ubDOSurgeryHealPercentBase + gSkillTraitValues.ubDOSurgeryHealPercentBloodbag + gSkillTraitValues.ubDOSurgeryHealPercentOnTop * NUM_SKILL_TRAITS( pAutomaticSurgeryDoctor, DOCTOR_NT )) / 10000; + + if ( healwith_bloodbag > healwithout_bloodbag ) + { + swprintf( zStr, New113Message[MSG113_SURGERY_BEFORE_DOCTOR_ASSIGNMENT_BLOODBAG], pAutomaticSurgeryPatient->GetName(), healwithout_bloodbag, healwith_bloodbag ); + + wcscpy( gzUserDefinedButton[0], New113Message[MSG113_BLOODBAGOPTIONS_YESSTAR] ); + wcscpy( gzUserDefinedButton[1], New113Message[MSG113_BLOODBAGOPTIONS_YES] ); + wcscpy( gzUserDefinedButton[2], New113Message[MSG113_BLOODBAGOPTIONS_NO] ); + wcscpy( gzUserDefinedButton[3], New113Message[MSG113_BLOODBAGOPTIONS_NO] ); + DoMapMessageBox( MSG_BOX_BASIC_STYLE, zStr, MAP_SCREEN, (MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS | MSG_BOX_BUTTONS_HORIZONTAL_ORIENTATION), SurgeryBeforePatientingRequesterCallback ); + } + else + { + swprintf( zStr, New113Message[MSG113_SURGERY_BEFORE_PATIENT_ASSIGNMENT] ); + DoMapMessageBox( MSG_BOX_BASIC_STYLE, zStr, MAP_SCREEN, MSG_BOX_FLAG_YESNO, SurgeryBeforePatientingRequesterCallback ); + } + } + } +} + void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) { // btn callback handler for assignment region @@ -13832,71 +13901,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) ///////////////////////////////////////////////////////////////////////////////////////// // SANDRO - added check for surgery - if( pSoldier->iHealableInjury >= 100 && gGameOptions.fNewTraitSystem ) // if we can heal at least one life point - { - SOLDIERTYPE * pMedic = NULL; - SOLDIERTYPE * pBestMedic = NULL; - UINT16 cnt; - INT8 bSlot; - - // Find the best doctor - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pMedic = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pMedic++) - { - if ( !(pMedic->bActive) || !(pMedic->bInSector) || ( pMedic->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pMedic->bAssignment == VEHICLE ) ) - continue; // is nowhere around! - - if ( (pSoldier->ubID == pMedic->ubID) || !IS_DOCTOR(pMedic->bAssignment) ) - continue; // cannot make surgery on self or not on the right assignment! - - bSlot = FindMedKit( pMedic ); - if (bSlot == NO_SLOT) - continue;// no medical kit! - - if (pMedic->stats.bLife >= OKLIFE && !(pMedic->bCollapsed) && pMedic->stats.bMedical > 0 && ( NUM_SKILL_TRAITS( pMedic, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery )) - { - if (pBestMedic != NULL) - { - if (NUM_SKILL_TRAITS( pMedic, DOCTOR_NT ) > NUM_SKILL_TRAITS( pBestMedic, DOCTOR_NT )) - pBestMedic = pMedic; - } - else - { - pBestMedic = pMedic; - } - } - } - - if (pBestMedic != NULL) - { - CHAR16 zStr[200]; - pAutomaticSurgeryDoctor = pBestMedic; - pAutomaticSurgeryPatient = pSoldier; - - INT32 healwithout_bloodbag = pAutomaticSurgeryPatient->iHealableInjury * ( gSkillTraitValues.ubDOSurgeryHealPercentBase + gSkillTraitValues.ubDOSurgeryHealPercentOnTop * NUM_SKILL_TRAITS( pAutomaticSurgeryDoctor, DOCTOR_NT ) ) / 10000; - - // Flugente: check whether we have a bloodbag we can use - INT32 healwith_bloodbag = -1; - if ( gSkillTraitValues.ubDOSurgeryHealPercentBloodbag > 0 && pAutomaticSurgeryDoctor->GetObjectWithItemFlag( BLOOD_BAG ) != NULL ) - healwith_bloodbag = pAutomaticSurgeryPatient->iHealableInjury * ( gSkillTraitValues.ubDOSurgeryHealPercentBase + gSkillTraitValues.ubDOSurgeryHealPercentBloodbag + gSkillTraitValues.ubDOSurgeryHealPercentOnTop * NUM_SKILL_TRAITS( pAutomaticSurgeryDoctor, DOCTOR_NT ) ) / 10000; - - if ( healwith_bloodbag > healwithout_bloodbag ) - { - swprintf( zStr, New113Message[MSG113_SURGERY_BEFORE_DOCTOR_ASSIGNMENT_BLOODBAG], pAutomaticSurgeryPatient->GetName(), healwithout_bloodbag, healwith_bloodbag ); - - wcscpy( gzUserDefinedButton[0], New113Message[MSG113_BLOODBAGOPTIONS_YESSTAR] ); - wcscpy( gzUserDefinedButton[1], New113Message[MSG113_BLOODBAGOPTIONS_YES] ); - wcscpy( gzUserDefinedButton[2], New113Message[MSG113_BLOODBAGOPTIONS_NO] ); - wcscpy( gzUserDefinedButton[3], New113Message[MSG113_BLOODBAGOPTIONS_NO] ); - DoMapMessageBox( MSG_BOX_BASIC_STYLE, zStr, MAP_SCREEN, ( MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS | MSG_BOX_BUTTONS_HORIZONTAL_ORIENTATION ), SurgeryBeforePatientingRequesterCallback ); - } - else - { - swprintf( zStr, New113Message[MSG113_SURGERY_BEFORE_PATIENT_ASSIGNMENT] ); - DoMapMessageBox( MSG_BOX_BASIC_STYLE, zStr, MAP_SCREEN, MSG_BOX_FLAG_YESNO, SurgeryBeforePatientingRequesterCallback ); - } - } - } + CheckForSurgery( pSoldier ); ///////////////////////////////////////////////////////////////////////////////////////// } break; @@ -14114,71 +14119,7 @@ void AssignmentMenuBtnCallback( MOUSE_REGION * pRegion, INT32 iReason ) ///////////////////////////////////////////////////////////////////////////////////////// // SANDRO - added check for surgery - if( pSoldier->iHealableInjury >= 100 && gGameOptions.fNewTraitSystem ) // if we can heal at least one life point - { - SOLDIERTYPE * pMedic = NULL; - SOLDIERTYPE * pBestMedic = NULL; - UINT16 cnt; - INT8 bSlot; - - // Find the best doctor - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pMedic = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pMedic++) - { - if ( !(pMedic->bActive) || !(pMedic->bInSector) || ( pMedic->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pMedic->bAssignment == VEHICLE ) ) - continue; // is nowhere around! - - if ( (pSoldier->ubID == pMedic->ubID) || !IS_DOCTOR(pMedic->bAssignment) ) - continue; // cannot make surgery on self or not on the right assignment! - - bSlot = FindMedKit( pMedic ); - if (bSlot == NO_SLOT) - continue;// no medical kit! - - if (pMedic->stats.bLife >= OKLIFE && !(pMedic->bCollapsed) && pMedic->stats.bMedical > 0 && ( NUM_SKILL_TRAITS( pMedic, DOCTOR_NT ) >= gSkillTraitValues.ubDONumberTraitsNeededForSurgery )) - { - if (pBestMedic != NULL) - { - if (NUM_SKILL_TRAITS( pMedic, DOCTOR_NT ) > NUM_SKILL_TRAITS( pBestMedic, DOCTOR_NT )) - pBestMedic = pMedic; - } - else - { - pBestMedic = pMedic; - } - } - } - - if (pBestMedic != NULL) - { - CHAR16 zStr[200]; - pAutomaticSurgeryDoctor = pBestMedic; - pAutomaticSurgeryPatient = pSoldier; - - INT32 healwithout_bloodbag = pAutomaticSurgeryPatient->iHealableInjury * ( gSkillTraitValues.ubDOSurgeryHealPercentBase + gSkillTraitValues.ubDOSurgeryHealPercentOnTop * NUM_SKILL_TRAITS( pAutomaticSurgeryDoctor, DOCTOR_NT ) ) / 10000; - - // Flugente: check whether we have a bloodbag we can use - INT32 healwith_bloodbag = -1; - if ( gSkillTraitValues.ubDOSurgeryHealPercentBloodbag > 0 && pAutomaticSurgeryDoctor->GetObjectWithItemFlag( BLOOD_BAG ) != NULL ) - healwith_bloodbag = pAutomaticSurgeryPatient->iHealableInjury * ( gSkillTraitValues.ubDOSurgeryHealPercentBase + gSkillTraitValues.ubDOSurgeryHealPercentBloodbag + gSkillTraitValues.ubDOSurgeryHealPercentOnTop * NUM_SKILL_TRAITS( pAutomaticSurgeryDoctor, DOCTOR_NT ) ) / 10000; - - if ( healwith_bloodbag > healwithout_bloodbag ) - { - swprintf( zStr, New113Message[MSG113_SURGERY_BEFORE_DOCTOR_ASSIGNMENT_BLOODBAG], pAutomaticSurgeryPatient->GetName(), healwithout_bloodbag, healwith_bloodbag ); - - wcscpy( gzUserDefinedButton[0], New113Message[MSG113_BLOODBAGOPTIONS_YESSTAR] ); - wcscpy( gzUserDefinedButton[1], New113Message[MSG113_BLOODBAGOPTIONS_YES] ); - wcscpy( gzUserDefinedButton[2], New113Message[MSG113_BLOODBAGOPTIONS_NO] ); - wcscpy( gzUserDefinedButton[3], New113Message[MSG113_BLOODBAGOPTIONS_NO] ); - DoMapMessageBox( MSG_BOX_BASIC_STYLE, zStr, MAP_SCREEN, ( MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS | MSG_BOX_BUTTONS_HORIZONTAL_ORIENTATION ), SurgeryBeforePatientingRequesterCallback ); - } - else - { - swprintf( zStr, New113Message[MSG113_SURGERY_BEFORE_PATIENT_ASSIGNMENT] ); - DoMapMessageBox( MSG_BOX_BASIC_STYLE, zStr, MAP_SCREEN, MSG_BOX_FLAG_YESNO, SurgeryBeforePatientingRequesterCallback ); - } - } - } + CheckForSurgery( pSoldier ); ///////////////////////////////////////////////////////////////////////////////////////// } break; From de56f653ec7a65d8bff86d11de174219a3c9092f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:47:00 +0200 Subject: [PATCH 195/571] Use SoldierID --- Laptop/personnel.cpp | 68 +++++++++++---------- Strategic/Assignments.cpp | 33 ++++++----- Strategic/Auto Resolve.cpp | 30 ++++++---- Strategic/Creature Spreading.cpp | 13 ++-- Strategic/Game Init.cpp | 15 ++--- Strategic/Hourly Update.cpp | 48 +++++++-------- Strategic/LuaInitNPCs.cpp | 23 ++++---- Strategic/Map Screen Interface Map.cpp | 12 ++-- Strategic/Map Screen Interface.cpp | 5 +- Strategic/Merc Contract.cpp | 12 ++-- Strategic/MilitiaIndividual.cpp | 37 ++++++------ Strategic/MiniEvents.cpp | 16 ++--- Strategic/PreBattle Interface.cpp | 27 ++++----- Strategic/Queen Command.cpp | 60 +++++++++---------- Strategic/Quests.cpp | 15 +++-- Strategic/Rebel Command.cpp | 28 ++++----- Strategic/Strategic AI.cpp | 12 ++-- Strategic/Strategic Merc Handler.cpp | 32 +++++----- Strategic/Strategic Movement.cpp | 14 ++--- Strategic/Strategic Town Loyalty.cpp | 17 +++--- Strategic/Strategic Transport Groups.cpp | 16 ++--- Strategic/mapscreen.cpp | 29 ++++----- Strategic/strategic.cpp | 6 +- Strategic/strategicmap.cpp | 71 +++++++++++----------- Tactical/Air Raid.cpp | 26 ++++---- Tactical/Boxing.cpp | 7 +-- Tactical/Campaign.cpp | 12 ++-- Tactical/Dialogue Control.cpp | 38 ++++++------ Tactical/DisplayCover.cpp | 5 +- Tactical/Drugs And Alcohol.cpp | 10 ++-- Tactical/DynamicDialogue.cpp | 75 +++++++++++++----------- Tactical/DynamicDialogue.h | 2 +- Tactical/End Game.cpp | 26 ++++---- Tactical/Enemy Soldier Save.cpp | 9 ++- Tactical/Food.cpp | 15 +++-- Tactical/Handle Doors.cpp | 4 +- Tactical/Handle Items.cpp | 11 ++-- Tactical/Handle UI.cpp | 36 ++++++------ 38 files changed, 454 insertions(+), 461 deletions(-) diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 65aabfe2..239b48ef 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -9122,81 +9122,85 @@ void AssignPersonnelWoundsHelpText( INT32 ubProfile ) INT8 CalculateMercsAchievementPercentage( INT32 ubProfile ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt=0; UINT32 uiMercPoints, uiMercPercentage; unsigned long ulTotalMercPoints = 0; // run through active soldiers - for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id) { - pTeamSoldier = MercPtrs[cnt]; + pTeamSoldier = id; // Only count stats of merc (not vehicles) if ( !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pTeamSoldier ) ) { if( pTeamSoldier->bActive && pTeamSoldier->stats.bLife > 0 && pTeamSoldier->ubProfile != 0 ) { + const STRUCT_Records &records = gMercProfiles[pTeamSoldier->ubProfile].records; + // get total value of all mercs, adjust by importance ulTotalMercPoints += - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usLocksPicked ) + ( records.usLocksPicked ) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usLocksBreached ) + ( records.usLocksBreached ) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usTrapsRemoved *3/2) + ( records.usTrapsRemoved *3/2) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usExpDetonated *3/2) + ( records.usExpDetonated *3/2) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usItemsRepaired /2) + ( records.usItemsRepaired /2) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usItemsCombined *2) + ( records.usItemsCombined *2) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usItemsStolen ) + ( records.usItemsStolen ) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usMercsBandaged *3/4) + ( records.usMercsBandaged *3/4) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usSurgeriesMade *3/2) + ( records.usSurgeriesMade *3/2) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usNPCsDiscovered *4/3) + ( records.usNPCsDiscovered *4/3) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usSectorsDiscovered ) + ( records.usSectorsDiscovered ) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.usMilitiaTrained /4) + ( records.usMilitiaTrained /4) + - ( gMercProfiles[ pTeamSoldier->ubProfile ].records.ubQuestsHandled *2) + ( records.ubQuestsHandled *2) + - (gMercProfiles[pTeamSoldier->ubProfile].records.usInterrogations); + ( records.usInterrogations); } } } // Now get points of our mercs - uiMercPoints = - ( gMercProfiles[ ubProfile ].records.usLocksPicked ) + const STRUCT_Records &records = gMercProfiles[ubProfile].records; + uiMercPoints = + ( records.usLocksPicked ) + - ( gMercProfiles[ ubProfile ].records.usLocksBreached ) + ( records.usLocksBreached ) + - ( gMercProfiles[ ubProfile ].records.usTrapsRemoved *3/2) + ( records.usTrapsRemoved *3/2) + - ( gMercProfiles[ ubProfile ].records.usExpDetonated *3/2) + ( records.usExpDetonated *3/2) + - ( gMercProfiles[ ubProfile ].records.usItemsRepaired /2) + ( records.usItemsRepaired /2) + - ( gMercProfiles[ ubProfile ].records.usItemsCombined *2) + ( records.usItemsCombined *2) + - ( gMercProfiles[ ubProfile ].records.usItemsStolen ) + ( records.usItemsStolen ) + - ( gMercProfiles[ ubProfile ].records.usMercsBandaged *3/4) + ( records.usMercsBandaged *3/4) + - ( gMercProfiles[ ubProfile ].records.usSurgeriesMade *3/2) + ( records.usSurgeriesMade *3/2) + - ( gMercProfiles[ ubProfile ].records.usNPCsDiscovered *4/3) + ( records.usNPCsDiscovered *4/3) + - ( gMercProfiles[ ubProfile ].records.usSectorsDiscovered ) + ( records.usSectorsDiscovered ) + - ( gMercProfiles[ ubProfile ].records.usMilitiaTrained /4) + ( records.usMilitiaTrained /4) + - ( gMercProfiles[ ubProfile ].records.ubQuestsHandled *2) + ( records.ubQuestsHandled *2) + - ( gMercProfiles[ubProfile].records.usInterrogations ); + ( records.usInterrogations ); // Calculate percentage if( ulTotalMercPoints != 0 ) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 3df48d31..afac13f5 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -18407,12 +18407,12 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn BOOLEAN IsAnyOneOnPlayersTeamOnThisAssignment( INT8 bAssignment ) { - SOLDIERTYPE *pSoldier = NULL; - - for( INT32 iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++iCounter ) + SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for( ; id <= lastid; ++id) { // get the current soldier - pSoldier = &Menptr[ iCounter ]; + SOLDIERTYPE *pSoldier = id; // active? if( pSoldier->bActive == FALSE ) @@ -18443,7 +18443,6 @@ void RebuildAssignmentsBox( void ) void BandageBleedingDyingPatientsBeingTreated( ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; SOLDIERTYPE *pDoctor = NULL; INT32 iKitSlot; @@ -18452,10 +18451,10 @@ void BandageBleedingDyingPatientsBeingTreated( ) UINT32 uiKitPtsUsed; BOOLEAN fSomeoneStillBleedingDying = FALSE; - for( iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) + for( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id ) { // get the soldier - pSoldier = &Menptr[ iCounter ]; + pSoldier = id; // check if the soldier is currently active? if( pSoldier->bActive == FALSE ) @@ -19601,9 +19600,11 @@ void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ) fSomethingWasRepairedThisPass = FALSE; // look for jammed guns on other soldiers in sector and unjam them - for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { - pOtherSoldier = MercPtrs[ bLoop ]; + pOtherSoldier = id; // check character is valid, alive, same sector, not between, has inventory, etc. if ( CanCharacterRepairAnotherSoldiersStuff( pSoldier, pOtherSoldier ) ) @@ -19621,9 +19622,11 @@ void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft ) pBestOtherSoldier = NULL; // now look for items to repair on other mercs - for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; id <= lastid; ++id ) { - pOtherSoldier = MercPtrs[ bLoop ]; + pOtherSoldier = id; // check character is valid, alive, same sector, not between, has inventory, etc. if ( CanCharacterRepairAnotherSoldiersStuff( pSoldier, pOtherSoldier ) ) @@ -22806,11 +22809,11 @@ BOOLEAN MercStaffsMilitaryHQ() return TRUE; SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + for ( ; id <= lastid; ++id) { + pSoldier = id; if( pSoldier && pSoldier->bAssignment == FACILITY_STRATEGIC_MILITIA_MOVEMENT && pSoldier->flags.fMercAsleep == FALSE ) { return TRUE; diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index c5e0010f..f19dd2c9 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -1852,11 +1852,14 @@ void RenderAutoResolve() case BATTLE_SURRENDERED: case BATTLE_CAPTURED: - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + { + SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; id <= lastid; ++id ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = id; - if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) ) + if ( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) ) { //Merc is active and alive, and not a vehicle or robot if ( PlayerMercInvolvedInThisCombat( pSoldier ) ) { @@ -1866,17 +1869,18 @@ void RenderAutoResolve() } } HandleMoraleEvent( NULL, MORALE_HEARD_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); - if( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); - #ifdef NEWMUSIC - GlobalSoundID = MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0]; - if ( MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0] != -1 ) - SetMusicModeID( MUSIC_TACTICAL_DEATH, MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalDeath[0] ); + if ( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); +#ifdef NEWMUSIC + GlobalSoundID = MusicSoundValues[SECTOR( gpAR->ubSectorX, gpAR->ubSectorY )].SoundTacticalDeath[0]; + if ( MusicSoundValues[SECTOR( gpAR->ubSectorX, gpAR->ubSectorY )].SoundTacticalDeath[0] != -1 ) + SetMusicModeID( MUSIC_TACTICAL_DEATH, MusicSoundValues[SECTOR( gpAR->ubSectorX, gpAR->ubSectorY )].SoundTacticalDeath[0] ); else - #endif - SetMusicMode( MUSIC_TACTICAL_DEATH ); +#endif + SetMusicMode( MUSIC_TACTICAL_DEATH ); gsEnemyGainedControlOfSectorID = (INT16)SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ); break; + } case BATTLE_DEFEAT: HandleMoraleEvent( NULL, MORALE_HEARD_BATTLE_LOST, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); @@ -5959,9 +5963,11 @@ void CheckForSoldiersWhoRetreatedIntoMilitiaHeldSectors() (!gTacticalStatus.fEnemyInSector)) { unsigned mercCnt = 0; - for( int i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) + SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; + const SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; id <= lastid; ++id ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) ) { diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index 1bd1c033..e55ca1f2 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -1676,9 +1676,9 @@ void DetermineCreatureTownCompositionBasedOnTacticalInformation( UINT16 *pubNumC *pubNumCreatures = 0; pSector->ubNumCreatures = 0; pSector->ubCreaturesInBattle = 0; - for( INT32 i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { switch( pSoldier->ubBodyType ) @@ -1712,9 +1712,9 @@ void DetermineOtherCreatureTownCompositionBasedOnTacticalInformation( UINT16* pu *pubNumCreatures = 0; pSector->ubNumCreatures = 0; pSector->ubCreaturesInBattle = 0; - for ( INT32 i = gTacticalStatus.Team[CREATURE_TEAM].bFirstID; i <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; ++i ) + for ( SoldierID i = gTacticalStatus.Team[CREATURE_TEAM].bFirstID; i <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; ++i ) { - pSoldier = MercPtrs[i]; + pSoldier = i; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { if ( pSoldier->IsZombie() ) @@ -2243,7 +2243,6 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine() { CREATURE_DIRECTIVE *curr; SOLDIERTYPE *pSoldier; - INT32 i; INT16 sSectorX, sSectorY; INT8 bSectorZ; @@ -2261,9 +2260,9 @@ BOOLEAN PlayerGroupIsInACreatureInfestedMine() bSectorZ = (INT8)curr->pLevel->ubSectorZ; //Loop through all the creature directives (mine sectors that are infectible) and //see if players are there. - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife && pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index c47c0578..250cb79f 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -842,19 +842,14 @@ fFirstTimeInMapScreen = TRUE; BOOLEAN AnyMercsHired( ) { - INT32 cnt; - SOLDIERTYPE *pTeamSoldier; - INT16 bLastTeamID; - - // Find first guy availible in team - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + // Find first guy available in team + SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) + for ( ; id <= bLastTeamID; ++id) { - if ( pTeamSoldier->bActive ) + if ( id->bActive ) { return( TRUE ); } diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index f6e3386e..b6b91ef9 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -361,18 +361,18 @@ UINT16 LarryItems[ NUM_LARRY_ITEMS ][ 3 ] = void HourlyLarryUpdate() { - SOLDIERTYPE * pSoldier = NULL; - SOLDIERTYPE * pOtherSoldier = NULL; - INT8 bSlot = NO_SLOT, bBoozeSlot; - UINT16 usTemptation = 0; - UINT16 usCashAmount; - BOOLEAN fBar = FALSE; - OBJECTTYPE* pObj = NULL; - BOOLEAN fTookDrugs = FALSE; + SOLDIERTYPE *pSoldier = NULL; + SOLDIERTYPE *pOtherSoldier = NULL; + INT8 bSlot = NO_SLOT, bBoozeSlot; + UINT16 usTemptation = 0; + UINT16 usCashAmount; + BOOLEAN fBar = FALSE; + OBJECTTYPE* pObj = NULL; + BOOLEAN fTookDrugs = FALSE; - for( UINT32 cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt ) + for( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = id; if ( pSoldier && pSoldier->bActive && !pSoldier->flags.fMercAsleep && ( pSoldier->ubProfile == LARRY_NORMAL || pSoldier->ubProfile == LARRY_DRUNK || pSoldier->HasBackgroundFlag( BACKGROUND_DRUGUSE ) ) ) { @@ -484,9 +484,9 @@ void HourlyLarryUpdate() { // anv: snitches stop mercs from getting wasted BOOLEAN fSnitchStoppedBehaviour = FALSE; - for( INT32 cnt2 = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt2 ) + for( SoldierID id2 = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id2 <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id2 ) { - pOtherSoldier = MercPtrs[ cnt2 ]; + pOtherSoldier = id2; // note - snitches stop others, but can get wasted themselves (if they have drug use specifically set in background...) if( pOtherSoldier && !pOtherSoldier->flags.fBetweenSectors && pOtherSoldier->bActive && !pOtherSoldier->flags.fMercAsleep && pSoldier->ubProfile != pOtherSoldier->ubProfile ) { @@ -612,12 +612,12 @@ void HourlyLarryUpdate() // Flugente: mercs that are smokers occasionally consume smokes if they have some in their inventory void HourlySmokerUpdate( ) { - SOLDIERTYPE * pSoldier = NULL; - OBJECTTYPE* pObj = NULL; + SOLDIERTYPE *pSoldier = NULL; + OBJECTTYPE *pObj = NULL; - for ( UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) + for ( SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; id <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++id ) { - pSoldier = MercPtrs[cnt]; + pSoldier = id; if ( pSoldier && pSoldier->bActive && !pSoldier->flags.fMercAsleep ) { @@ -647,9 +647,9 @@ void HourlyDisabilityUpdate( ) SOLDIERTYPE* pSoldier = NULL; SOLDIERTYPE* pOtherSoldier = NULL; - for ( UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) + for ( SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; id <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++id ) { - pSoldier = MercPtrs[cnt]; + pSoldier = id; if ( pSoldier && pSoldier->bActive ) { @@ -664,9 +664,9 @@ void HourlyDisabilityUpdate( ) { // anv: snitches stop mercs from getting wasted BOOLEAN fSnitchStoppedBehaviour = FALSE; - for ( INT32 cnt2 = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt2 <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt2 ) + for ( SoldierID id2 = gTacticalStatus.Team[OUR_TEAM].bFirstID; id2 <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++id2 ) { - pOtherSoldier = MercPtrs[cnt2]; + pOtherSoldier = id2; // note - snitches stop others, but can get wasted themselves (if they have drug use specifically set in background...) if ( pOtherSoldier && !pOtherSoldier->flags.fBetweenSectors && pOtherSoldier->bActive && !pOtherSoldier->flags.fMercAsleep && pSoldier->ubProfile != pOtherSoldier->ubProfile ) @@ -760,9 +760,9 @@ void HourlyStealUpdate() SOLDIERTYPE * pSoldier = NULL; SOLDIERTYPE * pOtherSoldier = NULL; - for( INT32 cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt ) + for( SoldierID cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; // merc must be alive, not travelling and awake. If he is in the currently loaded sector, we may not be in tactical (we would see an item suddenly disappearing) and not in combat if ( pSoldier @@ -794,9 +794,9 @@ void HourlyStealUpdate() // anv: snitches prevent scrounging in the same sector BOOLEAN fSnitchStoppedBehaviour = FALSE; - for ( UINT32 cnt2 = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt2 <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt2 ) + for ( SoldierID cnt2 = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt2 <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt2 ) { - pOtherSoldier = MercPtrs[cnt2]; + pOtherSoldier = cnt2; // note - snitches stop others, but can scrounge themselves (if they have scrounging specifically set in background...) if ( pOtherSoldier diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index ee32f9e8..5a0141f2 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -2953,17 +2953,14 @@ SOLDIERTYPE * FindSoldierByProfileID_( UINT8 ubProfileID ) SOLDIERTYPE * FindSoldierByProfileID2( UINT8 ubProfileID, BOOLEAN fPlayerMercsOnly ) { - UINT16 cnt2, ubLoopLimit; - SOLDIERTYPE * pSoldier; + SoldierID soldier = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[CIV_TEAM].bLastID; - ubLoopLimit = gTacticalStatus.Team[CIV_TEAM].bLastID; - - cnt2 = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt2 ]; cnt2 <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt2++ ,pSoldier++) + for ( ; soldier <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++soldier) { - if ( pSoldier->bActive && pSoldier->bInSector ) + if ( soldier->bActive && soldier->bInSector ) { - return( pSoldier ); + return( soldier ); } } return( NULL ); @@ -5977,7 +5974,6 @@ return 0; static int l_ActionInProgress(lua_State *L) { - UINT16 cnt2; SOLDIERTYPE * pSoldier; if (lua_gettop(L) >= 2) @@ -5995,9 +5991,10 @@ static int l_ActionInProgress(lua_State *L) } else { - cnt2 = gTacticalStatus.Team[CIV_TEAM].bFirstID; - for (pSoldier = MercPtrs[cnt2]; cnt2 <= gTacticalStatus.Team[CIV_TEAM].bLastID; cnt2++, pSoldier++) + SoldierID cnt2 = gTacticalStatus.Team[CIV_TEAM].bFirstID; + for ( ; cnt2 <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt2) { + pSoldier = cnt2; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->ubProfile == NO_PROFILE) { pSoldier->aiData.bActionInProgress = ExecuteAction(pSoldier); @@ -7623,9 +7620,9 @@ static int l_SetEnterCombatMode (lua_State *L) return 0; SOLDIERTYPE* pGoon = NULL; - for ( UINT16 ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) + for ( SoldierID ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++ubLoop) { - pGoon = MercPtrs[ ubLoop ]; + pGoon = ubLoop; if ( pGoon->ubCivilianGroup == group && pGoon->bActive && pGoon->bInSector && pGoon->stats.bLife >= OKLIFE && pGoon->aiData.bOppList[ ubID ] == SEEN_CURRENTLY ) { MakeCivHostile(pGoon); diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 41e11cda..46332334 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -6948,19 +6948,15 @@ UINT32 WhatPlayerKnowsAboutEnemiesInSector( INT16 sSectorX, INT16 sSectorY ) BOOLEAN CanMercsScoutThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { - INT32 iFirstId = 0, iLastId = 0; - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - // to speed it up a little? - iFirstId = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - iLastId = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - - for( iCounter = iFirstId; iCounter <= iLastId; iCounter++ ) + SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + const SoldierID iLastId = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + for( ; id <= iLastId; ++id ) { // get the soldier - pSoldier = &Menptr[ iCounter ]; + pSoldier = id; // is the soldier active if( pSoldier->bActive == FALSE ) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 8e51fa4c..42c65f78 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -6173,7 +6173,7 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber ( !pSoldier->flags.fBetweenSectors ) && gMercProfiles[ ELDIN ].bMercStatus != MERC_IS_DEAD ) { //DBrot: More Rooms - UINT16 /*ubRoom,*/ cnt; + SoldierID /*ubRoom,*/ cnt; UINT16 usRoom; SOLDIERTYPE * pSoldier2; @@ -6181,8 +6181,9 @@ BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbErrorNumber { cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier2 = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier2++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt) { + pSoldier2 = cnt; if ( pSoldier2->bActive ) { if ( FindObj( pSoldier2, CHALICE ) != ITEM_NOT_FOUND ) diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index 848213e9..c8a85fdd 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -742,16 +742,12 @@ BOOLEAN WillMercRenew( SOLDIERTYPE *pSoldier, BOOLEAN fSayQuote ) void HandleBuddiesReactionToFiringMerc(SOLDIERTYPE *pFiredSoldier, INT8 bMoraleEvent ) { - UINT16 bMercID; - UINT16 bLastTeamID; - SOLDIERTYPE * pSoldier; - - - bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + SoldierID bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs to find buddies - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) + for ( ; bMercID <= bLastTeamID; ++bMercID) { + SOLDIERTYPE *pSoldier = bMercID; //if the merc is active, in Arulco, not POW and is a buddy if ( WhichBuddy(pSoldier->ubProfile,pFiredSoldier->ubProfile) != (-1) && pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && diff --git a/Strategic/MilitiaIndividual.cpp b/Strategic/MilitiaIndividual.cpp index d40759af..bc950bf8 100644 --- a/Strategic/MilitiaIndividual.cpp +++ b/Strategic/MilitiaIndividual.cpp @@ -282,9 +282,9 @@ void UpdateMilitia( MILITIA aMilitia ) SOLDIERTYPE* GetUsedSoldierToIndividualMilitia( UINT32 aMilitiaId ) { - for ( UINT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; ++cnt ) { - SOLDIERTYPE *pSoldier = MercPtrs[cnt]; + SOLDIERTYPE *pSoldier = cnt; if ( pSoldier && pSoldier->bActive && pSoldier->usIndividualMilitiaID == aMilitiaId ) { return pSoldier; @@ -300,11 +300,11 @@ void ApplyTacticalLifeRatioToMilitia() if ( !gGameExternalOptions.fIndividualMilitia ) return; - SOLDIERTYPE* pSoldier; - UINT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; - INT32 lastid = gTacticalStatus.Team[MILITIA_TEAM].bLastID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[MILITIA_TEAM].bLastID; + for ( ; cnt < lastid; ++cnt ) { + SOLDIERTYPE *pSoldier = cnt; MILITIA militia; if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLifeMax && GetMilitia( pSoldier->usIndividualMilitiaID, &militia ) ) { @@ -326,11 +326,11 @@ void ApplyMilitiaHealthRatioToTactical() if ( !gGameExternalOptions.fIndividualMilitia || !gGameExternalOptions.fIndividualMilitia_ManageHealth ) return; - SOLDIERTYPE* pSoldier; - UINT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; - INT32 lastid = gTacticalStatus.Team[MILITIA_TEAM].bLastID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[MILITIA_TEAM].bLastID; + for ( ; cnt < lastid; ++cnt ) { + SOLDIERTYPE *pSoldier = cnt; MILITIA militia; if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLifeMax && GetMilitia( pSoldier->usIndividualMilitiaID, &militia ) ) { @@ -696,12 +696,12 @@ UINT32 GetIdOfUnusedIndividualMilitia( UINT8 aSoldierClass, UINT8 aSector ) // fitting data found - now we have to make sure this one isn't already in use BOOLEAN found = FALSE; - SOLDIERTYPE* pSoldier; - - INT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; - INT32 lastid = gTacticalStatus.Team[MILITIA_TEAM].bLastID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[MILITIA_TEAM].bLastID; + for ( ; cnt < lastid; ++cnt ) { + SOLDIERTYPE *pSoldier = cnt; + if ( pSoldier && pSoldier->bActive && ( *it ).id == pSoldier->usIndividualMilitiaID && IsLegalMilitiaId( pSoldier->usIndividualMilitiaID ) ) { found = TRUE; @@ -853,10 +853,11 @@ FLOAT PromoteIndividualMilitiaInSector( UINT8 aSector, FLOAT aPointsToAdd ) { BOOLEAN changesnecessary = FALSE; - SOLDIERTYPE* pSoldier = NULL; - int cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[MILITIA_TEAM].bLastID; + for ( ; cnt < lastid; ++cnt ) { + SOLDIERTYPE *pSoldier = cnt; MILITIA militia; if ( pSoldier && GetMilitia( pSoldier->usIndividualMilitiaID, &militia ) ) diff --git a/Strategic/MiniEvents.cpp b/Strategic/MiniEvents.cpp index 88516ea3..21e4660e 100644 --- a/Strategic/MiniEvents.cpp +++ b/Strategic/MiniEvents.cpp @@ -1089,9 +1089,9 @@ namespace MiniEventHelpers INT16 x = 0; INT16 y = 0; INT8 z = 0; - for (UINT32 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - const SOLDIERTYPE* merc = MercPtrs[i]; + const SOLDIERTYPE* merc = i; if (merc && merc->ubProfile == profileId) { x = merc->sSectorX; @@ -1519,9 +1519,9 @@ void MiniEventsLua(UINT32 eventId) gAllMercs.clear(); // get all mercs eligible to get a mini event - for (UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt) + for (SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt) { - SOLDIERTYPE* pSoldier = MercPtrs[ cnt ]; + SOLDIERTYPE* pSoldier = cnt; if (pSoldier && pSoldier->bActive && pSoldier->stats.bLife > 0 @@ -1542,9 +1542,9 @@ void MiniEventsLua(UINT32 eventId) // second param: a table containing basic info about all of the player's mercs ({ nickname = profileid }) f.TableOpen(); - for (UINT32 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for (SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - const SOLDIERTYPE* merc = MercPtrs[i]; + const SOLDIERTYPE* merc = i; if (merc && merc->bActive && merc->bAssignment != IN_TRANSIT && !(merc->flags.uiStatusFlags & SOLDIER_VEHICLE) && !(AM_A_ROBOT(merc))) { std::wstring ws(gMercProfiles[merc->ubProfile].zNickname); @@ -1561,9 +1561,9 @@ void MiniEventsLua(UINT32 eventId) LuaFunction f = LuaFunction(gLS, "BeginRandomEvent"); // first param: a table containing basic info about all of the player's mercs ({ nickname = profileid }) f.TableOpen(); - for (UINT32 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - const SOLDIERTYPE* merc = MercPtrs[i]; + const SOLDIERTYPE* merc = i; if (merc && merc->bActive && merc->bAssignment != IN_TRANSIT && !(merc->flags.uiStatusFlags & SOLDIER_VEHICLE) && !(AM_A_ROBOT(merc))) { std::wstring ws(gMercProfiles[merc->ubProfile].zNickname); diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 73bb1cd8..30d8f540 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -296,7 +296,6 @@ FLOAT gAmbushRadiusModifier = 1.0f; void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) { VOBJECT_DESC VObjectDesc; - INT32 i; UINT8 ubGroupID = 0; UINT16 ubNumStationaryEnemies = 0; UINT16 ubNumMobileEnemies = 0; @@ -600,9 +599,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) //Count the number of players involved or not involved in this battle guiNumUninvolved = 0; guiNumInvolved = 0; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if ( PlayerMercInvolvedInThisCombat( pSoldier ) ) @@ -889,9 +888,9 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) // SANDRO - merc records - ambush experienced if ( GetEnemyEncounterCode() == ENEMY_AMBUSH_CODE || GetEnemyEncounterCode() == BLOODCAT_AMBUSH_CODE || GetEnemyEncounterCode() == ENEMY_AMBUSH_DEPLOYMENT_CODE || fAmbushPrevented ) { - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if ( PlayerMercInvolvedInThisCombat( pSoldier ) && pSoldier->ubProfile != NO_PROFILE ) @@ -1577,9 +1576,9 @@ void RenderPreBattleInterface() // | NAME | ASSIGN | COND | HP | BP | line = 0; y = TOP_Y + TOP_Y_TEXT_BUFFER - bListOffset; - for( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++) + for( SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; id <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++id) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if( PlayerMercInvolvedInThisCombat( pSoldier ) ) @@ -1623,9 +1622,9 @@ void RenderPreBattleInterface() { pGroup = gpGroupList; y = TOP_Y + TOP_Y_TEXT_BUFFER + ubUninvolvedStartY + UNINVOLVED_RELEVANT_HEIGHT - bListOffset; - for( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++ ) + for( SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; id <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++id ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if( !PlayerMercInvolvedInThisCombat(pSoldier) ) @@ -1816,9 +1815,9 @@ void RetreatMercsCallback( GUI_BUTTON *btn, INT32 reason ) { ///////////////////////////////////////////////////////////////////////////////// // SANDRO - merc records - times retreated counter - for( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { if ( PlayerMercInvolvedInThisCombat( pSoldier ) && pSoldier->ubProfile != NO_PROFILE ) @@ -2558,12 +2557,10 @@ BOOLEAN CurrentBattleSectorIs( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) void CheckForRobotAndIfItsControlled( void ) { - INT32 i; - // search for the robot on player's team - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife && AM_A_ROBOT( pSoldier )) { // check whether it has a valid controller with it. This sets its ubRobotRemoteHolderID field. diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 1ee6eaef..0841d470 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -103,13 +103,13 @@ void ValidateEnemiesHaveWeapons() { #ifdef JA2BETAVERSION SGPRect CenteringRect= {0 + xResOffset, 0, SCREEN_WIDTH - xResOffset, SCREEN_HEIGHT }; - INT32 i, iErrorDialog; + INT32 iErrorDialog; SOLDIERTYPE *pSoldier; INT32 iNumInvalid = 0; - for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( !pSoldier->bActive || !pSoldier->bInSector ) { continue; @@ -287,11 +287,12 @@ UINT16 NumPlayerTeamMembersInSector( INT16 sSectorX, INT16 sSectorY, INT8 sSecto { UINT16 teammemberspresent = 0; - SOLDIERTYPE* pTeamSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pTeamSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pTeamSoldier++ ) + SOLDIERTYPE *pTeamSoldier = NULL; + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pTeamSoldier = bMercID; // we test several conditions before we allow adding an opinion // other merc must be active, have a profile, be someone else and not be in transit or dead if ( pTeamSoldier->bActive && !pTeamSoldier->flags.fBetweenSectors && pTeamSoldier->stats.bLife > 0 && !(pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && @@ -505,7 +506,6 @@ void GetNumberOfEnemiesInSector( INT16 sSectorX, INT16 sSectorY, UINT16 *pubNumA void EndTacticalBattleForEnemy() { GROUP *pGroup; - INT32 i; //Clear enemies in battle for all stationary groups in the sector. if( gbWorldSectorZ > 0 ) @@ -558,15 +558,15 @@ void EndTacticalBattleForEnemy() //Check to see if any of our mercs have abandoned the militia during a battle. This is cause for a rather //severe loyalty blow. - for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE ) { //found one live militia, so look for any enemies/creatures. // NOTE: this is relying on ENEMY_TEAM being immediately followed by CREATURE_TEAM - for(UINT16 j = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; j <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++i ) + for( SoldierID j = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; j <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++j ) { - SOLDIERTYPE *pEnemy = MercPtrs[j]; + SOLDIERTYPE *pEnemy = j; if( pEnemy->bActive && pEnemy->bInSector && pEnemy->stats.bLife >= OKLIFE ) { //confirmed at least one enemy here, so do the loyalty penalty. HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_ABANDON_MILITIA, gWorldSectorX, gWorldSectorY, 0 ); @@ -583,9 +583,9 @@ UINT16 NumFreeSlots( UINT8 ubTeam ) UINT16 ubNumFreeSlots = 0; //Count the number of free enemy slots. It is possible to have multiple groups exceed the maximum. - for ( INT32 i = gTacticalStatus.Team[ubTeam].bFirstID; i <= gTacticalStatus.Team[ubTeam].bLastID; ++i ) + for ( SoldierID i = gTacticalStatus.Team[ubTeam].bFirstID; i <= gTacticalStatus.Team[ubTeam].bLastID; ++i ) { - if ( !Menptr[i].bActive ) + if ( !i->bActive ) ++ubNumFreeSlots; } @@ -2106,14 +2106,14 @@ void AddPossiblePendingEnemiesToBattle() void NotifyPlayersOfNewEnemies() { - INT32 iSoldiers, iChosenSoldier, i; + INT32 iSoldiers, iChosenSoldier; SOLDIERTYPE *pSoldier; BOOLEAN fIgnoreBreath = FALSE; iSoldiers = 0; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { //find a merc that is aware. - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) { iSoldiers++; @@ -2123,9 +2123,9 @@ void NotifyPlayersOfNewEnemies() { // look for an out of breath merc. fIgnoreBreath = TRUE; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { //find a merc that is aware. - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { iSoldiers++; @@ -2135,9 +2135,9 @@ void NotifyPlayersOfNewEnemies() if( iSoldiers ) { iChosenSoldier = Random( iSoldiers ); - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { //find a merc that is aware. - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bInSector && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && ( ( pSoldier->bBreath >= OKBREATH ) || fIgnoreBreath ) ) { @@ -2969,13 +2969,13 @@ BOOLEAN PlayerSectorDefended( UINT8 ubSectorID ) BOOLEAN OnlyHostileCivsInSector() { SOLDIERTYPE *pSoldier; - INT32 i; + SoldierID i; BOOLEAN fHostileCivs = FALSE; //Look for any hostile civs. - for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; i++ ) + for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { if( !pSoldier->aiData.bNeutral ) @@ -2990,9 +2990,9 @@ BOOLEAN OnlyHostileCivsInSector() return FALSE; } //Look for anybody else hostile. If found, return FALSE immediately. - for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; i++ ) + for( i = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; i <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { if( !pSoldier->aiData.bNeutral ) @@ -3001,9 +3001,9 @@ BOOLEAN OnlyHostileCivsInSector() } } } - for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; i++ ) + for( i = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { if( !pSoldier->aiData.bNeutral ) @@ -3012,9 +3012,9 @@ BOOLEAN OnlyHostileCivsInSector() } } } - for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ ) + for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife ) { if( !pSoldier->aiData.bNeutral ) diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index c125bda6..3606eca6 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -394,7 +394,7 @@ BOOLEAN PCInSameRoom( UINT8 ubProfileID ) //DBrot: More Rooms //UINT8 ubRoom; UINT16 usRoom; - UINT16 bLoop; + SoldierID bLoop; SOLDIERTYPE * pSoldier; pNPC = FindSoldierByProfileID( ubProfileID, FALSE ); @@ -404,9 +404,9 @@ BOOLEAN PCInSameRoom( UINT8 ubProfileID ) } usRoom = gusWorldRoomInfo[ pNPC->sGridNo ]; - for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLoop++ ) + for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) { - pSoldier = MercPtrs[ bLoop ]; + pSoldier = bLoop; if ( pSoldier && pSoldier->bActive && pSoldier->bInSector ) { if ( gusWorldRoomInfo[ pSoldier->sGridNo ] == usRoom ) @@ -536,12 +536,11 @@ BOOLEAN FemalePresent( UINT8 ubProfileID ) BOOLEAN CheckPlayerHasHead( void ) { - UINT16 bLoop; SOLDIERTYPE * pSoldier; - for ( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; bLoop++ ) + for ( SoldierID bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) { - pSoldier = MercPtrs[ bLoop ]; + pSoldier = bLoop; if ( pSoldier->bActive && pSoldier->stats.bLife > 0 ) { @@ -1714,9 +1713,9 @@ void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpR { ScreenMsg( FONT_MCOLOR_LTBLUE, MSG_TESTVERSION, L"QUEST COMPLETED - Adding to merc records and awarding experiences (%d).", (bExpReward * gGameExternalOptions.usAwardSpecialExpForQuests) ); - for ( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) + for ( SoldierID i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife >= CONSCIOUSNESS && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && pSoldier->ubProfile != NO_PROFILE && pSoldier->sSectorX == sQuestSectorX && pSoldier->sSectorY == sQuestsSectorY && !pSoldier->flags.fBetweenSectors && pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD && gMercProfiles[ pSoldier->ubProfile ].ubBodyType != 21 ) // != ROBOTNOWEAPON ) diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index 1688ea83..67e32bec 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -2178,9 +2178,9 @@ BOOLEAN SetupMissionAgentBox(UINT16 x, UINT16 y, INT8 index) // temp/fixme std::vector mercs; - for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - SOLDIERTYPE* pSoldier = MercPtrs[i]; + SOLDIERTYPE* pSoldier = i; if (pSoldier && pSoldier->bActive && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) @@ -2823,9 +2823,9 @@ void PrepareMission(INT8 index) // confirmation popup std::vector mercs; - for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - SOLDIERTYPE* pSoldier = MercPtrs[i]; + SOLDIERTYPE* pSoldier = i; if (pSoldier && pSoldier->bActive && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) @@ -2988,9 +2988,9 @@ void PrepareMission(INT8 index) if (!evt.sentGenericRebelAgent) { - for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - SOLDIERTYPE* pSoldier = MercPtrs[i]; + SOLDIERTYPE* pSoldier = i; if (pSoldier->ubProfile == evt.mercProfileId) { TakeSoldierOutOfVehicle(pSoldier); @@ -4908,9 +4908,9 @@ void HandleStrategicEvent(const UINT32 eventParam) // make sure the merc's still on our team BOOLEAN foundMerc = FALSE; - for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - const SOLDIERTYPE* pSoldier = MercPtrs[i]; + const SOLDIERTYPE* pSoldier = i; if (pSoldier->ubProfile == evt1.mercProfileId && pSoldier->bActive) { @@ -4979,9 +4979,9 @@ void HandleStrategicEvent(const UINT32 eventParam) if (!evt1.sentGenericRebelAgent) { - for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - SOLDIERTYPE* pSoldier = MercPtrs[i]; + SOLDIERTYPE* pSoldier = i; if (pSoldier->ubProfile == evt1.mercProfileId) { if (mission == RCAM_FORGE_TRANSPORT_ORDERS) @@ -5006,9 +5006,9 @@ void HandleStrategicEvent(const UINT32 eventParam) { if (!evt1.sentGenericRebelAgent && foundMerc) { - for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - SOLDIERTYPE* pSoldier = MercPtrs[i]; + SOLDIERTYPE* pSoldier = i; if (pSoldier->ubProfile == evt1.mercProfileId) { // mission failed! we tried, give some pity exp @@ -5028,9 +5028,9 @@ void HandleStrategicEvent(const UINT32 eventParam) if (!evt1.sentGenericRebelAgent && foundMerc) { - for (UINT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - SOLDIERTYPE* pSoldier = MercPtrs[i]; + SOLDIERTYPE* pSoldier = i; if (pSoldier->ubProfile == evt1.mercProfileId) { // merc ready for reassignment diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index 8fbed770..91f80588 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -912,7 +912,6 @@ void RemovePlayersFromAllMismatchGroups( SOLDIERTYPE *pSoldier ) #ifdef JA2BETAVERSION void ValidatePlayersAreInOneGroupOnly() { - INT32 i; INT32 iGroups; INT32 iMismatches; INT32 iNumErrors; @@ -923,10 +922,10 @@ void ValidatePlayersAreInOneGroupOnly() UINT8 ubGroupID; //Go through each merc slot in the player team iNumErrors = 0; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { //check to see if the merc has a group ID - pSoldier = MercPtrs[ i ]; + pSoldier = i; if( !pSoldier || !pSoldier->bActive || !pSoldier->stats.bLife || !pSoldier->ubGroupID ) { //non-existant, dead, or in no group (don't care, skip to next merc) @@ -4107,13 +4106,12 @@ BOOLEAN LoadStrategicAI( HWFILE hFile ) } else { //We are in the basement sector, relocate queen to proper position. - INT32 i; - for( i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; i <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++i ) { - if( MercPtrs[ i ]->ubProfile == QUEEN ) + if( i->ubProfile == QUEEN ) { //Found queen, relocate her to 16866 BumpAnyExistingMerc( 16866 ); - TeleportSoldier( MercPtrs[ i ], 16866, TRUE ); + TeleportSoldier( i, 16866, TRUE ); break; } } diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index f510e653..8f8a0790 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -184,8 +184,8 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ) // MercDailyUpdate() gets called every day at midnight. If something is to happen to a merc that day, add an event for it. void MercDailyUpdate() { - INT32 cnt; - UINT16 bLastTeamID; + SoldierID id; + SoldierID bLastTeamID; SOLDIERTYPE *pSoldier; //SOLDIERTYPE *pQuitList[ 21 ]; MERCPROFILESTRUCT *pProfile; @@ -217,12 +217,13 @@ void MercDailyUpdate() AddSameDayStrategicEvent( EVENT_BEGIN_CONTRACT_RENEWAL_SEQUENCE, MERC_ARRIVE_TIME_SLOT_2, 0 ); AddSameDayStrategicEvent( EVENT_BEGIN_CONTRACT_RENEWAL_SEQUENCE, MERC_ARRIVE_TIME_SLOT_3, 0 ); - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop though all the mercs - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; ++cnt,++pSoldier) + for ( ; id <= bLastTeamID; ++id) { + pSoldier = id; //if the merc is active if ( ( pSoldier->bActive )&&( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != IN_TRANSIT ) ) { @@ -374,11 +375,10 @@ void MercDailyUpdate() } } - //r eset the counter - cnt = 0; - - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + //reset the counter + for ( id = 0; id <= bLastTeamID; ++id ) { + pSoldier = id; //if the merc is active if ( ( pSoldier->bActive )&&( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != IN_TRANSIT ) ) { @@ -402,7 +402,7 @@ void MercDailyUpdate() // WANNE: Only send mails from the original 1.13 merc, and not from the wildfire merc, // otherwise we get wrong mails cause of hardcoded Email.edt structure!!!!! UINT16 numOriginalProfiles = 255; - for( cnt = 0; cnt < numOriginalProfiles; ++cnt) + for( UINT16 cnt = 0; cnt < numOriginalProfiles; ++cnt) { pProfile = &(gMercProfiles[ cnt ]); @@ -900,7 +900,7 @@ void MercComplainAboutEquipment( UINT8 ubProfile ) void UpdateBuddyAndHatedCounters( void ) { - UINT16 bMercID, bOtherID, bLastTeamID; + SoldierID bMercID, bOtherID, bLastTeamID; INT32 iLoop; UINT8 ubOtherProfileID; SOLDIERTYPE *pSoldier; @@ -913,8 +913,9 @@ void UpdateBuddyAndHatedCounters( void ) bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop though all the mercs - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; fSameGroupOnly = FALSE; //if the merc is active and on a combat assignment @@ -931,9 +932,9 @@ void UpdateBuddyAndHatedCounters( void ) fUpdatedTimeTillNextHatedComplaint = FALSE; bOtherID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - - for ( pOtherSoldier = MercPtrs[ bOtherID ]; bOtherID <= bLastTeamID; bOtherID++, pOtherSoldier++) + for ( ; bOtherID <= bLastTeamID; ++bOtherID ) { + pOtherSoldier = bOtherID; // is this guy in the same sector and on active duty (or in the same moving group) if (bOtherID != bMercID && pOtherSoldier->bActive && pOtherSoldier->bAssignment < ON_DUTY ) @@ -1248,15 +1249,16 @@ void UpdateBuddyAndHatedCounters( void ) void HourlyCamouflageUpdate( void ) { - UINT16 bMercID, bLastTeamID; + SoldierID bMercID, bLastTeamID; SOLDIERTYPE * pSoldier; BOOLEAN camoWoreOff = FALSE; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; bMercID++,pSoldier++) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; if ( pSoldier->bActive ) { // SANDRO - new Ranger trait reduces camo degrading, which replaces camouflage trait diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 8ebeaf87..09c9ff0c 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -5456,9 +5456,9 @@ BOOLEAN TestForBloodcatAmbush( GROUP *pGroup ) // merc recoeds - get a point to scouts if ( fBloodCatAmbushPrevented ) { - for( UINT16 i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) ) { if ( pSoldier->sSectorX == pGroup->ubSectorX && pSoldier->sSectorY == pGroup->ubSectorY && pSoldier->bAssignment != ASSIGNMENT_POW && pSoldier->bAssignment != ASSIGNMENT_MINIEVENT && pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND && pSoldier->stats.bLife >= OKLIFE ) @@ -5939,12 +5939,10 @@ BOOLEAN ValidateGroups( GROUP *pGroup ) BOOLEAN ScoutIsPresentInSquad( INT16 ubSectorNumX, INT16 ubSectorNumY ) { BOOLEAN fScoutPresent = FALSE; - INT32 i; - // sevenfm: scout should not be sleeping, in vehicle or on assignment - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->sSectorX == ubSectorNumX && @@ -5982,9 +5980,9 @@ BOOLEAN ConcealedMercInSector( INT16 ubSectorNumX, INT16 ubSectorNumY, BOOLEAN a if ( !gGameOptions.fNewTraitSystem ) return FALSE; - for ( int i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i ) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && SPY_LOCATION( pSoldier->bAssignment ) ) { if ( pSoldier->sSectorX == ubSectorNumX && pSoldier->sSectorY == ubSectorNumY && pSoldier->bSectorZ == 10 ) diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 44fc5f1f..e9fdea1b 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -679,7 +679,6 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) INT8 bTownId = 0; INT32 iLoyaltyChange = 0; INT8 bSeenState = 0; - INT32 iCounter = 0; SOLDIERTYPE *pCivSoldier = NULL; UINT32 uiChanceFalseAccusal = 0; INT8 bKillerTeam = 0; @@ -789,10 +788,10 @@ void HandleMurderOfCivilian( SOLDIERTYPE *pSoldier, BOOLEAN fIntentional ) // check if LOS between any civ, killer and killed // if so, then do not adjust - for( iCounter = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; iCounter++ ) + for( SoldierID iCounter = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++iCounter ) { // set current civ soldier - pCivSoldier = MercPtrs[ iCounter ]; + pCivSoldier = iCounter; if ( pCivSoldier == pSoldier ) { @@ -2129,13 +2128,12 @@ BOOLEAN DidFirstBattleTakePlaceInThisTown( INT8 bTownId ) UINT32 PlayerStrength( void ) { - UINT16 ubLoop; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; UINT32 uiStrength, uiTotal = 0; - for ( ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++ ) + for ( SoldierID ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop ) { - pSoldier = MercPtrs[ ubLoop ]; + pSoldier = ubLoop; if ( pSoldier->bActive ) { if ( pSoldier->bInSector || (pSoldier->flags.fBetweenSectors && SECTORX( pSoldier->ubPrevSectorID ) == gWorldSectorX && SECTORY( pSoldier->ubPrevSectorID ) == gWorldSectorY && (pSoldier->bSectorZ == gbWorldSectorZ)) ) @@ -2151,13 +2149,12 @@ UINT32 PlayerStrength( void ) UINT32 EnemyStrength( void ) { - UINT16 ubLoop; SOLDIERTYPE * pSoldier; UINT32 uiStrength, uiTotal = 0; - for ( ubLoop = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) + for ( SoldierID ubLoop = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++ubLoop ) { - pSoldier = MercPtrs[ ubLoop ]; + pSoldier = ubLoop; if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral ) { // count this person's strength (condition), calculated as life reduced up to half according to maxbreath diff --git a/Strategic/Strategic Transport Groups.cpp b/Strategic/Strategic Transport Groups.cpp index 5cc85f3d..e385d6b5 100644 --- a/Strategic/Strategic Transport Groups.cpp +++ b/Strategic/Strategic Transport Groups.cpp @@ -222,9 +222,9 @@ void FillMapColoursForTransportGroups(INT32(&colorMap)[MAXIMUM_VALID_Y_COORDINAT // build map of detection sectors + ranges std::map, INT8> detectionMap; std::map monitoredTowns; - for( INT16 i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && @@ -448,8 +448,8 @@ void UpdateTransportGroupInventory() if (gGameExternalOptions.fStrategicTransportGroupsEnabled == FALSE) return; - const int firstSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; - const int lastSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; + const SoldierID firstSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + const SoldierID lastSlot = gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; const UINT8 progress = CurrentPlayerProgressPercentage(); enum ItemTypes @@ -481,9 +481,9 @@ void UpdateTransportGroupInventory() { // let's be nice to the player and only drop ammo for guns their mercs have in inventory std::set playerCalibres; - for (INT16 i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if (pSoldier->bActive && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE)) { for (int j = 0 ; j < pSoldier->inv.size(); ++j) @@ -602,9 +602,9 @@ void UpdateTransportGroupInventory() // cache the initial jeep count of every group we find std::map cachedGroupJeepCount; - for (int slot = firstSlot; (slot <= lastSlot); ++slot) + for ( SoldierID slot = firstSlot; (slot <= lastSlot); ++slot) { - SOLDIERTYPE* pSoldier = &Menptr[slot]; + SOLDIERTYPE* pSoldier = slot; const std::map>::iterator groupIter = transportGroupIdToSoldierMap.find(pSoldier->ubGroupID); if (groupIter != transportGroupIdToSoldierMap.end()) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 0f563116..d283a09a 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -12864,12 +12864,12 @@ void ReBuildCharactersList( void ) gCharactersList[ sCount ].usSolID = NOBODY; } - // fills array with pressence of player controlled characters - for ( INT32 cnt=gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++) + // fills array with presence of player controlled characters + for ( SoldierID soldier = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; soldier <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++soldier ) { - if(Menptr[ cnt ].bActive == 1) + if( soldier->bActive ) { - AddCharacter( &Menptr[ cnt ] ); + AddCharacter( soldier ); } } @@ -16029,19 +16029,15 @@ void MakeMapModesSuitableForDestPlotting( INT8 bCharNumber ) BOOLEAN AnyMovableCharsInOrBetweenThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { - INT32 iFirstId = 0, iLastId = 0; - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - - // to speed it up a little? - iFirstId = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - iLastId = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + SoldierID iLastId = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for( iCounter = iFirstId; iCounter <= iLastId; iCounter++ ) + for( ; id <= iLastId; ++id) { // get the soldier - pSoldier = &Menptr[ iCounter ]; + pSoldier = id; // is the soldier active if( pSoldier->bActive == FALSE ) @@ -17629,12 +17625,11 @@ BOOLEAN CanGiveStrategicMilitiaMoveOrder( INT16 sMapX, INT16 sMapY ) // 3. they are a radio operator in an adjacent sector // 4. they are a radio operator in a sector adjacent to the militia's town // 5. they are a radio operator in a town adjacent to the militia's sector - SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[OUR_TEAM].bFirstID; - UINT32 lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier ) + SoldierID id = gTacticalStatus.Team[OUR_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; id <= lastid; ++id) { + SOLDIERTYPE *pSoldier = id; if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { BOOLEAN fRadioOperator = pSoldier->CanUseRadio( FALSE ); diff --git a/Strategic/strategic.cpp b/Strategic/strategic.cpp index 09513662..a4f662fe 100644 --- a/Strategic/strategic.cpp +++ b/Strategic/strategic.cpp @@ -101,16 +101,16 @@ BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ) void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ) { - INT32 cnt = 0; SOLDIERTYPE *pTeamSoldier; INT8 bBuddyIndex; // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; // see if this was the friend of a living merc - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive ) { bBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pSoldier->ubProfile ); diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index ff7e2edc..191fb0ad 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -2429,15 +2429,15 @@ BOOLEAN MapExists( UINT8 * szFilename ) void RemoveMercsInSector( ) { - INT32 cnt; SOLDIERTYPE *pSoldier; // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; // ATE: only for OUR guys.. the rest is taken care of in TrashWorld() when a new sector is added... - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive ) { pSoldier->RemoveSoldierFromGridNo( ); @@ -2698,7 +2698,6 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN //UINT8 ubRandomMiner[RANDOM_HEAD_MINERS] = { 106, 156, 157, 158 }; //UINT8 ubMiner, ubMinersPlaced, ubMine; UINT8 ubThisMine; - UINT16 cnt; SOLDIERTYPE * pSoldier; // are we in a mine sector, on the surface? @@ -2783,13 +2782,13 @@ void HandleQuestCodeOnSectorEntry( INT16 sNewSectorX, INT16 sNewSectorY, INT8 bN // Check to see if any player merc has the Chalice; if so, // note it as stolen - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { - if ( pSoldier->bActive ) + if ( cnt->bActive ) { - if ( FindObj( pSoldier, CHALICE ) != ITEM_NOT_FOUND ) + if ( FindObj( cnt, CHALICE ) != ITEM_NOT_FOUND ) { SetFactTrue( FACT_CHALICE_STOLEN ); } @@ -2951,7 +2950,6 @@ extern void SetLastTimePlayerWasInSector( ); // @calls SetLastTimePlayerWasInSector BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { - INT32 i; UNDERGROUND_SECTORINFO *pNode = NULL; CHAR8 bFilename[50]; @@ -2968,9 +2966,9 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) //@@@Evaluate if ( gfWorldLoaded ) { - for ( i = gTacticalStatus.Team[CIV_TEAM].bFirstID; i <= gTacticalStatus.Team[CIV_TEAM].bLastID; i++ ) + for ( SoldierID i = gTacticalStatus.Team[CIV_TEAM].bFirstID; i <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if ( pSoldier->bActive && pSoldier->bInSector ) { SetupProfileInsertionDataForSoldier( pSoldier ); @@ -3099,7 +3097,6 @@ BOOLEAN EnterSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { - INT32 cnt; SOLDIERTYPE *pSoldier; BOOLEAN fPOWSquadSet = FALSE; UINT8 ubPOWSquad = 0; @@ -3129,8 +3126,9 @@ void UpdateMercsInSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) //if( !(gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) { - for ( cnt = 0, pSoldier = MercPtrs[cnt]; cnt < MAX_NUM_SOLDIERS; ++cnt, ++pSoldier ) + for ( SoldierID cnt = 0; cnt < MAX_NUM_SOLDIERS; ++cnt ) { + pSoldier = cnt; if ( gfRestoringEnemySoldiersFromTempFile && cnt >= gTacticalStatus.Team[ENEMY_TEAM].bFirstID && cnt <= gTacticalStatus.Team[CREATURE_TEAM].bLastID ) @@ -3954,7 +3952,6 @@ UINT8 GetStrategicInsertionDataFromAdjacentMoveDirection( UINT8 ubTacticalDirect void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32 sAdditionalData )//dnl ch56 151009 { - INT32 cnt; SOLDIERTYPE *pSoldier; SOLDIERTYPE *pValidSoldier = NULL; GROUP *pGroup; @@ -3972,11 +3969,12 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32 { // TODO: Check flags to see if we can jump! // Move controllable mercs! - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pSoldier = cnt; // If we are controllable if ( OK_CONTROLLABLE_MERC( pSoldier ) && pSoldier->bAssignment == CurrentSquad( ) ) { @@ -4214,12 +4212,13 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32 void JumpIntoEscapedSector(UINT8 ubTacticalDirection) { // Remove any incapacitated mercs from current squads and assign them to new squad - UINT32 i = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 const lastID = gTacticalStatus.Team[gbPlayerNum].bLastID; + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID const lastID = gTacticalStatus.Team[gbPlayerNum].bLastID; INT8 currentSquad = -1; - for (SOLDIERTYPE* pSoldier = MercPtrs[i]; i <= lastID; ++i, ++pSoldier) + for ( ; id <= lastID; ++id ) { + SOLDIERTYPE *pSoldier = id; // Are we not active in sector if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->stats.bLife >= OKLIFE) { @@ -4833,7 +4832,6 @@ BOOLEAN SoldierOKForSectorExit( SOLDIERTYPE * pSoldier, INT8 bExitDirection, INT //ATE: Returns FALSE if NOBODY is close enough, 1 if ONLY selected guy is and 2 if all on squad are... BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *puiTraverseTimeInMinutes )//dnl ch56 151009 { - INT32 cnt; SOLDIERTYPE *pSoldier; BOOLEAN fAtLeastOneMercControllable = FALSE; BOOLEAN fOnlySelectedGuy = FALSE; @@ -4876,11 +4874,12 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu gbPotentiallyAbandonedEPCSlotID = NOBODY; // Look through all mercs and check if they are within range of east end.... - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt, ++pSoldier ) + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pSoldier = cnt; // If we are controllable if ( OK_CONTROLLABLE_MERC( pSoldier ) && (pSoldier->bAssignment == CurrentSquad( ) || (pSoldier->bAssignment == VEHICLE && pSoldier->iVehicleId != iHelicopterVehicleId && GetSoldierStructureForVehicle( pSoldier->iVehicleId )->bAssignment == CurrentSquad( ))) ) @@ -5157,7 +5156,7 @@ void SetSamHackStatus( INT16 sSectorX, INT16 sSectorY, INT8 sStatus ) BOOLEAN CanGoToTacticalInSector( INT16 sX, INT16 sY, UINT8 ubZ ) { - INT32 cnt; + SoldierID cnt; SOLDIERTYPE *pSoldier; // if not a valid sector @@ -5170,8 +5169,9 @@ BOOLEAN CanGoToTacticalInSector( INT16 sX, INT16 sY, UINT8 ubZ ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all living, fighting mercs on player's team. Robot and EPCs qualify! - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // ARM: now allows loading of sector with all mercs below OKLIFE as long as they're alive if( ( pSoldier->bActive && pSoldier->stats.bLife ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && ( pSoldier->bAssignment != IN_TRANSIT ) && ( pSoldier->bAssignment != ASSIGNMENT_POW ) && ( pSoldier->bAssignment != ASSIGNMENT_MINIEVENT ) && ( pSoldier->bAssignment != ASSIGNMENT_REBELCOMMAND ) && @@ -6430,8 +6430,6 @@ BOOLEAN IsSectorRoad( INT16 sSectorX, INT16 sSectorY ) BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode ) { - INT32 i; - // clear tactical queue ClearEventQueue( ); @@ -6493,9 +6491,9 @@ BOOLEAN HandleDefiniteUnloadingOfWorld( UINT8 ubUnloadCode ) //Setup the tactical existance of the current soldier. //@@@Evaluate - for ( i = gTacticalStatus.Team[CIV_TEAM].bFirstID; i <= gTacticalStatus.Team[CIV_TEAM].bLastID; i++ ) + for ( SoldierID i = gTacticalStatus.Team[CIV_TEAM].bFirstID; i <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if ( pSoldier->bActive && pSoldier->bInSector ) { SetupProfileInsertionDataForSoldier( pSoldier ); @@ -6514,18 +6512,18 @@ BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( int pSectorX, int pSect { //We don't have mercs in the sector. Now, we check to see if there are BOTH enemies and militia. If both //co-exist in the sector, then make them fight for control of the sector via autoresolve. - for ( int i = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; i <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; i++ ) + for ( SoldierID i = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; i <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; ++i ) { - SOLDIERTYPE *pEnemy = MercPtrs[i]; + SOLDIERTYPE *pEnemy = i; if ( pEnemy->bActive && pEnemy->stats.bLife ) { if ( pEnemy->sSectorX == pSectorX && pEnemy->sSectorY == pSectorY && pEnemy->bSectorZ == pSectorZ ) { //We have enemies, now look for militia! - for ( i = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; i <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; i++ ) + for ( SoldierID j = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; j <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; ++j ) { - SOLDIERTYPE *pMilitia = MercPtrs[i]; + SOLDIERTYPE *pMilitia = j; if ( pMilitia->bActive && pMilitia->stats.bLife && pMilitia->bSide == OUR_TEAM ) { if ( pMilitia->sSectorX == pSectorX && @@ -6567,7 +6565,6 @@ BOOLEAN HandlePotentialBringUpAutoresolveToFinishBattle( int pSectorX, int pSect BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( ) { - INT32 i; INT16 sBattleSectorX, sBattleSectorY, sBattleSectorZ; //Don't bother checking this if we don't have a world loaded. @@ -6592,9 +6589,9 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( ) { //The user has decided to let the game autoresolve the current battle. if ( gWorldSectorX == sBattleSectorX && gWorldSectorY == sBattleSectorY && gbWorldSectorZ == sBattleSectorZ ) { - for ( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++ ) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i ) { //If we have a live and valid soldier - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if ( pSoldier->bActive && pSoldier->stats.bLife && !pSoldier->flags.fBetweenSectors && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) ) { if ( pSoldier->sSectorX == gWorldSectorX && @@ -6610,9 +6607,9 @@ BOOLEAN CheckAndHandleUnloadingOfCurrentWorld( ) } else { //Check and see if we have any live mercs in the sector. - for ( i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; i++ ) + for ( SoldierID i = gTacticalStatus.Team[OUR_TEAM].bFirstID; i <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++i ) { //If we have a live and valid soldier - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if ( pSoldier->bActive && pSoldier->stats.bLife && !pSoldier->flags.fBetweenSectors && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pSoldier ) && !AM_AN_EPC( pSoldier ) ) { if ( pSoldier->sSectorX == gWorldSectorX && diff --git a/Tactical/Air Raid.cpp b/Tactical/Air Raid.cpp index 5066e3e0..e498c89b 100644 --- a/Tactical/Air Raid.cpp +++ b/Tactical/Air Raid.cpp @@ -187,7 +187,6 @@ void ScheduleAirRaid( AIR_RAID_DEFINITION *pAirRaidDef ) BOOLEAN BeginAirRaid( ) { - INT32 cnt=0; BOOLEAN fOK = FALSE; SOLDIERTYPE *pSoldier; gfQuoteSaid = FALSE; @@ -215,9 +214,10 @@ BOOLEAN BeginAirRaid( ) // Do we have any guys in here... DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: check for mercs: first id = %d, last id = %d ",gTacticalStatus.Team[ gbPlayerNum ].bFirstID, gTacticalStatus.Team[ gbPlayerNum ].bLastID)); - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive)); if ( pSoldier->bActive ) { @@ -309,18 +309,18 @@ INT32 PickLocationNearAnyMercInSector( ) UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt=0; // Loop through all our guys and randomly say one from someone in our sector DebugMsg(TOPIC_JA2,DBG_LEVEL_3,"PickLocationNearAnyMercInSector"); // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: total guys = %d", gTacticalStatus.Team[ gbPlayerNum ].bLastID)); - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("PickLocationNearAnyMercInSector: looping %d",cnt)); if ( OK_INSECTOR_MERC( pTeamSoldier ) ) @@ -1057,9 +1057,10 @@ void HandleAirRaid( ) DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: check for mercs: first id = %d, last id = %d ",gTacticalStatus.Team[ gbPlayerNum ].bFirstID, gTacticalStatus.Team[ gbPlayerNum ].bLastID)); SOLDIERTYPE * pSoldier; BOOLEAN fOK = FALSE; - int cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive)); if ( pSoldier->bActive ) { @@ -1447,12 +1448,12 @@ void EndAirRaid( ) if ( !gTacticalStatus.Team[ ENEMY_TEAM ].bTeamActive && !gTacticalStatus.Team[ CREATURE_TEAM ].bTeamActive ) { SOLDIERTYPE * pTeamSoldier; - INT32 cnt; // Loop through all militia and restore them to peaceful status - cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++,pTeamSoldier++) + SoldierID cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; @@ -1462,8 +1463,9 @@ void EndAirRaid( ) cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; // Loop through all civs and restore them to peaceful status - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; diff --git a/Tactical/Boxing.cpp b/Tactical/Boxing.cpp index b48a4447..d667d93f 100644 --- a/Tactical/Boxing.cpp +++ b/Tactical/Boxing.cpp @@ -478,8 +478,6 @@ BOOLEAN AnotherFightPossible( void ) // a player has at least OKLIFE + 5 life // and at least one fight HAS occurred - UINT16 ubLoop; - SOLDIERTYPE * pSoldier; UINT8 ubAvailable; ubAvailable = BoxersAvailable(); @@ -490,9 +488,8 @@ BOOLEAN AnotherFightPossible( void ) } // Loop through all mercs on player team - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - pSoldier = MercPtrs[ ubLoop ]; - for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop, pSoldier++ ) + SoldierID pSoldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; pSoldier <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++pSoldier ) { if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > (OKLIFE + 5) && !pSoldier->bCollapsed ) { diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 9fa4b48e..a488fda3 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -1836,13 +1836,9 @@ void TestDumpStatChanges(void) void AwardExperienceBonusToActiveSquad( UINT8 ubExpBonusType ) { - UINT16 usXPs = 0; - UINT16 ubGuynum; - SOLDIERTYPE *pSoldier; - - Assert ( ubExpBonusType < NUM_EXP_BONUS_TYPES ); + UINT16 usXPs = 0; switch ( ubExpBonusType ) { case EXP_BONUS_MINIMUM: usXPs = 25; break; @@ -1853,9 +1849,9 @@ void AwardExperienceBonusToActiveSquad( UINT8 ubExpBonusType ) } // to do: find guys in sector on the currently active squad, those that are conscious get this amount in XPs - for ( ubGuynum = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pSoldier = MercPtrs[ ubGuynum ]; - ubGuynum <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; - ubGuynum++, pSoldier++ ) + for ( SoldierID pSoldier = gTacticalStatus.Team[ gbPlayerNum ].bFirstID ; + pSoldier <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; + ++pSoldier) { if ( pSoldier->bActive && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) && ( pSoldier->stats.bLife >= CONSCIOUSNESS ) && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index e6b12677..0534fb05 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -1759,9 +1759,10 @@ void AdditionalTacticalCharacterDialogue_AllInSector(INT16 aSectorX, INT16 aSect UINT16 usEventNr, UINT32 aData1, UINT32 aData2, UINT32 aData3, INT32 aAroundGridno, INT32 aRadius ) { SOLDIERTYPE* pSoldier; - int cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive && pSoldier->ubProfile != ausIgnoreProfile && pSoldier->sSectorX == aSectorX && pSoldier->sSectorY == aSectorY && pSoldier->bSectorZ == aSectorZ && @@ -3122,10 +3123,10 @@ void HandleDialogueEnd( FACETYPE *pFace ) break; default: // select random enemy, who we see, who sees us and isn't deaf - for(UINT16 cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID ; cnt++ ) + for( SoldierID cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID ; ++cnt ) { - if( MercPtrs[cnt] != NULL && MercPtrs[cnt]->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY - && MercPtrs[pSoldier->ubID]->aiData.bOppList[cnt] == SEEN_CURRENTLY && !( MercPtrs[cnt]->bDeafenedCounter > 0 ) ) + if( cnt->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY + && pSoldier->ubID->aiData.bOppList[cnt] == SEEN_CURRENTLY && !( cnt->bDeafenedCounter > 0 ) ) { ubSeenEnemies[ubSeenEnemiesCnt] = cnt; ubSeenEnemiesCnt++; @@ -3297,16 +3298,16 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt; // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; id <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++id ) { + pTeamSoldier = id; // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { @@ -3329,7 +3330,7 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) #endif } - ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; + ubMercsInSector[ ubNumMercs ] = (UINT16)id; ubNumMercs++; } } @@ -3342,7 +3343,7 @@ void SayQuoteFromAnyBodyInSector( UINT16 usQuoteNum ) // If we are air raid, AND red exists somewhere... if ( usQuoteNum == QUOTE_AIR_RAID ) { - for ( cnt = 0; cnt < ubNumMercs; cnt++ ) + for ( UINT16 cnt = 0; cnt < ubNumMercs; cnt++ ) { if ( ubMercsInSector[ cnt ] == 11 ) { @@ -3366,16 +3367,16 @@ void SayQuoteFromAnyBodyInThisSector( INT16 sSectorX, INT16 sSectorY, INT8 bSect UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt; // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive ) { // Add guy if he's a candidate... @@ -3419,16 +3420,16 @@ void SayQuoteFromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQuo UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt; // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && PythSpacesAway( sGridNo, pTeamSoldier->sGridNo ) < bDistance && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep && SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, 0, 0, TRUE ) ) @@ -3464,14 +3465,15 @@ void SayQuote58FromNearbyMercInSector( INT32 sGridNo, INT8 bDistance, UINT16 usQ UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && PythSpacesAway( sGridNo, pTeamSoldier->sGridNo ) < bDistance && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep && SoldierTo3DLocationLineOfSightTest( pTeamSoldier, sGridNo, 0, 0, TRUE ) ) diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index 40f674f1..852375d0 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -711,9 +711,10 @@ void CalculateCover() if (gTacticalStatus.fAtLeastOneGuyOnMultiSelect) // view of selected mercs { // OK, loop through all guys who are 'multi-selected' and - INT32 cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for (pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt, ++pSoldier) + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector) { if (pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED) diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index 60a38884..db33d4ae 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -407,16 +407,16 @@ BOOLEAN MercDrugged( SOLDIERTYPE *pSoldier ) void HourlyDrugUpdate( ) { - for ( UINT16 ubID = gTacticalStatus.Team[OUR_TEAM].bFirstID; ubID <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++ubID ) + for ( SoldierID ubID = gTacticalStatus.Team[OUR_TEAM].bFirstID; ubID <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++ubID ) { // every hour, we lower our alcohol counter - if ( MercPtrs[ubID]->newdrugs.drinkstaken > 0.0f ) + if ( ubID->newdrugs.drinkstaken > 0.0f ) { - MercPtrs[ubID]->newdrugs.drinkstaken = max( 0.0, MercPtrs[ubID]->newdrugs.drinkstaken - 0.15f ); + ubID->newdrugs.drinkstaken = max( 0.0, ubID->newdrugs.drinkstaken - 0.15f ); - if ( MercPtrs[ubID]->newdrugs.drinkstaken <= 0.0f ) + if ( ubID->newdrugs.drinkstaken <= 0.0f ) { - MercPtrs[ubID]->usSoldierFlagMask2 &= ~SOLDIER_HUNGOVER; + ubID->usSoldierFlagMask2 &= ~SOLDIER_HUNGOVER; } } } diff --git a/Tactical/DynamicDialogue.cpp b/Tactical/DynamicDialogue.cpp index 6b197ae3..62af182d 100644 --- a/Tactical/DynamicDialogue.cpp +++ b/Tactical/DynamicDialogue.cpp @@ -1632,11 +1632,11 @@ void HandleDynamicOpinionsDailyRefresh( ) RolloverDynamicOpinions( usProfileA ); } - SOLDIERTYPE* pSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pSoldier++ ) + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + SOLDIERTYPE* pSoldier = bMercID; if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && !(pSoldier->bAssignment == IN_TRANSIT || AM_A_ROBOT(pSoldier) || pSoldier->bAssignment == ASSIGNMENT_DEAD) ) @@ -1672,11 +1672,11 @@ void RolloverDynamicOpinions( UINT8 usProfileA ) // check wether other people are friends with someone else we hate. All persons must be in Arulco void CheckForFriendsofHated( SOLDIERTYPE* pSoldier ) { - UINT16 bMercID, bOtherID, bThirdID, bLastTeamID; - INT8 bOpinion = -1; - INT8 bSecondOpinion = -1; - SOLDIERTYPE* pOtherSoldier; - SOLDIERTYPE* pThirdSoldier; + SoldierID bMercID, bOtherID, bThirdID, bLastTeamID; + INT8 bOpinion = -1; + INT8 bSecondOpinion = -1; + SOLDIERTYPE *pOtherSoldier; + SOLDIERTYPE *pThirdSoldier; // make sure we ourselves aren't in transit if ( !pSoldier->bActive || pSoldier->ubProfile == NO_PROFILE || AM_A_ROBOT(pSoldier) || pSoldier->bAssignment == IN_TRANSIT || pSoldier->bAssignment == ASSIGNMENT_DEAD ) @@ -1687,8 +1687,9 @@ void CheckForFriendsofHated( SOLDIERTYPE* pSoldier ) // loop through all other mercs bOtherID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pOtherSoldier = MercPtrs[bOtherID]; bOtherID <= bLastTeamID; ++bOtherID, pOtherSoldier++ ) + for ( ; bOtherID <= bLastTeamID; ++bOtherID ) { + pOtherSoldier = bOtherID; // skip past ourselves and all inactive mercs if ( bOtherID != bMercID && pOtherSoldier->bActive && pOtherSoldier->ubProfile != NO_PROFILE && !(pOtherSoldier->bAssignment == IN_TRANSIT || @@ -1702,8 +1703,9 @@ void CheckForFriendsofHated( SOLDIERTYPE* pSoldier ) // there is someone in our team that we hate. We dislike his friends somewhat, purely because they like our foe // loop through all other mercs bThirdID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pThirdSoldier = MercPtrs[bThirdID]; bThirdID <= bLastTeamID; ++bThirdID, pThirdSoldier++ ) + for ( ; bThirdID <= bLastTeamID; ++bThirdID ) { + pThirdSoldier = bThirdID; // skip past ourselves and all inactive mercs if ( bThirdID != bMercID && bThirdID != bOtherID && pThirdSoldier->bActive && pThirdSoldier->ubProfile != NO_PROFILE && !(pThirdSoldier->bAssignment == IN_TRANSIT || @@ -1843,11 +1845,11 @@ void HandleDynamicOpinionTeamDrinking( SOLDIERTYPE* pSoldier ) if ( !pSoldier || pSoldier->ubProfile == NO_PROFILE || AM_A_ROBOT(pSoldier) || pSoldier->newdrugs.drinkstaken <= 0.0 ) return; - SOLDIERTYPE* pTeamSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pTeamSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pTeamSoldier++ ) + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID) { + SOLDIERTYPE* pTeamSoldier = bMercID; // everybody other merc in the same sector can get updated if they are drugged too if ( pTeamSoldier->bActive && pTeamSoldier->ubProfile != NO_PROFILE && pTeamSoldier->ubProfile != pSoldier->ubProfile && pTeamSoldier->sSectorX == pSoldier->sSectorX && pTeamSoldier->sSectorY == pSoldier->sSectorY && pTeamSoldier->bSectorZ == pSoldier->bSectorZ && @@ -1902,11 +1904,11 @@ void HandleDynamicOpinionTeaching( SOLDIERTYPE* pSoldier, UINT8 ubStat ) break; } - SOLDIERTYPE* pTeamSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pTeamSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pTeamSoldier++ ) + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID) { + SOLDIERTYPE* pTeamSoldier = bMercID; // award event for every trainer in this sector if ( pTeamSoldier->bActive && pTeamSoldier->ubProfile != NO_PROFILE && pTeamSoldier->ubProfile != pSoldier->ubProfile && pTeamSoldier->sSectorX == pSoldier->sSectorX && pTeamSoldier->sSectorY == pSoldier->sSectorY && pTeamSoldier->bSectorZ == pSoldier->bSectorZ && @@ -1939,16 +1941,16 @@ UINT32 GetSoldierLeaderRating( SOLDIERTYPE* pSoldier ) } -UINT16 GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ) +SoldierID GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ) { - UINT32 highestrating = 0; - UINT16 bestid = NOBODY; + UINT32 highestrating = 0; + SoldierID bestid = NOBODY; + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - SOLDIERTYPE* pSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, ++pSoldier ) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + SOLDIERTYPE* pSoldier = bMercID; // everybody other merc in the same sector gets annoyed if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->sSectorX == sX && pSoldier->sSectorY == sY && pSoldier->bSectorZ == sZ && @@ -1971,10 +1973,11 @@ UINT8 GetRandomMercInSectorNotInList( INT16 sX, INT16 sY, INT8 sZ, std::vector resultvector; SOLDIERTYPE* pTeamSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pTeamSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, ++pTeamSoldier ) + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pTeamSoldier = bMercID; // everybody other merc in the same sector gets annoyed if ( pTeamSoldier->bActive && pTeamSoldier->ubProfile != NO_PROFILE && pTeamSoldier->sSectorX == sX && pTeamSoldier->sSectorY == sY && pTeamSoldier->bSectorZ == sZ && @@ -2017,10 +2020,11 @@ UINT8 GetFittingInterjectorProfile( UINT8 usEvent, UINT8 usProfileVictim, UINT8 std::vector profilevector; SOLDIERTYPE* pTeamSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[pSoldierVictim->bTeam].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[pSoldierVictim->bTeam].bLastID; - for ( pTeamSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pTeamSoldier++ ) + SoldierID bMercID = gTacticalStatus.Team[pSoldierVictim->bTeam].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[pSoldierVictim->bTeam].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pTeamSoldier = bMercID; // only people that are here if ( !pTeamSoldier->bActive || pTeamSoldier->bAssignment == IN_TRANSIT || pTeamSoldier->bAssignment == ASSIGNMENT_DEAD || pTeamSoldier->bAssignment == ASSIGNMENT_POW || pTeamSoldier->bAssignment == ASSIGNMENT_MINIEVENT || pTeamSoldier->bAssignment == ASSIGNMENT_REBELCOMMAND ) continue; @@ -2156,10 +2160,11 @@ void HandleDynamicOpinionChange( SOLDIERTYPE* pSoldier, UINT8 usEvent, BOOLEAN f UINT8 usEventUsed; // it is possible that the individual event is switched SOLDIERTYPE* pTeamSoldier = NULL; - UINT16 bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT16 bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for ( pTeamSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pTeamSoldier++ ) + SoldierID bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pTeamSoldier = bMercID; // we test several conditions before we allow adding an opinion // other merc must be active, have a profile, be someone else and not be in transit or dead if ( pTeamSoldier->bActive && pTeamSoldier->ubProfile != NO_PROFILE && pTeamSoldier->ubProfile != pSoldier->ubProfile && diff --git a/Tactical/DynamicDialogue.h b/Tactical/DynamicDialogue.h index 262fde2b..92896a50 100644 --- a/Tactical/DynamicDialogue.h +++ b/Tactical/DynamicDialogue.h @@ -480,7 +480,7 @@ void HandleDynamicOpinionTeaching( SOLDIERTYPE* pSoldier, UINT8 ubStat ); // some events require a 'leader' - merc the team will regard as the one being in charge, and subsequently being praised or damned for the way things develop UINT32 GetSoldierLeaderRating( SOLDIERTYPE* pSoldier ); -UINT16 GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ); +SoldierID GetBestMercLeaderInSector( INT16 sX, INT16 sY, INT8 sZ ); // get id of a random merc in a sector, provided one exists UINT8 GetRandomMercInSectorNotInList( INT16 sX, INT16 sY, INT8 sZ, std::vector aTaboo, BOOLEAN fImpOnly ); diff --git a/Tactical/End Game.cpp b/Tactical/End Game.cpp index 795ec9cc..919ed80b 100644 --- a/Tactical/End Game.cpp +++ b/Tactical/End Game.cpp @@ -240,15 +240,16 @@ void DoneFadeInKilledQueen( void ) void DoneFadeOutKilledQueen( void ) { - INT32 cnt; + SoldierID cnt; SOLDIERTYPE *pSoldier, *pTeamSoldier; // For one, loop through our current squad and move them over cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for (; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) { @@ -272,8 +273,9 @@ void DoneFadeOutKilledQueen( void ) cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we active and in sector..... if ( pTeamSoldier->bActive ) { @@ -350,7 +352,7 @@ void HandleDoneLastKilledQueenQuote( ) void EndQueenDeathEndgameBeginEndCimenatic( ) { - INT32 cnt; + SoldierID cnt; SOLDIERTYPE *pSoldier; // Start end cimimatic.... @@ -360,8 +362,9 @@ void EndQueenDeathEndgameBeginEndCimenatic( ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && !AM_AN_EPC( pSoldier ) ) { @@ -633,7 +636,7 @@ void FadeOutToLaptopOnEndGame( void ) void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt; + SoldierID cnt; gpKillerSoldier = pKillerSoldier; @@ -654,8 +657,9 @@ void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT cnt = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Are we active and ALIVE and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->stats.bLife > 0 ) { @@ -679,8 +683,7 @@ void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt; - UINT16 ubKillerSoldierID = NOBODY; + SoldierID ubKillerSoldierID = NOBODY; // Start victory music here... SetMusicMode( MUSIC_TACTICAL_VICTORY ); @@ -693,13 +696,14 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLe // STEP 1 ) START ALL QUOTES GOING! // OK - loop through all witnesses and see if they want to say something abou this... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { if ( cnt != ubKillerSoldierID ) { + pTeamSoldier = cnt; if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) { if ( QuoteExp[ pTeamSoldier->ubProfile ].QuoteExpWitnessQueenBugDeath ) diff --git a/Tactical/Enemy Soldier Save.cpp b/Tactical/Enemy Soldier Save.cpp index 2fdfa34f..2874685d 100644 --- a/Tactical/Enemy Soldier Save.cpp +++ b/Tactical/Enemy Soldier Save.cpp @@ -1395,7 +1395,6 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY { SOLDIERINITNODE *curr; SOLDIERTYPE *pSoldier; - INT32 i; INT32 slots = 0; UINT32 uiNumBytesWritten; UINT32 uiTimeStamp; @@ -1428,9 +1427,9 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY //STEP ONE: Prep the soldiers for saving... //modify the map's soldier init list to reflect the changes to the members still alive... - for( i = gTacticalStatus.Team[ ubStartID ].bFirstID; i <= gTacticalStatus.Team[ ubEndID ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ ubStartID ].bFirstID; i <= gTacticalStatus.Team[ ubEndID ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; //make sure the person is active, alive, in the sector, and is not a profiled person if( pSoldier && pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife && pSoldier->ubProfile == NO_PROFILE ) @@ -1584,9 +1583,9 @@ BOOLEAN NewWayOfSavingEnemyAndCivliansToTempFile( INT16 sSectorX, INT16 sSectorY return TRUE; } - for( i = gTacticalStatus.Team[ ubStartID ].bFirstID; i <= gTacticalStatus.Team[ ubEndID ].bLastID; i++ ) + for( SoldierID i = gTacticalStatus.Team[ ubStartID ].bFirstID; i <= gTacticalStatus.Team[ ubEndID ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; // CJC: note that bInSector is not required; the civ could be offmap! if( pSoldier->bActive /*&& pSoldier->bInSector*/ && pSoldier->stats.bLife ) { diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 02d36567..709510f4 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -763,15 +763,16 @@ void EatFromInventory( SOLDIERTYPE *pSoldier, BOOLEAN fcanteensonly ) void HourlyFoodUpdate( void ) { - UINT16 bMercID, bLastTeamID; + SoldierID bMercID, bLastTeamID; SOLDIERTYPE * pSoldier = NULL; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs to calculate their morale - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID, ++pSoldier) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; //if the merc is active, and in Arulco if ( pSoldier && pSoldier->bActive && !AM_AN_EPC(pSoldier) && pSoldier->ubProfile != ROBOT && !IsVehicle(pSoldier) && !(pSoldier->bAssignment == IN_TRANSIT || pSoldier->bAssignment == ASSIGNMENT_DEAD ) ) { @@ -829,15 +830,16 @@ void SectorFillCanteens( void ) addtemperature = FOOD_WATER_POISONOUS_TEMPERATURE; // first step: fill all canteens in inventories - UINT16 bMercID, bLastTeamID; + SoldierID bMercID, bLastTeamID; SOLDIERTYPE * pSoldier = NULL; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID, pSoldier++) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; //if the merc is in this sector if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bInSector && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { @@ -903,15 +905,16 @@ void SectorFillCanteens( void ) INT32 drumsize = Food[Item[pWaterDrum->usItem].foodtype].bDrinkPoints; // first step: fill all canteens in inventories - UINT16 bMercID, bLastTeamID; + SoldierID bMercID, bLastTeamID; SOLDIERTYPE * pSoldier = NULL; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID, pSoldier++) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; //if the merc is in this sector if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && pSoldier->bInSector && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index c5b74bb1..52704cfc 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -439,9 +439,9 @@ void ProcessImplicationsOfPCMessingWithDoor( SOLDIERTYPE * pSoldier ) if ( (InARoom( pSoldier->sGridNo, &usRoom ) && IN_BROTHEL( usRoom )) || (gWorldSectorX == 5 && gWorldSectorY == MAP_ROW_D && gbWorldSectorZ == 0 && (pSoldier->sGridNo == gModSettings.iBrothelDoor1 || pSoldier->sGridNo == gModSettings.iBrothelDoor2 || pSoldier->sGridNo == gModSettings.iBrothelDoor3 ) ) )//11010,11177,11176 { // see if a kingpin goon can see us - for (UINT16 ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) + for ( SoldierID ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++ubLoop ) { - pGoon = MercPtrs[ ubLoop ]; + pGoon = ubLoop; if ( pGoon->ubCivilianGroup == KINGPIN_CIV_GROUP && pGoon->bActive && pGoon->bInSector && pGoon->stats.bLife >= OKLIFE && pGoon->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { MakeCivHostile(pGoon); diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index d95b6157..d58980fe 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -5389,15 +5389,16 @@ void UpdateGear() if ( (guiCurrentScreen != GAME_SCREEN && guiCurrentScreen != MSG_BOX_SCREEN) ) return; - UINT16 bMercID, bLastTeamID; + SoldierID bMercID, bLastTeamID; SOLDIERTYPE* pSoldier = NULL; bMercID = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; // loop through all mercs - for ( pSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, ++pSoldier ) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; //if the merc is in this sector if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier->sSectorX == gWorldSectorX) && (pSoldier->sSectorY == gWorldSectorY) && (pSoldier->bSectorZ == gbWorldSectorZ) ) { @@ -6735,7 +6736,7 @@ void CheckForPickedOwnership( void ) UINT8 ubProfile; UINT8 ubCivGroup; SOLDIERTYPE * pSoldier; - UINT16 ubLoop; + SoldierID ubLoop; // LOOP THROUGH LIST TO FIND NODE WE WANT GetItemPool( gsTempGridNo, &pItemPool, gpTempSoldier->pathing.bLevel ); @@ -6762,9 +6763,9 @@ void CheckForPickedOwnership( void ) pItemPool = pItemPool->pNext; continue; } - for ( ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) + for ( ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++ubLoop ) { - pSoldier = MercPtrs[ ubLoop ]; + pSoldier = ubLoop; if ( pSoldier && pSoldier->ubCivilianGroup == ubCivGroup ) { TestPotentialOwner( pSoldier ); diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index b53d91ba..aba46b8a 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -1403,15 +1403,16 @@ UINT32 UIHandleEndTurn( UI_EVENT *pUIEvent ) // WANNE: Ignore, so the game can continue ... } - INT32 tcnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID tcnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; SOLDIERTYPE *tS; INT16 sXOffset, sYOffset; INT32 sGridNo; UINT16 usSightLimit=0; - for ( tS = MercPtrs[ tcnt ]; tcnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++tcnt, tS++ ) + for ( ; tcnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++tcnt ) { + tS = tcnt; if ( tS->stats.bLife >= OKLIFE && tS->sGridNo != NOWHERE && tS->bInSector ) { //loop through all the gridnos that we are interested in @@ -2113,17 +2114,17 @@ UINT32 UIHandleCWait( UI_EVENT *pUIEvent ) // SelectedMercCanAffordMove UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) { - INT32 usMapPos; - SOLDIERTYPE *pSoldier; - INT32 sDestGridNo; - INT32 sActionGridNo; - STRUCTURE *pStructure; - UINT8 ubDirection = 0xff; - BOOLEAN fAllMove; - UINT16 bLoop; - LEVELNODE *pIntTile; - INT32 sIntTileGridNo; - BOOLEAN fOldFastMove; + INT32 usMapPos; + SOLDIERTYPE *pSoldier; + INT32 sDestGridNo; + INT32 sActionGridNo; + STRUCTURE *pStructure; + UINT8 ubDirection = 0xff; + BOOLEAN fAllMove; + SoldierID bLoop; + LEVELNODE *pIntTile; + INT32 sIntTileGridNo; + BOOLEAN fOldFastMove; if ( gusSelectedSoldier != NOBODY ) { @@ -2144,13 +2145,14 @@ UINT32 UIHandleCMoveMerc( UI_EVENT *pUIEvent ) // Loop through all mercs and make go! // TODO: Only our squad! - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pSoldier++) + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) { + pSoldier = bLoop; if ( OK_CONTROLLABLE_MERC( pSoldier ) && pSoldier->bAssignment == CurrentSquad( ) && !pSoldier->flags.fMercAsleep ) { - // If we can't be controlled, returninvalid... - if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) - { + // If we can't be controlled, returninvalid... + if ( pSoldier->flags.uiStatusFlags & SOLDIER_ROBOT ) + { if ( !pSoldier->CanRobotBeControlled( ) ) { continue; From 4e8c5fa9ab9595f40e29cbe55e60cc019320408c Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 30 Nov 2024 23:50:17 +0200 Subject: [PATCH 196/571] Remove unused function & globals --- Tactical/Handle UI.cpp | 32 -------------------------------- Tactical/Handle UI.h | 4 ---- TileEngine/worlddef.cpp | 2 -- 3 files changed, 38 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index aba46b8a..fcae5d59 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -423,9 +423,6 @@ BOOLEAN gRubberBandActive = FALSE; BOOLEAN gfIgnoreOnSelectedGuy = FALSE; BOOLEAN gfViewPortAdjustedForSouth = FALSE; -INT16 guiCreateGuyIndex = 0; -// Temp values for placing bad guys -INT16 guiCreateBadGuyIndex = 8; // FLAGS // These flags are set for a single frame execution and then are reset for the next iteration. @@ -3304,35 +3301,6 @@ void HandleObjectHighlighting( ) } -void AdjustSoldierCreationStartValues( ) -{ - INT32 cnt; - SOLDIERTYPE *pSoldier; - - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - guiCreateGuyIndex = (INT16)cnt; - - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; pSoldier++, ++cnt ) - { - if ( !pSoldier->bActive ) - { - guiCreateGuyIndex = (INT16)cnt; - break; - } - } - - cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID + 1; - guiCreateBadGuyIndex = (INT16)cnt; - - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; pSoldier++, ++cnt ) - { - if ( !pSoldier->bActive && cnt > gTacticalStatus.Team[ gbPlayerNum ].bLastID ) - { - guiCreateBadGuyIndex = (INT16)cnt; - break; - } - } -} BOOLEAN SelectedMercCanAffordAttack( ) { diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index 717ddc8c..acfc4cab 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -292,9 +292,6 @@ void HandleObjectHighlighting( ); extern BOOLEAN gfUIForceReExamineCursorData; -extern INT16 guiCreateGuyIndex; -extern INT16 guiCreateBadGuyIndex; - // WANNE: Calculate the APs to turn around INT16 APsToTurnAround(SOLDIERTYPE *pSoldier, INT32 sAdjustedGridNo); @@ -315,7 +312,6 @@ void GetRTMousePositionInput( UINT32 *puiNewEvent ); void QueryRTLeftButton( UINT32 *puiNewEvent ); void QueryRTRightButton( UINT32 *puiNewEvent ); -void AdjustSoldierCreationStartValues( ); BOOLEAN SelectedMercCanAffordAttack( ); BOOLEAN SelectedMercCanAffordMove( ); diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 2b78ad20..d8a44a4b 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -3294,7 +3294,6 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor if(gusSelectedSoldier->bActive == FALSE) gusSelectedSoldier = NOBODY; } - AdjustSoldierCreationStartValues(); RenderProgressBar(0, 60); InvalidateWorldRedundency(); // SAVE FILENAME @@ -3327,7 +3326,6 @@ BOOLEAN NewWorld( INT32 nMapRows, INT32 nMapCols ) UINT16 NewIndex; INT32 cnt; - AdjustSoldierCreationStartValues( ); TrashWorld(); From e59d915e58267ec6f50a275973ebd34152819d73 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 1 Dec 2024 00:20:41 +0200 Subject: [PATCH 197/571] Use SoldierID --- Tactical/Handle UI.cpp | 66 ++++++++++++++++++--------------- Tactical/Interface Dialogue.cpp | 48 +++++++++++++----------- Tactical/Interface Panels.cpp | 17 ++++----- Tactical/Interface.cpp | 6 +-- Tactical/Items.cpp | 7 ++-- Tactical/Keys.cpp | 52 +++++++++++++------------- Tactical/Merc Hiring.cpp | 27 +++++++------- Tactical/Militia Control.cpp | 53 ++++++++++++++------------ Tactical/Morale.cpp | 17 +++++---- 9 files changed, 158 insertions(+), 135 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index fcae5d59..f6ed976f 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -5503,9 +5503,9 @@ BOOLEAN MakeSoldierTurn( SOLDIERTYPE *pSoldier, INT16 sXPos, INT16 sYPos ) UINT32 UIHandleLCLook( UI_EVENT *pUIEvent ) { - INT16 sXPos, sYPos; - SOLDIERTYPE *pSoldier; - INT32 cnt; + INT16 sXPos, sYPos; + SOLDIERTYPE *pSoldier; + SoldierID cnt; if ( !GetMouseXY( &sXPos, &sYPos ) ) { return( GAME_SCREEN ); @@ -5515,8 +5515,9 @@ UINT32 UIHandleLCLook( UI_EVENT *pUIEvent ) { // OK, loop through all guys who are 'multi-selected' and cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -5820,10 +5821,10 @@ void GetGridNoScreenXY( INT32 sGridNo, INT16 *pScreenX, INT16 *pScreenY ) void EndMultiSoldierSelection( BOOLEAN fAcknowledge ) { - SOLDIERTYPE * pSoldier; - INT32 cnt; - SOLDIERTYPE *pFirstSoldier = NULL; - BOOLEAN fSelectedSoldierInBatch = FALSE; + SOLDIERTYPE *pSoldier; + SoldierID cnt; + SOLDIERTYPE *pFirstSoldier = NULL; + BOOLEAN fSelectedSoldierInBatch = FALSE; gTacticalStatus.fAtLeastOneGuyOnMultiSelect = FALSE; @@ -5833,8 +5834,9 @@ void EndMultiSoldierSelection( BOOLEAN fAcknowledge ) // check if our currently selected guy is among the // lucky few.. if not, change to a guy who is... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -5879,15 +5881,16 @@ BOOLEAN StopRubberBandedMercFromMoving(void) } SOLDIERTYPE *pSoldier; - INT32 cnt; + SoldierID cnt; BOOLEAN fFound = FALSE; // OK, loop through all guys who are 'multi-selected' and // check if our currently selected guy is among the // lucky few.. if not, change to a guy who is... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -5923,10 +5926,10 @@ void EndRubberBanding( ) BOOLEAN HandleMultiSelectionMove( INT32 sDestGridNo ) { - SOLDIERTYPE * pSoldier; - INT32 cnt; - BOOLEAN fAtLeastOneMultiSelect = FALSE; - BOOLEAN fMoveFast = FALSE; + SOLDIERTYPE *pSoldier; + SoldierID cnt; + BOOLEAN fAtLeastOneMultiSelect = FALSE; + BOOLEAN fMoveFast = FALSE; // OK, loop through all guys who are 'multi-selected' and // Make them move.... @@ -5935,8 +5938,9 @@ BOOLEAN HandleMultiSelectionMove( INT32 sDestGridNo ) gfGetNewPathThroughPeople = TRUE; cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -5958,8 +5962,9 @@ BOOLEAN HandleMultiSelectionMove( INT32 sDestGridNo ) INT32 highestY = 0; cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -5978,8 +5983,9 @@ BOOLEAN HandleMultiSelectionMove( INT32 sDestGridNo ) INT32 centerY = (highestY + lowestY)/2; cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -6068,9 +6074,10 @@ void ResetMultiSelection( ) { // OK, loop through all guys who are 'multi-selected' and // Make them move.... - INT32 cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for (SOLDIERTYPE* pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + SOLDIERTYPE *pSoldier = cnt; if ( pSoldier && pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -6087,12 +6094,12 @@ void ResetMultiSelection( ) UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) { - SOLDIERTYPE * pSoldier; - INT32 cnt; - INT16 sScreenX, sScreenY; - INT32 iTemp; - SGPRect aRect; - BOOLEAN fAtLeastOne = FALSE; + SOLDIERTYPE *pSoldier; + SoldierID cnt; + INT16 sScreenX, sScreenY; + INT32 iTemp; + SGPRect aRect; + BOOLEAN fAtLeastOne = FALSE; guiNewUICursor = NO_UICURSOR; //SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); @@ -6120,8 +6127,9 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) // ATE:Check at least for one guy that's in point! cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Check if this guy is OK to control.... if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) { @@ -6148,9 +6156,9 @@ UINT32 UIHandleRubberBandOnTerrain( UI_EVENT *pUIEvent ) // ATE: Now loop through our guys and see if any fit! cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { - + pSoldier = cnt; // Check if this guy is OK to control.... if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) { diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index a47e6402..65fbf560 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -1818,16 +1818,16 @@ void HandleFactForNPCUnescorted( UINT8 ubNPC ) void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum ) { - INT32 cnt; - SOLDIERTYPE *pSoldier, *pSoldier2; - INT8 bNumDone = 0; - INT32 sGridNo = NOWHERE, sAdjustedGridNo; - INT8 bItemIn; - UINT8 ubDesiredMercDir; - EXITGRID ExitGrid; - INT32 iRandom = 0; - UINT8 ubMineIndex; - INT16 sX, sY, sX2, sY2; + SoldierID cnt; + SOLDIERTYPE *pSoldier, *pSoldier2; + INT8 bNumDone = 0; + INT32 sGridNo = NOWHERE, sAdjustedGridNo; + INT8 bItemIn; + UINT8 ubDesiredMercDir; + EXITGRID ExitGrid; + INT32 iRandom = 0; + UINT8 ubMineIndex; + INT16 sX, sY, sX2, sY2; pSoldier2 = NULL; //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Handling %s, action %d at %ld", gMercProfiles[ ubTargetNPC ].zNickname, usActionCode, GetJA2Clock() ); @@ -1880,8 +1880,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum // Squad here to search for... // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) { @@ -2170,8 +2171,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector ) { @@ -3726,8 +3728,9 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum { //HOSPITAL_PATIENT_DISTANCE cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && (pSoldier->stats.bLife < pSoldier->stats.bLifeMax || NumberOfDamagedStats(pSoldier) > 0) && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL && PythSpacesAway( pSoldier->sGridNo, pSoldier2->sGridNo ) < HOSPITAL_PATIENT_DISTANCE ) { @@ -4578,9 +4581,9 @@ UINT32 CalcMedicalCost( UINT8 ubId ) INT32 sGridNo = pNPC->sGridNo; - for ( UINT32 cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->bAssignment != ASSIGNMENT_HOSPITAL ) { if ( pSoldier->stats.bLife < pSoldier->stats.bLifeMax || NumberOfDamagedStats(pSoldier) > 0) @@ -4850,13 +4853,14 @@ void DialogueMessageBoxCallBack( UINT8 ubExitValue ) { // He tried to lie..... // Find the best conscious merc with a chance.... - UINT16 cnt; - SOLDIERTYPE * pLier = NULL; - SOLDIERTYPE * pSoldier; + SoldierID cnt; + SOLDIERTYPE *pLier = NULL; + SOLDIERTYPE *pSoldier; cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->bBreath >= OKBREATH ) { if (!pLier || (EffectiveWisdom( pSoldier ) + EffectiveLeadership( pSoldier ) > EffectiveWisdom( pLier ) + EffectiveLeadership( pSoldier ) ) ) @@ -5016,13 +5020,13 @@ void DoneFadeInActionBasement( ) { // Start conversation, etc SOLDIERTYPE *pSoldier, *pNPCSoldier; - INT32 cnt; // Look for someone to talk to // look for all mercs on the same team, - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector && pSoldier->bAssignment == CurrentSquad( ) ) { diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 8f039637..b723ab93 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -591,7 +591,7 @@ void CheckForDisabledForGiveItem( ) INT16 sDist; INT32 sDestGridNo; INT8 bDestLevel; - INT32 cnt; + SoldierID cnt; SOLDIERTYPE *pSoldier; SoldierID ubSrcSoldier; @@ -614,8 +614,9 @@ void CheckForDisabledForGiveItem( ) { // Go through each merc and see if there is one closeby.... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) && pSoldier->bInSector && IsMercOnCurrentSquad( pSoldier ) ) { sDist = PythSpacesAway( gpSMCurrentMerc->sGridNo, pSoldier->sGridNo ); @@ -4511,9 +4512,9 @@ void BtnDropPackCallback(GUI_BUTTON *btn,INT32 reason) if ( _KeyDown( SHIFT ) ) { INT8 bAssignment = gpSMCurrentMerc->bAssignment; - for( int x = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; x <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; x++ ) + for( SoldierID x = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; x <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++x ) { - SOLDIERTYPE *pSoldier = MercPtrs[x]; + SOLDIERTYPE *pSoldier = x; /* Is DropPackFlag currently false and is there something in the backpack pocket? If so, we haven't dropped a pack yet and apparently want to*/ if(pSoldier->bAssignment == bAssignment && pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.DropPackFlag) @@ -6437,13 +6438,12 @@ void CheckForFacePanelStartAnims( SOLDIERTYPE *pSoldier, INT16 sPanelX, INT16 sP void FinishAnySkullPanelAnimations( ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt2; - - cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt2 ]; cnt2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt2++,pTeamSoldier++ ) + for ( ; cnt2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt2 ) { + pTeamSoldier = cnt2; if ( pTeamSoldier->bActive && pTeamSoldier->stats.bLife == 0 ) { if ( pTeamSoldier->flags.fUIdeadMerc || pTeamSoldier->flags.fClosePanelToDie ) @@ -6455,7 +6455,6 @@ void FinishAnySkullPanelAnimations( ) } } } - } void HandlePanelFaceAnimations( SOLDIERTYPE *pSoldier ) diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 615cec5a..b25d4c7a 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -5209,7 +5209,6 @@ void UpdateEnemyUIBar( ) void InitPlayerUIBar( BOOLEAN fInterrupt ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; INT16 bNumOK = 0, bNumNotOK = 0; if ( !gGameOptions.fTurnTimeLimit ) @@ -5235,11 +5234,12 @@ void InitPlayerUIBar( BOOLEAN fInterrupt ) gTacticalStatus.usTactialTurnLimitCounter = 0; // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Are we active and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 70de1d87..c88fd215 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -15332,10 +15332,11 @@ OBJECTTYPE* GetExternalFeedingObject(SOLDIERTYPE* pSoldier, OBJECTTYPE * pObject // loop over other members of our team in this sector. This includes ourself, as our gun can be fed from a belt in our inventory SOLDIERTYPE* pTeamSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - INT32 lastid = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt < lastid; ++cnt, ++pTeamSoldier) + SoldierID cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pTeamSoldier = cnt; // check if teamsoldier exists in this sector if ( !pTeamSoldier || !pTeamSoldier->bActive || !pTeamSoldier->bInSector || pTeamSoldier->stats.bLife < OKLIFE || pTeamSoldier->sSectorX != pSoldier->sSectorX || pTeamSoldier->sSectorY != pSoldier->sSectorY || pTeamSoldier->bSectorZ != pSoldier->bSectorZ ) continue; diff --git a/Tactical/Keys.cpp b/Tactical/Keys.cpp index b8dc66e4..38171f5f 100644 --- a/Tactical/Keys.cpp +++ b/Tactical/Keys.cpp @@ -1390,11 +1390,11 @@ DOOR_STATUS *GetDoorStatus( INT32 sGridNo ) BOOLEAN AllMercsLookForDoor( INT32 sGridNo, BOOLEAN fUpdateValue ) { - INT32 cnt, cnt2; - INT8 bDirs[ 8 ] = { NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST }; - SOLDIERTYPE *pSoldier; - DOOR_STATUS *pDoorStatus; - INT32 usNewGridNo; + INT32 cnt2; + INT8 bDirs[ 8 ] = { NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST }; + SOLDIERTYPE *pSoldier; + DOOR_STATUS *pDoorStatus; + INT32 usNewGridNo; // Get door pDoorStatus = GetDoorStatus( sGridNo ); @@ -1405,11 +1405,12 @@ BOOLEAN AllMercsLookForDoor( INT32 sGridNo, BOOLEAN fUpdateValue ) } // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // ATE: Ok, lets check for some basic things here! if ( pSoldier->stats.bLife >= OKLIFE && !TileIsOutOfBounds(pSoldier->sGridNo) && pSoldier->bActive && pSoldier->bInSector ) { @@ -2070,11 +2071,10 @@ BOOLEAN LoadKeyTableFromSaveedGameFile( HWFILE hFile, UINT32 uiSaveGameVersion ) void ExamineDoorsOnEnteringSector( ) { - INT32 cnt; - DOOR_STATUS *pDoorStatus; - SOLDIERTYPE *pSoldier; - BOOLEAN fOK = FALSE; - INT8 bTownId; + DOOR_STATUS *pDoorStatus; + SOLDIERTYPE *pSoldier; + BOOLEAN fOK = FALSE; + INT8 bTownId; // OK, only do this if conditions are met.... // If this is any omerta tow, don't do it... @@ -2093,10 +2093,11 @@ void ExamineDoorsOnEnteringSector( ) // there is at least one human being in that sector. // check for civ - cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; cnt++ ,pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive ) { if ( pSoldier->bInSector ) @@ -2110,7 +2111,7 @@ void ExamineDoorsOnEnteringSector( ) // Let's do it! if ( fOK ) { - for ( cnt = 0; cnt < gubNumDoorStatus; cnt++ ) + for ( UINT8 cnt = 0; cnt < gubNumDoorStatus; cnt++ ) { pDoorStatus = &( gpDoorStatus[ cnt ] ); @@ -2126,12 +2127,11 @@ void ExamineDoorsOnEnteringSector( ) void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) { - INT32 cnt; - DOOR_STATUS *pDoorStatus; - SOLDIERTYPE *pSoldier; - BOOLEAN fOK = FALSE; - INT32 iNumNewMercs = 0; - INT8 bTownId; + DOOR_STATUS *pDoorStatus; + SOLDIERTYPE *pSoldier; + BOOLEAN fOK = FALSE; + INT32 iNumNewMercs = 0; + INT8 bTownId; // OK, only do this if conditions are met.... @@ -2145,7 +2145,7 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) // 1 ) there is at least one human being in that sector. // check for civ - cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; // Check time... if ( ( GetWorldTotalMin( ) - gTacticalStatus.uiTimeSinceLastInTactical ) < 30 ) @@ -2154,8 +2154,9 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) } // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; cnt++ ,pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ LAST_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { fOK = TRUE; @@ -2165,8 +2166,9 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) // Loop through our team now.... cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++ ,pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && gbMercIsNewInThisSector[ cnt ] ) { iNumNewMercs++; @@ -2182,7 +2184,7 @@ void HandleDoorsChangeWhenEnteringSectorCurrentlyLoaded( ) // Let's do it! if ( fOK ) { - for ( cnt = 0; cnt < gubNumDoorStatus; cnt++ ) + for ( UINT8 cnt = 0; cnt < gubNumDoorStatus; cnt++ ) { pDoorStatus = &( gpDoorStatus[ cnt ] ); diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 9cc5525b..a1db1e9d 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -673,10 +673,10 @@ BOOLEAN IsTheSoldierAliveAndConcious( SOLDIERTYPE *pSoldier ) UINT16 NumberOfMercsOnPlayerTeam() { - UINT16 cnt; - SOLDIERTYPE *pSoldier; - UINT16 bLastTeamID; - UINT16 ubCount=0; + SoldierID cnt; + SOLDIERTYPE *pSoldier; + SoldierID bLastTeamID; + UINT16 ubCount=0; // Set locator to first merc cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; @@ -685,8 +685,9 @@ UINT16 NumberOfMercsOnPlayerTeam() if (! MercPtrs[cnt]) return 0; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pSoldier++) + for ( ; cnt <= bLastTeamID; ++cnt ) { + pSoldier = cnt; AssertNotNIL(pSoldier); //if the is active, and is not a vehicle @@ -702,9 +703,9 @@ UINT16 NumberOfMercsOnPlayerTeam() void HandleMercArrivesQuotes( SOLDIERTYPE *pSoldier ) { - UINT16 cnt, usLastTeamID; - INT8 bHated; - SOLDIERTYPE *pTeamSoldier; + SoldierID cnt, usLastTeamID; + INT8 bHated; + SOLDIERTYPE *pTeamSoldier; #ifdef JA2UB //if we are at the begining of the game going through the initial heli scequence if( pSoldier->fWaitingToGetupFromJA25Start ) @@ -730,8 +731,9 @@ void HandleMercArrivesQuotes( SOLDIERTYPE *pSoldier ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; usLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop though all the mercs - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= usLastTeamID; ++cnt, ++pTeamSoldier) + for ( ; cnt <= usLastTeamID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive ) { if ( pTeamSoldier->ubWhatKindOfMercAmI == MERC_TYPE__AIM_MERC ) @@ -819,14 +821,13 @@ UINT32 GetMercArrivalTimeOfDay( ) void UpdateAnyInTransitMercsWithGlobalArrivalSector( ) { - INT32 cnt; SOLDIERTYPE *pSoldier; - - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive ) { if ( pSoldier->bAssignment == IN_TRANSIT ) diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index e5fad2d8..0986c867 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -176,12 +176,11 @@ void ResetMilitia() void RemoveMilitiaFromTactical() { SOLDIERINITNODE *curr; - INT32 i; - for( i = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; i <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; i++ ) + for( SoldierID id = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; id <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++id ) { - if( MercPtrs[ i ]->bActive ) + if( id->bActive ) { - TacticalRemoveSoldier( MercPtrs[ i ]->ubID ); + TacticalRemoveSoldier( id ); } } curr = gSoldierInitHead; @@ -327,7 +326,6 @@ void PrepareMilitiaForTactical( BOOLEAN fPrepareAll) void HandleMilitiaPromotions( void ) { - UINT16 cnt; SOLDIERTYPE* pTeamSoldier; gbGreenToElitePromotions = 0; @@ -335,10 +333,11 @@ void HandleMilitiaPromotions( void ) gbRegToElitePromotions = 0; gbMilitiaPromotions = 0; - cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt, ++pTeamSoldier) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 ) { // Flugente: take care of promotions and individual militia update @@ -1422,13 +1421,14 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_ATTACK ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI @@ -1459,13 +1459,14 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_HOLD ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI @@ -1495,14 +1496,15 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_RETREAT ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; INT16 sActionGridNo; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI @@ -1558,15 +1560,16 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_COMETOME ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; UINT8 ubDirection; INT32 sActionGridNo, sGridNo, sAdjustedGridNo; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI @@ -1615,14 +1618,15 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_SPREAD ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; INT32 sActionGridNo; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI @@ -1668,13 +1672,14 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_GETDOWN ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI @@ -1706,13 +1711,14 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_CROUCH ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt, ++pTeamSoldier) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI @@ -1744,15 +1750,16 @@ void MilitiaControlMenuBtnCallBack( MOUSE_REGION * pRegion, INT32 iReason ) case( MILCON_MENU_ALL_TAKE_COVER ): if (fAllowSectorOrder) { - UINT16 cnt; + SoldierID cnt; INT16 sActionGridNo; INT32 iDummy; SOLDIERTYPE *pTeamSoldier; cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( (pTeamSoldier->bActive) && (pTeamSoldier->bInSector) && (pTeamSoldier->stats.bLife >= OKLIFE) ) { // sevenfm: stop any AI diff --git a/Tactical/Morale.cpp b/Tactical/Morale.cpp index bd2924cb..6a3fcc85 100644 --- a/Tactical/Morale.cpp +++ b/Tactical/Morale.cpp @@ -253,12 +253,13 @@ void DecayStrategicMorale( SOLDIERTYPE * pSoldier ) void DecayTacticalMoraleModifiers( void ) { SOLDIERTYPE * pSoldier; - UINT16 ubLoop, ubLoop2; + SoldierID ubLoop, ubLoop2; BOOLEAN fHandleNervous; ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pSoldier++ ) + for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop ) { + pSoldier = ubLoop; //if the merc is active, in Arulco // CJC: decay modifiers while asleep! or POW! if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && @@ -313,10 +314,10 @@ void DecayTacticalMoraleModifiers( void ) { // look for anyone else in same sector fHandleNervous = TRUE; - for ( ubLoop2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop2++ ) + for ( ubLoop2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop2 <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop2 ) { - SOLDIERTYPE *pSoldier = MercPtrs[ubLoop2]; - if ( pSoldier != pSoldier && pSoldier->bActive && pSoldier->sSectorX == pSoldier->sSectorX && pSoldier->sSectorY == pSoldier->sSectorY && pSoldier->bSectorZ == pSoldier->bSectorZ ) + SOLDIERTYPE *pSoldier2 = ubLoop2; + if ( pSoldier2 != pSoldier && pSoldier2->bActive && pSoldier2->sSectorX == pSoldier->sSectorX && pSoldier2->sSectorY == pSoldier->sSectorY && pSoldier2->bSectorZ == pSoldier->bSectorZ ) { // found someone! fHandleNervous = FALSE; @@ -361,11 +362,11 @@ void DecayTacticalMoraleModifiers( void ) void DecayStrategicMoraleModifiers( void ) { SOLDIERTYPE * pSoldier; - UINT16 ubLoop; + SoldierID ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pSoldier++ ) + for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop ) { + pSoldier = ubLoop; //if the merc is active, in Arulco // CJC: decay modifiers while asleep! or POW! if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && From bfb724eab9088460cebb207295e2cd72d01cc2d1 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 1 Dec 2024 18:23:52 +0200 Subject: [PATCH 198/571] Use SoldierID --- Laptop/BobbyRGuns.cpp | 17 +- Multiplayer/client.cpp | 13 +- Strategic/Quests.cpp | 4 +- Strategic/Strategic Merc Handler.cpp | 8 +- Tactical/Morale.cpp | 116 ++--- Tactical/Overhead.cpp | 419 +++++++++--------- Tactical/Overhead.h | 2 +- Tactical/Real Time Input.cpp | 92 ++-- Tactical/Rotting Corpses.cpp | 18 +- Tactical/ShopKeeper Interface.cpp | 5 +- Tactical/SkillCheck.cpp | 6 +- Tactical/SkillMenu.cpp | 14 +- Tactical/Soldier Add.cpp | 16 +- Tactical/Soldier Ani.cpp | 15 +- Tactical/Soldier Control.cpp | 137 +++--- Tactical/Soldier Create.cpp | 28 +- Tactical/Soldier Init List.cpp | 18 +- Tactical/Soldier Profile.cpp | 13 +- Tactical/Strategic Exit GUI.cpp | 6 +- Tactical/Tactical Save.cpp | 34 +- Tactical/Tactical Turns.cpp | 17 +- Tactical/TeamTurns.cpp | 177 ++++---- Tactical/Turn Based Input.cpp | 584 +++++++++++++------------- Tactical/Vehicles.cpp | 14 +- Tactical/opplist.cpp | 315 +++++++------- TacticalAI/AIMain.cpp | 17 +- TacticalAI/AIUtils.cpp | 95 ++--- TacticalAI/Attacks.cpp | 4 +- TacticalAI/CreatureDecideAction.cpp | 14 +- TacticalAI/DecideAction.cpp | 4 +- TacticalAI/Knowledge.cpp | 12 +- TacticalAI/Medical.cpp | 28 +- TacticalAI/NPC.cpp | 12 +- TileEngine/Explosion Control.cpp | 32 +- TileEngine/Isometric Utils.cpp | 7 +- TileEngine/Tactical Placement GUI.cpp | 14 +- 36 files changed, 1165 insertions(+), 1162 deletions(-) diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 26d2c43a..64e8281f 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -3719,26 +3719,27 @@ void OutOfStockMessageBoxCallBack( UINT8 bExitValue ) UINT8 CheckPlayersInventoryForGunMatchingGivenAmmoID( INT16 sItemID ) { UINT8 ubItemCount=0; - UINT16 ubMercCount; UINT8 ubPocketCount; - UINT16 ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - UINT16 ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + SoldierID id; + SoldierID ubFirstID = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + SoldierID ubLastID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; //loop through all the mercs on the team - for( ubMercCount = ubFirstID; ubMercCount <= ubLastID; ++ubMercCount ) + for( id = ubFirstID; id <= ubLastID; ++id ) { - if( Menptr[ ubMercCount ].bActive ) + SOLDIERTYPE *pSoldier = id; + if( pSoldier->bActive ) { //loop through all the pockets on the merc - UINT8 invsize = Menptr[ ubMercCount ].inv.size(); + UINT8 invsize = pSoldier->inv.size(); for( ubPocketCount=0; ubPocketCountinv[ ubPocketCount ].usItem ].usItemClass == IC_GUN ) { //if the weapon uses the same kind of ammo as the one passed in, return true - if( Weapon[ Menptr[ ubMercCount ].inv[ ubPocketCount ].usItem ].ubCalibre == Magazine[ Item[ sItemID ].ubClassIndex ].ubCalibre ) + if( Weapon[ pSoldier->inv[ ubPocketCount ].usItem ].ubCalibre == Magazine[ Item[ sItemID ].ubClassIndex ].ubCalibre ) { ++ubItemCount; } diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 8e1229d4..be5de69f 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -4102,7 +4102,6 @@ void recieveMISS (RPCParameters *rpcParameters) BOOLEAN check_status (void)// any 'enemies' and clients left to fight ?? { SOLDIERTYPE *pSoldier; - int cnt; int soldiers= 0 ; int numActiveSides = 0; @@ -4112,9 +4111,9 @@ BOOLEAN check_status (void)// any 'enemies' and clients left to fight ?? { soldiers=0; - for(cnt = gTacticalStatus.Team[ x ].bFirstID;cnt <= gTacticalStatus.Team[ x ].bLastID; cnt++) + for( SoldierID cnt = gTacticalStatus.Team[ x ].bFirstID;cnt <= gTacticalStatus.Team[ x ].bLastID; ++cnt) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; if(pSoldier->stats.bLife >= OKLIFE && pSoldier->bActive && pSoldier->bInSector) { soldiers++; @@ -4331,14 +4330,14 @@ void null_team (RPCParameters *rpcParameters) { kickR* kick = (kickR*)rpcParameters->input; ScreenMsg( FONT_LTGREEN, MSG_INTERFACE, MPClientMessage[29],(kick->ubResult-5),client_names[kick->ubResult-6] ); - int fID = gTacticalStatus.Team[ kick->ubResult ].bFirstID; - int lID = gTacticalStatus.Team[ kick->ubResult ].bLastID; + SoldierID fID = gTacticalStatus.Team[ kick->ubResult ].bFirstID; + SoldierID lID = gTacticalStatus.Team[ kick->ubResult ].bLastID; if(kick->ubResult==netbTeam) fID=0,lID=19; - int cnt; - for ( cnt=fID ; cnt <= lID; cnt++ ) + SoldierID cnt; + for ( cnt=fID ; cnt <= lID; ++cnt ) { TacticalRemoveSoldier( cnt ); } diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index 3606eca6..4010cf5b 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -1713,9 +1713,9 @@ void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpR { ScreenMsg( FONT_MCOLOR_LTBLUE, MSG_TESTVERSION, L"QUEST COMPLETED - Adding to merc records and awarding experiences (%d).", (bExpReward * gGameExternalOptions.usAwardSpecialExpForQuests) ); - for ( SoldierID i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++i ) + for ( SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; id <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++id ) { - SOLDIERTYPE *pSoldier = i; + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && pSoldier->stats.bLife >= CONSCIOUSNESS && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && pSoldier->ubProfile != NO_PROFILE && pSoldier->sSectorX == sQuestSectorX && pSoldier->sSectorY == sQuestsSectorY && !pSoldier->flags.fBetweenSectors && pSoldier->bTeam == gbPlayerNum && pSoldier->bAssignment != IN_TRANSIT && pSoldier->bAssignment != ASSIGNMENT_DEAD && gMercProfiles[ pSoldier->ubProfile ].ubBodyType != 21 ) // != ROBOTNOWEAPON ) diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index 8f8a0790..e5c3daea 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -185,7 +185,7 @@ void StrategicHandlePlayerTeamMercDeath( SOLDIERTYPE *pSoldier ) void MercDailyUpdate() { SoldierID id; - SoldierID bLastTeamID; + SoldierID lastid; SOLDIERTYPE *pSoldier; //SOLDIERTYPE *pQuitList[ 21 ]; MERCPROFILESTRUCT *pProfile; @@ -218,10 +218,10 @@ void MercDailyUpdate() AddSameDayStrategicEvent( EVENT_BEGIN_CONTRACT_RENEWAL_SEQUENCE, MERC_ARRIVE_TIME_SLOT_3, 0 ); id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + lastid = gTacticalStatus.Team[ gbPlayerNum ].bLastID; //loop though all the mercs - for ( ; id <= bLastTeamID; ++id) + for ( ; id <= lastid; ++id) { pSoldier = id; //if the merc is active @@ -376,7 +376,7 @@ void MercDailyUpdate() } //reset the counter - for ( id = 0; id <= bLastTeamID; ++id ) + for ( id = 0; id <= lastid; ++id ) { pSoldier = id; //if the merc is active diff --git a/Tactical/Morale.cpp b/Tactical/Morale.cpp index 6a3fcc85..3031cae1 100644 --- a/Tactical/Morale.cpp +++ b/Tactical/Morale.cpp @@ -728,9 +728,9 @@ void HandleMoraleEventForSoldier( SOLDIERTYPE * pSoldier, INT8 bMoraleEvent ) void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { - UINT16 ubLoop; - SOLDIERTYPE * pTeamSoldier; - MERCPROFILESTRUCT * pProfile; + SoldierID id; + SOLDIERTYPE *pTeamSoldier; + MERCPROFILESTRUCT *pProfile; gfSomeoneSaidMoraleQuote = FALSE; @@ -778,9 +778,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I case MORALE_BATTLE_WON: // affects everyone to varying degrees - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; id <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive ) { if ( SOLDIER_IN_SECTOR( pTeamSoldier, sMapX, sMapY, bMapZ ) ) @@ -797,9 +798,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I break; case MORALE_RAN_AWAY: // affects everyone to varying degrees - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; id <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive ) { // CJC: adding to SOLDIER_IN_SECTOR check special stuff because the old sector values might @@ -869,9 +871,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I case MORALE_MONSTER_QUEEN_KILLED: case MORALE_DEIDRANNA_KILLED: // affects everyone, everywhere - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive ) { if ( gGameOptions.fNewTraitSystem && bMoraleEvent != MORALE_DEIDRANNA_KILLED) @@ -898,9 +901,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I case MORALE_GREAT_MORALE: case MORALE_AIRSTRIKE: // affects every in sector - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive && SOLDIER_IN_SECTOR( pTeamSoldier, sMapX, sMapY, bMapZ ) ) { HandleMoraleEventForSoldier( pTeamSoldier, bMoraleEvent ); @@ -913,9 +917,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I Assert( pSoldier ); // affects everyone - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive ) { HandleMoraleEventForSoldier( pTeamSoldier, bMoraleEvent ); @@ -927,9 +932,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I Assert( pSoldier ); // affects everyone, in sector differently than not, extra bonuses if it's a buddy or hated merc - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive && pTeamSoldier->ubProfile != NO_PROFILE) { pProfile = &(gMercProfiles[ pTeamSoldier->ubProfile ]); @@ -982,9 +988,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I // female mercs get unhappy based on how sexist they are (=hate men) // gentlemen males get unhappy too - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive && pTeamSoldier->ubProfile != NO_PROFILE ) { if ( WhichHated( pTeamSoldier->ubProfile, pSoldier->ubProfile ) != -1 ) @@ -1044,9 +1051,10 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I case MORALE_ENEMYGROUP_COWARD: // affects coward in sector - ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pTeamSoldier = MercPtrs[ubLoop]; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++, pTeamSoldier++ ) + id = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; if ( pTeamSoldier->bActive && (pTeamSoldier->sSectorX == sMapX) && (pTeamSoldier->sSectorY == sMapY) && (pTeamSoldier->bSectorZ == bMapZ) ) { if ( DoesMercHavePersonality( pTeamSoldier, CHAR_TRAIT_COWARD ) ) @@ -1142,27 +1150,28 @@ void HandleMoraleEvent( SOLDIERTYPE *pSoldier, INT8 bMoraleEvent, INT16 sMapX, I void HourlyMoraleUpdate( void ) { - UINT16 bMercID, bOtherID, bLastTeamID; - INT8 bActualTeamOpinion; - INT8 bTeamMoraleModChange, bTeamMoraleModDiff; - INT8 bOpinion=-1; - INT32 iTotalOpinions; - INT8 bNumTeamMembers; - INT8 bHighestTeamLeadership = 0; - SOLDIERTYPE * pSoldier; - SOLDIERTYPE * pOtherSoldier; - MERCPROFILESTRUCT * pProfile; - BOOLEAN fSameGroupOnly; - static INT8 bStrategicMoraleUpdateCounter = 0; - BOOLEAN fFoundHated = FALSE; - INT8 bHated; + SoldierID bMercID, bOtherID, bLastTeamID; + INT8 bActualTeamOpinion; + INT8 bTeamMoraleModChange, bTeamMoraleModDiff; + INT8 bOpinion=-1; + INT32 iTotalOpinions; + INT8 bNumTeamMembers; + INT8 bHighestTeamLeadership = 0; + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pOtherSoldier; + MERCPROFILESTRUCT *pProfile; + BOOLEAN fSameGroupOnly; + static INT8 bStrategicMoraleUpdateCounter = 0; + BOOLEAN fFoundHated = FALSE; + INT8 bHated; bMercID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLastTeamID = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // loop through all mercs to calculate their morale - for ( pSoldier = MercPtrs[ bMercID ]; bMercID <= bLastTeamID; ++bMercID,pSoldier++) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; //if the merc is active, in Arulco, and conscious, not POW if ( pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && !(pSoldier->bAssignment == IN_TRANSIT || @@ -1194,8 +1203,9 @@ void HourlyMoraleUpdate( void ) // loop through all other mercs bOtherID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pOtherSoldier = MercPtrs[ bOtherID ]; bOtherID <= bLastTeamID; bOtherID++,pOtherSoldier++) + for ( ; bOtherID <= bLastTeamID; ++bOtherID ) { + pOtherSoldier = bOtherID; // skip past ourselves and all inactive mercs if (bOtherID != bMercID && pOtherSoldier->bActive && pOtherSoldier->ubProfile != NO_PROFILE && !(pOtherSoldier->bAssignment == IN_TRANSIT || @@ -1345,13 +1355,12 @@ void HourlyMoraleUpdate( void ) void HandleSnitchCheck( void ) { - UINT16 bMercID, bOtherID; - INT8 bOpinion = -1; - UINT16 bLastTeamID; - SOLDIERTYPE* pSoldier; - SOLDIERTYPE* pOtherSoldier; - MERCPROFILESTRUCT* pProfile; - BOOLEAN fSameGroupOnly; + SoldierID bMercID, bOtherID, bLastTeamID; + INT8 bOpinion = -1; + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pOtherSoldier; + MERCPROFILESTRUCT *pProfile; + BOOLEAN fSameGroupOnly; // anv: save merc id and his negative morale event for snitches std::vector snitcheventvector; @@ -1359,8 +1368,9 @@ void HandleSnitchCheck( void ) bLastTeamID = gTacticalStatus.Team[gbPlayerNum].bLastID; // loop through all mercs to calculate their morale - for ( pSoldier = MercPtrs[bMercID]; bMercID <= bLastTeamID; ++bMercID, pSoldier++ ) + for ( ; bMercID <= bLastTeamID; ++bMercID ) { + pSoldier = bMercID; //if the merc is active, in Arulco, not POW, not a vehicle if ( pSoldier && pSoldier->bActive && pSoldier->ubProfile != NO_PROFILE && !(pSoldier->bAssignment == IN_TRANSIT || @@ -1383,8 +1393,9 @@ void HandleSnitchCheck( void ) } // loop through all other mercs bOtherID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pOtherSoldier = MercPtrs[bOtherID]; bOtherID <= bLastTeamID; ++bOtherID, pOtherSoldier++ ) + for ( ; bOtherID <= bLastTeamID; ++bOtherID ) { + pOtherSoldier = bOtherID; // skip past ourselves and all inactive mercs if ( bOtherID != bMercID && pOtherSoldier && pOtherSoldier->bActive && pOtherSoldier->ubProfile != NO_PROFILE && !(pOtherSoldier->bAssignment == IN_TRANSIT || @@ -1558,7 +1569,7 @@ void HandleSnitchesReports( std::vector& aVec ) void RememberSnitchableEvent( UINT8 ubTargetProfile, UINT8 ubSecondaryTargetProfile, BOOLEAN fSameGroupOnly, UINT8 ubEventType, std::vector& aVec ) { - UINT16 bSnitchID; + SoldierID bSnitchID; INT16 sSnitchingChance = 0; UINT8 ubSnitchProfile; SOLDIERTYPE * pSnitch; @@ -1570,8 +1581,9 @@ void RememberSnitchableEvent( UINT8 ubTargetProfile, UINT8 ubSecondaryTargetProf // loop through all other mercs bSnitchID = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pSnitch = MercPtrs[bSnitchID]; bSnitchID <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bSnitchID, pSnitch++ ) + for ( ; bSnitchID <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bSnitchID ) { + pSnitch = bSnitchID; ubSnitchProfile = pSnitch->ubProfile; // skip past ourselves and all inactive mercs if ( ProfileHasSkillTrait( ubSnitchProfile, SNITCH_NT ) && @@ -1703,10 +1715,10 @@ void DailyMoraleUpdate(SOLDIERTYPE *pSoldier) // Added by SANDRO BOOLEAN IsShowOffNearBy( SOLDIERTYPE * pSoldier ) { - UINT32 uiLoop; - SOLDIERTYPE * pTeammate; - BOOLEAN fOneException = FALSE; - BOOLEAN fYesHeIs = FALSE; + SoldierID uiLoop; + SOLDIERTYPE *pTeammate; + BOOLEAN fOneException = FALSE; + BOOLEAN fYesHeIs = FALSE; if (!pSoldier) { @@ -1717,9 +1729,9 @@ BOOLEAN IsShowOffNearBy( SOLDIERTYPE * pSoldier ) return( FALSE ); } - for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; uiLoop++) + for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++uiLoop ) { - pTeammate = MercPtrs[ uiLoop ]; + pTeammate = uiLoop; if ( pTeammate == NULL ) { continue; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 0b28c4e0..789a4b80 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -2276,14 +2276,13 @@ BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLE // IF not in combat, stop them all if ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - INT32 cnt2; - SOLDIERTYPE *pSoldier2; - - cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + SOLDIERTYPE *pSoldier2; + SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // look for all mercs on the same team, - for ( pSoldier2 = MercPtrs[ cnt2 ]; cnt2 >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt2-- ,pSoldier2-- ) + for ( ; id >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; --id ) { + pSoldier2 = id; if ( pSoldier2->bActive ) { pSoldier2->EVENT_StopMerc( pSoldier2->sGridNo, pSoldier2->ubDirection ); @@ -2983,14 +2982,13 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) // IF not in combat, stop them all if ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) { - INT32 cnt2; - SOLDIERTYPE *pSoldier2; - - cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + SOLDIERTYPE *pSoldier2; + SoldierID cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bLastID; // look for all mercs on the same team, - for ( pSoldier2 = MercPtrs[ cnt2 ]; cnt2 >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt2-- ,pSoldier2-- ) + for ( ; cnt2 >= gTacticalStatus.Team[ gbPlayerNum ].bFirstID; --cnt2 ) { + pSoldier2 = cnt2; if ( pSoldier2->bActive ) { pSoldier2->EVENT_StopMerc( pSoldier2->sGridNo, pSoldier2->ubDirection ); @@ -3230,17 +3228,17 @@ BOOLEAN HandleAtNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving ) void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ) { - INT32 cnt; SOLDIERTYPE *pTeamSoldier; BOOLEAN fSoldierFound = FALSE; DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SelectNextAvailSoldier")); // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + SoldierID id = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( ; id <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++id ) { + pTeamSoldier = id; if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) ) { fSoldierFound = TRUE; @@ -3251,7 +3249,7 @@ void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier ) if ( fSoldierFound ) { DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SelectNextAvailSoldier: selectsoldier")); - SelectSoldier( cnt, FALSE, FALSE ); + SelectSoldier( id, FALSE, FALSE ); } else { @@ -3604,7 +3602,7 @@ void RebuildAllSoldierShadeTables( ) void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) { - INT32 cnt; + SoldierID cnt; SoldierID iNewSelectedSoldier; SOLDIERTYPE *pTeamSoldier; BOOLEAN fMissionFailed = TRUE; @@ -3619,8 +3617,9 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) { iNewSelectedSoldier = cnt; @@ -3643,8 +3642,9 @@ void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ) // see if this was the friend of a living merc cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife >= OKLIFE ) { bBuddyIndex = WhichBuddy( pTeamSoldier->ubProfile, pSoldier->ubProfile ); @@ -4245,19 +4245,18 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) CheckForEndOfBattle( FALSE ); } -UINT16 LastActiveTeamMember( UINT16 ubTeam ) +SoldierID LastActiveTeamMember( UINT16 ubTeam ) { - INT32 cnt; SOLDIERTYPE *pSoldier; - - cnt = gTacticalStatus.Team[ ubTeam ].bLastID; + SoldierID cnt = gTacticalStatus.Team[ ubTeam ].bLastID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt >= gTacticalStatus.Team[ ubTeam ].bFirstID; cnt-- ,pSoldier--) + for ( ; cnt >= gTacticalStatus.Team[ ubTeam ].bFirstID; --cnt) { + pSoldier = cnt; if ( pSoldier->bActive ) { - return( (UINT16)cnt ); + return( cnt ); } } @@ -4479,9 +4478,10 @@ void MakeCivHostile(SOLDIERTYPE *pSoldier) // rehandle sight for everybody SOLDIERTYPE* pTeamSoldier; - UINT16 iLoop = gTacticalStatus.Team[OUR_TEAM].bFirstID; - for ( pTeamSoldier = MercPtrs[iLoop]; iLoop <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++iLoop, ++pTeamSoldier ) + SoldierID iLoop = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; iLoop <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++iLoop ) { + pTeamSoldier = iLoop; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->stats.bLife > 0 ) { RecalculateOppCntsDueToNoLongerNeutral( pTeamSoldier ); @@ -4522,16 +4522,16 @@ UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked ) { SOLDIERTYPE * pSoldier; UINT8 ubFirstProfile = NO_PROFILE; - UINT16 cnt; if ( pAttacked->ubCivilianGroup == NON_CIV_GROUP ) { return( pAttacked->ubProfile ); } - cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral ) { if ( pSoldier->ubCivilianGroup == pAttacked->ubCivilianGroup && pSoldier->ubBodyType != COW ) @@ -4565,7 +4565,6 @@ SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked ) SOLDIERTYPE * pNew; SOLDIERTYPE * pNewAttacked = pAttacked; SOLDIERTYPE * pSoldier; - UINT16 cnt; UINT8 ubFirstProfile = NO_PROFILE; if ( pAttacked->ubCivilianGroup == NON_CIV_GROUP ) @@ -4575,9 +4574,10 @@ SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked ) } // remove anyone (rebels) on our team and put them back in the civ team - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ ,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife) { if (pSoldier->ubCivilianGroup == pAttacked->ubCivilianGroup) @@ -4658,15 +4658,15 @@ SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked ) void CivilianGroupChangesSides( UINT8 ubCivilianGroup ) { // change civ group side due to external event (wall blowing up) - INT32 cnt; SOLDIERTYPE *pSoldier; gTacticalStatus.fCivGroupHostile[ ubCivilianGroup ] = CIV_GROUP_HOSTILE; // now change sides for anyone on the civ team - cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral) { if ( pSoldier->ubCivilianGroup == ubCivilianGroup && pSoldier->ubBodyType != COW ) @@ -4696,13 +4696,13 @@ void CivilianGroupChangesSides( UINT8 ubCivilianGroup ) void HickCowAttacked( SOLDIERTYPE * pNastyGuy, SOLDIERTYPE * pTarget ) { - INT32 cnt; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; // now change sides for anyone on the civ team - cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral && pSoldier->ubCivilianGroup == HICKS_CIV_GROUP ) { if ( SoldierToSoldierLineOfSightTest( pSoldier, pNastyGuy, TRUE ) ) @@ -4717,7 +4717,6 @@ void HickCowAttacked( SOLDIERTYPE * pNastyGuy, SOLDIERTYPE * pTarget ) void MilitiaChangesSides( ) { // make all the militia change sides - INT32 cnt; SOLDIERTYPE *pSoldier; if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 ) @@ -4726,9 +4725,10 @@ void MilitiaChangesSides( ) } // remove anyone (rebels) on our team and put them back in the civ team - cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++ ,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife) { if ( (gWorldSectorX == 0 && gWorldSectorY == 0) || !NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) ) @@ -4757,15 +4757,14 @@ gTacticalStatus.fCivGroupHostile[ ubLoop ] = CIV_GROUP_HOSTILE; UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) { - INT32 cnt; SOLDIERTYPE *pSoldier; UINT16 ubCount = 0; - - cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeam ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ ubTeam ].bLastID; ++cnt ) { + pSoldier = cnt; if ( OK_CONTROLLABLE_MERC( pSoldier) ) { ubCount++; @@ -4778,16 +4777,14 @@ UINT16 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ) SoldierID FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { - UINT16 bLastTeamID; - UINT16 cnt; SOLDIERTYPE *pTeamSoldier; - - cnt = pSoldier->ubID + 1; - bLastTeamID = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; + SoldierID cnt = pSoldier->ubID + 1; + SoldierID bLastTeamID = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) + for ( ; cnt <= bLastTeamID; ++cnt ) { + pTeamSoldier = cnt; if ( fOnlyRegularMercs ) { if ( pTeamSoldier->bActive && ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) ) @@ -4817,8 +4814,9 @@ SoldierID FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLes cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; bLastTeamID = pSoldier->ubID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) + for ( ; cnt <= bLastTeamID; ++cnt ) { + pTeamSoldier = cnt; if ( fOnlyRegularMercs ) { if ( pTeamSoldier->bActive && ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) ) @@ -4892,17 +4890,16 @@ SOLDIERTYPE *FindNextActiveSquad( SOLDIERTYPE *pSoldier ) SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ) { - UINT16 bLastTeamID; - INT32 cnt; SOLDIERTYPE *pTeamSoldier; // loop back - bLastTeamID = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - cnt = pSoldier->ubID - 1; + SoldierID bLastTeamID = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + SoldierID cnt = pSoldier->ubID - 1; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt >= bLastTeamID; cnt--,pTeamSoldier-- ) + for ( ; cnt >= bLastTeamID; --cnt ) { + pTeamSoldier = cnt; if ( fOnlyRegularMercs ) { if ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) @@ -4932,8 +4929,9 @@ SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLes cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt >= bLastTeamID; cnt--,pTeamSoldier-- ) + for ( ; cnt >= bLastTeamID; --cnt ) { + pTeamSoldier = cnt; if ( fOnlyRegularMercs ) { if ( AM_AN_EPC( pTeamSoldier ) || AM_A_ROBOT( pTeamSoldier ) ) @@ -4966,16 +4964,16 @@ SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLes BOOLEAN CheckForPlayerTeamInMissionExit( ) { - INT32 cnt; SOLDIERTYPE *pSoldier; UINT16 bGuysIn = 0; // End the turn of player charactors - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE ) { if ( pSoldier->flags.fInMissionExitNode ) @@ -5420,23 +5418,23 @@ BOOLEAN IsLocationSittableExcludingPeople( INT32 iMapIndex, BOOLEAN fOnRoof ) } -BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange) +BOOLEAN TeamMemberNear( INT8 bTeam, INT32 sGridNo, INT32 iRange ) { - UINT16 bLoop; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; - for (bLoop=gTacticalStatus.Team[bTeam].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[bTeam].bLastID; ++bLoop, pSoldier++) - { - if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) ) - { - if (PythSpacesAway(pSoldier->sGridNo,sGridNo) <= iRange) - { - return(TRUE); - } - } - } + for ( SoldierID bLoop = gTacticalStatus.Team[bTeam].bFirstID; bLoop <= gTacticalStatus.Team[bTeam].bLastID; ++bLoop ) + { + pSoldier = bLoop; + if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !(pSoldier->flags.uiStatusFlags & SOLDIER_GASSED) ) + { + if ( PythSpacesAway( pSoldier->sGridNo, sGridNo ) <= iRange ) + { + return(TRUE); + } + } + } - return(FALSE); + return(FALSE); } INT32 FindAdjacentGridEx( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 *pubDirection, INT32 *psAdjustedGridNo, BOOLEAN fForceToPerson, BOOLEAN fDoor, bool allow_diagonal ) @@ -6198,7 +6196,6 @@ BOOLEAN UIOKMoveDestination( SOLDIERTYPE *pSoldier, INT32 usMapPos ) void HandleTeamServices( UINT8 ubTeamNum ) { - INT32 cnt; SOLDIERTYPE *pTeamSoldier, *pTargetSoldier; UINT32 uiPointsUsed; SoldierID usSoldierIndex; @@ -6207,11 +6204,12 @@ void HandleTeamServices( UINT8 ubTeamNum ) BOOLEAN fDone; // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ ubTeamNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ ubTeamNum ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeamNum ].bLastID; ++cnt, pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ ubTeamNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->bInSector ) { fDone = FALSE; @@ -6502,7 +6500,6 @@ void CommonEnterCombatModeCode( ) void EnterCombatMode( UINT8 ubStartingTeam ) { - UINT32 cnt; SOLDIERTYPE *pTeamSoldier; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode"); @@ -6547,8 +6544,9 @@ void EnterCombatMode( UINT8 ubStartingTeam ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... nobody selected"); // OK, look through and find one.... - for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, pTeamSoldier++ ) + for ( SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppCnt > 0 ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"EnterCombatMode continuing... select soldier"); @@ -6755,9 +6753,8 @@ extern SoldierID gfLastMercTalkedAboutKillingID; BOOLEAN SoldierHasSeenEnemiesLastFewTurns( SOLDIERTYPE *pTeamSoldier ) { - INT32 cnt2; - SOLDIERTYPE *pSoldier; - INT32 cnt; + SOLDIERTYPE *pSoldier; + INT32 cnt; for ( cnt = 0; cnt < MAXTEAMS; cnt++ ) { @@ -6766,9 +6763,10 @@ BOOLEAN SoldierHasSeenEnemiesLastFewTurns( SOLDIERTYPE *pTeamSoldier ) { // check this team for possible enemies - cnt2 = gTacticalStatus.Team[ cnt ].bFirstID; - for ( pSoldier = MercPtrs[ cnt2 ]; cnt2 <= gTacticalStatus.Team[ cnt ].bLastID; cnt2++, pSoldier++ ) + SoldierID cnt2 = gTacticalStatus.Team[ cnt ].bFirstID; + for ( ; cnt2 <= gTacticalStatus.Team[ cnt ].bLastID; ++cnt2 ) { + pSoldier = cnt2; if ( pSoldier->bActive && pSoldier->bInSector && ( pSoldier->bTeam == gbPlayerNum || pSoldier->stats.bLife >= OKLIFE ) ) { if ( !CONSIDERED_NEUTRAL( pTeamSoldier, pSoldier ) && ( pTeamSoldier->bSide != pSoldier->bSide ) ) @@ -6867,16 +6865,16 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt; // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { @@ -6888,11 +6886,10 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = (UINT16)Random( ubNumMercs ); + ubChosenMerc = ubMercsInSector[ (UINT16)Random( ubNumMercs ) ]; MercPtrs[ ubChosenMerc ]->DoMercBattleSound( (UINT8)iBattleSnd ); } - } @@ -7514,12 +7511,13 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if (fBattleLost) { // sevenfm: count alive/dead/not covert mercs in sector/retreating from sector - UINT16 ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; BOOLEAN fFoundNotCovertMerc = FALSE; BOOLEAN fFoundAliveMerc = FALSE; BOOLEAN fFoundDeadMerc = FALSE; - for (pTeamSoldier = MercPtrs[ubLoop]; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++, pTeamSoldier++) + for (; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++ubLoop ) { + pTeamSoldier = ubLoop; if (pTeamSoldier->bActive) { if (pTeamSoldier->bInSector || @@ -7833,9 +7831,10 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // Loop through all militia and restore them to peaceful status - cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++,pTeamSoldier++) + SoldierID cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; @@ -7865,8 +7864,9 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) // Loop through all civs and restore them to peaceful status cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { pTeamSoldier->aiData.bAlertStatus = STATUS_GREEN; @@ -8172,12 +8172,12 @@ void CycleVisibleEnemiesBackward( SOLDIERTYPE *pSrcSoldier ) UINT32 CountNonVehiclesOnPlayerTeam( ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; - UINT32 bNumber = 0; + SOLDIERTYPE *pSoldier; + UINT32 bNumber = 0; - for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID, pSoldier = MercPtrs[ cnt ]; cnt <= (UINT32)( gTacticalStatus.Team[ gbPlayerNum ].bLastID ); cnt++, pSoldier++ ) + for ( SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { bNumber++; @@ -8185,7 +8185,6 @@ UINT32 CountNonVehiclesOnPlayerTeam( ) } return( bNumber ); - } @@ -8415,18 +8414,18 @@ UINT16 NumCapableEnemyInSector( ) BOOLEAN CheckForLosingEndOfBattle( ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; - UINT16 bNumDead = 0, bNumNotOK = 0, bNumInBattle = 0, bNumNotOKRealMercs = 0; - BOOLEAN fMadeCorpse; - BOOLEAN fDoCapture = FALSE; - BOOLEAN fOnlyEPCsLeft = TRUE; - BOOLEAN fMilitiaInSector = FALSE; + UINT16 bNumDead = 0, bNumNotOK = 0, bNumInBattle = 0, bNumNotOKRealMercs = 0; + BOOLEAN fMadeCorpse; + BOOLEAN fDoCapture = FALSE; + BOOLEAN fOnlyEPCsLeft = TRUE; + BOOLEAN fMilitiaInSector = FALSE; // ATE: Check for MILITIA - we won't lose if we have some..... - cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++,pTeamSoldier++) + SoldierID cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->bSide == gbPlayerNum ) { if ( pTeamSoldier->stats.bLife >= OKLIFE ) @@ -8443,8 +8442,9 @@ BOOLEAN CheckForLosingEndOfBattle( ) cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Are we active and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { @@ -8529,8 +8529,9 @@ BOOLEAN CheckForLosingEndOfBattle( ) // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Are we active and in sector..... if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { @@ -9555,7 +9556,6 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) SOLDIERTYPE *pSoldier; SOLDIERTYPE *pTarget; BOOLEAN fEnterCombat = FALSE; - UINT32 cnt; SoldierID ubID; @@ -9604,14 +9604,13 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) } else { - for (cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; - cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; - cnt++) + for ( SoldierID id = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; + id <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; + ++id) { - if (MercPtrs[ cnt ] && - MercPtrs[ cnt ]->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) + if (id != NOBODY && id->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = id; break; } } @@ -9712,14 +9711,12 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) { // Loop through our team, make guys who can see this fly away.... { - UINT32 cnt; - SOLDIERTYPE *pTeamSoldier; - UINT8 ubTeam; + SOLDIERTYPE *pTeamSoldier; + UINT8 ubTeam = pTarget->bTeam; - ubTeam = pTarget->bTeam; - - for ( cnt = gTacticalStatus.Team[ ubTeam ].bFirstID, pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeam ].bLastID; cnt++, pTeamSoldier++ ) + for ( SoldierID cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; cnt <= gTacticalStatus.Team[ ubTeam ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { if ( pTeamSoldier->ubBodyType == CROW ) @@ -9859,15 +9856,16 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) if ( gTacticalStatus.uiFlags & CHECK_SIGHT_AT_END_OF_ATTACK ) { - UINT16 ubLoop; + SoldierID ubLoop; SOLDIERTYPE * pSightSoldier; AllTeamsLookForAll( FALSE ); // call fov code ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSightSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pSightSoldier++ ) + for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop ) { + pSightSoldier = ubLoop; if ( pSightSoldier->bActive && pSightSoldier->bInSector ) { RevealRoofsAndItems( pSightSoldier, TRUE, FALSE, pSightSoldier->pathing.bLevel, FALSE ); @@ -9936,7 +9934,7 @@ SOLDIERTYPE *InternalReduceAttackBusyCount( ) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Reset various flags and values that should be 0 once the action is overwith - for (cnt = 0; cnt < guiNumMercSlots; cnt++) + for (UINT32 cnt = 0; cnt < guiNumMercSlots; cnt++) { pSoldier = MercSlots[ cnt ]; if ( pSoldier ) @@ -10241,9 +10239,9 @@ void EndBattleWithUnconsciousGuysCallback( UINT8 bExitValue ) void InitializeTacticalStatusAtBattleStart( ) { - INT8 bLoop; - INT32 cnt; - SOLDIERTYPE * pSoldier; + INT8 bLoop; + SoldierID cnt; + SOLDIERTYPE *pSoldier; gTacticalStatus.ubArmyGuysKilled = 0; gTacticalStatus.bOriginalSizeOfEnemyForce = 0; @@ -10257,10 +10255,10 @@ void InitializeTacticalStatusAtBattleStart( ) gTacticalStatus.ubPanicTolerance[ bLoop ] = 0; } - for( cnt = 0; cnt < MAXTEAMS; cnt++ ) + for( bLoop = 0; bLoop < MAXTEAMS; bLoop++ ) { - gTacticalStatus.Team[ cnt ].ubLastMercToRadio = NOBODY; - gTacticalStatus.Team[ cnt ].bAwareOfOpposition = FALSE; + gTacticalStatus.Team[ bLoop ].ubLastMercToRadio = NOBODY; + gTacticalStatus.Team[ bLoop ].bAwareOfOpposition = FALSE; } gTacticalStatus.ubTheChosenOne = NOBODY; @@ -10268,19 +10266,18 @@ void InitializeTacticalStatusAtBattleStart( ) ClearIntList(); // make sure none of our guys have leftover shock values etc - for ( cnt = gTacticalStatus.Team[ 0 ].bFirstID; cnt <= gTacticalStatus.Team[ 0 ].bLastID; cnt++ ) + for ( cnt = gTacticalStatus.Team[ 0 ].bFirstID; cnt <= gTacticalStatus.Team[ 0 ].bLastID; ++cnt ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; pSoldier->aiData.bShock = 0; pSoldier->bTilesMoved = 0; } // loop through everyone; clear misc flags - for ( cnt = 0; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ) + for ( cnt = 0; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++cnt ) { - MercPtrs[ cnt ]->ubMiscSoldierFlags = 0; + cnt->ubMiscSoldierFlags = 0; } - } @@ -10329,16 +10326,15 @@ void CaptureTimerCallback( ) void DoPOWPathChecks( ) { - INT32 iLoop; SOLDIERTYPE *pSoldier; BOOLEAN is_this_tixa = (gWorldSectorX == gModSettings.ubTixaPrisonSectorX && gWorldSectorY == gModSettings.ubTixaPrisonSectorY); // loop through all mercs on our team and if they are POWs in sector, do POW path check and // put on a squad if available - for ( iLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; iLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; iLoop++ ) + for ( SoldierID iLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; iLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++iLoop ) { - pSoldier = MercPtrs[ iLoop ]; + pSoldier = iLoop; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->bAssignment == ASSIGNMENT_POW ) { @@ -10378,7 +10374,6 @@ void DoPOWPathChecks( ) BOOLEAN HostileCiviliansPresent( ) { - INT32 iLoop; SOLDIERTYPE * pSoldier; if ( gTacticalStatus.Team[ CIV_TEAM ].bTeamActive == FALSE ) @@ -10386,9 +10381,9 @@ BOOLEAN HostileCiviliansPresent( ) return( FALSE ); } - for ( iLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; iLoop++ ) + for ( SoldierID iLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++iLoop ) { - pSoldier = MercPtrs[ iLoop ]; + pSoldier = iLoop; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && !pSoldier->aiData.bNeutral ) { @@ -10401,17 +10396,16 @@ BOOLEAN HostileCiviliansPresent( ) BOOLEAN HostileCiviliansWithGunsPresent( ) { - INT32 iLoop; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; if ( gTacticalStatus.Team[ CIV_TEAM ].bTeamActive == FALSE ) { return( FALSE ); } - for ( iLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; iLoop++ ) + for ( SoldierID iLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++iLoop ) { - pSoldier = MercPtrs[ iLoop ]; + pSoldier = iLoop; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && !pSoldier->aiData.bNeutral ) { @@ -10428,17 +10422,16 @@ BOOLEAN HostileCiviliansWithGunsPresent( ) BOOLEAN HostileBloodcatsPresent( ) { - INT32 iLoop; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; if ( gTacticalStatus.Team[ CREATURE_TEAM ].bTeamActive == FALSE ) { return( FALSE ); } - for ( iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; iLoop++ ) + for ( SoldierID iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++iLoop ) { - pSoldier = MercPtrs[ iLoop ]; + pSoldier = iLoop; //KM : Aug 11, 1999 -- Patch fix: Removed the check for bNeutral. Bloodcats automatically become hostile // on site. Because the check used to be there, it was possible to get into a 2nd battle elsewhere @@ -10454,17 +10447,16 @@ BOOLEAN HostileBloodcatsPresent( ) BOOLEAN HostileZombiesPresent( ) { - INT32 iLoop; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; if ( gTacticalStatus.Team[ CREATURE_TEAM ].bTeamActive == FALSE ) { return( FALSE ); } - for ( iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++iLoop ) + for ( SoldierID iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++iLoop ) { - pSoldier = MercPtrs[ iLoop ]; + pSoldier = iLoop; if ( pSoldier && pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->IsZombie( ) ) { @@ -10484,9 +10476,9 @@ BOOLEAN HostileCreaturesPresent() return( FALSE ); } - for ( INT32 iLoop = gTacticalStatus.Team[CREATURE_TEAM].bFirstID; iLoop <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; ++iLoop ) + for ( SoldierID iLoop = gTacticalStatus.Team[CREATURE_TEAM].bFirstID; iLoop <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; ++iLoop ) { - pSoldier = MercPtrs[iLoop]; + pSoldier = iLoop; if ( pSoldier && pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) { @@ -10505,7 +10497,6 @@ void HandleCreatureTenseQuote( ) UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt; INT32 uiTime; @@ -10523,11 +10514,12 @@ void HandleCreatureTenseQuote( ) gTacticalStatus.uiCreatureTenseQuoteLastUpdate = uiTime; // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { @@ -10652,9 +10644,9 @@ INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier ) INT8 bLevelDifference = 0; // Run through each friendly. - for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( SoldierID iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ++iCounter ) { - pLeader = MercPtrs[ iCounter ]; + pLeader = iCounter; // Make sure that character is alive, not too shocked, and conscious, and of higher experience level // than the character being suppressed. if (pLeader != pSoldier && pLeader->bActive && pLeader->aiData.bShock < pLeader->stats.bLeadership/5 && @@ -10744,9 +10736,9 @@ INT8 CheckStatusNearbyFriendliesSimple(SOLDIERTYPE *pSoldier) } // Run through each friendly. - for (UINT16 ubFriend = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; ubFriend <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ubFriend ++) + for ( SoldierID ubFriend = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; ubFriend <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ++ubFriend) { - pFriend = MercPtrs[ ubFriend ]; + pFriend = ubFriend; // Make sure that character is alive and active if (pFriend && @@ -11065,10 +11057,11 @@ void AttemptToCapturePlayerSoldiers() BeginCaptureSquence(); const UINT8 currentPOWs = gStrategicStatus.ubNumCapturedForRescue; // Do capture - UINT32 i = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 const lastID = gTacticalStatus.Team[gbPlayerNum].bLastID; - for (SOLDIERTYPE* pSoldier = MercPtrs[i]; i <= lastID; ++i, ++pSoldier) + SoldierID i = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID const lastID = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; i <= lastID; ++i ) { + SOLDIERTYPE *pSoldier = i; // Are we active and in sector if (pSoldier->bActive && pSoldier->bInSector && pSoldier->bAssignment != ASSIGNMENT_POW) { @@ -11100,10 +11093,11 @@ void AttemptToCapturePlayerSoldiers() // If we have any remaining active mercs in sector after capture, give them a chance to escape from the clutches of Deidranna's soldiers! bool activeMercs = false; - UINT32 i = gTacticalStatus.Team[gbPlayerNum].bFirstID; - UINT32 lastId = gTacticalStatus.Team[gbPlayerNum].bLastID; - for (SOLDIERTYPE* pSoldier = MercPtrs[i]; i <= lastId; ++i, ++pSoldier) + SoldierID i = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID lastId = gTacticalStatus.Team[gbPlayerNum].bLastID; + for ( ; i <= lastId; ++i ) { + SOLDIERTYPE *pSoldier = i; // Are we active and in sector const bool inSector = (pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ); if (pSoldier->bActive && inSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->bAssignment != ASSIGNMENT_POW) @@ -11126,7 +11120,6 @@ void AttemptToCapturePlayerSoldiers() void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) { SOLDIERTYPE *pSoldier = NULL; - UINT32 uiCnt=0; BOOLEAN success = FALSE; if ( ubExitValue == 1 ) @@ -11148,10 +11141,11 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) UINT32 enemysidestrength = 0; // player team - UINT32 firstid = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + for ( ; id <= lastid; ++id ) { + pSoldier = id; if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { // if we are disguised as a civilian, the enemy does not take us into the equation - he does not consider us @@ -11167,10 +11161,11 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) } // militia team - firstid = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; + id = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; lastid = gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + for ( ; id <= lastid; ++id ) { + pSoldier = id; if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { playersidestrength += pSoldier->GetSurrenderStrength(); @@ -11190,10 +11185,12 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) BOOLEAN fNoSurrender = FALSE; // shadooow: rewritten to only check soldiers from the same team - firstid = gTacticalStatus.Team[pSoldierToSurrender->bTeam].bFirstID; + SoldierID firstid = gTacticalStatus.Team[pSoldierToSurrender->bTeam].bFirstID; lastid = gTacticalStatus.Team[pSoldierToSurrender->bTeam].bLastID; - for (uiCnt = firstid, pSoldier = MercPtrs[uiCnt]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + + for (SoldierID id = firstid; id <= lastid; ++id ) { + pSoldier = id; if (pSoldier->bActive && (pSoldier->sSectorX == gWorldSectorX) && (pSoldier->sSectorY == gWorldSectorY) && (pSoldier->bSectorZ == gbWorldSectorZ)) { if (pSoldierToSurrender->bTeam == CIV_TEAM) @@ -11233,8 +11230,9 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue ) if ( !fNoSurrender && playersidestrength >= gGameExternalOptions.fSurrenderMultiplier * enemysidestrength ) { // it is enough to simply set all soldiers to captured - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + for ( SoldierID id = firstid; id <= lastid; ++id ) { + pSoldier = id; if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { // can this guy be captured? @@ -11355,9 +11353,9 @@ void CheckChatPartners() SOLDIERTYPE* pSoldier = NULL; - for ( int ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++ubLoop ) + for ( SoldierID ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++ubLoop ) { - pSoldier = MercPtrs[ubLoop]; + pSoldier = ubLoop; if ( pSoldier && pSoldier->bVisible && pSoldier->usChatPartnerID != NOBODY && pSoldier->usChatPartnerID->bVisible ) { @@ -11448,11 +11446,11 @@ void TeamDropAll(UINT8 bTeam, BOOLEAN fForce) #endif SOLDIERTYPE *pSoldier; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ bTeam ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ bTeam ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID id = gTacticalStatus.Team[ bTeam ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ bTeam ].bLastID; + for ( ; id <= lastid; ++id ) { + pSoldier = id; // if soldier is in the current sector, drop all equipment (that has the TAKEN_BY_MILITIA-flag set) if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { @@ -11479,11 +11477,11 @@ void TeamRestock(UINT8 bTeam) #endif SOLDIERTYPE *pSoldier; - UINT32 uiCnt = 0; - UINT32 firstid = gTacticalStatus.Team[ bTeam ].bFirstID; - UINT32 lastid = gTacticalStatus.Team[ bTeam ].bLastID; - for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier) + SoldierID id = gTacticalStatus.Team[ bTeam ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ bTeam ].bLastID; + for ( ; id <= lastid; ++id ) { + pSoldier = id; if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) ) { // the function fills a createstruct, so create one @@ -11539,9 +11537,9 @@ BOOLEAN IsProfileInUse(UINT8 usTeam, INT8 aType, UINT16 aNr) } SOLDIERTYPE* pSoldier = NULL; - for( INT32 i = gTacticalStatus.Team[ usTeam ].bFirstID; i <= gTacticalStatus.Team[ usTeam ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ usTeam ].bFirstID; i <= gTacticalStatus.Team[ usTeam ].bLastID; ++i ) { - pSoldier = MercPtrs[ i ]; + pSoldier = i; if ( pSoldier && pSoldier->ubSoldierClass == searchedclass && pSoldier->usSoldierProfile == aNr ) return TRUE; @@ -11665,13 +11663,13 @@ INT8 CalcEffectiveShockLevel( SOLDIERTYPE * pSoldier ) // Flugente: count number of enemy officers UINT16 HighestEnemyOfficersInSector( UINT8& aType ) { - SOLDIERTYPE* pSoldier; - INT32 cnt = 0; - UINT16 num = 0; - UINT8 type = OFFICER_NONE; + SOLDIERTYPE *pSoldier; + UINT16 num = 0; + UINT8 type = OFFICER_NONE; - for ( cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID, pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; pSoldier++, ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) { // count officers, but do not count those that we have already captured @@ -11691,12 +11689,12 @@ UINT16 HighestEnemyOfficersInSector( UINT8& aType ) // count all soldiers in the current sector that have a specific flag set UINT16 NumSoldiersWithFlagInSector( UINT8 aTeam, UINT32 aFlag ) { - SOLDIERTYPE* pSoldier; - INT32 cnt = 0; - UINT16 num = 0; + SOLDIERTYPE *pSoldier; + UINT16 num = 0; - for ( cnt = gTacticalStatus.Team[aTeam].bFirstID, pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[aTeam].bLastID; pSoldier++, ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[aTeam].bFirstID; cnt <= gTacticalStatus.Team[aTeam].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) { if ( pSoldier->usSoldierFlagMask & aFlag ) @@ -11711,12 +11709,12 @@ UINT16 NumSoldiersWithFlagInSector( UINT8 aTeam, UINT32 aFlag ) UINT16 NumSoldiersofClassWithFlag2InSector( UINT8 aTeam, UINT8 aSoldierClass, UINT32 aFlag ) { - SOLDIERTYPE* pSoldier; - INT32 cnt = 0; - UINT16 num = 0; + SOLDIERTYPE *pSoldier; + UINT16 num = 0; - for ( cnt = gTacticalStatus.Team[aTeam].bFirstID, pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[aTeam].bLastID; pSoldier++, ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[aTeam].bFirstID; cnt <= gTacticalStatus.Team[aTeam].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) { if ( (pSoldier->usSoldierFlagMask2 & aFlag) @@ -12002,11 +12000,12 @@ BOOLEAN IsCivFactionMemberAliveInSector( UINT8 usCivilianGroup ) SOLDIERTYPE *pSoldier = NULL; // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - UINT16 cnt = gTacticalStatus.Team[CIV_TEAM].bFirstID; + SoldierID cnt = gTacticalStatus.Team[CIV_TEAM].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt, ++pSoldier ) + for ( ; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && (pSoldier->sSectorX == gWorldSectorX) && (pSoldier->sSectorY == gWorldSectorY) && (pSoldier->bSectorZ == gbWorldSectorZ) ) { if ( pSoldier->ubCivilianGroup == usCivilianGroup && pSoldier->stats.bLife > 0 ) @@ -12017,15 +12016,15 @@ BOOLEAN IsCivFactionMemberAliveInSector( UINT8 usCivilianGroup ) return FALSE; } -BOOLEAN IsFreeSlotAvailable( int aTeam ) +BOOLEAN IsFreeSlotAvailable( int aTeam ) { SOLDIERTYPE *pSoldier; - INT32 cnt = gTacticalStatus.Team[aTeam].bFirstID; + SoldierID cnt = gTacticalStatus.Team[aTeam].bFirstID; // run through list - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[aTeam].bLastID; ++cnt, ++pSoldier ) + for ( ; cnt <= gTacticalStatus.Team[aTeam].bLastID; ++cnt ) { - if ( !pSoldier->bActive ) + if ( !cnt->bActive ) { return TRUE; } diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 87b5034a..f611474b 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -238,7 +238,7 @@ void SlideToLocation( INT32 sDestGridNo ); void RebuildAllSoldierShadeTables( ); void HandlePlayerTeamMemberDeath( SOLDIERTYPE *pSoldier ); -UINT16 LastActiveTeamMember( UINT16 ubTeam ); +SoldierID LastActiveTeamMember( UINT16 ubTeam ); BOOLEAN SoldierOnVisibleWorldTile( SOLDIERTYPE *pSoldier ); SoldierID FindNextActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLessOKLife, BOOLEAN fOnlyRegularMercs ); diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index 02141ace..4c97f6b2 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -2143,55 +2143,57 @@ void HandleMouseRTX1Button( UINT32 *puiNewEvent ) void HandleMouseRTX2Button( UINT32 *puiNewEvent ) { - if ( _KeyDown( ALT ) ) - AutoReload( gusSelectedSoldier ); - else - // Toggle squad's stealth mode..... - // For each guy on squad... + if ( _KeyDown( ALT ) ) + AutoReload( gusSelectedSoldier ); + else + // Toggle squad's stealth mode..... + // For each guy on squad... + { + SOLDIERTYPE *pTeamSoldier; + SoldierID bLoop; + BOOLEAN fStealthOn = FALSE; + + // Check if at least one guy is on stealth.... + for ( bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) + { + pTeamSoldier = bLoop; + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad() ) { - SOLDIERTYPE *pTeamSoldier; - INT16 bLoop; - BOOLEAN fStealthOn = FALSE; - - // Check if at least one guy is on stealth.... - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + if ( pTeamSoldier->bStealthMode ) { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) ) - { - if ( pTeamSoldier->bStealthMode ) - { - fStealthOn = TRUE; - } - } - } - - fStealthOn = !fStealthOn; - - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) - { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) - { - if ( gpSMCurrentMerc != NULL && bLoop == gpSMCurrentMerc->ubID ) - { - gfUIStanceDifferent = TRUE; - } - - pTeamSoldier->bStealthMode = fStealthOn; - } - } - - fInterfacePanelDirty = DIRTYLEVEL2; - - // OK, display message - if ( fStealthOn ) - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_ON_STEALTHMODE ] ); - } - else - { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_OFF_STEALTHMODE ] ); + fStealthOn = TRUE; } } + } + + fStealthOn = !fStealthOn; + + for ( bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) + { + pTeamSoldier = bLoop; + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad() && !AM_A_ROBOT( pTeamSoldier ) ) + { + if ( gpSMCurrentMerc != NULL && bLoop == gpSMCurrentMerc->ubID ) + { + gfUIStanceDifferent = TRUE; + } + + pTeamSoldier->bStealthMode = fStealthOn; + } + } + + fInterfacePanelDirty = DIRTYLEVEL2; + + // OK, display message + if ( fStealthOn ) + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_SQUAD_ON_STEALTHMODE] ); + } + else + { + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_SQUAD_OFF_STEALTHMODE] ); + } + } } // sevenfm: common functionality diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 7749051f..c6c3ce0b 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1272,11 +1272,11 @@ void HandleRottingCorpses( ) // ATE: Check for multiple crows..... // Couint how many we have now... { - UINT16 bLoop; SOLDIERTYPE * pSoldier; - for ( bLoop=gTacticalStatus.Team[ CIV_TEAM ].bFirstID, pSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; bLoop++, pSoldier++) + for ( SoldierID bLoop=gTacticalStatus.Team[ CIV_TEAM ].bFirstID; bLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++bLoop ) { + pSoldier = bLoop; if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) ) { if ( pSoldier->ubBodyType == CROW ) @@ -1344,8 +1344,7 @@ void MakeCorpseVisible( SOLDIERTYPE *pSoldier, ROTTING_CORPSE *pCorpse ) void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam ) { - INT32 cnt; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; INT32 sGridNo; // If this cump is already visible, return @@ -1360,13 +1359,14 @@ void AllMercsOnTeamLookForCorpse( ROTTING_CORPSE *pCorpse, INT8 bTeam ) } // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ bTeam ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ bTeam ].bFirstID; sGridNo = pCorpse->def.sGridNo; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; cnt++,pSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; ++cnt ) { + pSoldier = cnt; // ATE: Ok, lets check for some basic things here! if ( pSoldier->stats.bLife >= OKLIFE && !TileIsOutOfBounds(pSoldier->sGridNo) && pSoldier->bActive && pSoldier->bInSector ) { @@ -2526,7 +2526,6 @@ void LookForAndMayCommentOnSeeingCorpse( SOLDIERTYPE *pSoldier, INT32 sGridNo, U { ROTTING_CORPSE *pCorpse; INT8 bToleranceThreshold = 0; - INT32 cnt; SOLDIERTYPE *pTeamSoldier; if ( QuoteExp[ pSoldier->ubProfile ].QuoteExpHeadShotOnly == 1 ) @@ -2567,11 +2566,12 @@ void LookForAndMayCommentOnSeeingCorpse( SOLDIERTYPE *pSoldier, INT32 sGridNo, U if ( Random( 2 ) == 1 ) { // IF IT'S THE SELECTED GUY, MAKE ANOTHER SELECTED! - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // ATE: Ok, lets check for some basic things here! if ( pTeamSoldier->stats.bLife >= OKLIFE && !TileIsOutOfBounds(pTeamSoldier->sGridNo) && pTeamSoldier->bActive && pTeamSoldier->bInSector ) { diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 1986893f..17f255b5 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -759,7 +759,6 @@ UINT32 ShopKeeperScreenShutdown() BOOLEAN EnterShopKeeperInterface() { VOBJECT_DESC VObjectDesc; - UINT16 ubCnt; CHAR8 zTemp[32]; VSURFACE_DESC vs_desc; @@ -886,9 +885,9 @@ BOOLEAN EnterShopKeeperInterface() //Create an array of all mercs (anywhere!) currently in the player's employ, and load their small faces // This is to support showing of repair item owner's faces even when they're not in the sector, as long as they still work for player gubNumberMercsInArray = 0; - for( ubCnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; ubCnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++ubCnt ) + for( SoldierID ubCnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; ubCnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++ubCnt ) { - pSoldier = MercPtrs[ ubCnt ]; + pSoldier = ubCnt; if( pSoldier->bActive && ( pSoldier->ubProfile != NO_PROFILE ) && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !AM_A_ROBOT( pSoldier ) ) diff --git a/Tactical/SkillCheck.cpp b/Tactical/SkillCheck.cpp index cff7ad4e..30773c78 100644 --- a/Tactical/SkillCheck.cpp +++ b/Tactical/SkillCheck.cpp @@ -339,7 +339,6 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) INT32 iSkill; INT32 iChance, iReportChance; INT32 iRoll, iMadeItBy; - INT32 iLoop; SOLDIERTYPE * pTeamSoldier; INT8 bBuddyIndex; BOOLEAN fForceDamnSound = FALSE; @@ -946,9 +945,10 @@ INT32 SkillCheck( SOLDIERTYPE * pSoldier, INT8 bReason, INT8 bChanceMod ) if (iRoll < iChance) { // If a buddy of this merc is standing around nearby, they'll make a positive comment. - iLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ iLoop ]; iLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; iLoop++,pTeamSoldier++ ) + SoldierID iLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; iLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++iLoop ) { + pTeamSoldier = iLoop; if ( OK_INSECTOR_MERC( pTeamSoldier ) ) { if ( SpacesAway( pSoldier->sGridNo, pTeamSoldier->sGridNo ) < 15 ) diff --git a/Tactical/SkillMenu.cpp b/Tactical/SkillMenu.cpp index 0b4cdaf7..18a175ae 100644 --- a/Tactical/SkillMenu.cpp +++ b/Tactical/SkillMenu.cpp @@ -784,17 +784,17 @@ SoldierSelection::Setup( UINT32 aVal ) // pretty simple: we find every soldier in a radius around the target position and add him to the list // loop through all soldiers around - for ( UINT32 cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID ; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID ; ++cnt ) + for ( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID ; id <= gTacticalStatus.Team[ CIV_TEAM ].bLastID ; ++id ) { - INT32 iRange = GetRangeInCellCoordsFromGridNoDiff( sTraitsMenuTargetGridNo, MercPtrs[ cnt ]->sGridNo ); + INT32 iRange = GetRangeInCellCoordsFromGridNoDiff( sTraitsMenuTargetGridNo, id->sGridNo ); if ( iRange < 100 ) { - if ( cnt != pSoldier->ubID ) + if ( id != pSoldier->ubID ) { - swprintf( pStr, L"%s", MercPtrs[ cnt ]->GetName() ); + swprintf( pStr, L"%s", id->GetName() ); - pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction( &Wrapper_Function_SoldierSelection, cnt ) ); + pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction( &Wrapper_Function_SoldierSelection, id ) ); // grey out if no artillery can be called from this sector if ( 0 ) @@ -865,11 +865,11 @@ DragSelection::Setup( UINT32 aVal ) // pretty simple: we find every soldier in a radius around the target position and add him to the list // loop through all soldiers around - for ( UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt ) { if ( cnt != pSoldier->ubID && pSoldier->CanDragPerson(cnt) ) { - swprintf( pStr, L"%s", MercPtrs[cnt]->GetName( ) ); + swprintf( pStr, L"%s", cnt->GetName( ) ); pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction( &Wrapper_Function_DragSelection, cnt ) ); diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index 61e4494c..ac65d912 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1761,16 +1761,14 @@ void AddSoldierToSectorGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDir // IsMercOnTeam() checks to see if the passed in Merc Profile ID is currently on the player's team BOOLEAN IsMercOnTeam(UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive) { - UINT16 cnt; - UINT16 ubLastTeamID; SOLDIERTYPE *pTeamSoldier; - - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + SoldierID cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + SoldierID ubLastTeamID = gTacticalStatus.Team[ OUR_TEAM ].bLastID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; ++cnt, pTeamSoldier++) + for ( ; cnt <= ubLastTeamID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->ubProfile == ubMercID && pTeamSoldier->bActive ) { if ( aAlreadyInCountry && pTeamSoldier->bAssignment == IN_TRANSIT ) @@ -1791,12 +1789,12 @@ BOOLEAN IsMercOnTeam(UINT8 ubMercID, BOOLEAN aAlreadyInCountry, BOOLEAN aAlive) SoldierID GetSoldierIDFromMercID(UINT8 ubMercID) { SOLDIERTYPE *pTeamSoldier = NULL; - - UINT16 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; + SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt, ++pTeamSoldier ) + for ( ; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->ubProfile == ubMercID ) { if( pTeamSoldier->bActive ) diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 2ef15f57..be1e866d 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -3559,7 +3559,6 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; - INT32 cnt; UINT16 usQuoteNum; BOOLEAN buddyquoteused = FALSE; @@ -3570,11 +3569,12 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, return; // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, ++pTeamSoldier ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep && !TileIsOutOfBounds(pTeamSoldier->sGridNo) && pTeamSoldier->ubProfile != pKillerSoldier->ubProfile ) @@ -3709,8 +3709,9 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, { cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pTeamSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt, ++pTeamSoldier ) + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pTeamSoldier = cnt; // we do not exclude the buddies from above. If we get to this point, it might have been a buddy that already said his line. In that case additional dialogue might play other ones // Add guy if he's a candidate... @@ -3742,7 +3743,6 @@ void SayBuddyWitnessedQuoteFromKill( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt; // WDS - make number of mercenaries, etc. be configurable std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); UINT16 ubNumMercs = 0; @@ -3802,11 +3802,12 @@ void HandleKilledQuote( SOLDIERTYPE *pKilledSoldier, SOLDIERTYPE *pKillerSoldier if ( fDoSomeoneElse ) { // Check if a person is here that has this quote.... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( cnt != pKillerSoldier->ubID ) { if ( OK_INSECTOR_MERC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !AM_AN_EPC( pTeamSoldier ) ) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index bffbc8eb..8235157c 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2836,7 +2836,6 @@ BOOLEAN SOLDIERTYPE::ChangeSoldierState( UINT16 usNewState, UINT16 usStartingAni // This function reevaluates the stance if the guy sees us! BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) { - INT32 cnt; SoldierID iClosestEnemy = NOBODY; INT16 sTargetXPos, sTargetYPos; BOOLEAN fReturnVal = FALSE; @@ -2871,7 +2870,7 @@ BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) if ( pSoldier->aiData.bOppCnt > 0 ) { // Pick a guy this buddy sees and turn towards them! - for ( cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; cnt++ ) + for ( SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) { if ( pSoldier->aiData.bOppList[cnt] == SEEN_CURRENTLY ) { @@ -12260,16 +12259,13 @@ BOOLEAN SOLDIERTYPE::MercInHighWater( void ) void RevivePlayerTeam( ) { - INT32 cnt; - SOLDIERTYPE *pSoldier; - // End the turn of player charactors - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pSoldier++ ) + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { - pSoldier->ReviveSoldier( ); + id->ReviveSoldier( ); } } @@ -15221,10 +15217,11 @@ BOOLEAN SOLDIERTYPE::IsFeedingExternal( SoldierID * pubId1, UINT16* pGunSlot1, INT32 nextGridNoinSight = NewGridNo( this->sGridNo, DirectionInc( this->ubDirection ) ); SOLDIERTYPE* pTeamSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[this->bTeam].bFirstID; - INT32 lastid = gTacticalStatus.Team[this->bTeam].bLastID; - for ( pTeamSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pTeamSoldier ) + SoldierID cnt = gTacticalStatus.Team[this->bTeam].bFirstID; + SoldierID lastid = gTacticalStatus.Team[this->bTeam].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pTeamSoldier = cnt; // check if teamsoldier exists in this sector if ( !pTeamSoldier || !pTeamSoldier->bActive || !pTeamSoldier->bInSector || pTeamSoldier->sSectorX != this->sSectorX || pTeamSoldier->sSectorY != this->sSectorY || pTeamSoldier->bSectorZ != this->bSectorZ ) continue; @@ -16234,9 +16231,10 @@ void SOLDIERTYPE::LooseDisguise( void ) // rehandle sight for everybody SOLDIERTYPE* pSoldier; - UINT16 iLoop = gTacticalStatus.Team[OUR_TEAM].bFirstID; - for ( pSoldier = MercPtrs[iLoop]; iLoop <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++iLoop, ++pSoldier ) + SoldierID iLoop = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; iLoop <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++iLoop ) { + pSoldier = iLoop; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) { RecalculateOppCntsDueToNoLongerNeutral( pSoldier ); @@ -18880,10 +18878,11 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN UINT16 mortararray[maxFiringMortarsAmount] = { 0 }; SOLDIERTYPE* pSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[bTeam].bFirstID; - INT32 lastid = gTacticalStatus.Team[bTeam].bLastID; - for ( pSoldier = MercPtrs[cnt]; (cnt < lastid) && (mortaritemcnt < maxFiringMortarsAmount); ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[bTeam].bFirstID; + SoldierID lastid = gTacticalStatus.Team[bTeam].bLastID; + for ( ; (cnt < lastid) && (mortaritemcnt < maxFiringMortarsAmount); ++cnt ) { + pSoldier = cnt; // check if soldier exists in this sector if ( !pSoldier || !pSoldier->bActive || pSoldier->sSectorX != sSectorX || pSoldier->sSectorY != sSectorY || pSoldier->bSectorZ != bSectorZ || pSoldier->bAssignment > ON_DUTY ) continue; @@ -18924,8 +18923,9 @@ BOOLEAN SOLDIERTYPE::OrderArtilleryStrike( UINT32 usSectorNr, INT32 sTargetGridN // second loop: check for all mortar shells and 'fire' them cnt = gTacticalStatus.Team[bTeam].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + for ( ; cnt < lastid; ++cnt ) { + pSoldier = cnt; // check if soldier exists in this sector if ( !pSoldier || !pSoldier->bActive || pSoldier->sSectorX != sSectorX || pSoldier->sSectorY != sSectorY || pSoldier->bSectorZ != bSectorZ || pSoldier->bAssignment > ON_DUTY ) continue; @@ -21602,15 +21602,16 @@ BOOLEAN SOLDIERTYPE::OrderTurnCoatToSwitchSides( SoldierID usID ) void SOLDIERTYPE::OrderAllTurnCoatToSwitchSides() { SOLDIERTYPE *pSoldier; - INT32 cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ENEMY_TEAM].bFirstID; // rftr: force the player to enter turn-based combat. this function already includes a check to see if we're already in combat, so no harm calling this. // this also prevents a hang when activating a sector with 100% turncoats EnterCombatMode(OUR_TEAM); // run through list - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; ++cnt, ++pSoldier ) + for ( ; cnt <= gTacticalStatus.Team[ENEMY_TEAM].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->usSoldierFlagMask2 & SOLDIER_TURNCOAT ) @@ -23687,16 +23688,15 @@ void SOLDIERTYPE::UpdateRobotControllerGivenRobot( void ) //the original function passed in pRobot, not pSoldier SOLDIERTYPE *pRobot = this; SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; - // Loop through guys and look for a controller! // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; - // run through list - for ( pTeamSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pTeamSoldier++ ) + // Loop through guys and look for a controller! + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive ) { if ( pTeamSoldier->ControllingRobot( ) ) @@ -23714,7 +23714,6 @@ void SOLDIERTYPE::UpdateRobotControllerGivenRobot( void ) void SOLDIERTYPE::UpdateRobotControllerGivenController( void ) { SOLDIERTYPE *pTeamSoldier; - INT32 cnt = 0; // First see if are still controlling the robot if ( !this->ControllingRobot( ) ) @@ -23723,11 +23722,12 @@ void SOLDIERTYPE::UpdateRobotControllerGivenController( void ) } // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; // Loop through guys to find the robot.... - for ( pTeamSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && (pTeamSoldier->flags.uiStatusFlags & SOLDIER_ROBOT) ) { pTeamSoldier->ubRobotRemoteHolderID = this->ubID; @@ -23923,11 +23923,11 @@ void PlayStealthySoldierFootstepSound( SOLDIERTYPE *pSoldier ) void CrowsFlyAway( UINT8 ubTeam ) { - UINT32 cnt; SOLDIERTYPE *pTeamSoldier; - for ( cnt = gTacticalStatus.Team[ubTeam].bFirstID, pTeamSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ubTeam].bLastID; cnt++, pTeamSoldier++ ) + for ( SoldierID cnt = gTacticalStatus.Team[ubTeam].bFirstID; cnt <= gTacticalStatus.Team[ubTeam].bLastID; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { if ( pTeamSoldier->ubBodyType == CROW && pTeamSoldier->usAnimState != CROW_FLY ) @@ -23943,7 +23943,6 @@ void CrowsFlyAway( UINT8 ubTeam ) #ifdef JA2BETAVERSION void DebugValidateSoldierData( ) { - UINT32 cnt; SOLDIERTYPE *pSoldier; CHAR16 sString[1024]; BOOLEAN fProblemDetected = FALSE; @@ -23960,9 +23959,10 @@ void DebugValidateSoldierData( ) uiFrameCount = 0; // Loop through our team... - cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive ) { // OK, first check for alive people @@ -24048,7 +24048,6 @@ void SOLDIERTYPE::BeginTyingToFall( void ) void SOLDIERTYPE::SetSoldierAsUnderAiControl( void ) { SOLDIERTYPE *pSoldier = NULL; - INT32 cnt; //this is silly, but left over from when pSoldierToSet was passed in as a parameter if ( this == NULL ) @@ -24057,9 +24056,10 @@ void SOLDIERTYPE::SetSoldierAsUnderAiControl( void ) } // Loop through ALL teams... - cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[LAST_TEAM].bLastID; cnt++, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[LAST_TEAM].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive ) { pSoldier->flags.uiStatusFlags &= ~SOLDIER_UNDERAICONTROL; @@ -24096,12 +24096,12 @@ void HandlePlayerTogglingLightEffects( BOOLEAN fToggleValue ) void EnableDisableSoldierLightEffects( BOOLEAN fEnableLights ) { SOLDIERTYPE *pSoldier = NULL; - INT32 cnt; // Loop through player teams... - cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - for ( pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; cnt++, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) { + pSoldier = cnt; //if the soldier is in the sector if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE ) { @@ -24248,11 +24248,11 @@ BOOLEAN SOLDIERTYPE::CanStartDrag(void) if (!TileIsOutOfBounds(sNewGridNo) && sNewGridNo != this->sGridNo) { // soldiers - for (UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt) + for ( SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt) { if (cnt != this->ubID && cnt != NOBODY && - MercPtrs[cnt]->sGridNo == sNewGridNo && + cnt->sGridNo == sNewGridNo && this->CanDragPerson(cnt)) { return TRUE; @@ -24312,11 +24312,11 @@ void SOLDIERTYPE::StartDrag(void) if (!TileIsOutOfBounds(sNewGridNo) && sNewGridNo != this->sGridNo) { // soldiers - for (UINT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt) + for ( SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++cnt) { if (cnt != this->ubID && - MercPtrs[cnt] && - MercPtrs[cnt]->sGridNo == sNewGridNo && + cnt != NOBODY && + cnt->sGridNo == sNewGridNo && this->CanDragPerson(cnt)) { SetDragOrderPerson(cnt); @@ -24488,13 +24488,12 @@ INT8 NUM_SKILL_TRAITS( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber ) UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHigherLevel, BOOLEAN fDontCheckDistance ) { - UINT16 cnt = 0; UINT8 ubNumberSL = 0; // loop through all soldiers around - for ( cnt = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; cnt <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; cnt++ ) + for ( SoldierID cnt = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; cnt <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; ++cnt ) { - SOLDIERTYPE *pSquadLeader = MercPtrs[cnt]; + SOLDIERTYPE *pSquadLeader = cnt; // Get active conscious soldier if ( pSquadLeader != pSoldier && pSquadLeader->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 && pSquadLeader->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( pSquadLeader, SQUADLEADER_NT ) ) @@ -24531,9 +24530,9 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe // special loop for militia - they can get a bonus from our mercs if ( pSoldier->bTeam == MILITIA_TEAM && ubNumberSL < gSkillTraitValues.ubSLMaxBonuses ) { - for ( cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; cnt <= gTacticalStatus.Team[OUR_TEAM].bLastID; ++cnt ) { - SOLDIERTYPE *pSquadLeader = MercPtrs[cnt]; + SOLDIERTYPE *pSquadLeader = cnt; // Get active conscious soldier if ( pSquadLeader != pSoldier && pSquadLeader->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 && pSquadLeader->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( pSquadLeader, SQUADLEADER_NT ) ) @@ -24981,7 +24980,7 @@ BOOLEAN ResolvePendingInterrupt( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType ) if ( gGameExternalOptions.fAllowCollectiveInterrupts ) { SOLDIERTYPE *pTeammate; - UINT16 uCnt2 = 0, usColIntChance = 0; + UINT16 usColIntChance = 0; UINT8 ubOriginalInterruptersCount = ubInterruptersFound, uCnt3 = 0; BOOLEAN fAlreadyIn; @@ -24989,9 +24988,10 @@ BOOLEAN ResolvePendingInterrupt( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType ) { pInterrupter = MercPtrs[ubaInterruptersList[uCnt]]; - uCnt2 = gTacticalStatus.Team[pInterrupter->bTeam].bFirstID; - for ( pTeammate = MercPtrs[uCnt2]; uCnt2 <= gTacticalStatus.Team[pInterrupter->bTeam].bLastID; uCnt2++, pTeammate++ ) + SoldierID uCnt2 = gTacticalStatus.Team[pInterrupter->bTeam].bFirstID; + for ( ; uCnt2 <= gTacticalStatus.Team[pInterrupter->bTeam].bLastID; ++uCnt2 ) { + pTeammate = uCnt2; if ( pTeammate == NULL ) continue; // not valid if ( pTeammate->bTeam != pInterrupter->bTeam ) @@ -25236,10 +25236,11 @@ BOOLEAN GetRadioOperatorSignal( SoldierID usOwner, INT32* psTargetGridNo ) bTeam = ENEMY_TEAM; SOLDIERTYPE* pSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[bTeam].bFirstID; - INT32 lastid = gTacticalStatus.Team[bTeam].bLastID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[bTeam].bFirstID; + SoldierID lastid = gTacticalStatus.Team[bTeam].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pSoldier = cnt; if ( pSoldier && pSoldier->CanUseRadio( FALSE ) && pSoldier->bActive && pSoldier->bInSector && (pSoldier->sSectorX == gWorldSectorX) && (pSoldier->sSectorY == gWorldSectorY) && (pSoldier->bSectorZ == gbWorldSectorZ) ) { *psTargetGridNo = pSoldier->sGridNo; @@ -25306,10 +25307,11 @@ BOOLEAN IsValidArtilleryOrderSector( INT16 sSectorX, INT16 sSectorY, INT8 bSecto BOOLEAN activeradio = FALSE; BOOLEAN mortarfound = FALSE; SOLDIERTYPE* pSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[bTeam].bFirstID; - INT32 lastid = gTacticalStatus.Team[bTeam].bLastID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[bTeam].bFirstID; + SoldierID lastid = gTacticalStatus.Team[bTeam].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pSoldier = cnt; // check if soldier exists in this sector, and is on duty if ( !pSoldier || !pSoldier->bActive || pSoldier->sSectorX != sSectorX || pSoldier->sSectorY != sSectorY || pSoldier->bSectorZ != bSectorZ || pSoldier->bAssignment > ON_DUTY ) continue; @@ -25332,10 +25334,11 @@ BOOLEAN SectorJammed( ) { // check every soldier: are we jamming frequencies? SOLDIERTYPE* pSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - INT32 lastid = MAX_NUM_SOLDIERS; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; + SoldierID lastid = MAX_NUM_SOLDIERS; + for ( ; cnt < lastid; ++cnt ) { + pSoldier = cnt; if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && pSoldier->stats.bLife > 0 && pSoldier->IsJamming( ) ) return TRUE; } @@ -25347,10 +25350,11 @@ BOOLEAN PlayerTeamIsScanning( ) { // check every soldier: are we jamming frequencies? SOLDIERTYPE* pSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; - INT32 lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; + SoldierID lastid = gTacticalStatus.Team[OUR_TEAM].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pSoldier = cnt; if ( pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && pSoldier->stats.bLife > 0 && pSoldier->IsScanning( ) ) return TRUE; } @@ -25364,10 +25368,11 @@ UINT16 GridNoSpotterCTHBonus( SOLDIERTYPE* pSniper, INT32 sGridNo, INT8 bTeam ) UINT16 bestvalue = 0; SOLDIERTYPE* pSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[bTeam].bFirstID; - INT32 lastid = gTacticalStatus.Team[bTeam].bLastID; - for ( pSoldier = MercPtrs[cnt]; cnt < lastid; ++cnt, ++pSoldier ) + SoldierID cnt = gTacticalStatus.Team[bTeam].bFirstID; + SoldierID lastid = gTacticalStatus.Team[bTeam].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pSoldier = cnt; if ( pSoldier != pSniper && pSoldier->sSectorX == gWorldSectorX && pSoldier->sSectorY == gWorldSectorY && pSoldier->bSectorZ == gbWorldSectorZ && pSoldier->IsSpotting( ) && PythSpacesAway( pSoldier->sGridNo, pSniper->sGridNo ) <= gGameExternalOptions.usSpotterRange diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 1a2be1a6..4d84b470 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -574,7 +574,6 @@ INT16 gsStrategicDiseaseOriginSector = -1; SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, SoldierID *pubID ) { SOLDIERTYPE Soldier; - INT32 cnt; SOLDIERTYPE *pTeamSoldier; BOOLEAN fGuyAvail = FALSE; UINT16 bLastTeamID; @@ -761,7 +760,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, Soldier if( guiCurrentScreen != AUTORESOLVE_SCREEN ) { - cnt = gTacticalStatus.Team[ Soldier.bTeam ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ Soldier.bTeam ].bFirstID; // ATE: If we are a vehicle, and a player, start at a different slot ( 2 - max ) if( Soldier.ubBodyType == HUMVEE || @@ -778,8 +777,9 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, Soldier bLastTeamID = gTacticalStatus.Team[ Soldier.bTeam ].bLastID; // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= bLastTeamID; cnt++,pTeamSoldier++) + for ( ; cnt <= bLastTeamID; ++cnt ) { + pTeamSoldier = cnt; if ( !pTeamSoldier->bActive ) { fGuyAvail = TRUE; @@ -794,7 +794,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, Soldier } // OK, set ID - Soldier.ubID = (UINT16)cnt; + Soldier.ubID = cnt; *pubID = Soldier.ubID; } @@ -3031,7 +3031,7 @@ void ForceSoldierProfileID( SOLDIERTYPE *pSoldier, UINT8 ubProfileID ) SOLDIERTYPE* ReserveTacticalSoldierForAutoresolve( UINT8 ubSoldierClass ) { - INT32 i, iStart, iEnd; + SoldierID i, iStart, iEnd; SOLDIERTYPE *pSoldier; //This code looks for a soldier of specified type that currently exists in tactical and //returns the pointer to that soldier. This is used when copying the exact status of @@ -3049,13 +3049,13 @@ SOLDIERTYPE* ReserveTacticalSoldierForAutoresolve( UINT8 ubSoldierClass ) iEnd = gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; } for( i = iStart; i <= iEnd; ++i ) - { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife && !TileIsOutOfBounds(MercPtrs[ i ]->sGridNo)) + { + if( i->bActive && i->bInSector && i->stats.bLife && !TileIsOutOfBounds(i->sGridNo)) { - if( MercPtrs[ i ]->ubSoldierClass == ubSoldierClass ) + if( i->ubSoldierClass == ubSoldierClass ) { //reserve this soldier - MercPtrs[ i ]->sGridNo = NOWHERE; + i->sGridNo = NOWHERE; //Allocate and copy the soldier pSoldier = new SOLDIERTYPE(*MercPtrs[i]); //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); @@ -3348,7 +3348,7 @@ SOLDIERTYPE* TacticalCreateZombie() SOLDIERTYPE* ReserveTacticalMilitiaSoldierForAutoresolve( UINT8 ubSoldierClass ) { - INT32 i, iStart, iEnd; + SoldierID i, iStart, iEnd; SOLDIERTYPE *pSoldier; // For description look original ReserveTacticalSoldierForAutoresolve() @@ -3356,14 +3356,14 @@ SOLDIERTYPE* ReserveTacticalMilitiaSoldierForAutoresolve( UINT8 ubSoldierClass ) iStart = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; iEnd = gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; - for( i = iStart; i <= iEnd; i++ ) + for( i = iStart; i <= iEnd; ++i ) { - if( MercPtrs[ i ]->bActive && MercPtrs[ i ]->bInSector && MercPtrs[ i ]->stats.bLife && !TileIsOutOfBounds(MercPtrs[ i ]->sGridNo)) + if( i->bActive && i->bInSector && i->stats.bLife && !TileIsOutOfBounds(i->sGridNo)) { - if( MercPtrs[ i ]->ubSoldierClass == ubSoldierClass ) + if( i->ubSoldierClass == ubSoldierClass ) { //reserve this soldier - MercPtrs[ i ]->sGridNo = NOWHERE; + i->sGridNo = NOWHERE; //Allocate and copy the soldier pSoldier = new SOLDIERTYPE(*MercPtrs[i]); //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 9568210e..e0a02013 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -1891,9 +1891,9 @@ void AddSoldierInitListMilitia( UINT16 ubNumGreen, UINT16 ubNumRegs, UINT16 ubNu { // determine how many militia have already been created in this sector (this can also have happened in another function), so count all active ones UINT16 tacticalmilitia = 0; - for ( UINT16 i = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; i <= gTacticalStatus.Team[MILITIA_TEAM ].bLastID; ++i ) + for ( SoldierID i = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; i <= gTacticalStatus.Team[MILITIA_TEAM ].bLastID; ++i ) { - if ( MercPtrs[i]->bInSector && MercPtrs[i]->bActive ) + if ( i->bInSector && i->bActive ) ++tacticalmilitia; } @@ -3205,10 +3205,11 @@ void SectorAddAssassins( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) // count current number of civilians UINT16 numberofcivs = 0; SOLDIERTYPE* pTeamSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - INT32 lastid = gTacticalStatus.Team[ CIV_TEAM ].bLastID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt < lastid; ++cnt, ++pTeamSoldier) + SoldierID cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ CIV_TEAM ].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pTeamSoldier = cnt; // check if teamsoldier exists in this sector if ( pTeamSoldier && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->sSectorX == sMapX && pTeamSoldier->sSectorY == sMapY && pTeamSoldier->bSectorZ == sMapZ ) ++numberofcivs; @@ -3276,10 +3277,11 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) UINT16 numberofcivs = 0; UINT16 numberofpows = 0; SOLDIERTYPE* pTeamSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - INT32 lastid = gTacticalStatus.Team[ CIV_TEAM ].bLastID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt < lastid; ++cnt, ++pTeamSoldier) + SoldierID cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ CIV_TEAM ].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pTeamSoldier = cnt; // check if teamsoldier exists in this sector if ( pTeamSoldier && pTeamSoldier->bActive && pTeamSoldier->bInSector && pTeamSoldier->sSectorX == sMapX && pTeamSoldier->sSectorY == sMapY && pTeamSoldier->bSectorZ == sMapZ ) ++numberofcivs; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index f5d9a379..f1afe93f 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -2717,11 +2717,10 @@ void OverwriteMercOpinionsWithXMLData( UINT32 uiLoop ) // SANDRO - added function INT8 CheckMercsNearForCharTraits( UINT8 ubProfileID, INT8 bCharTraitID ) { - INT8 bNumber = 0; - UINT32 uiLoop; - SOLDIERTYPE * pSoldier; - SOLDIERTYPE * pTeammate; - BOOLEAN fOnlyOneException = FALSE; + INT8 bNumber = 0; + SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pTeammate; + BOOLEAN fOnlyOneException = FALSE; pSoldier = FindSoldierByProfileID( ubProfileID, FALSE ); if (!pSoldier || !( pSoldier->bActive ) || !( pSoldier->bInSector ) ) @@ -2729,9 +2728,9 @@ INT8 CheckMercsNearForCharTraits( UINT8 ubProfileID, INT8 bCharTraitID ) return( -1 ); } - for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; uiLoop++) + for ( SoldierID uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++uiLoop ) { - pTeammate = MercPtrs[ uiLoop ]; + pTeammate = uiLoop; if ( pTeammate == NULL ) { continue; diff --git a/Tactical/Strategic Exit GUI.cpp b/Tactical/Strategic Exit GUI.cpp index eb8192fc..d87eb3b7 100644 --- a/Tactical/Strategic Exit GUI.cpp +++ b/Tactical/Strategic Exit GUI.cpp @@ -397,17 +397,17 @@ void DoneFadeInWarp( void ) void DoneFadeOutWarpCallback( void ) { - INT32 cnt; SOLDIERTYPE *pSoldier; // Warp! // Set insertion data... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we in this sector, On the current squad? if ( pSoldier->bActive && pSoldier->stats.bLife >= OKLIFE && pSoldier->bInSector ) { diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index 852032d0..9efc1edf 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -119,7 +119,7 @@ void SaveNPCInformationToProfileStruct( ); BOOLEAN DoesTempFileExistsForMap( UINT32 uiType, INT16 sMapX, INT16 sMapY, INT8 bMapZ ); -INT16 GetSoldierIDFromAnyMercID(UINT8 ubMercID); +SoldierID GetSoldierIDFromAnyMercID(UINT8 ubMercID); BOOLEAN SetUnderGroundSectorFlag( INT16 sSectorX, INT16 sSectorY, UINT8 ubSectorZ, UINT32 uiFlagToSet ); @@ -1131,7 +1131,6 @@ BOOLEAN SaveCurrentSectorsInformationToTempItemFile( ) void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ) { // find out which items in the list are reachable - UINT32 uiCounter = 0; UINT8 ubDir, ubMovementCost; BOOLEAN fReachable = FALSE; INT32 sGridNo = NOWHERE, sGridNo2 = NOWHERE; @@ -1179,9 +1178,9 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS { sGridNo2 = gMapInformation.sIsolatedGridNo; - for( uiCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiCounter <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++uiCounter ) + for( SoldierID uiCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiCounter <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++uiCounter ) { - pSoldier = MercPtrs[ uiCounter ]; + pSoldier = uiCounter; if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLife > 0 && pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ ) { if ( FindBestPath( pSoldier, sGridNo2, pSoldier->pathing.bLevel, WALKING, NO_COPYROUTE, 0 ) ) @@ -1200,7 +1199,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS GlobalItemsReachableTest( sGridNo, sGridNo2 ); - for( uiCounter = 0; uiCounter < guiNumWorldItems; ++uiCounter ) + for( UINT32 uiCounter = 0; uiCounter < guiNumWorldItems; ++uiCounter ) { // reset reachablity fReachable = FALSE; @@ -2130,29 +2129,26 @@ BOOLEAN DoesTempFileExistsForMap( UINT32 uiType, INT16 sMapX, INT16 sMapY, INT8 } -INT16 GetSoldierIDFromAnyMercID(UINT8 ubMercID) +SoldierID GetSoldierIDFromAnyMercID(UINT8 ubMercID) { - UINT16 cnt; - UINT16 ubLastTeamID; SOLDIERTYPE *pTeamSoldier; + SoldierID cnt = gTacticalStatus.Team[OUR_TEAM].bFirstID; + SoldierID ubLastTeamID = TOTAL_SOLDIERS; - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - - ubLastTeamID = TOTAL_SOLDIERS; - - // look for all mercs on the same team, - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= ubLastTeamID; cnt++,pTeamSoldier++) + // look for all mercs on the same team, + for ( ; cnt <= ubLastTeamID; ++cnt ) { - if( pTeamSoldier->bActive ) + pTeamSoldier = cnt; + if ( pTeamSoldier->bActive ) { if ( pTeamSoldier->ubProfile == ubMercID ) { - return( cnt ); + return(cnt); } } } - return( -1 ); + return(NOBODY); } @@ -2554,9 +2550,9 @@ BOOLEAN SetSectorFlag( INT16 sMapX, INT16 sMapY, UINT8 bMapZ, UINT32 uiFlagToSet UpdateLastDayOfPlayerActivity( (UINT16) GetWorldDay() ); } - for ( UINT16 i = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; i <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; i++ ) + for ( SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; id <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++id ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = id; if( pSoldier->bActive && pSoldier->stats.bLife && !(pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE) && pSoldier->ubProfile != NO_PROFILE && pSoldier->sSectorX == sMapX && pSoldier->sSectorY == sMapY && pSoldier->bSectorZ == bMapZ && !pSoldier->flags.fBetweenSectors && diff --git a/Tactical/Tactical Turns.cpp b/Tactical/Tactical Turns.cpp index 98f33558..38ec44fa 100644 --- a/Tactical/Tactical Turns.cpp +++ b/Tactical/Tactical Turns.cpp @@ -46,7 +46,6 @@ void HandleRPCDescription( ) UINT16 ubNumMercs = 0; UINT16 ubChosenMerc = 0; SOLDIERTYPE *pTeamSoldier; - INT32 cnt2; BOOLEAN fSAMSite = FALSE; @@ -97,12 +96,13 @@ void HandleRPCDescription( ) // OK, count how many rpc guys we have.... // set up soldier ptr as first element in mercptrs list - cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt2 = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; if (gTacticalStatus.ubGuideDescriptionToUse != 100) { // run through list - for ( pTeamSoldier = MercPtrs[cnt2]; cnt2 <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt2, pTeamSoldier++ ) + for ( ; cnt2 <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt2 ) { + pTeamSoldier = cnt2; // Add guy if he's a candidate... if ( RPC_RECRUITED( pTeamSoldier ) ) { @@ -137,8 +137,9 @@ void HandleRPCDescription( ) { // run through list cnt2 = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for ( pTeamSoldier = MercPtrs[cnt2]; cnt2 <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt2, pTeamSoldier++ ) + for ( ; cnt2 <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt2 ) { + pTeamSoldier = cnt2; if ( pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bActive && pTeamSoldier->sSectorX == gTacticalStatus.bGuideDescriptionSectorX && pTeamSoldier->sSectorY == gTacticalStatus.bGuideDescriptionSectorY && pTeamSoldier->bSectorZ == gbWorldSectorZ && @@ -154,7 +155,6 @@ void HandleRPCDescription( ) void HandleTacticalEndTurn( ) { - UINT32 cnt; SOLDIERTYPE *pSoldier; UINT32 uiTime; static UINT32 uiTimeSinceLastStrategicUpdate = 0; @@ -239,9 +239,10 @@ void HandleTacticalEndTurn( ) BeginLoggingForBleedMeToos( TRUE ); - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->stats.bLife > 0 && !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) ) { // Handle everything from getting breath back, to bleeding, etc @@ -275,7 +276,7 @@ void HandleTacticalEndTurn( ) // OK, loop through the mercs to perform 'end turn' events on each... // We're looping through only mercs in tactical engine, ignoring our mercs // because they were done earilier... - for ( cnt = 0; cnt < guiNumMercSlots; cnt++ ) + for ( UINT32 cnt = 0; cnt < guiNumMercSlots; cnt++ ) { pSoldier = MercSlots[ cnt ]; diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index 964bbdf4..efac8945 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -136,8 +136,7 @@ void ClearIntList( void ) BOOLEAN BloodcatsPresent( void ) { - INT32 iLoop; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"BloodcatsPresent"); if ( gTacticalStatus.Team[ CREATURE_TEAM ].bTeamActive == FALSE ) @@ -145,9 +144,9 @@ BOOLEAN BloodcatsPresent( void ) return( FALSE ); } - for ( iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; iLoop++ ) + for ( SoldierID iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++iLoop ) { - pSoldier = MercPtrs[ iLoop ]; + pSoldier = iLoop; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 && pSoldier->ubBodyType == BLOODCAT ) { @@ -160,7 +159,6 @@ BOOLEAN BloodcatsPresent( void ) void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) { - INT32 cnt; DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StartPlayerTeamTurn"); // SOLDIERTYPE *pSoldier; // EV_S_BEGINTURN SBeginTurn; @@ -178,8 +176,6 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // make sure set properly in gTacticalStatus: gTacticalStatus.ubCurrentTeam = OUR_TEAM; - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - InitPlayerUIBar( FALSE ); if ( gTacticalStatus.uiFlags & TURNBASED ) @@ -197,6 +193,7 @@ void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode ) // ATE: Commented out - looks like this message is called earlier for our team // look for all mercs on the same team, + //SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; //for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) //{ // if ( pSoldier->bActive && pSoldier->stats.bLife > 0 ) @@ -302,7 +299,6 @@ void EndTurn( UINT8 ubNextTeam ) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"EndTurn"); SOLDIERTYPE * pSoldier; - INT32 cnt; //Check for enemy pooling (add enemies if there happens to be more than the max in the //current battle. If one or more slots have freed up, we can add them now. @@ -344,9 +340,10 @@ void EndTurn( UINT8 ubNextTeam ) FreezeInterfaceForEnemyTurn(); // Loop through all mercs and set to moved - cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; cnt++,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive ) { pSoldier->aiData.bMoved = TRUE; @@ -380,7 +377,6 @@ void EndAITurn( void ) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"EndAITurn"); SOLDIERTYPE * pSoldier; - INT32 cnt; // Remove any deadlock message EndDeadlockMsg( ); @@ -395,9 +391,10 @@ void EndAITurn( void ) } else { - cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; cnt++,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive ) { pSoldier->aiData.bMoved = TRUE; @@ -417,7 +414,6 @@ void EndAllAITurns( void ) DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"EndAllAITurns"); // warp turn to the player's turn SOLDIERTYPE * pSoldier; - INT32 cnt; // Remove any deadlock message EndDeadlockMsg( ); @@ -428,9 +424,10 @@ void EndAllAITurns( void ) if ( gTacticalStatus.ubCurrentTeam != gbPlayerNum ) { - cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; cnt++,pSoldier++) + SoldierID id = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; + for ( ; id <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ++id ) { + pSoldier = id; if ( pSoldier->bActive ) { pSoldier->aiData.bMoved = TRUE; @@ -463,9 +460,10 @@ void EndTurnEvents( void ) DecaySmokeEffects( GetWorldTotalSeconds( ) ); SOLDIERTYPE* pSoldier = NULL; - UINT32 cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt, ++pSoldier) + SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; id <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++id ) { + pSoldier = id; if ( pSoldier->bActive && pSoldier->stats.bLife > 0 )//&& !( pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !( AM_A_ROBOT( pSoldier ) ) ) { // Flugente: update multi-turn actions @@ -505,8 +503,6 @@ BOOLEAN LightningEndOfTurn( UINT8 ubTeam ); void BeginTeamTurn( UINT8 ubTeam ) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"BeginTeamTurn"); - INT32 cnt; - SoldierID ubID; SOLDIERTYPE *pSoldier; //rain @@ -573,9 +569,10 @@ void BeginTeamTurn( UINT8 ubTeam ) // decay team's public opplist DecayPublicOpplist( ubTeam ); - cnt = gTacticalStatus.Team[ ubTeam ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ ubTeam ].bLastID; cnt++,pSoldier++) + SoldierID id = gTacticalStatus.Team[ ubTeam ].bFirstID; + for ( ; id <= gTacticalStatus.Team[ ubTeam ].bLastID; ++id ) { + pSoldier = id; if ( pSoldier->bActive && pSoldier->stats.bLife > 0) { // decay personal opplist, and refresh APs and BPs @@ -644,7 +641,7 @@ void BeginTeamTurn( UINT8 ubTeam ) if ( BuildAIListForTeam( ubTeam ) ) { - ubID = RemoveFirstAIListEntry(); + SoldierID ubID = RemoveFirstAIListEntry(); if (ubID != NOBODY) { // Dirty panel interface! @@ -810,12 +807,12 @@ BOOLEAN EveryoneInInterruptListOnSameTeam( void ) void StartInterrupt( void ) { - UINT16 ubFirstInterrupter; - INT8 bTeam; - SOLDIERTYPE * pSoldier; - SOLDIERTYPE * pTempSoldier; - UINT16 ubInterrupter; - INT32 cnt; + INT8 bTeam; + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pTempSoldier; + SoldierID ubFirstInterrupter; + SoldierID ubInterrupter; + INT32 cnt; DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"StartInterrupt"); ubFirstInterrupter = LATEST_INTERRUPT_GUY; @@ -837,9 +834,9 @@ void StartInterrupt( void ) gTacticalStatus.fInterruptOccurred = TRUE; - cnt = 0; - for ( pTempSoldier = MercPtrs[ cnt ]; cnt < MAX_NUM_SOLDIERS; cnt++,pTempSoldier++) + for ( SoldierID id = 0; id < MAX_NUM_SOLDIERS; ++id ) { + pTempSoldier = id; if ( pTempSoldier->bActive ) { pTempSoldier->bMovedPriorToInterrupt = pTempSoldier->aiData.bMoved; @@ -862,7 +859,7 @@ void StartInterrupt( void ) //while( 1 ) for( iCounter = 0; iCounter < MAX_NUM_SOLDIERS; iCounter++ ) { - MercPtrs[ubInterrupter]->aiData.bMoved = FALSE; + ubInterrupter->aiData.bMoved = FALSE; DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("INTERRUPT: popping %d off of the interrupt queue", ubInterrupter ) ); REMOVE_LATEST_INTERRUPT_GUY(); @@ -873,7 +870,7 @@ void StartInterrupt( void ) { continue; } - else if (MercPtrs[ubInterrupter]->bTeam != bTeam) + else if (ubInterrupter->bTeam != bTeam) { break; } @@ -891,7 +888,7 @@ void StartInterrupt( void ) handleInterrupt = FALSE; // build string in separate loop here, want to linearly process squads... - SOLDIERTYPE *pInterruptedSoldier = MercPtrs[ubInterrupter]; + SOLDIERTYPE *pInterruptedSoldier = ubInterrupter; for ( iSquad = 0; iSquad < NUMBER_OF_SQUADS; iSquad++ ) { for ( iCounter = 0; iCounter < NUMBER_OF_SOLDIERS_PER_SQUAD; iCounter++ ) @@ -981,9 +978,9 @@ void StartInterrupt( void ) PlayJA2Sample( ENDTURN_1, RATE_11025, MIDVOLUME, 1, MIDDLEPAN ); // report any close call quotes for us here - for ( iCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; iCounter <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; iCounter++ ) + for ( SoldierID id = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; id <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++id ) { - SOLDIERTYPE *pSoldier = MercPtrs[iCounter]; + SOLDIERTYPE *pSoldier = id; if ( OK_INSECTOR_MERC( pSoldier ) ) { @@ -1022,7 +1019,7 @@ void StartInterrupt( void ) UINT16 usCounter; for( usCounter = 0; usCounter < MAX_NUM_SOLDIERS; usCounter++ ) { - MercPtrs[ubInterrupter]->aiData.bMoved = FALSE; + ubInterrupter->aiData.bMoved = FALSE; DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("INTERRUPT: popping %d off of the interrupt queue", ubInterrupter ) ); @@ -1033,7 +1030,7 @@ void StartInterrupt( void ) { continue; } - else if (MercPtrs[ubInterrupter]->bTeam != bTeam) + else if (ubInterrupter->bTeam != bTeam) { break; } @@ -1047,12 +1044,12 @@ void StartInterrupt( void ) BuildAIListForTeam( bTeam ); // set to the new first interrupter - cnt = RemoveFirstAIListEntry(); + SoldierID id = RemoveFirstAIListEntry(); // sevenfm: RemoveFirstAIListEntry() can return NOBODY - if( cnt != NOBODY ) + if( id != NOBODY ) { - pTempSoldier = MercPtrs[ cnt ]; + pTempSoldier = id; // sevenfm: don't do anything if pTempSoldier is NULL if( pTempSoldier != NULL ) @@ -1117,16 +1114,15 @@ void StartInterrupt( void ) void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) { - UINT16 ubInterruptedSoldier; - SOLDIERTYPE * pSoldier; - SOLDIERTYPE * pTempSoldier; - INT32 cnt; - BOOLEAN fFound; - INT16 ubMinAPsToAttack; + SoldierID ubInterruptedSoldier; + SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pTempSoldier; + BOOLEAN fFound; + INT16 ubMinAPsToAttack; DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,"EndInterrupt"); - for ( cnt = gubOutOfTurnPersons; cnt > 0; cnt-- ) + for ( UINT16 cnt = gubOutOfTurnPersons; cnt > 0; cnt-- ) { DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("ENDINT: Q position %d: %d", cnt, gubOutOfTurnOrder[ cnt ] ) ); } @@ -1144,9 +1140,10 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) } // Loop through all mercs and see if any passed on this interrupt - cnt = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; - for ( pTempSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; cnt++,pTempSoldier++) + SoldierID id = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; + for ( ; id <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ++id ) { + pTempSoldier = id; if ( pTempSoldier->bActive && pTempSoldier->bInSector && !pTempSoldier->aiData.bMoved && (pTempSoldier->bActionPoints == pTempSoldier->aiData.bIntStartAPs)) { ubMinAPsToAttack = MinAPsToAttack( pTempSoldier, pTempSoldier->sLastTarget, FALSE, 0 ); @@ -1163,58 +1160,58 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) // resume interrupted interrupt //hayden - if (!is_networked) + if ( !is_networked ) { StartInterrupt(); - } - else + } + else { - UINT16 nubFirstInterrupter; - INT8 nbTeam; - SOLDIERTYPE * npSoldier; - + SoldierID nubFirstInterrupter; + INT8 nbTeam; + SOLDIERTYPE *npSoldier; + nubFirstInterrupter = LATEST_INTERRUPT_GUY; - npSoldier = MercPtrs[nubFirstInterrupter]; + npSoldier = nubFirstInterrupter; nbTeam = npSoldier->bTeam; - + //pSoldier is interrupted //but its not available //needs calculating //npSoldier,nbTeam is interruptor //hayden #ifdef BETAVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"unchecked interrupt call area:(resume interrupted interrupt)..."); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"unchecked interrupt call area:(resume interrupted interrupt)..." ); #endif - - if ((nbTeam > 0) && (nbTeam <6 ) && is_server) // AI interrupt resume and im server + + if ( (nbTeam > 0) && (nbTeam < 6) && is_server ) // AI interrupt resume and im server { send_interrupt( npSoldier ); StartInterrupt(); - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s and AI", TeamNameStrings[npSoldier->bTeam]);//tried to use pSoldier, but its not available. find another way to get correct team + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s and AI", TeamNameStrings[npSoldier->bTeam] );//tried to use pSoldier, but its not available. find another way to get correct team } - else if(is_server && gTacticalStatus.ubCurrentTeam == 1)// resume AI interrupted and im server + else if ( is_server && gTacticalStatus.ubCurrentTeam == 1 )// resume AI interrupted and im server { //hayden send_interrupt( npSoldier ); - if(nbTeam !=0) - intAI(npSoldier); - else - StartInterrupt(); - - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt of AI by %s", TeamNameStrings[npSoldier->bTeam]); + if ( nbTeam != 0 ) + intAI( npSoldier ); + else + StartInterrupt(); + + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt of AI by %s", TeamNameStrings[npSoldier->bTeam] ); } - + #ifdef INTERRUPT_MP_DEADLOCK_FIX //its our turn//else// pure client awarding interrupt resume //its our turn - else if(gTacticalStatus.ubCurrentTeam == 0) + else if ( gTacticalStatus.ubCurrentTeam == 0 ) #else // pure client awarding interrupt resume else #endif { - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s", TeamNameStrings[npSoldier->bTeam]);//this can be simplified if above comment is implemented + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"Continuing interrupt with %s", TeamNameStrings[npSoldier->bTeam] );//this can be simplified if above comment is implemented //ClearIntList(); //hayden//may need more work. StartInterrupt(); @@ -1228,11 +1225,11 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) DebugMsg( TOPIC_JA2INTERRUPT, DBG_LEVEL_3, String("INTERRUPT: interrupt over, %d's team regains control", ubInterruptedSoldier ) ); - pSoldier = MercPtrs[ubInterruptedSoldier]; + pSoldier = ubInterruptedSoldier; - cnt = 0; - for ( pTempSoldier = MercPtrs[ cnt ]; cnt < MAX_NUM_SOLDIERS; cnt++,pTempSoldier++) + for ( SoldierID id = 0; id < MAX_NUM_SOLDIERS; ++id) { + pTempSoldier = id; if ( pTempSoldier->bActive ) { // AI guys only here... @@ -1371,9 +1368,10 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) fFound = FALSE; // rebuild list for this team if anyone on the team is still available - cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; - for ( pTempSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; cnt++,pTempSoldier++) + SoldierID id = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; + for ( ; id <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ++id ) { + pTempSoldier = id; if ( pTempSoldier->bActive && pTempSoldier->bInSector && pTempSoldier->stats.bLife >= OKLIFE ) { fFound = TRUE; @@ -1390,16 +1388,16 @@ void EndInterrupt( BOOLEAN fMarkInterruptOccurred ) { // now bubble up everyone left in the interrupt queue, starting // at the front of the array - for (cnt = 1; cnt <= gubOutOfTurnPersons; cnt++) + for (UINT16 cnt = 1; cnt <= gubOutOfTurnPersons; cnt++) { MoveToFrontOfAIList( gubOutOfTurnOrder[ cnt ] ); } - cnt = RemoveFirstAIListEntry(); - if (cnt != NOBODY) + SoldierID id = RemoveFirstAIListEntry(); + if (id != NOBODY) { fFound = TRUE; - StartNPCAI( MercPtrs[ cnt ] ); + StartNPCAI( id ); } } @@ -2382,7 +2380,7 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) { DebugMsg (TOPIC_JA2INTERRUPT,DBG_LEVEL_3,String("ResolveInterruptsVs: Soldier ID = %d, APs = %d (interrupt type = %d)",pSoldier->ubID,pSoldier->bActionPoints, ubInterruptType)); UINT8 ubTeam; - UINT16 ubOpp; + SoldierID ubOpp; UINT16 ubIntCnt; UINT16 ubIntList[MAXMERCS]; UINT8 ubIntDiff[MAXMERCS]; @@ -2404,9 +2402,9 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) // WDS fix broken interrupts (I hope...) if (/*gTacticalStatus.Team[ubTeam].bTeamActive &&*/ (gTacticalStatus.Team[ubTeam].bSide != pSoldier->bSide) && ubTeam != CIV_TEAM) { - for ( ubOpp = gTacticalStatus.Team[ ubTeam ].bFirstID; ubOpp <= gTacticalStatus.Team[ ubTeam ].bLastID; ubOpp++) + for ( ubOpp = gTacticalStatus.Team[ ubTeam ].bFirstID; ubOpp <= gTacticalStatus.Team[ ubTeam ].bLastID; ++ubOpp) { - pOpponent = MercPtrs[ubOpp]; + pOpponent = ubOpp; AssertNotNIL(pOpponent); if ( pOpponent->bActive && pOpponent->bInSector && (pOpponent->stats.bLife >= OKLIFE) && (pOpponent->bBreath >= OKBREATH) && !(pOpponent->bCollapsed) ) { @@ -2519,17 +2517,16 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) { // if anyone on this team is under AI control, remove // their AI control flag and put them on the queue instead of this guy - for ( ubLoop = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ubLoop++ ) + for ( SoldierID id = gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bFirstID; id <= gTacticalStatus.Team[ gTacticalStatus.ubCurrentTeam ].bLastID; ++id) { - if ( (MercPtrs[ ubLoop ]->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) ) + if ( id->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) { // this guy lost control - MercPtrs[ ubLoop ]->flags.uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); - AddToIntList( ubLoop, FALSE, TRUE); + id->flags.uiStatusFlags &= (~SOLDIER_UNDERAICONTROL); + AddToIntList( id, FALSE, TRUE); break; } } - } else { diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index f4c6c575..4a3a2b37 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -2209,9 +2209,10 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // sevenfm: unready weapon for all selected if (!fFound) { - UINT16 cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; - for (SOLDIERTYPE *pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; cnt++, pSoldier++) + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for (; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) { + SOLDIERTYPE *pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED && WeaponReady(pSoldier)) { pSoldier->InternalSoldierReadyWeapon(pSoldier->ubDirection, TRUE, FALSE); @@ -4125,14 +4126,16 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) // swap sungoggles and nightgoggles / put on gas masks case 'N': - SOLDIERTYPE *pTeamSoldier; - UINT16 bLoop; + { + SOLDIERTYPE *pTeamSoldier; + SoldierID id; // emergency command: everybody in this sector puts on gasmasks if ( fAlt ) { - for ( bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier = MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++ ) + for ( id = gTacticalStatus.Team[gbPlayerNum].bFirstID; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; if ( !AM_A_ROBOT( pTeamSoldier ) && pTeamSoldier->stats.bLife >= OKLIFE && (pTeamSoldier->sSectorX == gWorldSectorX) && (pTeamSoldier->sSectorY == gWorldSectorY) && (pTeamSoldier->bSectorZ == gbWorldSectorZ) ) { WearGasMaskIfAvailable( pTeamSoldier ); @@ -4149,37 +4152,39 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) { BOOLEAN fToNightVision; - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + for ( id = gTacticalStatus.Team[gbPlayerNum].bFirstID; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) + pTeamSoldier = id; + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad() && !AM_A_ROBOT( pTeamSoldier ) ) { if ( pTeamSoldier->inv[HEAD1POS].exists() || pTeamSoldier->inv[HEAD2POS].exists() ) { - fToNightVision = ( Item[pTeamSoldier->inv[HEAD1POS].usItem].brightlightvisionrangebonus > 0 || Item[pTeamSoldier->inv[HEAD2POS].usItem].brightlightvisionrangebonus > 0 ); + fToNightVision = (Item[pTeamSoldier->inv[HEAD1POS].usItem].brightlightvisionrangebonus > 0 || Item[pTeamSoldier->inv[HEAD2POS].usItem].brightlightvisionrangebonus > 0); break; } - if ( bLoop == gTacticalStatus.Team[gbPlayerNum].bLastID ) + if ( id == gTacticalStatus.Team[gbPlayerNum].bLastID ) { // Default to night or day based on game hour fToNightVision = NightTime(); } } } - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + for ( id = gTacticalStatus.Team[gbPlayerNum].bFirstID; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { + pTeamSoldier = id; // HEADROCK HAM 3.5: When this INI setting is enabled, ALL mercs in the current sector will do a goggle swap. - if (gGameExternalOptions.fGoggleSwapAffectsAllMercsInSector) + if ( gGameExternalOptions.fGoggleSwapAffectsAllMercsInSector ) { if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->sSectorX == gWorldSectorX && pTeamSoldier->sSectorY == gWorldSectorY && pTeamSoldier->bSectorZ == gbWorldSectorZ && !AM_A_ROBOT( pTeamSoldier ) ) { - SwapGogglesUniformly(pTeamSoldier, fToNightVision); + SwapGogglesUniformly( pTeamSoldier, fToNightVision ); } } else { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad() && !AM_A_ROBOT( pTeamSoldier ) ) { - SwapGogglesUniformly(pTeamSoldier, fToNightVision); + SwapGogglesUniformly( pTeamSoldier, fToNightVision ); } } } @@ -4189,7 +4194,7 @@ void GetKeyboardInput( UINT32 *puiNewEvent ) HandleTBSwapGoogles(); } break; - + } case 'n': if ( !AreInMeanwhile() ) { @@ -6271,7 +6276,6 @@ void HandleSelectMercSlot( UINT8 ubPanelSlot, INT8 bCode ) void TestMeanWhile( INT32 iID ) { MEANWHILE_DEFINITION MeanwhileDef; - INT32 cnt; SOLDIERTYPE *pSoldier; MeanwhileDef.sSectorX = gModSettings.ubMeanwhilePalaceSectorX; //3 @@ -6288,10 +6292,11 @@ void TestMeanWhile( INT32 iID ) // Loop through our mercs and set gridnos once some found..... // look for all mercs on the same team, - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // Are we a POW in this sector? if ( pSoldier->bActive && pSoldier->bInSector ) { @@ -6363,16 +6368,16 @@ void HandleStanceChangeFromUIKeys( UINT8 ubAnimHeight ) { // If we have multiple guys selected, make all change stance! SOLDIERTYPE * pSoldier; - INT32 cnt; if ( gTacticalStatus.fAtLeastOneGuyOnMultiSelect && !( gTacticalStatus.uiFlags & INCOMBAT ) ) { // OK, loop through all guys who are 'multi-selected' and // check if our currently selected guy is amoung the // lucky few.. if not, change to a guy who is... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -6485,16 +6490,16 @@ void HandleStealthChangeFromUIKeys( ) { // If we have multiple guys selected, make all change stance! SOLDIERTYPE * pSoldier; - INT32 cnt; if ( gTacticalStatus.fAtLeastOneGuyOnMultiSelect && !( gTacticalStatus.uiFlags & INCOMBAT ) ) { // OK, loop through all guys who are 'multi-selected' and // check if our currently selected guy is amoung the // lucky few.. if not, change to a guy who is... - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && !AM_A_ROBOT( pSoldier ) && pSoldier->bInSector ) { if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTI_SELECTED ) @@ -7682,12 +7687,13 @@ void HandleTBToggleStealthAll( void ) // Toggle squad's stealth mode..... // For each guy on squad... SOLDIERTYPE *pTeamSoldier; - UINT16 bLoop; + SoldierID bLoop; BOOLEAN fStealthOn = FALSE; // Check if at least one guy is on stealth.... - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) { + pTeamSoldier = bLoop; if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) ) { if ( pTeamSoldier->bStealthMode ) @@ -7697,8 +7703,9 @@ void HandleTBToggleStealthAll( void ) fStealthOn = !fStealthOn; - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) { + pTeamSoldier = bLoop; if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) { if ( gpSMCurrentMerc != NULL && bLoop == gpSMCurrentMerc->ubID ) @@ -7715,6 +7722,7 @@ void HandleTBToggleStealthAll( void ) else ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[ MSG_SQUAD_OFF_STEALTHMODE ] ); } + void HandleTBToggleFireMode( void ) { // toggle fire mode @@ -7722,23 +7730,23 @@ void HandleTBToggleFireMode( void ) ( ( gsCurInterfacePanel != SM_PANEL ) || ( ButtonList[ iSMPanelButtons[ BURSTMODE_BUTTON ] ]->uiFlags & BUTTON_ENABLED ) ) ) SetBurstMode(); } + void HandleTBSelectAllMercs( void ) { - SOLDIERTYPE * pSoldier; - INT32 cnt; - - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++ ) - { - + SOLDIERTYPE *pSoldier; + SoldierID cnt = gTacticalStatus.Team[gbPlayerNum].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++cnt ) + { + pSoldier = cnt; // Check if this guy is OK to control.... - if ( OK_CONTROLLABLE_MERC( pSoldier ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER ) ) ) + if ( OK_CONTROLLABLE_MERC( pSoldier ) && !(pSoldier->flags.uiStatusFlags & (SOLDIER_VEHICLE | SOLDIER_PASSENGER | SOLDIER_DRIVER)) ) { pSoldier->flags.uiStatusFlags |= SOLDIER_MULTI_SELECTED; - } - } + } + } EndMultiSoldierSelection( TRUE ); } + void HandleTBCycleThroughKnownEnemies( void ) { if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) @@ -7747,6 +7755,7 @@ void HandleTBCycleThroughKnownEnemies( void ) CycleThroughKnownEnemies( ); } } + void HandleTBCycleThroughKnownEnemiesBackward( void ) { if ( gTacticalStatus.uiFlags & TURNBASED && (gTacticalStatus.uiFlags & INCOMBAT) ) @@ -7755,6 +7764,7 @@ void HandleTBCycleThroughKnownEnemiesBackward( void ) CycleThroughKnownEnemies( TRUE ); } } + void HandleTBCycleThroughVisibleEnemies( void ) { SOLDIERTYPE *pSoldier; @@ -7848,10 +7858,10 @@ void HandleTBSwapSidearm( void ) void HandleTBSwapGoogles( void ) { SOLDIERTYPE *pTeamSoldier; - UINT16 bLoop; - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + for ( SoldierID bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) { + pTeamSoldier = bLoop; // HEADROCK HAM 3.5: When this INI setting is enabled, ALL mercs in the current sector will do a goggle swap. if (gGameExternalOptions.fGoggleSwapAffectsAllMercsInSector) { @@ -7945,270 +7955,270 @@ void HandleTBReload( void ) } void HandleTBReloadAll( void ) { - if (! ( gTacticalStatus.fEnemyInSector ) ) + if ( !(gTacticalStatus.fEnemyInSector) ) + { + SOLDIERTYPE *pTeamSoldier; + SoldierID bLoop; + UINT16 bullets; + OBJECTTYPE *pGun, *pAmmo, *pAmmoMags; + + // Search for soldier + for ( bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) + { + pTeamSoldier = bLoop; + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad() && !AM_A_ROBOT( pTeamSoldier ) ) + { + // Search for gun in soldier inventory + UINT32 invsize = pTeamSoldier->inv.size(); + for ( UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2 ) { - SOLDIERTYPE *pTeamSoldier; - UINT16 bLoop; - UINT16 bullets; - OBJECTTYPE *pGun, *pAmmo, *pAmmoMags; - - // Search for soldier - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) + if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & (IC_GUN | IC_LAUNCHER)) ) { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) + pGun = &(pTeamSoldier->inv[bLoop2]); + + UINT16 gunmagsize = GetMagSize( pGun ); + + //if magazine is not full + if ( (*pGun)[0]->data.gun.ubGunShotsLeft < gunmagsize ) { - // Search for gun in soldier inventory - UINT32 invsize = pTeamSoldier->inv.size(); - for (UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2) + // Search for ammo in sector + for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop ) { - if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & (IC_GUN | IC_LAUNCHER)) ) + if ( (gWorldItems[uiLoop].bVisible == TRUE) && (gWorldItems[uiLoop].fExists) && (gWorldItems[uiLoop].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[uiLoop].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped { - pGun = &(pTeamSoldier->inv[bLoop2]); - - UINT16 gunmagsize = GetMagSize( pGun ); - - //if magazine is not full - if ( (*pGun)[0]->data.gun.ubGunShotsLeft < gunmagsize ) + if ( (Item[gWorldItems[uiLoop].object.usItem].usItemClass & IC_AMMO) ) // the item is ammo { - // Search for ammo in sector - for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop ) + pAmmo = &(gWorldItems[uiLoop].object); + + if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun { - if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped + // same ammo type in gun and magazine + if ( Magazine[Item[(*pGun)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) { - if ( ( Item[ gWorldItems[ uiLoop ].object.usItem ].usItemClass & IC_AMMO ) ) // the item is ammo - { - pAmmo = &( gWorldItems[ uiLoop ].object ); - - if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun - { - // same ammo type in gun and magazine - if ( Magazine[Item[(*pGun)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) - { - ReloadGun( pTeamSoldier, pGun, pAmmo ); - } - - if ((*pAmmo)[0]->data.ubShotsLeft == 0) - { - RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel ); - } - - // if gun is full, we can stop this - if ( (*pGun)[0]->data.gun.ubGunShotsLeft >= gunmagsize ) - break; - } - } + ReloadGun( pTeamSoldier, pGun, pAmmo ); } + + if ( (*pAmmo)[0]->data.ubShotsLeft == 0 ) + { + RemoveItemFromPool( gWorldItems[uiLoop].sGridNo, uiLoop, gWorldItems[uiLoop].ubLevel ); + } + + // if gun is full, we can stop this + if ( (*pGun)[0]->data.gun.ubGunShotsLeft >= gunmagsize ) + break; } } - //CHRISL: if not enough ammo in sector, reload using ammo carried in inventory - if ( (*pGun)[0]->data.gun.ubGunShotsLeft < gunmagsize ) - { - AutoReload( pTeamSoldier ); - } } } } - } - - //MM: loop thru the soldiers again (lazy copy/paste :p). could do it all at once, but then there may not be enough ammo from the world items to fill everyone's guns first - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++, pTeamSoldier++) - { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) + //CHRISL: if not enough ammo in sector, reload using ammo carried in inventory + if ( (*pGun)[0]->data.gun.ubGunShotsLeft < gunmagsize ) { - // Search for ammo in soldier inventory - UINT32 invsize = pTeamSoldier->inv.size(); - for (UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2) - { - if ( Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_AMMO ) - { - pAmmoMags = &(pTeamSoldier->inv[bLoop2]); - - for ( UINT16 stackMag = 0; stackMag < (*pAmmoMags).ubNumberOfObjects; stackMag++ ) - { - if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize ) - { - // Search for ammo in sector - for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop ) - { - if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped - { - if ( ( Item[ gWorldItems[ uiLoop ].object.usItem ].usItemClass & IC_AMMO ) ) // the item is ammo - { - pAmmo = &( gWorldItems[ uiLoop ].object ); - - if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubCalibre == Magazine[Item[pAmmo->usItem].ubClassIndex].ubCalibre ) // same calibre - { - // same ammo type - if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) - { - bullets = Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize - (*pAmmoMags)[stackMag]->data.ubShotsLeft; - - if ((*pAmmo)[0]->data.ubShotsLeft < bullets) - bullets = (*pAmmo)[0]->data.ubShotsLeft; - - (*pAmmoMags)[stackMag]->data.ubShotsLeft += bullets; - (*pAmmo)[0]->data.ubShotsLeft -= bullets; - - fCharacterInfoPanelDirty = TRUE; - fInterfacePanelDirty = DIRTYLEVEL2; - } - - if ((*pAmmo)[0]->data.ubShotsLeft == 0) - { - RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel ); - } - } - } - } - } - - //MM: if magazines still are partly empty, look through inventory for boxes and crates - if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize ) - { - UINT32 invsize = pTeamSoldier->inv.size(); - for (UINT32 uiLoop = 0; uiLoop < invsize; ++uiLoop) - { - if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO) && Magazine[Item[pTeamSoldier->inv[uiLoop].usItem].ubClassIndex].ubMagType >= AMMO_BOX ) - { - pAmmo = &(pTeamSoldier->inv[uiLoop]); - - if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubCalibre == Magazine[Item[pAmmo->usItem].ubClassIndex].ubCalibre ) // same calibre - { - // same ammo type - if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) - { - bullets = Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize - (*pAmmoMags)[stackMag]->data.ubShotsLeft; - - if ((*pAmmo)[0]->data.ubShotsLeft < bullets) - bullets = (*pAmmo)[0]->data.ubShotsLeft; - - (*pAmmoMags)[stackMag]->data.ubShotsLeft += bullets; - (*pAmmo)[0]->data.ubShotsLeft -= bullets; - - fCharacterInfoPanelDirty = TRUE; - fInterfacePanelDirty = DIRTYLEVEL2; - } - - if ((*pAmmo)[0]->data.ubShotsLeft == 0) - DeleteObj(pAmmo); - } - } - } - } - } - } - - if (IsWeaponAttached(pGun, IC_GUN)) - { - OBJECTTYPE *pGun2 = FindAttachedWeapon(pGun, IC_GUN); - - UINT16 gunmagsize2 = GetMagSize( pGun2 ); - - if ( (*pGun2)[0]->data.gun.ubGunShotsLeft < gunmagsize2 ) - { - // Search for ammo in sector - for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop ) - { - if ( (gWorldItems[ uiLoop ].bVisible == TRUE) && (gWorldItems[ uiLoop ].fExists) && (gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[ uiLoop ].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped - { - if ( ( Item[ gWorldItems[ uiLoop ].object.usItem ].usItemClass & IC_AMMO ) ) // the item is ammo - { - pAmmo = &( gWorldItems[ uiLoop ].object ); - - if ( CompatibleAmmoForGun( pAmmo, pGun2 ) ) // can use the ammo with this gun - { - // same ammo type in gun and magazine - if ( Magazine[Item[(*pGun2)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) - { - ReloadGun( pTeamSoldier, pGun2, pAmmo ); - } - - if ((*pAmmo)[0]->data.ubShotsLeft == 0) - { - RemoveItemFromPool( gWorldItems[ uiLoop ].sGridNo, uiLoop, gWorldItems[ uiLoop ].ubLevel ); - } - - // if gun is full, we can stop this - if ( (*pGun2)[0]->data.gun.ubGunShotsLeft >= gunmagsize2 ) - break; - } - } - } - } - } - - //CHRISL: if not enough ammo in sector, reload using ammo carried in inventory - if ( (*pGun2)[0]->data.gun.ubGunShotsLeft < gunmagsize2 ) - { - AutoReload( pTeamSoldier ); - } - } - } - } + AutoReload( pTeamSoldier ); } } } - else + } + } + + //MM: loop thru the soldiers again (lazy copy/paste :p). could do it all at once, but then there may not be enough ammo from the world items to fill everyone's guns first + for ( bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) + { + pTeamSoldier = bLoop; + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad() && !AM_A_ROBOT( pTeamSoldier ) ) + { + // Search for ammo in soldier inventory + UINT32 invsize = pTeamSoldier->inv.size(); + for ( UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2 ) { - SOLDIERTYPE *pTeamSoldier; - UINT16 bLoop; - OBJECTTYPE *pGun, *pAmmo; - - for (bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID, pTeamSoldier=MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop, pTeamSoldier++) + if ( Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & IC_AMMO ) { - if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad( ) && !AM_A_ROBOT( pTeamSoldier ) ) - { - if ( (Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass & (IC_GUN | IC_LAUNCHER) ) ) - { - if ( ( gTacticalStatus.uiFlags & INCOMBAT ) ) - { - // Flugente: check for underbarrel weapons and use that object if necessary - pGun = pTeamSoldier->GetUsedWeapon( &(pTeamSoldier->inv[HANDPOS]) ); + pAmmoMags = &(pTeamSoldier->inv[bLoop2]); - //magazine is not full - if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) ) + for ( UINT16 stackMag = 0; stackMag < (*pAmmoMags).ubNumberOfObjects; stackMag++ ) + { + if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize ) + { + // Search for ammo in sector + for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop ) + { + if ( (gWorldItems[uiLoop].bVisible == TRUE) && (gWorldItems[uiLoop].fExists) && (gWorldItems[uiLoop].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[uiLoop].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped { - AutoReload( pTeamSoldier ); + if ( (Item[gWorldItems[uiLoop].object.usItem].usItemClass & IC_AMMO) ) // the item is ammo + { + pAmmo = &(gWorldItems[uiLoop].object); + + if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubCalibre == Magazine[Item[pAmmo->usItem].ubClassIndex].ubCalibre ) // same calibre + { + // same ammo type + if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) + { + bullets = Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize - (*pAmmoMags)[stackMag]->data.ubShotsLeft; + + if ( (*pAmmo)[0]->data.ubShotsLeft < bullets ) + bullets = (*pAmmo)[0]->data.ubShotsLeft; + + (*pAmmoMags)[stackMag]->data.ubShotsLeft += bullets; + (*pAmmo)[0]->data.ubShotsLeft -= bullets; + + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + + if ( (*pAmmo)[0]->data.ubShotsLeft == 0 ) + { + RemoveItemFromPool( gWorldItems[uiLoop].sGridNo, uiLoop, gWorldItems[uiLoop].ubLevel ); + } + } + } } } - else + + //MM: if magazines still are partly empty, look through inventory for boxes and crates + if ( (*pAmmoMags)[stackMag]->data.ubShotsLeft < Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize ) { - // Search for gun in soldier inventory UINT32 invsize = pTeamSoldier->inv.size(); - for (UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2) + for ( UINT32 uiLoop = 0; uiLoop < invsize; ++uiLoop ) { - if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & (IC_GUN | IC_LAUNCHER)) ) + if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO) && Magazine[Item[pTeamSoldier->inv[uiLoop].usItem].ubClassIndex].ubMagType >= AMMO_BOX ) { - pGun = &(pTeamSoldier->inv[bLoop2]); + pAmmo = &(pTeamSoldier->inv[uiLoop]); - UINT16 gunmagsize = GetMagSize( pGun ); - - //if magazine is not full - if ( (*pGun)[0]->data.gun.ubGunShotsLeft < gunmagsize ) + if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubCalibre == Magazine[Item[pAmmo->usItem].ubClassIndex].ubCalibre ) // same calibre { - // Search for ammo in soldier inventory - for ( UINT32 uiLoop = 0; uiLoop < invsize; ++uiLoop ) + // same ammo type + if ( Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) { - if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO ) ) // the item is ammo - { - pAmmo = &(pTeamSoldier->inv[uiLoop]); + bullets = Magazine[Item[pAmmoMags->usItem].ubClassIndex].ubMagSize - (*pAmmoMags)[stackMag]->data.ubShotsLeft; - if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun - { - // same ammo type in gun and magazine - if ( Magazine[Item[(*pGun)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) - { - ReloadGun( pTeamSoldier, pGun, pAmmo ); + if ( (*pAmmo)[0]->data.ubShotsLeft < bullets ) + bullets = (*pAmmo)[0]->data.ubShotsLeft; - fCharacterInfoPanelDirty = TRUE; - fInterfacePanelDirty = DIRTYLEVEL2; + (*pAmmoMags)[stackMag]->data.ubShotsLeft += bullets; + (*pAmmo)[0]->data.ubShotsLeft -= bullets; - // if gun is full, we can stop this - if ( (*pGun)[0]->data.gun.ubGunShotsLeft >= gunmagsize ) - break; - } - } - } + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + } + + if ( (*pAmmo)[0]->data.ubShotsLeft == 0 ) + DeleteObj( pAmmo ); + } + } + } + } + } + } + + if ( IsWeaponAttached( pGun, IC_GUN ) ) + { + OBJECTTYPE *pGun2 = FindAttachedWeapon( pGun, IC_GUN ); + + UINT16 gunmagsize2 = GetMagSize( pGun2 ); + + if ( (*pGun2)[0]->data.gun.ubGunShotsLeft < gunmagsize2 ) + { + // Search for ammo in sector + for ( UINT32 uiLoop = 0; uiLoop < guiNumWorldItems; ++uiLoop ) + { + if ( (gWorldItems[uiLoop].bVisible == TRUE) && (gWorldItems[uiLoop].fExists) && (gWorldItems[uiLoop].usFlags & WORLD_ITEM_REACHABLE) && !(gWorldItems[uiLoop].usFlags & WORLD_ITEM_ARMED_BOMB) )//item exists, is reachable, is visible and is not trapped + { + if ( (Item[gWorldItems[uiLoop].object.usItem].usItemClass & IC_AMMO) ) // the item is ammo + { + pAmmo = &(gWorldItems[uiLoop].object); + + if ( CompatibleAmmoForGun( pAmmo, pGun2 ) ) // can use the ammo with this gun + { + // same ammo type in gun and magazine + if ( Magazine[Item[(*pGun2)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) + { + ReloadGun( pTeamSoldier, pGun2, pAmmo ); + } + + if ( (*pAmmo)[0]->data.ubShotsLeft == 0 ) + { + RemoveItemFromPool( gWorldItems[uiLoop].sGridNo, uiLoop, gWorldItems[uiLoop].ubLevel ); + } + + // if gun is full, we can stop this + if ( (*pGun2)[0]->data.gun.ubGunShotsLeft >= gunmagsize2 ) + break; + } + } + } + } + } + + //CHRISL: if not enough ammo in sector, reload using ammo carried in inventory + if ( (*pGun2)[0]->data.gun.ubGunShotsLeft < gunmagsize2 ) + { + AutoReload( pTeamSoldier ); + } + } + } + } + } + } + } + else + { + SOLDIERTYPE *pTeamSoldier; + SoldierID bLoop; + OBJECTTYPE *pGun, *pAmmo; + + for ( bLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) + { + pTeamSoldier = bLoop; + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && pTeamSoldier->bAssignment == CurrentSquad() && !AM_A_ROBOT( pTeamSoldier ) ) + { + if ( (Item[pTeamSoldier->inv[HANDPOS].usItem].usItemClass & (IC_GUN | IC_LAUNCHER)) ) + { + if ( (gTacticalStatus.uiFlags & INCOMBAT) ) + { + // Flugente: check for underbarrel weapons and use that object if necessary + pGun = pTeamSoldier->GetUsedWeapon( &(pTeamSoldier->inv[HANDPOS]) ); + + //magazine is not full + if ( (*pGun)[0]->data.gun.ubGunShotsLeft < GetMagSize( pGun ) ) + { + AutoReload( pTeamSoldier ); + } + } + else + { + // Search for gun in soldier inventory + UINT32 invsize = pTeamSoldier->inv.size(); + for ( UINT32 bLoop2 = 0; bLoop2 < invsize; ++bLoop2 ) + { + if ( (Item[pTeamSoldier->inv[bLoop2].usItem].usItemClass & (IC_GUN | IC_LAUNCHER)) ) + { + pGun = &(pTeamSoldier->inv[bLoop2]); + + UINT16 gunmagsize = GetMagSize( pGun ); + + //if magazine is not full + if ( (*pGun)[0]->data.gun.ubGunShotsLeft < gunmagsize ) + { + // Search for ammo in soldier inventory + for ( UINT32 uiLoop = 0; uiLoop < invsize; ++uiLoop ) + { + if ( (Item[pTeamSoldier->inv[uiLoop].usItem].usItemClass & IC_AMMO) ) // the item is ammo + { + pAmmo = &(pTeamSoldier->inv[uiLoop]); + + if ( CompatibleAmmoForGun( pAmmo, pGun ) ) // can use the ammo with this gun + { + // same ammo type in gun and magazine + if ( Magazine[Item[(*pGun)[0]->data.gun.usGunAmmoItem].ubClassIndex].ubAmmoType == Magazine[Item[pAmmo->usItem].ubClassIndex].ubAmmoType ) + { + ReloadGun( pTeamSoldier, pGun, pAmmo ); + + fCharacterInfoPanelDirty = TRUE; + fInterfacePanelDirty = DIRTYLEVEL2; + + // if gun is full, we can stop this + if ( (*pGun)[0]->data.gun.ubGunShotsLeft >= gunmagsize ) + break; } } } @@ -8218,6 +8228,9 @@ void HandleTBReloadAll( void ) } } } + } + } + } } void HandleTBShowCover( void ) @@ -8311,9 +8324,9 @@ void HandleTBBackpacks(void) bool backpackDropped = false; SOLDIERTYPE* pTeamSoldier; - for (UINT16 ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++) + for ( SoldierID ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++ubLoop ) { - pTeamSoldier = MercPtrs[ubLoop]; + pTeamSoldier = ubLoop; if (OK_CONTROLLABLE_MERC(pTeamSoldier) && pTeamSoldier->flags.DropPackFlag) { @@ -8336,31 +8349,30 @@ void HandleTBBackpacks(void) void HandleTBDropBackpacks( void ) { //if( UsingNewInventorySystem() && gusSelectedSoldier != NOBODY ) - if( UsingNewInventorySystem() ) + if ( UsingNewInventorySystem() ) { //SOLDIERTYPE *pSoldier = gusSelectedSoldier; - SOLDIERTYPE *pTeamSoldier; - UINT16 ubLoop; + SOLDIERTYPE *pTeamSoldier; INT16 sAPCost = APBPConstants[AP_BACK_PACK]; INT32 iBPCost = APBPConstants[BP_BACK_PACK]; - for( ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++ ) + for ( SoldierID ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++ubLoop ) { - pTeamSoldier=MercPtrs[ ubLoop ]; + pTeamSoldier = ubLoop; - if( OK_CONTROLLABLE_MERC( pTeamSoldier ) && + if ( OK_CONTROLLABLE_MERC( pTeamSoldier ) && OK_INTERRUPT_MERC( pTeamSoldier ) && !AM_A_ROBOT( pTeamSoldier ) && - EnoughPoints(pTeamSoldier, sAPCost, iBPCost, FALSE) && + EnoughPoints( pTeamSoldier, sAPCost, iBPCost, FALSE ) && //pTeamSoldier->bAssignment == pSoldier->bAssignment && pTeamSoldier->bAssignment < ON_DUTY && pTeamSoldier->inv[BPACKPOCKPOS].exists() && !pTeamSoldier->flags.DropPackFlag ) - { - if( ChangeDropPackStatus(pTeamSoldier, TRUE) ) + { + if ( ChangeDropPackStatus( pTeamSoldier, TRUE ) ) { - ScreenMsg(FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_SOLDIER_DROP], pTeamSoldier->GetName()); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, NewInvMessage[NIV_SOLDIER_DROP], pTeamSoldier->GetName() ); } } } @@ -8378,14 +8390,13 @@ void HandleTBPickUpBackpacks( void ) { //SOLDIERTYPE *pSoldier = gusSelectedSoldier; SOLDIERTYPE *pTeamSoldier; - UINT16 ubLoop; INT16 sAPCost = APBPConstants[AP_BACK_PACK]; INT32 iBPCost = APBPConstants[BP_BACK_PACK]; - for( ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++ ) + for( SoldierID ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++ubLoop ) { - pTeamSoldier=MercPtrs[ubLoop]; + pTeamSoldier = ubLoop; if( OK_CONTROLLABLE_MERC( pTeamSoldier ) && OK_INTERRUPT_MERC( pTeamSoldier ) && @@ -9602,7 +9613,6 @@ void HandleTBPickUpBackpacks(BOOLEAN fAll) { SOLDIERTYPE* pSoldier = NULL; SOLDIERTYPE* pTeamSoldier; - UINT16 ubLoop; if (gusSelectedSoldier != NOBODY) { @@ -9612,9 +9622,9 @@ void HandleTBPickUpBackpacks(BOOLEAN fAll) INT16 sAPCost = APBPConstants[AP_BACK_PACK]; INT32 iBPCost = APBPConstants[BP_BACK_PACK]; - for (ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ubLoop++) + for ( SoldierID ubLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; ubLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++ubLoop ) { - pTeamSoldier = MercPtrs[ubLoop]; + pTeamSoldier = ubLoop; if (pTeamSoldier && OK_CONTROLLABLE_MERC(pTeamSoldier) && diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index b4e6ad96..14aa0e10 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -1718,15 +1718,15 @@ BOOLEAN EnterVehicle( SOLDIERTYPE *pVehicle, SOLDIERTYPE *pSoldier, UINT8 ubSeat SOLDIERTYPE *GetVehicleSoldierPointerFromPassenger( SOLDIERTYPE *pSrcSoldier ) { - UINT32 cnt; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; // End the turn of player charactors - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // look for all mercs on the same team, - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->flags.uiStatusFlags & SOLDIER_VEHICLE ) { // Check ubID.... @@ -2906,14 +2906,12 @@ BOOLEAN SoldierMustDriveVehicle( SOLDIERTYPE *pSoldier, INT32 iVehicleId, BOOLEA BOOLEAN OnlythisCanDriveVehicle( SOLDIERTYPE *pthis, INT32 iVehicleId ) { - INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; - - for( iCounter = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; iCounter <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; iCounter++ ) + for( SoldierID id = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; id <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++id ) { // get the current soldier - pSoldier = &Menptr[ iCounter ]; + pSoldier = id; // skip checking THIS soldier, we wanna know about everyone else if ( pSoldier == pthis ) diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 3a880361..b528e648 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -989,61 +989,61 @@ void HandleSight(SOLDIERTYPE *pSoldier, UINT8 ubSightFlags) void OurTeamRadiosRandomlyAbout(UINT16 ubAbout) { - INT32 iLoop; - // WDS - make number of mercenaries, etc. be configurable -INT16 radioCnt = 0,radioMan[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; - SOLDIERTYPE *pSoldier; + // WDS - make number of mercenaries, etc. be configurable + INT16 radioCnt = 0,radioMan[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; + SOLDIERTYPE *pSoldier; -// Temporary for opplist synching - disable random order radioing + // Temporary for opplist synching - disable random order radioing #ifdef RECORDOPPLIST - for (iLoop = Status.team[Net.pnum].guystart,ourPtr = MercPtrs[iLoop]; iLoop < Status.team[Net.pnum].guyend; iLoop++,ourPtr++) + for (iLoop = Status.team[Net.pnum].guystart,ourPtr = MercPtrs[iLoop]; iLoop < Status.team[Net.pnum].guyend; iLoop++,ourPtr++) { - // if this merc is active, in this sector, and well enough to look - if (pSoldier->active && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE)) - { - RadioSightings(pSoldier,ubAbout,pSoldier->bTeam); - pSoldier->bNewOppCnt = 0; - } + // if this merc is active, in this sector, and well enough to look + if (pSoldier->active && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE)) + { + RadioSightings(pSoldier,ubAbout,pSoldier->bTeam); + pSoldier->bNewOppCnt = 0; + } } - return; + return; #endif - // All mercs on our local team check if they should radio about him - iLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; + // All mercs on our local team check if they should radio about him + SoldierID id = gTacticalStatus.Team[gbPlayerNum].bFirstID; - // make a list of all of our team's mercs - for (pSoldier = MercPtrs[iLoop]; iLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; iLoop++,pSoldier++) + // make a list of all of our team's mercs + for ( ; id <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++id ) { - // if this merc is active, in this sector, and well enough to look - if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE)) - // put him on our list, and increment the counter - radioMan[radioCnt++] = (INT16)iLoop; + pSoldier = id; + // if this merc is active, in this sector, and well enough to look + if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE)) + // put him on our list, and increment the counter + radioMan[radioCnt++] = (INT16)id; } - // now RANDOMLY handle each of the mercs on our list, until none remain - // (this is all being done ONLY so that the mercs in the earliest merc - // slots do not arbitrarily get the bulk of the sighting speech quote - // action, while the later ones almost never pipe up, and is NOT - // strictly necessary, but a nice improvement over original JA) - while (radioCnt) + // now RANDOMLY handle each of the mercs on our list, until none remain + // (this is all being done ONLY so that the mercs in the earliest merc + // slots do not arbitrarily get the bulk of the sighting speech quote + // action, while the later ones almost never pipe up, and is NOT + // strictly necessary, but a nice improvement over original JA) + while (radioCnt) { - // pick a merc from one of the remaining slots at random - iLoop = Random(radioCnt); + // pick a merc from one of the remaining slots at random + INT16 iLoop = Random(radioCnt); - // handle radioing for that merc - RadioSightings(MercPtrs[radioMan[iLoop]],ubAbout,MercPtrs[radioMan[iLoop]]->bTeam); - Menptr[radioMan[iLoop]].bNewOppCnt = 0; + // handle radioing for that merc + RadioSightings( MercPtrs[radioMan[iLoop]], ubAbout, MercPtrs[radioMan[iLoop]]->bTeam ); + Menptr[radioMan[iLoop]].bNewOppCnt = 0; - // unless it WAS the last used slot that we happened to pick - if (iLoop != (radioCnt - 1)) - // move the contents of the last slot into the one just handled - radioMan[iLoop] = radioMan[radioCnt - 1]; + // unless it WAS the last used slot that we happened to pick + if (iLoop != (radioCnt - 1)) + // move the contents of the last slot into the one just handled + radioMan[iLoop] = radioMan[radioCnt - 1]; - radioCnt--; + radioCnt--; } } @@ -1058,71 +1058,69 @@ INT16 radioCnt = 0,radioMan[CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS]; INT16 TeamNoLongerSeesMan( UINT8 ubTeam, SOLDIERTYPE *pOpponent, UINT16 ubExcludeID, INT8 bIteration ) { - UINT16 bLoop; SOLDIERTYPE *pMate; - - - bLoop = gTacticalStatus.Team[ubTeam].bFirstID; + SoldierID bLoop = gTacticalStatus.Team[ubTeam].bFirstID; // look for all mercs on the same team, check opplists for this soldier - for (pMate = MercPtrs[bLoop]; bLoop <= gTacticalStatus.Team[ubTeam].bLastID; ++bLoop,pMate++) + for ( ; bLoop <= gTacticalStatus.Team[ubTeam].bLastID; ++bLoop ) { + pMate = bLoop; // if this "teammate" is me, myself, or I (whom we want to exclude) - if (bLoop == ubExcludeID) - continue; // skip to next teammate, I KNOW I don't see him... + if ( bLoop == ubExcludeID ) + continue; // skip to next teammate, I KNOW I don't see him... - // if this merc is not on the same team - if (pMate->bTeam != ubTeam) - continue; // skip him, he's no teammate at all! + // if this merc is not on the same team + if ( pMate->bTeam != ubTeam ) + continue; // skip him, he's no teammate at all! - // if this merc is not active, at base, on assignment, dead, unconscious - if (!pMate->bActive || !pMate->bInSector || (pMate->stats.bLife < OKLIFE)) - continue; // next merc + // if this merc is not active, at base, on assignment, dead, unconscious + if ( !pMate->bActive || !pMate->bInSector || (pMate->stats.bLife < OKLIFE) ) + continue; // next merc - // if this teammate currently sees this opponent - if (pMate->aiData.bOppList[pOpponent->ubID] == SEEN_CURRENTLY) - return(FALSE); // that's all I need to know, get out of here + // if this teammate currently sees this opponent + if ( pMate->aiData.bOppList[pOpponent->ubID] == SEEN_CURRENTLY ) + return(FALSE); // that's all I need to know, get out of here } -/* comm by ddd -#ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA - if ( bIteration == 0 ) + /* comm by ddd + #ifdef WE_SEE_WHAT_MILITIA_SEES_AND_VICE_VERSA + if ( bIteration == 0 ) + { + if ( ubTeam == gbPlayerNum && gTacticalStatus.Team[ MILITIA_TEAM ].bTeamActive ) + { + // check militia team as well + return( TeamNoLongerSeesMan( MILITIA_TEAM, pOpponent, ubExcludeID, 1 ) ); + } + else if ( ubTeam == MILITIA_TEAM && gTacticalStatus.Team[ gbPlayerNum ].bTeamActive ) + { + // check player team as well + return( TeamNoLongerSeesMan( gbPlayerNum, pOpponent, ubExcludeID, 1 ) ); + } + } + #endif + */ + //ddd + if ( gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa ) { - if ( ubTeam == gbPlayerNum && gTacticalStatus.Team[ MILITIA_TEAM ].bTeamActive ) + if ( bIteration == 0 ) { - // check militia team as well - return( TeamNoLongerSeesMan( MILITIA_TEAM, pOpponent, ubExcludeID, 1 ) ); + if ( ubTeam == gbPlayerNum && gTacticalStatus.Team[MILITIA_TEAM].bTeamActive ) + { + // check militia team as well + return(TeamNoLongerSeesMan( MILITIA_TEAM, pOpponent, ubExcludeID, 1 )); + } + else if ( ubTeam == MILITIA_TEAM && gTacticalStatus.Team[gbPlayerNum].bTeamActive ) + { + // check player team as well + return(TeamNoLongerSeesMan( gbPlayerNum, pOpponent, ubExcludeID, 1 )); + } } - else if ( ubTeam == MILITIA_TEAM && gTacticalStatus.Team[ gbPlayerNum ].bTeamActive ) - { - // check player team as well - return( TeamNoLongerSeesMan( gbPlayerNum, pOpponent, ubExcludeID, 1 ) ); - } - } -#endif -*/ -//ddd -if(gGameExternalOptions.bWeSeeWhatMilitiaSeesAndViceVersa) -{ - if ( bIteration == 0 ) - { - if ( ubTeam == gbPlayerNum && gTacticalStatus.Team[ MILITIA_TEAM ].bTeamActive ) - { - // check militia team as well - return( TeamNoLongerSeesMan( MILITIA_TEAM, pOpponent, ubExcludeID, 1 ) ); - } - else if ( ubTeam == MILITIA_TEAM && gTacticalStatus.Team[ gbPlayerNum ].bTeamActive ) - { - // check player team as well - return( TeamNoLongerSeesMan( gbPlayerNum, pOpponent, ubExcludeID, 1 ) ); - } - } -} -//ddd + } + //ddd - // none of my friends is currently seeing the guy, so return success - return(TRUE); + // none of my friends is currently seeing the guy, so return success + return(TRUE); } INT16 DistanceSmellable( SOLDIERTYPE *pSoldier, SOLDIERTYPE * pSubject ) @@ -1524,12 +1522,11 @@ void TurnOffEveryonesMuzzleFlashes( void ) void TurnOffTeamsMuzzleFlashes( UINT8 ubTeam ) { - UINT16 ubLoop; SOLDIERTYPE * pSoldier; - for (ubLoop = gTacticalStatus.Team[ ubTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ ubTeam ].bLastID; ubLoop++) + for ( SoldierID ubLoop = gTacticalStatus.Team[ ubTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ ubTeam ].bLastID; ++ubLoop ) { - pSoldier = MercPtrs[ ubLoop ]; + pSoldier = ubLoop; if ( pSoldier->flags.fMuzzleFlash ) { @@ -1638,15 +1635,14 @@ void InitOpplistForDoorOpening( void ) void AllTeamsLookForAll(UINT8 ubAllowInterrupts) { - UINT32 uiLoop; - SOLDIERTYPE *pSoldier; + SOLDIERTYPE *pSoldier; - if( ( gTacticalStatus.uiFlags & LOADING_SAVED_GAME ) ) + if ( (gTacticalStatus.uiFlags & LOADING_SAVED_GAME) ) { return; } - if (ubAllowInterrupts || !(gTacticalStatus.uiFlags & INCOMBAT) ) + if ( ubAllowInterrupts || !(gTacticalStatus.uiFlags & INCOMBAT) ) { gubBestToMakeSightingSize = BEST_SIGHTING_ARRAY_SIZE_ALL_TEAMS_LOOK_FOR_ALL; if ( gfDelayResolvingBestSightingDueToDoor ) @@ -1661,20 +1657,20 @@ void AllTeamsLookForAll(UINT8 ubAllowInterrupts) } } - for (uiLoop = 0; uiLoop < guiNumMercSlots; uiLoop++) + for ( UINT16 uiLoop = 0; uiLoop < guiNumMercSlots; ++uiLoop ) { - pSoldier = MercSlots[ uiLoop ]; + pSoldier = MercSlots[uiLoop]; if ( pSoldier != NULL && pSoldier->stats.bLife >= OKLIFE ) { - HandleSight(pSoldier,SIGHT_LOOK); // no radio or interrupts yet + HandleSight( pSoldier, SIGHT_LOOK ); // no radio or interrupts yet } } // the player team now radios about all sightings - for ( uiLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; uiLoop++ ) + for ( SoldierID uiLoop = gTacticalStatus.Team[gbPlayerNum].bFirstID; uiLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++uiLoop ) { - HandleSight( MercPtrs[ uiLoop ], SIGHT_RADIO ); // looking was done above + HandleSight( uiLoop, SIGHT_RADIO ); // looking was done above } if ( !(gTacticalStatus.uiFlags & INCOMBAT) ) @@ -1698,52 +1694,52 @@ void AllTeamsLookForAll(UINT8 ubAllowInterrupts) gubBestToMakeSightingSize = BEST_SIGHTING_ARRAY_SIZE_INCOMBAT; } - /* + /* - // do this here as well as in overhead so the looks/interrupts are combined! + // do this here as well as in overhead so the looks/interrupts are combined! - // if a door was recently opened/closed (doesn't matter if we could see it) - // this is done here so we can first handle everyone looking through the - // door, and deal with the resulting opplist changes, interrupts, etc. - if ( !TileIsOutOfBounds(Status.doorCreakedGridno)) - { - // opening/closing a door makes a bit of noise (constant volume) - MakeNoise(Status.doorCreakedGuynum,Status.doorCreakedGridno,TTypeList[Grid[Status.doorCreakedGridno].land],DOOR_NOISE_VOLUME,NOISE_CREAKING,EXPECTED_NOSEND); + // if a door was recently opened/closed (doesn't matter if we could see it) + // this is done here so we can first handle everyone looking through the + // door, and deal with the resulting opplist changes, interrupts, etc. + if ( !TileIsOutOfBounds(Status.doorCreakedGridno)) + { + // opening/closing a door makes a bit of noise (constant volume) + MakeNoise(Status.doorCreakedGuynum,Status.doorCreakedGridno,TTypeList[Grid[Status.doorCreakedGridno].land],DOOR_NOISE_VOLUME,NOISE_CREAKING,EXPECTED_NOSEND); - Status.doorCreakedGridno = NOWHERE; - Status.doorCreakedGuynum = NOBODY; - } + Status.doorCreakedGridno = NOWHERE; + Status.doorCreakedGuynum = NOBODY; + } - // all soldiers now radio their findings (NO interrupts permitted this early!) - // NEW: our entire team must radio first, so that they radio about EVERYBODY - // rather radioing about individuals one a a time (repeats see 1 enemy quote) - for (cnt = Status.team[Net.pnum].guystart,ptr = MercPtrs[cnt]; cnt < Status.team[Net.pnum].guyend; cnt++,ptr++) - { - if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE)) - HandleSight(ptr,SIGHT_RADIO); // looking was done above - } + // all soldiers now radio their findings (NO interrupts permitted this early!) + // NEW: our entire team must radio first, so that they radio about EVERYBODY + // rather radioing about individuals one a a time (repeats see 1 enemy quote) + for (cnt = Status.team[Net.pnum].guystart,ptr = MercPtrs[cnt]; cnt < Status.team[Net.pnum].guyend; cnt++,ptr++) + { + if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE)) + HandleSight(ptr,SIGHT_RADIO); // looking was done above + } - for (cnt = 0,ptr = Menptr; cnt < MAXMERCS; cnt++,ptr++) - { - if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE) && !PTR_OURTEAM) - HandleSight(ptr,SIGHT_RADIO); // looking was done above - } + for (cnt = 0,ptr = Menptr; cnt < MAXMERCS; cnt++,ptr++) + { + if (ptr->active && ptr->in_sector && (ptr->life >= OKLIFE) && !PTR_OURTEAM) + HandleSight(ptr,SIGHT_RADIO); // looking was done above + } - // if interrupts were allowed - if (allowInterrupts) - // resolve interrupts against the selected character (others disallowed) - HandleSight(MercPtrs[Status.allLookCharacter],SIGHT_INTERRUPT); + // if interrupts were allowed + if (allowInterrupts) + // resolve interrupts against the selected character (others disallowed) + HandleSight(MercPtrs[Status.allLookCharacter],SIGHT_INTERRUPT); - // revert to normal interrupt operation - InterruptOnlyGuynum = NOBODY; - InterruptsAllowed = TRUE; - */ + // revert to normal interrupt operation + InterruptOnlyGuynum = NOBODY; + InterruptsAllowed = TRUE; + */ - // reset interrupt only guynum which may have been used - gubInterruptProvoker = NOBODY; + // reset interrupt only guynum which may have been used + gubInterruptProvoker = NOBODY; } @@ -3115,7 +3111,7 @@ void RemoveManAsTarget(SOLDIERTYPE *pSoldier) void UpdatePublic(UINT8 ubTeam, SoldierID ubID, INT8 bNewOpplist, INT32 sGridNo, INT8 bLevel) { - INT32 cnt; + SoldierID cnt; UINT8 ubTeamMustLookAgain = FALSE, ubMadeDifference = FALSE; SOLDIERTYPE *pSoldier; INT8* pbPublOL = &(gbPublicOpplist[ubTeam][ubID]); @@ -3143,8 +3139,9 @@ void UpdatePublic(UINT8 ubTeam, SoldierID ubID, INT8 bNewOpplist, INT32 sGridNo, // then everyone on team who's not aware of guynum must look for him cnt = gTacticalStatus.Team[ubTeam].bFirstID; - for (pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ubTeam].bLastID; ++cnt, pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ubTeam].bLastID; ++cnt ) { + pSoldier = cnt; // if this soldier is active, in this sector, and well enough to look if (pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && !( pSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) ) { @@ -5719,7 +5716,6 @@ void TheirNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTer void ProcessNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage ) { SOLDIERTYPE *pSoldier; - UINT16 bLoop; UINT8 bTeam; UINT8 ubLoudestEffVolume, ubEffVolume; // UINT8 ubPlayVolume; @@ -5923,8 +5919,9 @@ void ProcessNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubT ubHeardLoudestBy = NOBODY; // All mercs on this team check if they are eligible to hear this noise - for (bLoop = gTacticalStatus.Team[bTeam].bFirstID,pSoldier = Menptr + bLoop; bLoop <= gTacticalStatus.Team[bTeam].bLastID; bLoop++,pSoldier++) + for ( SoldierID bLoop = gTacticalStatus.Team[bTeam].bFirstID; bLoop <= gTacticalStatus.Team[bTeam].bLastID; ++bLoop ) { + pSoldier = bLoop; // if this "listener" is inactive, or in no condition to care if (!pSoldier->bActive || !pSoldier->bInSector || pSoldier->flags.uiStatusFlags & SOLDIER_DEAD || (pSoldier->stats.bLife < OKLIFE) || pSoldier->ubBodyType == LARVAE_MONSTER) { @@ -7439,15 +7436,15 @@ void NoticeUnseenAttacker( SOLDIERTYPE * pAttacker, SOLDIERTYPE * pDefender, INT void CheckForAlertWhenEnemyDies( SOLDIERTYPE * pDyingSoldier ) { - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; INT8 bDir; INT16 sDistAway, sDistVisible; - for ( ubID = gTacticalStatus.Team[ pDyingSoldier->bTeam ].bFirstID; ubID <= gTacticalStatus.Team[ pDyingSoldier->bTeam ].bLastID; ubID++ ) + for ( ubID = gTacticalStatus.Team[ pDyingSoldier->bTeam ].bFirstID; ubID <= gTacticalStatus.Team[ pDyingSoldier->bTeam ].bLastID; ++ubID ) { - pSoldier = MercPtrs[ ubID ]; + pSoldier = ubID; if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier != pDyingSoldier) && (pSoldier->stats.bLife >= OKLIFE) && (pSoldier->aiData.bAlertStatus < STATUS_RED ) ) { @@ -7470,22 +7467,20 @@ void CheckForAlertWhenEnemyDies( SOLDIERTYPE * pDyingSoldier ) } } } - } - } BOOLEAN ArmyKnowsOfPlayersPresence( void ) { - UINT16 ubID; + SoldierID ubID; SOLDIERTYPE * pSoldier; // if anyone is still left... if (gTacticalStatus.Team[ ENEMY_TEAM ].bTeamActive && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector > 0 ) { - for ( ubID = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; ubID <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ubID++ ) + for ( ubID = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; ubID <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++ubID ) { - pSoldier = MercPtrs[ ubID ]; + pSoldier = ubID; if ( pSoldier->bActive && pSoldier->bInSector && (pSoldier->stats.bLife >= OKLIFE) && (pSoldier->aiData.bAlertStatus >= STATUS_RED ) ) { @@ -7498,19 +7493,19 @@ BOOLEAN ArmyKnowsOfPlayersPresence( void ) BOOLEAN MercSeesCreature( SOLDIERTYPE * pSoldier ) { - UINT16 ubID; + SoldierID ubID; - if (pSoldier->aiData.bOppCnt > 0) + if ( pSoldier->aiData.bOppCnt > 0 ) { - for ( ubID = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; ubID <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ubID++ ) + for ( ubID = gTacticalStatus.Team[CREATURE_TEAM].bFirstID; ubID <= gTacticalStatus.Team[CREATURE_TEAM].bLastID; ++ubID ) { - if ( (pSoldier->aiData.bOppList[ ubID ] == SEEN_CURRENTLY) && (MercPtrs[ ubID ]->flags.uiStatusFlags & SOLDIER_MONSTER) ) + if ( (pSoldier->aiData.bOppList[ubID] == SEEN_CURRENTLY) && (ubID->flags.uiStatusFlags & SOLDIER_MONSTER) ) { - return( TRUE ); + return(TRUE); } } } - return( FALSE ); + return(FALSE); } @@ -7626,14 +7621,14 @@ INT8 GetHighestWatchedLocPoints( UINT16 ubID ) void CommunicateWatchedLoc( SoldierID ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoints ) { - UINT16 ubLoop; + SoldierID ubLoop; INT8 bTeam, bLoopPoint, bPoint; bTeam = ubID->bTeam; - for ( ubLoop = gTacticalStatus.Team[ bTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ bTeam ].bLastID; ubLoop++ ) + for ( ubLoop = gTacticalStatus.Team[ bTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ bTeam ].bLastID; ++ubLoop ) { - SOLDIERTYPE *pSoldier = MercPtrs[ubLoop]; + SOLDIERTYPE *pSoldier = ubLoop; if ( ubLoop == ubID || pSoldier->bActive == FALSE || pSoldier->bInSector == FALSE || pSoldier->stats.bLife < OKLIFE ) { continue; @@ -7784,13 +7779,13 @@ void DecayWatchedLocs( INT8 bTeam ) void MakeBloodcatsHostile( void ) { - INT32 iLoop; - SOLDIERTYPE * pSoldier; + SOLDIERTYPE *pSoldier; + SoldierID id = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; - iLoop = gTacticalStatus.Team[ CREATURE_TEAM ].bFirstID; - - for (pSoldier = MercPtrs[iLoop]; iLoop <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++iLoop, ++pSoldier ) + for ( ; id <= gTacticalStatus.Team[ CREATURE_TEAM ].bLastID; ++id ) { + pSoldier = id; + if ( pSoldier->ubBodyType == BLOODCAT && pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) { SetSoldierNonNeutral( pSoldier ); diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index 90e7024b..51ea4558 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -874,8 +874,6 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) { - UINT16 ubID; - if (gfTurnBasedAI) { if (gTacticalStatus.uiFlags & PLAYER_TEAM_DEAD) @@ -885,9 +883,9 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) } // search for any player merc to say close call quote - for ( ubID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubID ) + for ( SoldierID ubID = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; ubID <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubID ) { - SOLDIERTYPE *pMerc = MercPtrs[ubID]; + SOLDIERTYPE *pMerc = ubID; if ( OK_INSECTOR_MERC( pMerc ) ) { @@ -941,10 +939,10 @@ void EndAIGuysTurn( SOLDIERTYPE *pSoldier ) #endif // find the next AI guy - ubID = RemoveFirstAIListEntry(); + SoldierID ubID = RemoveFirstAIListEntry(); if (ubID != NOBODY) { - StartNPCAI( MercPtrs[ ubID ] ); + StartNPCAI( ubID ); return; } @@ -1119,14 +1117,13 @@ void StartNPCAI(SOLDIERTYPE *pSoldier) BOOLEAN DestNotSpokenFor(SOLDIERTYPE *pSoldier, INT32 sGridNo) { - INT32 cnt; SOLDIERTYPE *pOurTeam; - - cnt = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; + SoldierID cnt = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; // make a list of all of our team's mercs - for (pOurTeam = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; cnt++,pOurTeam++) + for ( ; cnt <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; ++cnt ) { + pOurTeam = cnt; if ( pOurTeam->bActive ) { if (pOurTeam->sGridNo == sGridNo || pOurTeam->aiData.usActionData == sGridNo) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 8e1b8968..5ed40f53 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -1703,18 +1703,17 @@ INT32 ClosestPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ) // NOTE: skips EPCs! - UINT16 ubLoop; SOLDIERTYPE *pTargetSoldier; INT32 sMinDist = WORLD_MAX; INT32 sDist; INT32 sGridNo = NOWHERE; // Loop through all mercs on player team - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++) + for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop) { - pTargetSoldier = Menptr + ubLoop; + pTargetSoldier = ubLoop; if (!pTargetSoldier->bActive || !pTargetSoldier->bInSector) { @@ -1762,17 +1761,16 @@ INT32 ClosestUnDisguisedPC( SOLDIERTYPE *pSoldier, INT32 * psDistance ) // used by NPCs... find the closest PC // NOTE: skips EPCs! - UINT16 ubLoop; SOLDIERTYPE *pTargetSoldier; INT32 sMinDist = WORLD_MAX; INT32 sDist; INT32 sGridNo = NOWHERE; // Loop through all mercs on player team - ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++) + SoldierID ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop ) { - pTargetSoldier = Menptr + ubLoop; + pTargetSoldier = ubLoop; if (!pTargetSoldier->bActive || !pTargetSoldier->bInSector) continue; @@ -2021,7 +2019,6 @@ INT16 EstimatePathCostToLocation( SOLDIERTYPE * pSoldier, INT32 sDestGridNo, INT BOOLEAN GuySawEnemy( SOLDIERTYPE * pSoldier, UINT8 ubMax ) { UINT8 ubTeamLoop; - UINT16 ubIDLoop; SOLDIERTYPE *pOpponent; for ( ubTeamLoop = 0; ubTeamLoop < MAXTEAMS; ++ubTeamLoop ) @@ -2032,9 +2029,9 @@ BOOLEAN GuySawEnemy( SOLDIERTYPE * pSoldier, UINT8 ubMax ) if ( gTacticalStatus.Team[ ubTeamLoop ].bSide != pSoldier->bSide ) { // consider guys in this team, which isn't on our side - for ( ubIDLoop = gTacticalStatus.Team[ ubTeamLoop ].bFirstID; ubIDLoop <= gTacticalStatus.Team[ ubTeamLoop ].bLastID; ++ubIDLoop ) + for ( SoldierID ubIDLoop = gTacticalStatus.Team[ ubTeamLoop ].bFirstID; ubIDLoop <= gTacticalStatus.Team[ ubTeamLoop ].bLastID; ++ubIDLoop ) { - pOpponent = MercPtrs[ubIDLoop]; + pOpponent = ubIDLoop; // if this merc is inactive, at base, on assignment, or dead if (!pOpponent) @@ -2174,15 +2171,14 @@ INT32 ClosestReachableFriendInTrouble(SOLDIERTYPE *pSoldier, BOOLEAN * pfClimbin INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ) { // find the distance to the closest person on the same team - UINT16 ubLoop; SOLDIERTYPE *pTargetSoldier; INT16 sMinDist = 1000; INT16 sDist; // Loop through all mercs on player team - ubLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; + SoldierID ubLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; - for ( ; ubLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ubLoop++ ) + for ( ; ubLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; ++ubLoop ) { if (ubLoop == pSoldier->ubID) { @@ -2190,7 +2186,7 @@ INT16 DistanceToClosestFriend( SOLDIERTYPE * pSoldier ) continue; } - pTargetSoldier = Menptr + ubLoop; + pTargetSoldier = ubLoop; if ( pSoldier->bActive && pSoldier->bInSector ) { @@ -3167,12 +3163,11 @@ INT32 RangeChangeDesire( SOLDIERTYPE * pSoldier ) BOOLEAN ArmySeesOpponents( void ) { - INT32 cnt; SOLDIERTYPE * pSoldier; - for ( cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++ ) + for ( SoldierID cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++cnt ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->aiData.bOppCnt > 0 ) { @@ -3306,7 +3301,7 @@ INT16 AssessTacticalSituation( INT8 bTeam ) BOOLEAN TeamSeesOpponent( INT8 bTeam, SOLDIERTYPE * pOpponent ) { SOLDIERTYPE * pSoldier; - UINT16 cnt; + SoldierID cnt; // This assertion can be safely removed, assuming the program does what it should. It simply checks // whether the "opponent" is on the same team being checked. That should be avoided when calling this @@ -3316,9 +3311,9 @@ BOOLEAN TeamSeesOpponent( INT8 bTeam, SOLDIERTYPE * pOpponent ) // We're checking Merc/Militia visibility if (bTeam == OUR_TEAM || bTeam == MILITIA_TEAM ) { - for ( cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; cnt++ ) + for ( cnt = gTacticalStatus.Team[ MILITIA_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ MILITIA_TEAM ].bLastID; ++cnt ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE) { @@ -3328,9 +3323,9 @@ BOOLEAN TeamSeesOpponent( INT8 bTeam, SOLDIERTYPE * pOpponent ) return ( TRUE ); } } - for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++ ) + for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE) { @@ -3349,9 +3344,9 @@ BOOLEAN TeamSeesOpponent( INT8 bTeam, SOLDIERTYPE * pOpponent ) // Check enemy visibility else if (bTeam == ENEMY_TEAM) { - for ( cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; cnt++ ) + for ( cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; ++cnt ) { - pSoldier = MercPtrs[ cnt ]; + pSoldier = cnt; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE) { @@ -3448,14 +3443,13 @@ INT32 CalcStraightThreatValue( SOLDIERTYPE *pEnemy ) SoldierID GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag, BOOLEAN fCheckSight ) { SoldierID id = NOBODY; - UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; // go through each soldier, looking for "friends" (soldiers on same team) - for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) + for ( SoldierID uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) { - pFriend = MercPtrs[ uiLoop ]; + pFriend = uiLoop; // if this merc is inactive, not in sector, or dead if (!pFriend) @@ -3501,14 +3495,13 @@ SoldierID GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT SoldierID GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) { SoldierID id = NOBODY; - UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; // go through each soldier, looking for "friends" (soldiers on same team) - for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) + for ( SoldierID uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) { - pFriend = MercPtrs[ uiLoop ]; + pFriend = uiLoop; // if this merc is inactive, not in sector, or dead if (!pFriend) @@ -3550,14 +3543,13 @@ SoldierID GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT SoldierID GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam ) { SoldierID id = NOBODY; - UINT32 uiLoop; SOLDIERTYPE * pFriend; INT16 range = aRange; // go through each soldier, looking for "friends" (soldiers on same team) - for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) + for ( SoldierID uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) { - pFriend = MercPtrs[ uiLoop ]; + pFriend = uiLoop; // if this merc is inactive, not in sector, or dead if (!pFriend) @@ -3622,9 +3614,9 @@ UINT16 CountFriendsInDirection( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo ) ubMyDir = GetDirectionFromCenterCellXYGridNo(sTargetGridNo, pSoldier->sGridNo); // Run through each friendly. - for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( SoldierID iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ++iCounter ) { - pFriend = MercPtrs[ iCounter ]; + pFriend = iCounter; ubFriendDir = GetDirectionFromCenterCellXYGridNo(sTargetGridNo, pFriend->sGridNo); if (pFriend != pSoldier && @@ -3654,9 +3646,9 @@ UINT16 CountNearbyFriends( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubDistanc return 0; // Run through each friendly. - for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( SoldierID iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ++iCounter ) { - pFriend = MercPtrs[ iCounter ]; + pFriend = iCounter; // Make sure that character is alive, not too shocked, and conscious, and of higher experience level // than the character being suppressed. if (pFriend != pSoldier && pFriend->bActive && pFriend->stats.bLife >= OKLIFE && @@ -3963,9 +3955,9 @@ BOOLEAN WeAttack(INT8 bTeam) SOLDIERTYPE * pFriend; // Run through each friendly. - for (UINT16 iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; iCounter++) + for ( SoldierID iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; ++iCounter ) { - pFriend = MercPtrs[iCounter]; + pFriend = iCounter; if (pFriend && pFriend->bActive && @@ -3987,9 +3979,9 @@ UINT8 CountNearbyFriendsLastAttackHit( SOLDIERTYPE *pSoldier, INT32 sGridNo, UIN UINT8 ubFriendCount = 0; // Run through each friendly. - for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( SoldierID iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ++iCounter ) { - pFriend = MercPtrs[ iCounter ]; + pFriend = iCounter; if (pFriend != pSoldier && pFriend->bActive && @@ -4027,9 +4019,9 @@ UINT8 CountFriendsFlankSameSpot(SOLDIERTYPE *pSoldier, INT32 sSpot) } // Run through each friendly. - for (UINT16 iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; iCounter++) + for ( SoldierID iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; ++iCounter ) { - pFriend = MercPtrs[iCounter]; + pFriend = iCounter; if (pFriend && pFriend != pSoldier && @@ -4109,9 +4101,9 @@ UINT8 CountFriendsBlack( SOLDIERTYPE *pSoldier, INT32 sClosestOpponent ) } // Run through each friendly. - for ( UINT16 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) + for ( SoldierID iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; ++iCounter ) { - pFriend = MercPtrs[ iCounter ]; + pFriend = iCounter; // Make sure that character is alive, not too shocked, and conscious if (pFriend != pSoldier && @@ -4148,9 +4140,9 @@ UINT16 CountTeamUnderAttack(INT8 bTeam, INT32 sGridNo, INT16 sDistance) return 0; // Run through each friendly. - for (UINT16 iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; iCounter++) + for ( SoldierID iCounter = gTacticalStatus.Team[bTeam].bFirstID; iCounter <= gTacticalStatus.Team[bTeam].bLastID; ++iCounter ) { - pFriend = MercPtrs[iCounter]; + pFriend = iCounter; if (pFriend && pFriend->bActive && @@ -4400,9 +4392,9 @@ UINT16 CountTeamSeeSoldier( INT8 bTeam, SOLDIERTYPE *pSoldier ) if ( bTeam >= MAXTEAMS ) return 0; - for ( UINT16 cnt = gTacticalStatus.Team[bTeam].bFirstID; cnt <= gTacticalStatus.Team[bTeam].bLastID; ++cnt ) + for ( SoldierID cnt = gTacticalStatus.Team[bTeam].bFirstID; cnt <= gTacticalStatus.Team[bTeam].bLastID; ++cnt ) { - pFriend = MercPtrs[cnt]; + pFriend = cnt; if ( pFriend->bActive && pFriend->bInSector && @@ -4844,7 +4836,6 @@ UINT16 CountSeenEnemiesLastTurn( SOLDIERTYPE* pSoldier ) CHECKF(pSoldier); UINT8 ubTeamLoop; - UINT16 ubIDLoop; UINT16 cnt = 0; for( ubTeamLoop = 0; ubTeamLoop < MAXTEAMS; ubTeamLoop++ ) @@ -4855,7 +4846,7 @@ UINT16 CountSeenEnemiesLastTurn( SOLDIERTYPE* pSoldier ) if( gTacticalStatus.Team[ ubTeamLoop ].bSide != pSoldier->bSide ) { // consider guys in this team, which isn't on our side - for( ubIDLoop = gTacticalStatus.Team[ ubTeamLoop ].bFirstID; ubIDLoop <= gTacticalStatus.Team[ ubTeamLoop ].bLastID; ubIDLoop++ ) + for( SoldierID ubIDLoop = gTacticalStatus.Team[ ubTeamLoop ].bFirstID; ubIDLoop <= gTacticalStatus.Team[ ubTeamLoop ].bLastID; ++ubIDLoop ) { // if this guy SAW an enemy recently... if( pSoldier->aiData.bOppList[ ubIDLoop ] >= SEEN_CURRENTLY && diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 481c1f0a..74bc3548 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -3903,9 +3903,9 @@ void CheckTossFriendSmoke(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestThrow) UINT8 ubDirection; // Run through each friendly. - for (UINT16 iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; iCounter++) + for ( SoldierID iCounter = gTacticalStatus.Team[pSoldier->bTeam].bFirstID; iCounter <= gTacticalStatus.Team[pSoldier->bTeam].bLastID; ++iCounter) { - pFriend = MercPtrs[iCounter]; + pFriend = iCounter; // check that friend is alive and needs cover if (pFriend && diff --git a/TacticalAI/CreatureDecideAction.cpp b/TacticalAI/CreatureDecideAction.cpp index 9e01ff8e..ec03cc31 100644 --- a/TacticalAI/CreatureDecideAction.cpp +++ b/TacticalAI/CreatureDecideAction.cpp @@ -66,11 +66,11 @@ INT8 gbHuntCallPriority[NUM_CREATURE_CALLS] = void CreatureCall( SOLDIERTYPE * pCaller ) { UINT8 ubCallerType=0; - UINT16 ubReceiver; - INT8 bFullPriority; - INT8 bPriority; - SOLDIERTYPE * pReceiver; - UINT16 usDistToCaller; + SoldierID ubReceiver; + INT8 bFullPriority; + INT8 bPriority; + SOLDIERTYPE *pReceiver; + UINT16 usDistToCaller; // communicate call to all creatures on map through ultrasonics gTacticalStatus.Team[pCaller->bTeam].bAwareOfOpposition = TRUE; @@ -121,9 +121,9 @@ void CreatureCall( SOLDIERTYPE * pCaller ) } - for (ubReceiver = gTacticalStatus.Team[ pCaller->bTeam ].bFirstID; ubReceiver <= gTacticalStatus.Team[ pCaller->bTeam ].bLastID; ubReceiver++) + for (ubReceiver = gTacticalStatus.Team[ pCaller->bTeam ].bFirstID; ubReceiver <= gTacticalStatus.Team[ pCaller->bTeam ].bLastID; ++ubReceiver ) { - pReceiver = MercPtrs[ubReceiver]; + pReceiver = ubReceiver; if (pReceiver->bActive && pReceiver->bInSector && (pReceiver->stats.bLife >= OKLIFE) && (pReceiver != pCaller) && (pReceiver->aiData.bAlertStatus < STATUS_BLACK)) { if (pReceiver->ubBodyType != LARVAE_MONSTER && pReceiver->ubBodyType != INFANT_MONSTER && pReceiver->ubBodyType != QUEENMONSTER) diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index 578bfa29..ddddd888 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -754,9 +754,9 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier) { // WANNE: This should fix the bug if any merc are still under PC control. This could happen after boxing in SAN MONA. SOLDIERTYPE *pTeamSoldier; - for (UINT16 bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; bLoop++) + for ( SoldierID bLoop=gTacticalStatus.Team[gbPlayerNum].bFirstID; bLoop <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++bLoop ) { - pTeamSoldier=MercPtrs[bLoop]; + pTeamSoldier = bLoop; if (pTeamSoldier->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL) pTeamSoldier->flags.uiStatusFlags &= (~SOLDIER_PCUNDERAICONTROL); diff --git a/TacticalAI/Knowledge.cpp b/TacticalAI/Knowledge.cpp index 74fafb00..06739f4b 100644 --- a/TacticalAI/Knowledge.cpp +++ b/TacticalAI/Knowledge.cpp @@ -21,7 +21,6 @@ void CallAvailableEnemiesTo( INT32 sGridNo ) void CallAvailableTeamEnemiesTo( INT32 sGridNo, INT8 bTeam ) { - INT32 iLoop2; SOLDIERTYPE * pSoldier; // All enemy teams become aware of a very important "noise" coming from here! @@ -36,9 +35,10 @@ void CallAvailableTeamEnemiesTo( INT32 sGridNo, INT8 bTeam ) gubPublicNoiseVolume[bTeam] = MAX_MISC_NOISE_DURATION; // new situation for everyone; - iLoop2 = gTacticalStatus.Team[ bTeam ].bFirstID; - for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ bTeam ].bLastID; iLoop2++, pSoldier++ ) + SoldierID iLoop2 = gTacticalStatus.Team[ bTeam ].bFirstID; + for ( ; iLoop2 <= gTacticalStatus.Team[ bTeam ].bLastID; ++iLoop2 ) { + pSoldier = iLoop2; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE) { SetNewSituation( pSoldier ); @@ -54,7 +54,6 @@ void CallAvailableKingpinMenTo( INT32 sGridNo ) // like call all enemies, but only affects civgroup KINGPIN guys with // NO PROFILE - INT32 iLoop2; SOLDIERTYPE * pSoldier; // All enemy teams become aware of a very important "noise" coming from here! @@ -67,9 +66,10 @@ void CallAvailableKingpinMenTo( INT32 sGridNo ) // new situation for everyone... - iLoop2 = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[iLoop2]; iLoop2 <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; iLoop2++, pSoldier++ ) + SoldierID iLoop2 = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + for ( ; iLoop2 <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++iLoop2 ) { + pSoldier = iLoop2; if (pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->ubCivilianGroup == KINGPIN_CIV_GROUP && pSoldier->ubProfile == NO_PROFILE) { SetNewSituation( pSoldier ); diff --git a/TacticalAI/Medical.cpp b/TacticalAI/Medical.cpp index 35c2a334..56a5b202 100644 --- a/TacticalAI/Medical.cpp +++ b/TacticalAI/Medical.cpp @@ -72,7 +72,6 @@ BOOLEAN FindAutobandageClimbPoint( INT32 sDesiredGridNo, BOOLEAN fClimbUp ) BOOLEAN FullPatientCheck( SOLDIERTYPE * pPatient ) { - UINT16 cnt; SOLDIERTYPE * pSoldier; if ( CanCharacterAutoBandageTeammate( pPatient ) ) @@ -90,9 +89,10 @@ BOOLEAN FullPatientCheck( SOLDIERTYPE * pPatient ) else { // run though the list of chars on team - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // can this character help out? if ( CanCharacterAutoBandageTeammate( pSoldier ) == TRUE ) { @@ -119,17 +119,16 @@ BOOLEAN FullPatientCheck( SOLDIERTYPE * pPatient ) BOOLEAN CanAutoBandage( BOOLEAN fDoFullCheck ) { // returns false if we should stop being in auto-bandage mode - UINT16 cnt; UINT16 ubMedics = 0, ubPatients = 0; SOLDIERTYPE * pSoldier; static SoldierID ubIDForFullCheck = NOBODY; // run though the list of chars on team - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt) { // can this character help out? - if( CanCharacterAutoBandageTeammate( pSoldier ) == TRUE ) + if( CanCharacterAutoBandageTeammate( cnt ) == TRUE ) { // yep, up the number of medics in sector ubMedics++; @@ -143,8 +142,9 @@ BOOLEAN CanAutoBandage( BOOLEAN fDoFullCheck ) } cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pSoldier++) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pSoldier = cnt; // can this character be helped out by a teammate? if ( CanCharacterBeAutoBandagedByTeammate( pSoldier ) == TRUE ) { @@ -227,7 +227,6 @@ BOOLEAN CanCharacterBeAutoBandagedByTeammate( SOLDIERTYPE *pSoldier ) INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) { - UINT16 cnt; UINT8 cnt2; INT32 bBestPriority = 0, sBestAdjGridNo = NOWHERE; INT32 sPatientGridNo = NOWHERE, sBestPatientGridNo = NOWHERE; @@ -244,9 +243,10 @@ INT8 FindBestPatient( SOLDIERTYPE * pSoldier, BOOLEAN * pfDoClimb ) gubGlobalPathFlags = PATH_THROUGH_PEOPLE; // search for someone who needs aid - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pPatient = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pPatient++) + SoldierID cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt ) { + pPatient = cnt; if ( !(pPatient->bActive) || !(pPatient->bInSector) ) { continue; // NEXT!!! @@ -475,13 +475,13 @@ INT8 DecideAutoBandage( SOLDIERTYPE * pSoldier ) BOOLEAN DoctorIsPresent( SOLDIERTYPE * pPatient, BOOLEAN fOnDoctorAssignmentCheck ) { SOLDIERTYPE * pMedic = NULL; - UINT16 cnt; INT8 bSlot; BOOLEAN fDoctorHasBeenFound = FALSE; - cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - for ( pMedic = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; cnt++,pMedic++) + SoldierID cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++cnt ) { + pMedic = cnt; if ( !(pMedic->bActive) || !(pMedic->bInSector) || ( pMedic->flags.uiStatusFlags & SOLDIER_VEHICLE ) || (pMedic->bAssignment == VEHICLE ) ) { // is nowhere around! diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 727d0e83..fe48412c 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -2913,7 +2913,6 @@ void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier, *pSoldier; - INT32 cnt; // First get pointer to NPC pSoldier = FindSoldierByProfileID( ubNPC, FALSE ); @@ -2921,11 +2920,12 @@ void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) // Loop through all our guys and randomly say one from someone in our sector // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { @@ -3649,7 +3649,6 @@ void TriggerFriendWithHostileQuote( UINT8 ubNPC ) UINT16 ubNumMercsAvailable = 0, ubChosenMerc; SOLDIERTYPE * pTeamSoldier; SOLDIERTYPE * pSoldier; - INT32 cnt; INT8 bTeam; // First get pointer to NPC @@ -3663,11 +3662,12 @@ void TriggerFriendWithHostileQuote( UINT8 ubNPC ) // Loop through all our guys and find one to yell // set up soldier ptr as first element in mercptrs list - cnt = gTacticalStatus.Team[ bTeam ].bFirstID; + SoldierID cnt = gTacticalStatus.Team[ bTeam ].bFirstID; // run through list - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; cnt++,pTeamSoldier++ ) + for ( ; cnt <= gTacticalStatus.Team[ bTeam ].bLastID; ++cnt ) { + pTeamSoldier = cnt; // Add guy if he's a candidate... if ( pTeamSoldier->bActive && pSoldier->bInSector && pTeamSoldier->stats.bLife >= OKLIFE && pTeamSoldier->bBreath >= OKBREATH && pTeamSoldier->aiData.bOppCnt > 0 && pTeamSoldier->ubProfile != NO_PROFILE ) { diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index e8f6cc3e..d64a7526 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -3283,13 +3283,12 @@ void BillyBlocksDoorCallback( void ) BOOLEAN HookerInRoom( UINT16 usRoom ) { //DBrot: More Rooms - UINT16 ubLoop;//, ubTempRoom; UINT16 usTempRoom; SOLDIERTYPE * pSoldier; - for ( ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ubLoop++ ) + for ( SoldierID ubLoop = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; ubLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++ubLoop ) { - pSoldier = MercPtrs[ ubLoop ]; + pSoldier = ubLoop; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife >= OKLIFE && pSoldier->aiData.bNeutral && pSoldier->ubBodyType == MINICIV ) { @@ -4292,7 +4291,7 @@ void HandleExplosionQueue( void ) if (gfExplosionQueueMayHaveChangedSight) { - UINT16 ubLoop; + SoldierID ubLoop; SOLDIERTYPE * pTeamSoldier; // set variable so we may at least have someone to resolve interrupts vs @@ -4301,8 +4300,9 @@ void HandleExplosionQueue( void ) // call fov code ubLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; - for ( pTeamSoldier = MercPtrs[ ubLoop ]; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ubLoop++, pTeamSoldier++ ) + for ( ; ubLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++ubLoop ) { + pTeamSoldier = ubLoop; if ( pTeamSoldier->bActive && pTeamSoldier->bInSector ) { RevealRoofsAndItems( pTeamSoldier, TRUE, FALSE, pTeamSoldier->pathing.bLevel, FALSE ); @@ -4442,17 +4442,17 @@ void HandleExplosionWarningAnimations( ) // soldiers if (!fShow) { - for (UINT32 ubID = gTacticalStatus.Team[OUR_TEAM].bFirstID; ubID <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++ubID) + for ( SoldierID ubID = gTacticalStatus.Team[OUR_TEAM].bFirstID; ubID <= gTacticalStatus.Team[CIV_TEAM].bLastID; ++ubID) { if (ubID != pSoldier->ubID && - MercPtrs[ubID] && - MercPtrs[ubID]->sGridNo == sSpot && - MercPtrs[ubID]->bVisible == TRUE && - MercPtrs[ubID]->pathing.bLevel == bLevel && - gAnimControl[MercPtrs[ubID]->usAnimState].ubEndHeight == ANIM_PRONE && - !Water(MercPtrs[ubID]->sGridNo, MercPtrs[ubID]->pathing.bLevel) && + ubID != NOBODY && + ubID->sGridNo == sSpot && + ubID->bVisible == TRUE && + ubID->pathing.bLevel == bLevel && + gAnimControl[ubID->usAnimState].ubEndHeight == ANIM_PRONE && + !Water(ubID->sGridNo, ubID->pathing.bLevel) && pSoldier->ubBodyType <= REGFEMALE && - (MercPtrs[ubID]->bTeam == pSoldier->bTeam || MercPtrs[ubID]->IsUnconscious() || MercPtrs[ubID]->stats.bLife < OKLIFE)) + (ubID->bTeam == pSoldier->bTeam || ubID->IsUnconscious() || ubID->stats.bLife < OKLIFE)) { fShow = TRUE; } @@ -5308,7 +5308,6 @@ void UpdateSAMDoneRepair( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) void HandleBuldingDestruction( INT32 sGridNo, SoldierID ubOwner ) { SOLDIERTYPE * pSoldier; - UINT16 cnt; if ( ubOwner == NOBODY ) { @@ -5324,9 +5323,10 @@ void HandleBuldingDestruction( INT32 sGridNo, SoldierID ubOwner ) if ( sGridNo == NOWHERE || !InARoom( sGridNo, NULL ) ) return; - cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; - for ( pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; cnt++ ,pSoldier++ ) + SoldierID cnt = gTacticalStatus.Team[ CIV_TEAM ].bFirstID; + for ( ; cnt <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++cnt ) { + pSoldier = cnt; if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife && pSoldier->aiData.bNeutral ) { if ( pSoldier->ubProfile != NO_PROFILE ) diff --git a/TileEngine/Isometric Utils.cpp b/TileEngine/Isometric Utils.cpp index 51d8a986..82bf2859 100644 --- a/TileEngine/Isometric Utils.cpp +++ b/TileEngine/Isometric Utils.cpp @@ -1336,10 +1336,11 @@ INT32 RandomGridNo() BOOLEAN GridNoNearPlayerMercs( INT32 sGridNo, INT16 sRadius ) { SOLDIERTYPE* pTeamSoldier = NULL; - INT32 cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; - INT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; - for ( pTeamSoldier = MercPtrs[ cnt ]; cnt < lastid; ++cnt, ++pTeamSoldier) + SoldierID cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; + SoldierID lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID; + for ( ; cnt < lastid; ++cnt ) { + pTeamSoldier = cnt; if ( pTeamSoldier && pTeamSoldier->bActive && pTeamSoldier->bInSector ) { if ( PythSpacesAway(sGridNo, pTeamSoldier->sGridNo) < sRadius ) diff --git a/TileEngine/Tactical Placement GUI.cpp b/TileEngine/Tactical Placement GUI.cpp index 3c4fe0bd..0735de88 100644 --- a/TileEngine/Tactical Placement GUI.cpp +++ b/TileEngine/Tactical Placement GUI.cpp @@ -227,7 +227,7 @@ void InitTacticalPlacementGUI() { islocked=0;//hayden VOBJECT_DESC VObjectDesc; - INT32 i, xp, yp; + INT32 xp, yp; UINT8 ubFaceIndex; gfTacticalPlacementGUIActive = TRUE; gfTacticalPlacementGUIDirty = TRUE; @@ -325,9 +325,9 @@ void InitTacticalPlacementGUI() //First pass: Count the number of mercs that are going to be placed by the player. // This determines the size of the array we will allocate. giPlacements = 0; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && !pSoldier->flags.fBetweenSectors && CurrentBattleSectorIs( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && !( pSoldier->flags.uiStatusFlags & ( SOLDIER_VEHICLE ) ) && // ATE Ignore vehicles @@ -345,9 +345,9 @@ void InitTacticalPlacementGUI() Assert( gMercPlacement ); //Second pass: Assign the mercs to their respective slots. giPlacements = 0; - for( i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) + for( SoldierID i = gTacticalStatus.Team[ OUR_TEAM ].bFirstID; i <= gTacticalStatus.Team[ OUR_TEAM ].bLastID; ++i ) { - SOLDIERTYPE *pSoldier = MercPtrs[i]; + SOLDIERTYPE *pSoldier = i; if( pSoldier->bActive && pSoldier->stats.bLife && !pSoldier->flags.fBetweenSectors && CurrentBattleSectorIs( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ) && pSoldier->bAssignment != ASSIGNMENT_POW && @@ -426,7 +426,7 @@ void InitTacticalPlacementGUI() } //add all the faces now - for( i = 0; i < giPlacements; ++i ) + for( INT32 i = 0; i < giPlacements; ++i ) { VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; @@ -483,7 +483,7 @@ void InitTacticalPlacementGUI() { ButtonList[ iTPButtons[ GROUP_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON; - for( i = 0; i < giPlacements; ++i ) + for( INT32 i = 0; i < giPlacements; ++i ) { //go from the currently selected soldier to the end if( !gMercPlacement[ i ].fPlaced ) { //Found an unplaced merc. Select him. From 1013531a7f5eac0fafc86b6f1c55846b472508a3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 1 Dec 2024 21:17:23 +0200 Subject: [PATCH 199/571] Remove #pragma optimize("", off) calls --- Tactical/Civ Quotes.cpp | 2 -- Tactical/Soldier Control.cpp | 4 ++-- Tactical/Soldier Create.cpp | 3 +-- Tactical/Turn Based Input.cpp | 5 +++-- Tactical/Weapons.cpp | 3 +-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 01dfd72a..589c8643 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -1093,7 +1093,6 @@ BOOLEAN LoadCivQuotesFromLoadGameFile( HWFILE hFile ) return( TRUE ); } //-------------------------------------------------------------- -#pragma optimize("", off) // anv: start enemy taunt with probabilty depending on taunt settings void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SoldierID uiTargetID ) { @@ -1308,7 +1307,6 @@ void PossiblyStartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SoldierID StartEnemyTaunt( pCiv, iTauntType, pTarget ); } -#pragma optimize("", on) // SANDRO - soldier taunts void StartEnemyTaunt( SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTarget ) diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 8235157c..30547a63 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -5714,7 +5714,6 @@ UINT16 PickSoldierReadyAnimation( SOLDIERTYPE *pSoldier, BOOLEAN fEndReady, BOOL // extern SOLDIERTYPE * FreeUpAttackerGivenTarget( UINT8 ubID, UINT8 ubTargetID ); // extern SOLDIERTYPE * ReduceAttackBusyGivenTarget( UINT8 ubID, UINT8 ubTargetID ); -#pragma optimize("", off) // ATE: THIS FUNCTION IS USED FOR ALL SOLDIER TAKE DAMAGE FUNCTIONS! void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 bDirection, UINT16 sRange, SoldierID ubAttackerID, UINT8 ubSpecial, UINT8 ubHitLocation, INT16 sSubsequent, INT32 sLocationGrid ) { @@ -6425,7 +6424,8 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1 // anv: taunts are called from UseHandToHand() } } -#pragma optimize("", on) + + UINT8 CalcScreamVolume( SOLDIERTYPE * pSoldier, UINT8 ubCombinedLoss ) { // NB explosions are so loud they should drown out screams diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 4d84b470..478b3f9d 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -570,7 +570,6 @@ void DecideToAssignSniperOrders( SOLDIERCREATE_STRUCT * pp ) // This causes an issue if someone enters a sector from an adjacent sector - they should be affected by their point of origin, not the current sector // For this reason, we add a little helper variable that stores such a sector. INT16 gsStrategicDiseaseOriginSector = -1; -#pragma optimize("", off) SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, SoldierID *pubID ) { SOLDIERTYPE Soldier; @@ -1267,7 +1266,7 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, Soldier return pSoldier; } } -#pragma optimize("", on) + BOOLEAN TacticalCopySoldierFromProfile( SOLDIERTYPE *pSoldier, SOLDIERCREATE_STRUCT *pCreateStruct ) { diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 4a3a2b37..bc141fb2 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -5399,7 +5399,8 @@ void SetScopeMode( INT32 usMapPos ) ManLooksForOtherTeams( gusSelectedSoldier ); } } -#pragma optimize("", off) + + void ObliterateSector() { INT32 cnt; @@ -5433,7 +5434,7 @@ void ObliterateSector() } } } -#pragma optimize("", on) + void RandomizeMercProfile() { diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 8e527f79..85f3b54c 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -6257,7 +6257,7 @@ BOOLEAN InRange( SOLDIERTYPE *pSoldier, INT32 sGridNo ) return( FALSE ); } -#pragma optimize("", off) + UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ) { @@ -6612,7 +6612,6 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi return ((INT32)fFinalChance); } -#pragma optimize("", on) UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime, UINT8 ubAimPos ) From d0dbb9afb1c0420d93a149f8a73930aec5ee8f98 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 1 Dec 2024 21:37:52 +0200 Subject: [PATCH 200/571] Remove unused function --- Tactical/Overhead.cpp | 8 -------- Tactical/Overhead.h | 1 - 2 files changed, 9 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 789a4b80..13dfe11a 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -11728,14 +11728,6 @@ UINT16 NumSoldiersofClassWithFlag2InSector( UINT8 aTeam, UINT8 aSoldierClass, UI return num; } -INT32 GetClosestSoldierWithFlag( UINT8 aTeam, UINT32 aFlag ) -{ - INT32 sBestGridNo = NOWHERE; - - - - return sBestGridNo; -} // Flugente: VIP targets // can a new VIP be created? diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index f611474b..fc89d207 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -405,7 +405,6 @@ UINT16 HighestEnemyOfficersInSector(UINT8& aType); // count all soldiers in the current sector that have a specific flag set UINT16 NumSoldiersWithFlagInSector(UINT8 aTeam, UINT32 aFlag); UINT16 NumSoldiersofClassWithFlag2InSector( UINT8 aTeam, UINT8 aSoldierClass, UINT32 aFlag ); -INT32 GetClosestSoldierWithFlag( UINT8 aTeam, UINT32 aFlag ); // Flugente: VIP targets // can a new VIP be created? From abe6877d909791e743a7b12df01246999a6fa1b6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 1 Dec 2024 21:51:56 +0200 Subject: [PATCH 201/571] Delete VS project files Remnant from the initial branch commit --- Strategic/Strategic_VS2019.vcxproj.user | 4 ---- lua/lua_VS2019.vcxproj.user | 4 ---- 2 files changed, 8 deletions(-) delete mode 100644 Strategic/Strategic_VS2019.vcxproj.user delete mode 100644 lua/lua_VS2019.vcxproj.user diff --git a/Strategic/Strategic_VS2019.vcxproj.user b/Strategic/Strategic_VS2019.vcxproj.user deleted file mode 100644 index 88a55094..00000000 --- a/Strategic/Strategic_VS2019.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/lua/lua_VS2019.vcxproj.user b/lua/lua_VS2019.vcxproj.user deleted file mode 100644 index 88a55094..00000000 --- a/lua/lua_VS2019.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From 11bb0f741fea79ad4ea4cf03877e076845fa0c97 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 2 Dec 2024 01:10:58 +0200 Subject: [PATCH 202/571] Fix music playing when crepitus is present (#341) UseCreatureMusic( HostileZombiesPresent() ); was overriding the music mode set in PrepareCreaturesForBattle() when encountering crepitus or being in the creature caves, resulting in regular tense and battle music being played. --- Strategic/Meanwhile.cpp | 2 +- Strategic/PreBattle Interface.cpp | 4 +- Strategic/Strategic Movement.cpp | 2 +- Tactical/Merc Entering.cpp | 2 +- Tactical/Overhead.cpp | 85 +++++++++++++++---------------- Tactical/Rotting Corpses.cpp | 23 +++++++++ Tactical/Rotting Corpses.h | 4 +- 7 files changed, 73 insertions(+), 49 deletions(-) diff --git a/Strategic/Meanwhile.cpp b/Strategic/Meanwhile.cpp index ad9cdb8a..52c578fd 100644 --- a/Strategic/Meanwhile.cpp +++ b/Strategic/Meanwhile.cpp @@ -864,7 +864,7 @@ void EndMeanwhile( ) { // We leave this sector open for our POWs to escape! // Set music mode to enemy present! - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index a26c7ab8..0f04d615 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -1071,8 +1071,8 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) //Disable the options button when the auto resolve screen comes up EnableDisAbleMapScreenOptionsButton( FALSE ); - UseCreatureMusic(HostileZombiesPresent()); - + CheckForZombieMusic(); + #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ]; if ( MusicSoundValues[ SECTOR( gubPBSectorX, gubPBSectorY ) ].SoundTacticalTensor[gubPBSectorZ] != -1 ) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index e1c24384..b1e0b6be 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -1085,7 +1085,7 @@ void PrepareForPreBattleInterface( GROUP *pPlayerDialogGroup, GROUP *pInitiating } //Set music - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index 39dc0e7d..eacb0f7c 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -991,7 +991,7 @@ void HandleFirstHeliDropOfGame( ) SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); // Start music - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 9ea83354..ddc86eaa 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6664,7 +6664,7 @@ void ExitCombatMode( ) // unused //gfForceMusicToTense = TRUE; - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; @@ -6706,63 +6706,62 @@ void ExitCombatMode( ) } -void SetEnemyPresence( ) +void SetEnemyPresence() { - // We have an ememy present.... - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence")); + // We have an ememy present.... + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence" ) ); - // Check if we previously had no enemys present and we are in a virgin secotr ( no enemys spotted yet ) - if ( !gTacticalStatus.fEnemyInSector && gTacticalStatus.fVirginSector ) - { - // If we have a guy selected, say quote! - // For now, display ono status message - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ ENEMY_IN_SECTOR_STR ] ); + // Check if we previously had no enemys present and we are in a virgin secotr ( no enemys spotted yet ) + if ( !gTacticalStatus.fEnemyInSector && gTacticalStatus.fVirginSector ) + { + // If we have a guy selected, say quote! + // For now, display ono status message + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, TacticalStr[ENEMY_IN_SECTOR_STR] ); - // Change music modes.. + // Change music modes.. - // If we are just starting game, don't do this! + // If we are just starting game, don't do this! #ifdef JA2UB - //Ja25: no meanwhiles - if ( !DidGameJustStart() ) + //Ja25: no meanwhiles + if ( !DidGameJustStart() ) #else - if ( !DidGameJustStart() && !AreInMeanwhile( ) ) - + if ( !DidGameJustStart() && !AreInMeanwhile() ) #endif - { + { - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC - GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; - if ( MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] != -1 ) - SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ] ); - else + GlobalSoundID = MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ]; + if ( MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ] != -1 ) + SetMusicModeID( MUSIC_TACTICAL_ENEMYPRESENT, MusicSoundValues[SECTOR( gWorldSectorX, gWorldSectorY )].SoundTacticalTensor[gbWorldSectorZ] ); + else #endif - SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); + SetMusicMode( MUSIC_TACTICAL_ENEMYPRESENT ); - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = false")); - sniperwarning = FALSE; - biggunwarning = FALSE; - gogglewarning = FALSE; - checkBonusMilitia = TRUE; - // airstrikeavailable = TRUE; - } - else - { - DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("SetEnemyPresence: warnings = true")); - sniperwarning = TRUE; - biggunwarning = TRUE; - //gogglewarning = TRUE; - // airstrikeavailable = FALSE; - } + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence: warnings = false" ) ); + sniperwarning = FALSE; + biggunwarning = FALSE; + gogglewarning = FALSE; + checkBonusMilitia = TRUE; + // airstrikeavailable = TRUE; + } + else + { + DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String( "SetEnemyPresence: warnings = true" ) ); + sniperwarning = TRUE; + biggunwarning = TRUE; + //gogglewarning = TRUE; + // airstrikeavailable = FALSE; + } - // Say quote... - //SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); + // Say quote... + //SayQuoteFromAnyBodyInSector( QUOTE_ENEMY_PRESENCE ); - gTacticalStatus.fEnemyInSector = TRUE; + gTacticalStatus.fEnemyInSector = TRUE; - } + } } @@ -7078,7 +7077,7 @@ BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen ) // Begin tense music.... // unused //gfForceMusicToTense = TRUE; - UseCreatureMusic(HostileZombiesPresent()); + CheckForZombieMusic(); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gWorldSectorX, gWorldSectorY ) ].SoundTacticalTensor[gbWorldSectorZ]; diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 5083ecc9..64707e3f 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -3259,3 +3259,26 @@ FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse ) return (FLOAT)(min(gGameExternalOptions.usCorpseDelayUntilRotting, GetWorldTotalMin() - pCorpse->def.uiTimeOfDeath)) / gGameExternalOptions.usCorpseDelayUntilRotting; } + +void CheckForZombieMusic() +{ + extern UINT8 LightGetColors( SGPPaletteEntry * pPal ); + + if ( gGameSettings.fOptions[TOPTION_ZOMBIES] ) + { + SGPPaletteEntry LColors[3]; + LightGetColors( LColors ); + + // If we're underground in the creature caves, use creepy music based on the cave light colors. + // Without this, the crepitus cave music is not working correctly as these checks override the original musicmode choice + // See PrepareCreaturesForBattle() in Creature Spreading.cpp + if ( gbWorldSectorZ ) + { + UseCreatureMusic( LColors->peBlue || HostileZombiesPresent() ); + } + else + { + UseCreatureMusic( HostileZombiesPresent() ); + } + } +} diff --git a/Tactical/Rotting Corpses.h b/Tactical/Rotting Corpses.h index 79c53918..af65bcbc 100644 --- a/Tactical/Rotting Corpses.h +++ b/Tactical/Rotting Corpses.h @@ -242,4 +242,6 @@ BOOLEAN CorpseOkToDress( ROTTING_CORPSE* pCorpse ); // Flugente: how rotten is this corpse? values from 0 to 1, 1 as soon as it is rotting FLOAT GetCorpseRotFactor( ROTTING_CORPSE* pCorpse ); -#endif \ No newline at end of file +void CheckForZombieMusic(); + +#endif From ffccdfa6544927af573a04e67bedc65ad2393a0e Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 4 Dec 2024 00:18:22 +0200 Subject: [PATCH 203/571] Fix Tactical Placement GUI for increased teamsizes Requires new file OverheadInterface_scrollarea.sti in Gamedir/Data/Interface/ --- TileEngine/Tactical Placement GUI.cpp | 442 ++++++++++++++++++++++++-- 1 file changed, 415 insertions(+), 27 deletions(-) diff --git a/TileEngine/Tactical Placement GUI.cpp b/TileEngine/Tactical Placement GUI.cpp index 0735de88..3cacddd5 100644 --- a/TileEngine/Tactical Placement GUI.cpp +++ b/TileEngine/Tactical Placement GUI.cpp @@ -40,14 +40,20 @@ typedef struct MERCPLACEMENT { SOLDIERTYPE *pSoldier; - UINT32 uiVObjectID; - MOUSE_REGION region; - UINT8 ubStrategicInsertionCode; - BOOLEAN fPlaced; + UINT32 uiVObjectID; + MOUSE_REGION region; + UINT8 ubStrategicInsertionCode; + BOOLEAN fPlaced; }MERCPLACEMENT; MERCPLACEMENT *gMercPlacement = NULL; +UINT8 gfirstMercIndex = 0; // Index into gMercPlacement for the first visible merc face that is rendered +UINT16 gFacePanelXStart; // Defines the area for mouse wheel scrolling +UINT16 gFacePanelXEnd; +UINT16 gFacePanelYStart; +UINT16 gFacePanelYEnd; + enum { DONE_BUTTON, @@ -219,7 +225,314 @@ void CheckForValidMapEdge( UINT8 *pubStrategicInsertionCode ) } } -//#endif + +static UINT8 MaxRenderedFaces() +{ + // Based on OverheadInterface.sti files + if ( iResolution >= _640x480 && iResolution < _800x600 ) + { + return 20; + } + else if ( iResolution < _1024x768 ) + { + return 26; + } + else + { + return 34; + } +} + +static void InitializeMercScrollArea() +{ + // Based on OverheadInterface.sti files + gFacePanelXStart = 88 + xResOffset; + gFacePanelXEnd = SCREEN_WIDTH - xResOffset; + gFacePanelYStart = SCREEN_HEIGHT - 120; + gFacePanelYEnd = SCREEN_HEIGHT; +} + + +UINT32 gTacticalPlacementGUIPrevNextButtons[2]; +UINT32 gTacticalPlacementGUIPrevNextButtonImages[2]; +UINT32 gTacticalPlacementGUISliderBar; +MOUSE_REGION gTacticalPlacementGUISliderBarRegion; +UINT16 gScrollAreaXStart; +UINT16 gScrollAreaXEnd; +UINT16 gScrollAreaYStart; +UINT16 gScrollAreaYEnd; +UINT32 gScrollAreaGfx; + +static void IncreaseMercIndex() +{ + if ( gfirstMercIndex < (giPlacements - MaxRenderedFaces()) ) + { + if ( gfirstMercIndex + MaxRenderedFaces() >= giPlacements - 1 ) + { + gfirstMercIndex += 1; + } + else + { + gfirstMercIndex += 2; + } + gfTacticalPlacementGUIDirty = TRUE; + } +} + +static void DecreaseMercIndex() +{ + if ( gfirstMercIndex > 0 ) + { + if ( gfirstMercIndex == 1 ) + { + gfirstMercIndex -= 1; + } + else + { + gfirstMercIndex -= 2; + } + gfTacticalPlacementGUIDirty = TRUE; + } +} + +static void BtnTacticalPlacementNextCallback( GUI_BUTTON *btn, INT32 reason ) +{ + + if ( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + gfTacticalPlacementGUIDirty = TRUE; + btn->uiFlags |= (BUTTON_CLICKED_ON); + } + else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if ( btn->uiFlags & BUTTON_CLICKED_ON ) + { + btn->uiFlags &= ~(BUTTON_CLICKED_ON); + + IncreaseMercIndex(); + } + } +} + +static void BtnTacticalPlacementPrevCallback( GUI_BUTTON *btn, INT32 reason ) +{ + + if ( reason & MSYS_CALLBACK_REASON_LBUTTON_DWN ) + { + gfTacticalPlacementGUIDirty = TRUE; + btn->uiFlags |= (BUTTON_CLICKED_ON); + } + else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP ) + { + if ( btn->uiFlags & BUTTON_CLICKED_ON ) + { + btn->uiFlags &= ~(BUTTON_CLICKED_ON); + + DecreaseMercIndex(); + } + } +} + + +static void InitializeMercScrollButtons() +{ + UINT16 xPrev, xNext, y; + // Button locations based on OverheadInterface.sti files + xNext = SCREEN_WIDTH - 17 - xResOffset; + xPrev = 89 + xResOffset; + y = SCREEN_HEIGHT - 19; + + // time compression buttons + gTacticalPlacementGUIPrevNextButtonImages[0] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti", 10, 1, -1, 3, -1 ); + gTacticalPlacementGUIPrevNextButtonImages[1] = LoadButtonImage( "INTERFACE\\map_screen_bottom_arrows.sti", 9, 0, -1, 2, -1 ); + + + gTacticalPlacementGUIPrevNextButtons[0] = QuickCreateButton( gTacticalPlacementGUIPrevNextButtonImages[0], xNext, y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTacticalPlacementNextCallback ); + + gTacticalPlacementGUIPrevNextButtons[1] = QuickCreateButton( gTacticalPlacementGUIPrevNextButtonImages[1], xPrev, y, + BUTTON_TOGGLE, MSYS_PRIORITY_HIGHEST - 2, + (GUI_CALLBACK)BtnGenericMouseMoveButtonCallback, (GUI_CALLBACK)BtnTacticalPlacementPrevCallback ); + + + SetButtonCursor( gTacticalPlacementGUIPrevNextButtons[0], MSYS_NO_CURSOR ); + SetButtonCursor( gTacticalPlacementGUIPrevNextButtons[1], MSYS_NO_CURSOR ); +} + +static void LoadSliderBar( void ) +{ + VOBJECT_DESC VObjectDesc; + + VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; + sprintf( VObjectDesc.ImageFile, "INTERFACE\\map_screen_bottom_arrows.sti" ); + if ( !AddVideoObject( &VObjectDesc, &gTacticalPlacementGUISliderBar ) ) + { + AssertMsg( 0, "Failed to load Interface\\map_screen_bottom_arrows.sti" ); + } + + + sprintf( VObjectDesc.ImageFile, "INTERFACE\\OverheadInterface_scrollarea.sti" ); + if ( !AddVideoObject( &VObjectDesc, &gScrollAreaGfx ) ) + { + AssertMsg( 0, "Failed to load Interface\\OverheadInterface_scrollarea.sti" ); + } +} + + +static void TacticalPlacementScrollBarCallBack( MOUSE_REGION *pRegion, INT32 iReason ) +{ + POINT MousePos; + UINT16 desiredMercIndex; + const UINT8 sliderWidth = 11; + const UINT16 sliderBarRange = gScrollAreaXEnd - gScrollAreaXStart - sliderWidth; + + if ( iReason & MSYS_CALLBACK_REASON_INIT ) + { + return; + } + + + if ( iReason & (MSYS_CALLBACK_REASON_LBUTTON_DWN | MSYS_CALLBACK_REASON_LBUTTON_REPEAT) ) + { + // region is supposed to be disabled if there aren't enough messages to scroll. Formulas assume this + if ( giPlacements > MaxRenderedFaces() ) + { + // where is the mouse? + GetCursorPos( &MousePos ); + ScreenToClient( ghWindow, &MousePos ); // In window coords! + + const UINT16 ubMouseXOffset = (UINT16)MousePos.x - gScrollAreaXStart; + + // if clicking in the top 5 pixels of the slider bar + if ( ubMouseXOffset < (sliderWidth / 2) ) + { + // scroll all the way to the top + desiredMercIndex = 0; + } + // if clicking in the bottom 6 pixels of the slider bar + else if ( ubMouseXOffset >= ((gScrollAreaXEnd - gScrollAreaXStart) - (sliderWidth / 2)) ) + { + // scroll all the way to the bottom + desiredMercIndex = giPlacements - MaxRenderedFaces(); + } + else + { + // somewhere in between + const UINT16 desiredSliderOffset = ubMouseXOffset - (sliderWidth / 2); + + Assert( desiredSliderOffset <= sliderBarRange ); + + // calculate what the index should be to place the slider at this offset (round fractions of .5+ up) + desiredMercIndex = ((desiredSliderOffset * (giPlacements - MaxRenderedFaces())) + (sliderBarRange / 2)) / sliderBarRange; + } + + // if it's a change + if ( desiredMercIndex != gfirstMercIndex ) + { + gfirstMercIndex = desiredMercIndex; + gfTacticalPlacementGUIDirty = TRUE; + } + } + } +} + + +static void CreateTacticalPlacementGUIScrollBarRegion( void ) +{ + // Locations based on OverheadInterface.sti files + gScrollAreaXStart = 104 + xResOffset; + gScrollAreaXEnd = SCREEN_WIDTH - 18 - xResOffset; + gScrollAreaYStart = SCREEN_HEIGHT - 19; + gScrollAreaYEnd = gScrollAreaYStart + 11; //SLIDER_HEIGHT / SLIDER_WIDTH in Map Screen Interface Bottom.cpp; + + MSYS_DefineRegion( &gTacticalPlacementGUISliderBarRegion, + gScrollAreaXStart, + gScrollAreaYStart, + gScrollAreaXEnd, + gScrollAreaYEnd, + MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, TacticalPlacementScrollBarCallBack + ); +} + + +static void DisplayTacticalPlacementSlider() +{ + // will display the scroll bar icon + HVOBJECT hHandle; + + // only show the slider if there are more messages than will fit on screen + if ( giPlacements > MaxRenderedFaces() ) + { + // Slider bar area graphics + UINT16 imageIndex; + if ( (iResolution >= _640x480 && iResolution < _800x600) ) + { + imageIndex = 0; + } + else if ( iResolution < _1024x768 ) + { + imageIndex = 1; + } + else + { + imageIndex = 2; + } + + GetVideoObject( &hHandle, gScrollAreaGfx ); + BltVideoObject( FRAME_BUFFER, hHandle, imageIndex, gScrollAreaXStart, gScrollAreaYStart, VO_BLT_SRCTRANSPARENCY, NULL ); + + + // calculate where slider should be positioned + UINT8 sliderWidth = 11; + UINT16 sliderBarRange = gScrollAreaXEnd - gScrollAreaXStart - sliderWidth; + UINT16 ubSliderOffset = (sliderBarRange * gfirstMercIndex) / (giPlacements - MaxRenderedFaces()); + + GetVideoObject( &hHandle, gTacticalPlacementGUISliderBar ); + BltVideoObject( FRAME_BUFFER, hHandle, 8, gScrollAreaXStart + ubSliderOffset, gScrollAreaYStart + 1 , VO_BLT_SRCTRANSPARENCY, NULL ); + } +} + + +static void EnableDisableTacticalPlacementScrollButtonsAndRegions( void ) +{ + // if no scrolling required, or already showing the first merc + if ( (giPlacements <= MaxRenderedFaces()) || (gfirstMercIndex == 0) ) + { + DisableButton( gTacticalPlacementGUIPrevNextButtons[1] ); + ButtonList[gTacticalPlacementGUIPrevNextButtons[1]]->uiFlags &= ~(BUTTON_CLICKED_ON); + } + else + { + EnableButton( gTacticalPlacementGUIPrevNextButtons[1] ); + ShowButton( gTacticalPlacementGUIPrevNextButtons[1] ); + } + + // if no scrolling required, or already showing the last merc + if ( giPlacements <= MaxRenderedFaces() || + ((gfirstMercIndex + MaxRenderedFaces()) >= giPlacements) ) + { + DisableButton( gTacticalPlacementGUIPrevNextButtons[0] ); + ButtonList[gTacticalPlacementGUIPrevNextButtons[0]]->uiFlags &= ~(BUTTON_CLICKED_ON); + } + else + { + EnableButton( gTacticalPlacementGUIPrevNextButtons[0] ); + ShowButton( gTacticalPlacementGUIPrevNextButtons[0] ); + } + + if ( giPlacements <= MaxRenderedFaces()) + { + MSYS_DisableRegion( &gTacticalPlacementGUISliderBarRegion ); + HideButton( gTacticalPlacementGUIPrevNextButtons[0] ); + HideButton( gTacticalPlacementGUIPrevNextButtons[1] ); + } + else + { + MSYS_EnableRegion( &gTacticalPlacementGUISliderBarRegion ); + } +} + extern BOOLEAN gfTacticalDoHeliRun; @@ -233,6 +546,7 @@ void InitTacticalPlacementGUI() gfTacticalPlacementGUIDirty = TRUE; gfValidLocationsChanged = TRUE; gfTacticalPlacementFirstTime = TRUE; + gfirstMercIndex = 0; // WANNE - MP: Center gfCenter = FALSE; @@ -247,6 +561,10 @@ void InitTacticalPlacementGUI() //Enter overhead map GoIntoOverheadMap(); + MSYS_DisableRegion( &gRadarRegion ); // So it doesn't interfere with selecting mercs + InitializeMercScrollArea(); + LoadSliderBar(); + //Load the images VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE; @@ -473,7 +791,7 @@ void InitTacticalPlacementGUI() } //yp = (i % 2) ? 412 : 361; - MSYS_DefineRegion( &gMercPlacement[ i ].region, (UINT16)xp, (UINT16)yp, (UINT16)(xp + 54), (UINT16)(yp + 62), MSYS_PRIORITY_HIGH, 0, MercMoveCallback, MercClickCallback ); + MSYS_DefineRegion( &gMercPlacement[ i ].region, (UINT16)xp, (UINT16)yp, (UINT16)(xp + 54), (UINT16)(yp + 51), MSYS_PRIORITY_HIGH, 0, MercMoveCallback, MercClickCallback ); } if(!is_client) @@ -497,6 +815,9 @@ void InitTacticalPlacementGUI() } } } + + InitializeMercScrollButtons(); + CreateTacticalPlacementGUIScrollBarRegion(); } // WANNE - MP: This method checks, if the desired entry direction (N, E, S, W) on the map is valid. If not it chooses the next valid diretion @@ -610,6 +931,15 @@ UINT8 GetValidInsertionDirectionForMP(UINT8 currentInsertionPoint) return validInsertionDirection; } + +static void DisableFaceMouseRegions() +{ + for ( size_t i = 0; i < giPlacements; i++ ) + { + MSYS_DisableRegion( &gMercPlacement[i].region ); + } +} + void RenderTacticalPlacementGUI() { INT32 i, xp, yp, width, height; @@ -620,26 +950,31 @@ void RenderTacticalPlacementGUI() CHAR16 str[ 128 ]; UINT8 *pDestBuf; UINT8 ubColor; + const UINT8 maxFaces = MaxRenderedFaces(); if( gfTacticalPlacementFirstTime ) { gfTacticalPlacementFirstTime = FALSE; DisableScrollMessages(); } + EnableDisableTacticalPlacementScrollButtonsAndRegions(); //Check to make sure that if we have a hilighted merc (not selected) and the mouse has moved out //of it's region, then we will clear the hilighted ID, and refresh the display. if( !gfTacticalPlacementGUIDirty && gbHilightedMercID != -1 ) { - xp = xResOffset + 91 + (gbHilightedMercID / 2) * 54; + // Shift the index so we render the faces at the right locations + UINT8 highlightedMercIndex = gbHilightedMercID - gfirstMercIndex; - if (gbHilightedMercID % 2) + xp = xResOffset + 91 + (highlightedMercIndex / 2) * 54; + + if ( highlightedMercIndex % 2) { - yp = SCREEN_HEIGHT - 68; + yp = SCREEN_HEIGHT - 71; } else { - yp = SCREEN_HEIGHT - 119; + yp = SCREEN_HEIGHT - 122; } //yp = (gbHilightedMercID % 2) ? 412 : 361; @@ -657,33 +992,46 @@ void RenderTacticalPlacementGUI() if( gfTacticalPlacementGUIDirty ) { BltVideoObjectFromIndex( FRAME_BUFFER, giOverheadPanelImage, 0, xResOffset, SCREEN_HEIGHT - 160, VO_BLT_SRCTRANSPARENCY, 0 ); - InvalidateRegion( 0 + xResOffset, SCREEN_HEIGHT - 160, 320 + xResOffset, SCREEN_HEIGHT ); + InvalidateRegion( 0 + xResOffset, SCREEN_HEIGHT - 160, SCREEN_WIDTH, SCREEN_HEIGHT ); gfTacticalPlacementGUIDirty = FALSE; MarkButtonsDirty(); //DisableHilightsAndHelpText(); //RenderButtons(); //EnableHilightsAndHelpText(); - for( i = 0; i < giPlacements; ++i ) + + DisableFaceMouseRegions(); + UINT8 end = min(giPlacements, gfirstMercIndex + maxFaces); + for( UINT8 j = gfirstMercIndex; j < end; ++j ) { //Render the mercs - pSoldier = gMercPlacement[ i ].pSoldier; - + pSoldier = gMercPlacement[ j ].pSoldier; + + // Shift the index so we render the faces at the right locations + i = j - gfirstMercIndex; + xp = xResOffset + 95 + (i / 2) * 54; if (i % 2) { - yp = SCREEN_HEIGHT - 58; + yp = SCREEN_HEIGHT - 61; } else { - yp = SCREEN_HEIGHT - 109; + yp = SCREEN_HEIGHT - 112; } + // Shift the mouse region as well + gMercPlacement[j].region.RegionTopLeftX = xp; + gMercPlacement[j].region.RegionTopLeftY = yp; + gMercPlacement[j].region.RegionBottomRightX = xp + 54; + gMercPlacement[j].region.RegionBottomRightY = yp + 51; + MSYS_EnableRegion( &gMercPlacement[j].region ); + //yp = (i % 2) ? 422 : 371; ColorFillVideoSurfaceArea( FRAME_BUFFER, xp+36, yp+2, xp+44, yp+30, 0 ); BltVideoObjectFromIndex( FRAME_BUFFER, giMercPanelImage, 0, xp, yp, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObjectFromIndex( FRAME_BUFFER, gMercPlacement[ i ].uiVObjectID, 0, xp+2, yp+2, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObjectFromIndex( FRAME_BUFFER, gMercPlacement[ j ].uiVObjectID, 0, xp+2, yp+2, VO_BLT_SRCTRANSPARENCY, NULL ); //HEALTH BAR if( !pSoldier->stats.bLife ) @@ -725,6 +1073,8 @@ void RenderTacticalPlacementGUI() //Shade out the part of the tactical map that isn't considered placable. BlitBufferToBuffer(FRAME_BUFFER, guiSAVEBUFFER, 0, SCREEN_HEIGHT - 160, SCREEN_WIDTH, 160); + + DisplayTacticalPlacementSlider(); } if( gfValidLocationsChanged ) @@ -1054,31 +1404,35 @@ void RenderTacticalPlacementGUI() UnLockVideoSurface( FRAME_BUFFER ); } - for( i = 0; i < giPlacements; ++i ) + UINT8 end = min( giPlacements, gfirstMercIndex + maxFaces ); + for ( UINT8 j = gfirstMercIndex; j < end; ++j ) { - //Render the merc's names - pSoldier = gMercPlacement[ i ].pSoldier; + //Render the mercs + pSoldier = gMercPlacement[j].pSoldier; + + // Shift the index so we render the faces at the right locations + i = j - gfirstMercIndex; xp = xResOffset + 95 + (i / 2) * 54; if (i % 2) { - yp = SCREEN_HEIGHT - 58; + yp = SCREEN_HEIGHT - 61; } else { - yp = SCREEN_HEIGHT - 109; + yp = SCREEN_HEIGHT - 112; } //yp = (i % 2) ? 422 : 371; //NAME - if( gubDefaultButton == GROUP_BUTTON && gMercPlacement[ i ].pSoldier->ubGroupID == gubSelectedGroupID || - gubDefaultButton != GROUP_BUTTON && i == gbSelectedMercID ) + if( gubDefaultButton == GROUP_BUTTON && gMercPlacement[ j ].pSoldier->ubGroupID == gubSelectedGroupID || + gubDefaultButton != GROUP_BUTTON && j == gbSelectedMercID ) { ubColor = FONT_YELLOW; } - else if( gubDefaultButton == GROUP_BUTTON && gMercPlacement[ i ].pSoldier->ubGroupID == gubHilightedGroupID || - gubDefaultButton != GROUP_BUTTON && i == gbHilightedMercID ) + else if( gubDefaultButton == GROUP_BUTTON && gMercPlacement[ j ].pSoldier->ubGroupID == gubHilightedGroupID || + gubDefaultButton != GROUP_BUTTON && j == gbHilightedMercID ) { ubColor = FONT_WHITE; } @@ -1091,7 +1445,7 @@ void RenderTacticalPlacementGUI() SetFontShadow( 141 ); //Render the question mark over the face if the merc hasn't yet been placed. - if( gMercPlacement[ i ].fPlaced ) + if( gMercPlacement[ j ].fPlaced ) { RegisterBackgroundRect( BGND_FLAG_SINGLE, NULL, (INT16)(xp + 16), (INT16)(yp + 14), (INT16)(xp + 24), (INT16)(yp + 22) ); } @@ -1166,6 +1520,29 @@ void lockui (bool unlock) //lock onluck ui for lan //hayden } } +static void HandleMouseWheelScroll( void ) +{ + // Scroll through pages with regular mouse wheel + SGPPoint MousePos; + GetMousePos( &MousePos ); + const auto x = MousePos.iX; + const auto y = MousePos.iY; + if ( (gFacePanelXStart < x && x < gFacePanelXEnd) && (gFacePanelYStart < y && y < gFacePanelYEnd) ) + { + const auto Wheelstate = _WheelValue * (gGameSettings.fOptions[TOPTION_INVERT_WHEEL] ? -1 : 1); + if ( Wheelstate < 0 ) + { + IncreaseMercIndex(); + } + else if ( Wheelstate > 0 ) + { + DecreaseMercIndex(); + } + _WheelValue = 0; + } +} + + void TacticalPlacementHandle() { InputAtom InputEvent; @@ -1331,6 +1708,7 @@ void TacticalPlacementHandle() } ScrollOverheadMap();//dnl ch45 021009 + HandleMouseWheelScroll(); } void KillTacticalPlacementGUI() @@ -1365,6 +1743,16 @@ void KillTacticalPlacementGUI() MSYS_RemoveRegion( &gMercPlacement[ i ].region ); } + for ( size_t i = 0; i < 2; i++ ) + { + UnloadButtonImage( gTacticalPlacementGUIPrevNextButtonImages[i] ); + RemoveButton( gTacticalPlacementGUIPrevNextButtons[i] ); + } + MSYS_RemoveRegion( &gTacticalPlacementGUISliderBarRegion ); + DeleteVideoObjectFromIndex( gTacticalPlacementGUISliderBar ); + DeleteVideoObjectFromIndex( gScrollAreaGfx ); + + if( gsCurInterfacePanel < 0 || gsCurInterfacePanel >= NUM_UI_PANELS ) gsCurInterfacePanel = TEAM_PANEL; From 20a33893d997bb0eff754237e7087631f61cd6fb Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:49:53 +0200 Subject: [PATCH 204/571] Fix Teamlist for smaller resolutions Merc names were being printed past the end of teamlist area --- Strategic/mapscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index d283a09a..15eda907 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -5351,7 +5351,7 @@ UINT32 MapScreenHandle(void) else maxNumberOfMercVisibleInStrategyList = 51; } - else if (iResolution < _1024x768) + else if ( iResolution >= _800x600 && iResolution < _1024x768) { maxNumberOfMercVisibleInStrategyList = 34; } From 1eff9f6aaa67e787792f802df5c898fa7e4dca87 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:13:09 +0200 Subject: [PATCH 205/571] Fix bloodcat ambush endless loop (#343) Some bloodcats during ambushes could have ubInsertionDirection with values > 100, which then causes endless looping in pathfinding algorithms as valid direction values range from 0 to 7 --- Tactical/Soldier Add.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index 654283be..67b0e79d 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1201,7 +1201,14 @@ BOOLEAN InternalAddSoldierToSector( UINT8 ubID, BOOLEAN fCalculateDirection, BOO if( fCalculateDirection ) ubDirection = ubCalculatedDirection; else + { + // Override calculated direction if we were told to.... + if ( pSoldier->ubInsertionDirection >= 100 ) + { + pSoldier->ubInsertionDirection -= 100; + } ubDirection = pSoldier->ubInsertionDirection; + } } else { From 678ef822ca95657c14cabe478a57bb03a18fb273 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:54:01 +0200 Subject: [PATCH 206/571] Fix passive bloodcats --- TacticalAI/Movement.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index ec5daaaf..5bc4b0a9 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -516,13 +516,18 @@ INT32 InternalGoAsFarAsPossibleTowards(SOLDIERTYPE *pSoldier, INT32 sDesGrid, IN #ifdef DEBUGDECISIONS AIPopMessage("destination Grid # itself not valid, looking around it"); #endif - if ( CREATURE_OR_BLOODCAT( pSoldier ) ) - { - // we tried to get close, failed; abort! - pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; - return( NOWHERE ); - } - else + // Commented out this branch for now because bloodcats are constantly failing to find a legal destination in the previous call to legalNPCDestination + // Following the function calls deep enough ( GoAsFarAsPossibleTowards -> InternalGoAsFarAsPossibleTowards -> LegalNPCDestination -> NewOKDestination -> InternalOkayToAddStructureToWorld -> OkayToAddStructureToTile) shows that the last one fails when checking if we can add bloodcat's structure onto the tile our merc is + // This then results them freezing and staying in place even if they can see our mercs + // The reason I'm leaving the code here instead of simply removing it is because this and the check for adding structures to a tile are really old code, + // which has definitely worked fine at some point. As I'm right now unable to find the real reason for this breaking, I'm just circumventing the issue for now. -Asdow + //if ( CREATURE_OR_BLOODCAT( pSoldier ) ) + //{ + // // we tried to get close, failed; abort! + // pSoldier->pathing.usPathIndex = pSoldier->pathing.usPathDataSize = 0; + // return( NOWHERE ); + //} + //else { // else look at the 8 nearest gridnos to sDesGrid for a valid destination From febb283c3a82f11347aeea0d2889191866bc3a61 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:55:56 +0200 Subject: [PATCH 207/571] Allow bloodcats in RED state to roam farther Bloodcat lair had a few cats with CLOSE PATROL orders, resulting them to move only 15 tiles from their starting point, allowing them to be picked off from afar with scoped rifles. --- TacticalAI/AIUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index b6b5bf43..e0f53ecc 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -2787,7 +2787,7 @@ INT16 RoamingRange(SOLDIERTYPE *pSoldier, INT32 * pusFromGridNo) BOOL OppPosKnown = FALSE; if (CREATURE_OR_BLOODCAT(pSoldier)) { - if (pSoldier->aiData.bAlertStatus == STATUS_BLACK) + if (pSoldier->aiData.bAlertStatus > STATUS_YELLOW) { *pusFromGridNo = pSoldier->sGridNo; // from current position! return(MAX_ROAMING_RANGE); From dcde413b7bb0597092c64cec1581caffcc807aec Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:05:50 +0200 Subject: [PATCH 208/571] Initialize AI morale to normal instead of hopeless (#345) --- Tactical/Soldier Create.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 445fcfc6..202d1dc6 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -419,6 +419,7 @@ SOLDIERCREATE_STRUCT::~SOLDIERCREATE_STRUCT() { // Note that the constructor does this automatically. void SOLDIERCREATE_STRUCT::initialize() { memset( this, 0, SIZEOF_SOLDIERCREATE_STRUCT_POD); + this->bAIMorale = MORALE_NORMAL; Inv.clear(); } From 0b21d1d798f19e881b2c0da2d291a5ee8b3e85ff Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 12:53:28 -0300 Subject: [PATCH 209/571] add a TODO file put your TODOs here so you won't forget, or in case you do, maybe someone can pick it up in the decades to come --- TODO | 1 + 1 file changed, 1 insertion(+) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ + From b89c63058fa6957a3a933b5a5b23fb55bbf61221 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 12:54:54 -0300 Subject: [PATCH 210/571] fix broken MS2022 behavior a recent Visual Studio update introduced an error unless there is a CMakePresets.json file present, this patches it over for now and makes note to remove it once this is fixed --- CMakePresets.json | 3 +++ TODO | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..cd2f236b --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,3 @@ +{ + "version": 3 +} diff --git a/TODO b/TODO index 8b137891..75f8728d 100644 --- a/TODO +++ b/TODO @@ -1 +1 @@ - +remove CMakePresets.json file as soon as Visual Studio 2022 doesn't output a `Include is not found at path "x:\xxx\cmakepresets.json"` error when it's absent From 2424066aab015157999a29d3ac9cfedfa6206514 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 13:44:01 -0300 Subject: [PATCH 211/571] Revert "fix broken MS2022 behavior" This reverts commit b89c63058fa6957a3a933b5a5b23fb55bbf61221. --- CMakePresets.json | 3 --- TODO | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json deleted file mode 100644 index cd2f236b..00000000 --- a/CMakePresets.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": 3 -} diff --git a/TODO b/TODO index 75f8728d..8b137891 100644 --- a/TODO +++ b/TODO @@ -1 +1 @@ -remove CMakePresets.json file as soon as Visual Studio 2022 doesn't output a `Include is not found at path "x:\xxx\cmakepresets.json"` error when it's absent + From 98cdffe5fd072c40528e34cd825c2ec7db4117ad Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Mon, 9 Dec 2024 13:52:14 -0300 Subject: [PATCH 212/571] (actually) fix broken MS2022 behavior a recent Visual Studio update introduced an error unless there is a CMakePresets.json file present, completely blowing up the previous setup. after this commit, you should either delete the CMakeUserPresets.json file from your root or add it to your system - NOT repo! - excludesFile: https://stackoverflow.com/questions/7335420/global-git-ignore --- .gitignore | 2 +- cmake/CopyUserPresetTemplate.cmake | 4 ++-- cmake/presets/{CMakeUserPresets.json => CMakePresets.json} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename cmake/presets/{CMakeUserPresets.json => CMakePresets.json} (100%) diff --git a/.gitignore b/.gitignore index e91f3742..6466f05c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,6 @@ /.vs/ /build/ /out/ +/CMakePresets.json /CMakeSettings.json -/CMakeUserPresets.json /lib/ diff --git a/cmake/CopyUserPresetTemplate.cmake b/cmake/CopyUserPresetTemplate.cmake index 484f7ec8..fda0af34 100644 --- a/cmake/CopyUserPresetTemplate.cmake +++ b/cmake/CopyUserPresetTemplate.cmake @@ -5,7 +5,7 @@ function(CopyUserPresetTemplate) NOT EXISTS "${CMAKE_SOURCE_DIR}/CMakePresets.json" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/CMakeUserPresets.json" ) - file(COPY "${CMAKE_SOURCE_DIR}/cmake/presets/CMakeUserPresets.json" DESTINATION "${CMAKE_SOURCE_DIR}") - message(FATAL_ERROR "No existing preset was found, copied a preset template to ${CMAKE_SOURCE_DIR}/CMakeUserPresets.json.") + file(COPY "${CMAKE_SOURCE_DIR}/cmake/presets/CMakePresets.json" DESTINATION "${CMAKE_SOURCE_DIR}") + message(FATAL_ERROR "No existing preset was found, copied a preset template to ${CMAKE_SOURCE_DIR}/CMakePresets.json.") endif() endfunction() diff --git a/cmake/presets/CMakeUserPresets.json b/cmake/presets/CMakePresets.json similarity index 100% rename from cmake/presets/CMakeUserPresets.json rename to cmake/presets/CMakePresets.json From 87f51f0f6e41a47426136256cc7c13367d9a5e74 Mon Sep 17 00:00:00 2001 From: momoko-h Date: Tue, 10 Dec 2024 16:15:21 +0100 Subject: [PATCH 213/571] Fix warning C4715 in Music Control.cpp (#351) --- Utils/Music Control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utils/Music Control.cpp b/Utils/Music Control.cpp index aa86d29d..1030cd3d 100644 --- a/Utils/Music Control.cpp +++ b/Utils/Music Control.cpp @@ -234,7 +234,7 @@ BOOLEAN MusicPlay(NewMusicList mode, UINT8 songIndex) return FALSE; } - MusicPlay(MusicLists[mode][songIndex]); + return MusicPlay(MusicLists[mode][songIndex]); } //******************************************************************************** From 1d58bda82dc7364114f1a3bc8c9147c780c0bf8f Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 13 Dec 2024 19:07:39 -0300 Subject: [PATCH 214/571] cross-compilation scaffolding WIP requires clang/lld or mingw, obviously just make sure the MSVC_DIRECTORY env variable points to valid Visual Studio Build Tools directory and do: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=clang_or_mingw_toolchain_file` --- cmake/clang-toolchain.cmake | 39 +++++++++++++++++++++++++++++++++++++ cmake/mingw-toolchain.cmake | 11 +++++++++++ 2 files changed, 50 insertions(+) create mode 100644 cmake/clang-toolchain.cmake create mode 100644 cmake/mingw-toolchain.cmake diff --git a/cmake/clang-toolchain.cmake b/cmake/clang-toolchain.cmake new file mode 100644 index 00000000..e70a1375 --- /dev/null +++ b/cmake/clang-toolchain.cmake @@ -0,0 +1,39 @@ +set(CMAKE_SYSTEM_NAME Windows) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_RC_COMPILER llvm-rc) + +set(triple i386-pc-win32-msvc) +set(CMAKE_C_COMPILER_TARGET ${triple}) +set(CMAKE_CXX_COMPILER_TARGET ${triple}) +set(CMAKE_RC_COMPILER_TARGET ${triple}) + +set(msvc_dir "$ENV{MSVC_DIRECTORY}") +if(msvc_dir STREQUAL "") + message(FATAL_ERROR "Please set a valid MSVC_DIRECTORY environment variable") +endif() + +# Don't remember which version of Visual Studio Build Tools this is. +# When updating this, make sure to pin the version so people can get it. +set(msvc_include + "${msvc_dir}/14.34.31933/include" + "${msvc_dir}/14.34.31933/ATLMFC/include" + "${msvc_dir}/include/10.0.22000.0/ucrt" + "${msvc_dir}/include/10.0.22000.0/um" + "${msvc_dir}/include/10.0.22000.0/shared" + "${msvc_dir}/include/10.0.22000.0/winrt" + "${msvc_dir}/include/10.0.22000.0/cppwinrt" +) +set(msvc_libraries + "${msvc_dir}/14.34.31933/ATLMFC/lib/x86" + "${msvc_dir}/14.34.31933/lib/x86" + "${msvc_dir}/lib/10.0.22000.0/ucrt/x86" + "${msvc_dir}/lib/10.0.22000.0/um/x86" +) + +foreach(LANG C CXX) + set(CMAKE_${LANG}_STANDARD_INCLUDE_DIRECTORIES ${msvc_include}) +endforeach() + +link_directories(${msvc_libraries}) diff --git a/cmake/mingw-toolchain.cmake b/cmake/mingw-toolchain.cmake new file mode 100644 index 00000000..f8742cfb --- /dev/null +++ b/cmake/mingw-toolchain.cmake @@ -0,0 +1,11 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR i686) + +set(triple ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32) + +set(CMAKE_C_COMPILER ${triple}-gcc) +set(CMAKE_CXX_COMPILER ${triple}-g++) +set(CMAKE_RC_COMPILER ${triple}-windres) + +set(CMAKE_C_COMPILER_TARGET ${triple}) +set(CMAKE_CXX_COMPILER_TARGET ${triple}) From 86ad40118693ea3651b0039f869f459031086f21 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sat, 14 Dec 2024 19:01:11 -0300 Subject: [PATCH 215/571] add newline at end of file where it's lacking .editorconfig already enforces it but it's getting changed piecemeal in every commit. just get it done with. the script: ``` find . -type f -not -path "./.git/*" -not -path "./.vs/*" | while read -r file; do isFile=$(file -0 "$file" | cut -d $'\0' -f2) case "$isFile" in (*text*) echo "$file is text" if [[ $(tail -c 1 "$file" | wc -l) -ne 1 ]]; then echo "" >> "$file" fi ;; (*) echo "file isn't text" ;; esac done ``` --- Console/ComBSTROut.h | 2 +- Console/ComVariantOut.h | 2 +- Editor/Cursor Modes.h | 2 +- Editor/Editor Modes.h | 2 +- Editor/Editor Taskbar Creation.h | 2 +- Editor/Editor Taskbar Utils.h | 2 +- Editor/Road Smoothing.h | 2 +- Editor/Sector Summary.h | 2 +- Editor/Smoothing Utils.h | 2 +- Ja2/Cheats.h | 2 +- Ja2/Fade Screen.h | 2 +- Ja2/HelpScreen.h | 2 +- Ja2/Intro.h | 2 +- Ja2/JA2 Splash.h | 2 +- Ja2/Language Defines.h | 2 +- Ja2/MPChatScreen.h | 2 +- Ja2/MPConnectScreen.h | 2 +- Ja2/MPHostScreen.h | 2 +- Ja2/MPScoreScreen.h | 2 +- Ja2/MessageBoxScreen.h | 2 +- Ja2/Screens.h | 2 +- Ja2/gamescreen.h | 2 +- Ja2/jascreens.h | 2 +- Ja2/legion cfg.h | 2 +- Ja2/mainmenuscreen.h | 2 +- Ja2/screenids.h | 2 +- Ja2/ub_config.h | 2 +- Laptop/BriefingRoom.h | 2 +- Laptop/BriefingRoomM.h | 2 +- Laptop/BriefingRoom_Data.h | 2 +- Laptop/CampaignHistoryData.h | 2 +- Laptop/CampaignHistory_Summary.h | 2 +- Laptop/CampaignStats.h | 2 +- Laptop/IMP AboutUs.h | 2 +- Laptop/IMP Attribute Entrance.h | 2 +- Laptop/IMP Attribute Finish.h | 2 +- Laptop/IMP Attribute Selection.h | 2 +- Laptop/IMP Begin Screen.h | 2 +- Laptop/IMP Character and Disability Entrance.h | 2 +- Laptop/IMP Compile Character.h | 2 +- Laptop/IMP Finish.h | 2 +- Laptop/IMP HomePage.h | 2 +- Laptop/IMP MainPage.h | 2 +- Laptop/IMP Personality Entrance.h | 2 +- Laptop/IMP Personality Finish.h | 2 +- Laptop/IMP Personality Quiz.h | 2 +- Laptop/IMP Portraits.h | 2 +- Laptop/IMP Text System.h | 2 +- Laptop/IMP Voices.h | 2 +- Laptop/MilitiaWebsite.cpp | 2 +- Laptop/PMC.cpp | 2 +- Laptop/PostalService.h | 2 +- Laptop/Speck Quotes.h | 2 +- Laptop/XML_AIMAvailability.cpp | 2 +- Laptop/XML_ConditionsForMercAvailability.cpp | 2 +- Laptop/XML_DeliveryMethods.cpp | 2 +- Laptop/XML_ShippingDestinations.cpp | 2 +- Laptop/florist Cards.h | 2 +- Laptop/florist Gallery.h | 2 +- Laptop/florist Order Form.h | 2 +- Laptop/insurance Comments.h | 2 +- Laptop/insurance Contract.h | 2 +- Laptop/insurance Info.h | 2 +- Laptop/mercs Account.h | 2 +- Laptop/mercs Files.h | 2 +- Laptop/mercs No Account.h | 2 +- Multiplayer/fresh_header.h | 2 +- Multiplayer/network.h | 2 +- Multiplayer/raknet/AsynchronousFileIO.h | 2 +- Multiplayer/raknet/BitStream_NoTemplate.h | 2 +- Multiplayer/raknet/PacketPool.h | 2 +- Multiplayer/raknet/SimpleTCPServer.h | 2 +- Strategic/Assignments.h | 2 +- Strategic/Auto Resolve.h | 2 +- Strategic/Campaign Init.h | 2 +- Strategic/Campaign Types.h | 2 +- Strategic/Creature Spreading.cpp | 2 +- Strategic/Creature Spreading.h | 2 +- Strategic/Facilities.h | 2 +- Strategic/Game Init.h | 2 +- Strategic/Ja25 Strategic Ai.h | 2 +- Strategic/Luaglobal.cpp | 2 +- Strategic/Map Screen Helicopter.h | 2 +- Strategic/Map Screen Interface Border.h | 2 +- Strategic/Map Screen Interface Bottom.h | 2 +- Strategic/Map Screen Interface TownMine Info.h | 2 +- Strategic/Map Screen Interface.h | 2 +- Strategic/MilitiaIndividual.h | 2 +- Strategic/MilitiaSquads.h | 2 +- Strategic/Player Command.h | 2 +- Strategic/Quest Debug System.h | 2 +- Strategic/Reinforcement.h | 2 +- Strategic/Strategic AI.h | 2 +- Strategic/Strategic Event Handler.h | 2 +- Strategic/Strategic Mines.h | 2 +- Strategic/Strategic Pathing.cpp | 2 +- Strategic/Strategic Status.h | 2 +- Strategic/Strategic Town Loyalty.h | 2 +- Strategic/Strategic Turns.h | 2 +- Strategic/Town Militia.h | 2 +- Strategic/XML_Creatures.cpp | 2 +- Strategic/XML_SquadNames.cpp | 2 +- Strategic/mapscreen.h | 2 +- Strategic/strategic town reputation.h | 2 +- Strategic/strategic.h | 2 +- Tactical/Action Items.h | 2 +- Tactical/Air Raid.h | 2 +- Tactical/Animation Cache.h | 2 +- Tactical/Arms Dealer Init.h | 2 +- Tactical/Auto Bandage.h | 2 +- Tactical/Boxing.h | 2 +- Tactical/Bullets.h | 2 +- Tactical/Civ Quotes.h | 2 +- Tactical/Dialogue Control.h | 2 +- Tactical/End Game.h | 2 +- Tactical/Enemy Soldier Save.h | 2 +- Tactical/EnemyItemDrops.cpp | 2 +- Tactical/EnemyItemDrops.h | 2 +- Tactical/Handle Doors.h | 2 +- Tactical/Handle UI Plan.h | 2 +- Tactical/Handle UI.h | 2 +- Tactical/Interface Control.h | 2 +- Tactical/Interface Cursors.h | 2 +- Tactical/Interface Panels.h | 2 +- Tactical/Interface Utils.h | 2 +- Tactical/Interface.h | 2 +- Tactical/Inventory Choosing.h | 2 +- Tactical/Ja25_Tactical.h | 2 +- Tactical/Keys.h | 2 +- Tactical/LOS.h | 2 +- Tactical/Map Information.h | 2 +- Tactical/Militia Control.h | 2 +- Tactical/MiniGame.h | 2 +- Tactical/Morale.h | 2 +- Tactical/PathAIDebug.h | 2 +- Tactical/Rain.h | 2 +- Tactical/ShopKeeper Quotes.h | 2 +- Tactical/SkillCheck.h | 2 +- Tactical/SkillMenu.h | 2 +- Tactical/Soldier Ani.h | 2 +- Tactical/Soldier Create.h | 2 +- Tactical/Soldier Find.h | 2 +- Tactical/Soldier Functions.h | 2 +- Tactical/Soldier Init List.cpp | 2 +- Tactical/Soldier Init List.h | 2 +- Tactical/Soldier macros.h | 2 +- Tactical/Spread burst.h | 2 +- Tactical/Squads.h | 2 +- Tactical/Strategic Exit GUI.h | 2 +- Tactical/Structure Wrap.h | 2 +- Tactical/Tactical Turns.h | 2 +- Tactical/TeamTurns.h | 2 +- Tactical/UI Cursors.h | 2 +- Tactical/VehicleMenu.cpp | 2 +- Tactical/VehicleMenu.h | 2 +- Tactical/XML_HiddenNames.cpp | 2 +- Tactical/XML_LBEPocketPopup.cpp | 2 +- Tactical/XML_MercStartingGear.cpp | 2 +- Tactical/XML_RPCFacesSmall.cpp | 2 +- Tactical/XML_RandomStats.cpp | 2 +- Tactical/fov.h | 2 +- Tactical/opplist.h | 2 +- Tactical/qarray.h | 2 +- Tactical/rt time defines.h | 2 +- Tactical/soldier tile.h | 2 +- TileEngine/Ambient Control.cpp | 2 +- TileEngine/Ambient Control.h | 2 +- TileEngine/Buildings.h | 2 +- TileEngine/Fog Of War.h | 2 +- TileEngine/Interactive Tiles.h | 2 +- TileEngine/LightEffects.h | 2 +- TileEngine/Radar Screen.h | 2 +- TileEngine/Render Fun.h | 2 +- TileEngine/Shade Table Util.h | 2 +- TileEngine/Simple Render Utils.h | 2 +- TileEngine/SmokeEffects.h | 2 +- TileEngine/Structure Internals.h | 2 +- TileEngine/Tactical Placement GUI.h | 2 +- TileEngine/Tile Cache.h | 2 +- TileEngine/Tile Surface.h | 2 +- TileEngine/World Tileset Enums.h | 2 +- TileEngine/WorldDat.h | 2 +- TileEngine/physics.h | 2 +- TileEngine/pits.h | 2 +- TileEngine/renderworld.h | 2 +- TileEngine/structure.h | 2 +- TileEngine/sysutil.h | 2 +- TileEngine/worldman.h | 2 +- Utils/Animated ProgressBar.h | 2 +- Utils/Cinematics Bink.h | 2 +- Utils/Cursors.h | 2 +- Utils/Debug Control.h | 2 +- Utils/Encrypted File.cpp | 2 +- Utils/Encrypted File.h | 2 +- Utils/ExportStrings.h | 2 +- Utils/Multi Language Graphic Utils.h | 2 +- Utils/Multilingual Text Code Generator.h | 2 +- Utils/PopUpBox.h | 2 +- Utils/Quantize Wrap.h | 2 +- Utils/Quantize.h | 2 +- Utils/STIConvert.h | 2 +- Utils/Sound Control.h | 2 +- Utils/Text Input.h | 2 +- Utils/Timer Control.h | 2 +- Utils/XML_Language.h | 2 +- Utils/XML_SenderNameList.cpp | 2 +- Utils/maputility.h | 2 +- Utils/message.h | 2 +- Utils/popup_callback.h | 2 +- Utils/popup_class.cpp | 2 +- Utils/popup_definition.cpp | 2 +- Utils/popup_definition.h | 2 +- ext/VFS/src/Core/files.cmake | 2 +- ext/export/src/ja2/Structure Internals.h | 2 +- ext/export/src/ja2/Types.h | 2 +- sgp/Button Sound Control.cpp | 2 +- sgp/Compression.h | 2 +- sgp/DirectDraw Calls.h | 2 +- sgp/DirectX Common.h | 2 +- sgp/Ja2 Libs.h | 2 +- sgp/english.h | 2 +- sgp/imgfmt.h | 2 +- sgp/input.h | 2 +- sgp/mousesystem_macros.h | 2 +- sgp/pcx.h | 2 +- sgp/soundman.h | 2 +- sgp/timer.h | 2 +- sgp/vsurface_private.h | 2 +- 228 files changed, 228 insertions(+), 228 deletions(-) diff --git a/Console/ComBSTROut.h b/Console/ComBSTROut.h index 62bac6b8..598e5204 100644 --- a/Console/ComBSTROut.h +++ b/Console/ComBSTROut.h @@ -78,4 +78,4 @@ public: ///////////////////////////////////////////////////////////////////////////// -#endif // _COMBSTROUT_H_ \ No newline at end of file +#endif // _COMBSTROUT_H_ diff --git a/Console/ComVariantOut.h b/Console/ComVariantOut.h index 0efb673f..1e52a866 100644 --- a/Console/ComVariantOut.h +++ b/Console/ComVariantOut.h @@ -106,4 +106,4 @@ public: ///////////////////////////////////////////////////////////////////////////// -#endif // _COMVARIANTOUT_H_ \ No newline at end of file +#endif // _COMVARIANTOUT_H_ diff --git a/Editor/Cursor Modes.h b/Editor/Cursor Modes.h index a81b2be8..c4994185 100644 --- a/Editor/Cursor Modes.h +++ b/Editor/Cursor Modes.h @@ -40,4 +40,4 @@ extern BOOLEAN gfCurrentSelectionWithRightButton; #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Modes.h b/Editor/Editor Modes.h index 5b6eb61e..3eae7696 100644 --- a/Editor/Editor Modes.h +++ b/Editor/Editor Modes.h @@ -14,4 +14,4 @@ void ShowExitGrids(); void HideExitGrids(); #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Taskbar Creation.h b/Editor/Editor Taskbar Creation.h index 7ed74205..ca645a7e 100644 --- a/Editor/Editor Taskbar Creation.h +++ b/Editor/Editor Taskbar Creation.h @@ -7,4 +7,4 @@ void CreateEditorTaskbarInternal(); #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Editor Taskbar Utils.h b/Editor/Editor Taskbar Utils.h index 9750ed03..563452e6 100644 --- a/Editor/Editor Taskbar Utils.h +++ b/Editor/Editor Taskbar Utils.h @@ -67,4 +67,4 @@ extern UINT32 guiMercTempBuffer; extern INT32 giEditMercImage[2]; #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Road Smoothing.h b/Editor/Road Smoothing.h index 872c2d6b..f1b899d9 100644 --- a/Editor/Road Smoothing.h +++ b/Editor/Road Smoothing.h @@ -61,4 +61,4 @@ void InitializeRoadMacros(); #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Sector Summary.h b/Editor/Sector Summary.h index 47da8302..c1c97758 100644 --- a/Editor/Sector Summary.h +++ b/Editor/Sector Summary.h @@ -35,4 +35,4 @@ void GetSectorFromFileName(STR16 szFileName, INT16& sSectorX, INT16& sSectorY, I void ResetCustomFileSectorSummary(void);//dnl ch30 150909 #endif -#endif \ No newline at end of file +#endif diff --git a/Editor/Smoothing Utils.h b/Editor/Smoothing Utils.h index f1eeb0fd..7da29628 100644 --- a/Editor/Smoothing Utils.h +++ b/Editor/Smoothing Utils.h @@ -62,4 +62,4 @@ UINT16 GetHorizontalWallClass( INT32 iMapIndex ); BOOLEAN ValidDecalPlacement( INT32 iMapIndex ); #endif -#endif \ No newline at end of file +#endif diff --git a/Ja2/Cheats.h b/Ja2/Cheats.h index 8e683a7e..74760ab6 100644 --- a/Ja2/Cheats.h +++ b/Ja2/Cheats.h @@ -22,4 +22,4 @@ extern UINT8 gubCheatLevel; #define RESET_CHEAT_LEVEL( ) ( gubCheatLevel = 0 ) #define ACTIVATE_CHEAT_LEVEL() ( gubCheatLevel = 6 ) -#endif \ No newline at end of file +#endif diff --git a/Ja2/Fade Screen.h b/Ja2/Fade Screen.h index 5f764b7e..4daab22d 100644 --- a/Ja2/Fade Screen.h +++ b/Ja2/Fade Screen.h @@ -37,4 +37,4 @@ BOOLEAN HandleFadeInCallback( ); void FadeInNextFrame( ); void FadeOutNextFrame( ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/HelpScreen.h b/Ja2/HelpScreen.h index 3d22c3e9..fdee7428 100644 --- a/Ja2/HelpScreen.h +++ b/Ja2/HelpScreen.h @@ -72,4 +72,4 @@ void NewScreenSoResetHelpScreen( ); INT8 HelpScreenDetermineWhichMapScreenHelpToShow(); -#endif \ No newline at end of file +#endif diff --git a/Ja2/Intro.h b/Ja2/Intro.h index 27c51ca7..77048105 100644 --- a/Ja2/Intro.h +++ b/Ja2/Intro.h @@ -42,4 +42,4 @@ typedef struct extern INTRO_NAMES_VALUES zVideoFile[255]; -#endif \ No newline at end of file +#endif diff --git a/Ja2/JA2 Splash.h b/Ja2/JA2 Splash.h index 5c809e68..40e18fed 100644 --- a/Ja2/JA2 Splash.h +++ b/Ja2/JA2 Splash.h @@ -6,4 +6,4 @@ void InitJA2SplashScreen(); extern UINT32 guiSplashFrameFade; extern UINT32 guiSplashStartTime; -#endif \ No newline at end of file +#endif diff --git a/Ja2/Language Defines.h b/Ja2/Language Defines.h index ec64ffb4..8032d699 100644 --- a/Ja2/Language Defines.h +++ b/Ja2/Language Defines.h @@ -116,4 +116,4 @@ #define SINGLE_CHAR_WORDS #endif*/ -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPChatScreen.h b/Ja2/MPChatScreen.h index 8921fa99..af8957b9 100644 --- a/Ja2/MPChatScreen.h +++ b/Ja2/MPChatScreen.h @@ -26,4 +26,4 @@ extern BOOLEAN gfInChatBox; INT32 DoChatBox( bool bIncludeChatLog, const STR16 zString, UINT32 uiExitScreen, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); void ChatLogMessage( UINT16 usColor, UINT8 ubPriority, STR16 pStringA, ...); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPConnectScreen.h b/Ja2/MPConnectScreen.h index e0412279..4e091dbb 100644 --- a/Ja2/MPConnectScreen.h +++ b/Ja2/MPConnectScreen.h @@ -11,4 +11,4 @@ void SetConnectScreenHeadingA( const char* cmsg ); void SetConnectScreenSubMessageW( STR16 cmsg ); void SetConnectScreenSubMessageA( const char* cmsg ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPHostScreen.h b/Ja2/MPHostScreen.h index 051947ff..b1b44b38 100644 --- a/Ja2/MPHostScreen.h +++ b/Ja2/MPHostScreen.h @@ -9,4 +9,4 @@ UINT32 MPHostScreenShutdown( void ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MPScoreScreen.h b/Ja2/MPScoreScreen.h index 70043248..d70faed9 100644 --- a/Ja2/MPScoreScreen.h +++ b/Ja2/MPScoreScreen.h @@ -9,4 +9,4 @@ UINT32 MPScoreScreenShutdown( void ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/MessageBoxScreen.h b/Ja2/MessageBoxScreen.h index 79827396..737cf588 100644 --- a/Ja2/MessageBoxScreen.h +++ b/Ja2/MessageBoxScreen.h @@ -152,4 +152,4 @@ BOOLEAN DoOptionsMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 BOOLEAN DoSaveLoadMessageBoxWithRect( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/Screens.h b/Ja2/Screens.h index e01af6b3..f94c05c8 100644 --- a/Ja2/Screens.h +++ b/Ja2/Screens.h @@ -34,4 +34,4 @@ extern Screens GameScreens[MAX_SCREENS]; #include "jascreens.h" -#endif \ No newline at end of file +#endif diff --git a/Ja2/gamescreen.h b/Ja2/gamescreen.h index 38403749..de0696a4 100644 --- a/Ja2/gamescreen.h +++ b/Ja2/gamescreen.h @@ -41,4 +41,4 @@ void InitHelicopterEntranceByMercs( void ); void InternalLeaveTacticalScreen( UINT32 uiNewScreen ); -#endif \ No newline at end of file +#endif diff --git a/Ja2/jascreens.h b/Ja2/jascreens.h index 89b1a223..1822b377 100644 --- a/Ja2/jascreens.h +++ b/Ja2/jascreens.h @@ -184,4 +184,4 @@ extern std::list g_ExceptionList; void PrintExceptionList(); -#endif \ No newline at end of file +#endif diff --git a/Ja2/legion cfg.h b/Ja2/legion cfg.h index c8317c2b..cff53c95 100644 --- a/Ja2/legion cfg.h +++ b/Ja2/legion cfg.h @@ -102,4 +102,4 @@ extern void RandomStats (); #endif extern void RandomStats (); -#endif \ No newline at end of file +#endif diff --git a/Ja2/mainmenuscreen.h b/Ja2/mainmenuscreen.h index c943fa7f..616eb460 100644 --- a/Ja2/mainmenuscreen.h +++ b/Ja2/mainmenuscreen.h @@ -37,4 +37,4 @@ void ClearMainMenu( ); void InitDependingGameStyleOptions(); -#endif \ No newline at end of file +#endif diff --git a/Ja2/screenids.h b/Ja2/screenids.h index 047ad188..18457c24 100644 --- a/Ja2/screenids.h +++ b/Ja2/screenids.h @@ -47,4 +47,4 @@ enum ScreenTypes MAX_SCREENS }; -#endif \ No newline at end of file +#endif diff --git a/Ja2/ub_config.h b/Ja2/ub_config.h index 4b2c64b0..dc43d6e7 100644 --- a/Ja2/ub_config.h +++ b/Ja2/ub_config.h @@ -230,4 +230,4 @@ extern void RandomStats (); #endif extern void RandomStats (); -#endif \ No newline at end of file +#endif diff --git a/Laptop/BriefingRoom.h b/Laptop/BriefingRoom.h index b64ea822..989937dd 100644 --- a/Laptop/BriefingRoom.h +++ b/Laptop/BriefingRoom.h @@ -17,4 +17,4 @@ BOOLEAN DrawBriefingRoomDefaults(); BOOLEAN DisplayBriefingRoomSlogan(); BOOLEAN DisplayBriefingRoomCopyright(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/BriefingRoomM.h b/Laptop/BriefingRoomM.h index d223a89a..9470a9e4 100644 --- a/Laptop/BriefingRoomM.h +++ b/Laptop/BriefingRoomM.h @@ -17,4 +17,4 @@ BOOLEAN DrawBriefingRoomEnterDefaults(); BOOLEAN DisplayBriefingRoomEnterSlogan(); BOOLEAN DisplayBriefingRoomEnterCopyright(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/BriefingRoom_Data.h b/Laptop/BriefingRoom_Data.h index e9da8074..0e41225a 100644 --- a/Laptop/BriefingRoom_Data.h +++ b/Laptop/BriefingRoom_Data.h @@ -133,4 +133,4 @@ extern BOOLEAN SaveBriefingRoomToSaveGameFile( HWFILE hFile ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/CampaignHistoryData.h b/Laptop/CampaignHistoryData.h index 278dac6f..31acffeb 100644 --- a/Laptop/CampaignHistoryData.h +++ b/Laptop/CampaignHistoryData.h @@ -3,4 +3,4 @@ -#endif // __CAMPAIGNHISTORY_DATA_H \ No newline at end of file +#endif // __CAMPAIGNHISTORY_DATA_H diff --git a/Laptop/CampaignHistory_Summary.h b/Laptop/CampaignHistory_Summary.h index 75f80692..3a67e92c 100644 --- a/Laptop/CampaignHistory_Summary.h +++ b/Laptop/CampaignHistory_Summary.h @@ -27,4 +27,4 @@ void ExitCampaignHistory_News(); void HandleCampaignHistory_News(); void RenderCampaignHistory_News(); -#endif // __CAMPAIGNHISTORY_SUMMARY_H \ No newline at end of file +#endif // __CAMPAIGNHISTORY_SUMMARY_H diff --git a/Laptop/CampaignStats.h b/Laptop/CampaignStats.h index 2721ee3d..198de5a5 100644 --- a/Laptop/CampaignStats.h +++ b/Laptop/CampaignStats.h @@ -332,4 +332,4 @@ STR16 GetIncidentName( UINT32 aIncidentId ); UINT32 GetIdOfCurrentlyOngoingIncident(); -#endif // __CAMPAIGNSTATS_H \ No newline at end of file +#endif // __CAMPAIGNSTATS_H diff --git a/Laptop/IMP AboutUs.h b/Laptop/IMP AboutUs.h index 7aff8212..e2e7eb22 100644 --- a/Laptop/IMP AboutUs.h +++ b/Laptop/IMP AboutUs.h @@ -7,4 +7,4 @@ void ExitIMPAboutUs( void ); void EnterIMPAboutUs( void ); void HandleIMPAboutUs( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Attribute Entrance.h b/Laptop/IMP Attribute Entrance.h index 843340a8..b31e0026 100644 --- a/Laptop/IMP Attribute Entrance.h +++ b/Laptop/IMP Attribute Entrance.h @@ -8,4 +8,4 @@ void HandleIMPAttributeEntrance( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Attribute Finish.h b/Laptop/IMP Attribute Finish.h index 3b6af623..bea71834 100644 --- a/Laptop/IMP Attribute Finish.h +++ b/Laptop/IMP Attribute Finish.h @@ -7,4 +7,4 @@ void RenderIMPAttributeFinish( void ); void ExitIMPAttributeFinish( void ); void HandleIMPAttributeFinish( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Attribute Selection.h b/Laptop/IMP Attribute Selection.h index 12965c03..2518f5aa 100644 --- a/Laptop/IMP Attribute Selection.h +++ b/Laptop/IMP Attribute Selection.h @@ -22,4 +22,4 @@ extern BOOLEAN fReturnStatus; INT8 StartingLevelChosen(); // added - SANDRO -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Begin Screen.h b/Laptop/IMP Begin Screen.h index cbaa7594..9ec36bc6 100644 --- a/Laptop/IMP Begin Screen.h +++ b/Laptop/IMP Begin Screen.h @@ -9,4 +9,4 @@ void HandleIMPBeginScreen( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Character and Disability Entrance.h b/Laptop/IMP Character and Disability Entrance.h index 35a64a5a..72d64ba6 100644 --- a/Laptop/IMP Character and Disability Entrance.h +++ b/Laptop/IMP Character and Disability Entrance.h @@ -7,4 +7,4 @@ void RenderIMPCharacterAndDisabilityEntrance( void ); void ExitIMPCharacterAndDisabilityEntrance( void ); void HandleIMPCharacterAndDisabilityEntrance( void ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Compile Character.h b/Laptop/IMP Compile Character.h index 6a1d81a7..f854bd21 100644 --- a/Laptop/IMP Compile Character.h +++ b/Laptop/IMP Compile Character.h @@ -20,4 +20,4 @@ void ClearAllSkillsList( void ); extern STR8 pPlayerSelectedFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]; extern STR8 pPlayerSelectedBigFaceFileNames[ NUMBER_OF_PLAYER_PORTRAITS ]; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Finish.h b/Laptop/IMP Finish.h index 789bef6d..51d9c12c 100644 --- a/Laptop/IMP Finish.h +++ b/Laptop/IMP Finish.h @@ -10,4 +10,4 @@ void HandleIMPFinish( void ); extern BOOLEAN fFinishedCharGeneration; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP HomePage.h b/Laptop/IMP HomePage.h index c6d657b8..b60a73e5 100644 --- a/Laptop/IMP HomePage.h +++ b/Laptop/IMP HomePage.h @@ -15,4 +15,4 @@ void HandleImpHomePage( void ); #define IMP_MERC_FILENAME "IMP" extern INT32 GlowColorsList[][3]; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP MainPage.h b/Laptop/IMP MainPage.h index c783e801..e75f662a 100644 --- a/Laptop/IMP MainPage.h +++ b/Laptop/IMP MainPage.h @@ -29,4 +29,4 @@ enum IMP__FINISH, }; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Personality Entrance.h b/Laptop/IMP Personality Entrance.h index 6e0a9d83..3cb27fef 100644 --- a/Laptop/IMP Personality Entrance.h +++ b/Laptop/IMP Personality Entrance.h @@ -9,4 +9,4 @@ void HandleIMPPersonalityEntrance( void ); STR16 pSkillTraitBeginIMPStrings[]; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Personality Finish.h b/Laptop/IMP Personality Finish.h index 2d1400cd..8a147e1f 100644 --- a/Laptop/IMP Personality Finish.h +++ b/Laptop/IMP Personality Finish.h @@ -9,4 +9,4 @@ void HandleIMPPersonalityFinish( void ); extern UINT8 bPersonalityEndState; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Personality Quiz.h b/Laptop/IMP Personality Quiz.h index c6c27bd9..95b8b48d 100644 --- a/Laptop/IMP Personality Quiz.h +++ b/Laptop/IMP Personality Quiz.h @@ -12,4 +12,4 @@ void BltAnswerIndents( INT32 iNumberOfIndents ); extern INT32 giCurrentPersonalityQuizQuestion; extern INT32 iCurrentAnswer; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Portraits.h b/Laptop/IMP Portraits.h index e51cda26..b91b2659 100644 --- a/Laptop/IMP Portraits.h +++ b/Laptop/IMP Portraits.h @@ -10,4 +10,4 @@ BOOLEAN RenderPortrait( INT16 sX, INT16 sY ); extern INT32 iPortraitNumber; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Text System.h b/Laptop/IMP Text System.h index 09eebada..d0d0906a 100644 --- a/Laptop/IMP Text System.h +++ b/Laptop/IMP Text System.h @@ -145,4 +145,4 @@ enum{ }; -#endif \ No newline at end of file +#endif diff --git a/Laptop/IMP Voices.h b/Laptop/IMP Voices.h index e65f264b..99227b53 100644 --- a/Laptop/IMP Voices.h +++ b/Laptop/IMP Voices.h @@ -9,4 +9,4 @@ UINT32 PlayVoice( void ); extern UINT32 iSelectedIMPVoiceSet; -#endif \ No newline at end of file +#endif diff --git a/Laptop/MilitiaWebsite.cpp b/Laptop/MilitiaWebsite.cpp index 67e22893..16104a7e 100644 --- a/Laptop/MilitiaWebsite.cpp +++ b/Laptop/MilitiaWebsite.cpp @@ -835,4 +835,4 @@ template<> void TestTableTemplate<3>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End AddColumnDataProvider( itemnamecol );*/ TestTable::Init( sX, sY, sX_End, sY_End ); -} \ No newline at end of file +} diff --git a/Laptop/PMC.cpp b/Laptop/PMC.cpp index 652e15c5..aac3c86f 100644 --- a/Laptop/PMC.cpp +++ b/Laptop/PMC.cpp @@ -851,4 +851,4 @@ BOOLEAN LoadPMC( HWFILE hwFile ) } return TRUE; -} \ No newline at end of file +} diff --git a/Laptop/PostalService.h b/Laptop/PostalService.h index c3a0aaf1..dfd4df5c 100644 --- a/Laptop/PostalService.h +++ b/Laptop/PostalService.h @@ -254,4 +254,4 @@ private: protected: }; -#endif \ No newline at end of file +#endif diff --git a/Laptop/Speck Quotes.h b/Laptop/Speck Quotes.h index a1db2643..eadeda0b 100644 --- a/Laptop/Speck Quotes.h +++ b/Laptop/Speck Quotes.h @@ -305,4 +305,4 @@ enum{ }; #endif -#endif \ No newline at end of file +#endif diff --git a/Laptop/XML_AIMAvailability.cpp b/Laptop/XML_AIMAvailability.cpp index 76f7b2c0..981c9129 100644 --- a/Laptop/XML_AIMAvailability.cpp +++ b/Laptop/XML_AIMAvailability.cpp @@ -227,4 +227,4 @@ BOOLEAN WriteAimAvailability(STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/XML_ConditionsForMercAvailability.cpp b/Laptop/XML_ConditionsForMercAvailability.cpp index cd50b18c..0ef09034 100644 --- a/Laptop/XML_ConditionsForMercAvailability.cpp +++ b/Laptop/XML_ConditionsForMercAvailability.cpp @@ -287,4 +287,4 @@ BOOLEAN WriteMercAvailability(STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/XML_DeliveryMethods.cpp b/Laptop/XML_DeliveryMethods.cpp index 375ce4c4..07751b22 100644 --- a/Laptop/XML_DeliveryMethods.cpp +++ b/Laptop/XML_DeliveryMethods.cpp @@ -268,4 +268,4 @@ BOOLEAN ReadInDeliveryMethods(STR fileName) return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/XML_ShippingDestinations.cpp b/Laptop/XML_ShippingDestinations.cpp index 925465bf..e17b76ea 100644 --- a/Laptop/XML_ShippingDestinations.cpp +++ b/Laptop/XML_ShippingDestinations.cpp @@ -236,4 +236,4 @@ BOOLEAN ReadInShippingDestinations(STR fileName, BOOLEAN localizedVersion) XML_ParserFree(parser); return( TRUE ); -} \ No newline at end of file +} diff --git a/Laptop/florist Cards.h b/Laptop/florist Cards.h index 4a51c2dc..fb28fde6 100644 --- a/Laptop/florist Cards.h +++ b/Laptop/florist Cards.h @@ -16,4 +16,4 @@ void RenderFloristCards(); extern INT8 gbCurrentlySelectedCard; -#endif \ No newline at end of file +#endif diff --git a/Laptop/florist Gallery.h b/Laptop/florist Gallery.h index 4f9517ab..85939211 100644 --- a/Laptop/florist Gallery.h +++ b/Laptop/florist Gallery.h @@ -21,4 +21,4 @@ extern UINT32 guiCurrentlySelectedFlower; extern UINT8 gubCurFlowerIndex; -#endif \ No newline at end of file +#endif diff --git a/Laptop/florist Order Form.h b/Laptop/florist Order Form.h index 92823531..701eb35e 100644 --- a/Laptop/florist Order Form.h +++ b/Laptop/florist Order Form.h @@ -12,4 +12,4 @@ void InitFloristOrderForm(); void InitFloristOrderFormVariables(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/insurance Comments.h b/Laptop/insurance Comments.h index b2b32ac7..71b9c2e2 100644 --- a/Laptop/insurance Comments.h +++ b/Laptop/insurance Comments.h @@ -7,4 +7,4 @@ void ExitInsuranceComments(); void HandleInsuranceComments(); void RenderInsuranceComments(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/insurance Contract.h b/Laptop/insurance Contract.h index c7dcf460..8aa3d231 100644 --- a/Laptop/insurance Contract.h +++ b/Laptop/insurance Contract.h @@ -28,4 +28,4 @@ void InsuranceContractEndGameShutDown(); void PurchaseOrExtendInsuranceForSoldier( SOLDIERTYPE *pSoldier, UINT32 uiInsuranceLength ); -#endif \ No newline at end of file +#endif diff --git a/Laptop/insurance Info.h b/Laptop/insurance Info.h index 98c727b5..3a143936 100644 --- a/Laptop/insurance Info.h +++ b/Laptop/insurance Info.h @@ -9,4 +9,4 @@ void RenderInsuranceInfo(); void EnterInitInsuranceInfo(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/mercs Account.h b/Laptop/mercs Account.h index 33af5c78..c71a499c 100644 --- a/Laptop/mercs Account.h +++ b/Laptop/mercs Account.h @@ -9,4 +9,4 @@ void RenderMercsAccount(); UINT32 CalculateHowMuchPlayerOwesSpeck(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/mercs Files.h b/Laptop/mercs Files.h index 02142305..3491eeac 100644 --- a/Laptop/mercs Files.h +++ b/Laptop/mercs Files.h @@ -7,4 +7,4 @@ void ExitMercsFiles(); void HandleMercsFiles(); void RenderMercsFiles(); -#endif \ No newline at end of file +#endif diff --git a/Laptop/mercs No Account.h b/Laptop/mercs No Account.h index 5872d69c..46def55f 100644 --- a/Laptop/mercs No Account.h +++ b/Laptop/mercs No Account.h @@ -7,4 +7,4 @@ void ExitMercsNoAccount(); void HandleMercsNoAccount(); void RenderMercsNoAccount(); -#endif \ No newline at end of file +#endif diff --git a/Multiplayer/fresh_header.h b/Multiplayer/fresh_header.h index 58afdf26..403793df 100644 --- a/Multiplayer/fresh_header.h +++ b/Multiplayer/fresh_header.h @@ -65,4 +65,4 @@ BOOLEAN check_status (void); extern UINT8 NumEnemyInSector( ); extern INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam ); void send_heal (SOLDIERTYPE *pSoldier ); -void requestAIint(SOLDIERTYPE *pSoldier ); \ No newline at end of file +void requestAIint(SOLDIERTYPE *pSoldier ); diff --git a/Multiplayer/network.h b/Multiplayer/network.h index b2571b4f..e90064f6 100644 --- a/Multiplayer/network.h +++ b/Multiplayer/network.h @@ -159,4 +159,4 @@ namespace ja2 { void InitializeMultiplayerProfile(vfs::Path const& profileRoot); } -} \ No newline at end of file +} diff --git a/Multiplayer/raknet/AsynchronousFileIO.h b/Multiplayer/raknet/AsynchronousFileIO.h index e2de9189..e1dc25c5 100644 --- a/Multiplayer/raknet/AsynchronousFileIO.h +++ b/Multiplayer/raknet/AsynchronousFileIO.h @@ -88,4 +88,4 @@ void WriteAsynch( HANDLE handle, ExtendedOverlappedStruct *extended ); BOOL ReadAsynch( HANDLE handle, ExtendedOverlappedStruct *extended ); #endif -*/ \ No newline at end of file +*/ diff --git a/Multiplayer/raknet/BitStream_NoTemplate.h b/Multiplayer/raknet/BitStream_NoTemplate.h index 79aca6c4..afbc313c 100644 --- a/Multiplayer/raknet/BitStream_NoTemplate.h +++ b/Multiplayer/raknet/BitStream_NoTemplate.h @@ -781,4 +781,4 @@ namespace RakNet #endif // VC6 -#endif \ No newline at end of file +#endif diff --git a/Multiplayer/raknet/PacketPool.h b/Multiplayer/raknet/PacketPool.h index b534cac4..76ba0fc6 100644 --- a/Multiplayer/raknet/PacketPool.h +++ b/Multiplayer/raknet/PacketPool.h @@ -1 +1 @@ -// REMOVEME \ No newline at end of file +// REMOVEME diff --git a/Multiplayer/raknet/SimpleTCPServer.h b/Multiplayer/raknet/SimpleTCPServer.h index 1181cd0d..fc79bf1a 100644 --- a/Multiplayer/raknet/SimpleTCPServer.h +++ b/Multiplayer/raknet/SimpleTCPServer.h @@ -1 +1 @@ -// Eraseme \ No newline at end of file +// Eraseme diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 03672ed7..61d59e05 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -592,4 +592,4 @@ UINT8 CalcSoldierNeedForSleep( SOLDIERTYPE *pSoldier ); // Flugente: administration assignment FLOAT GetAdministrationPercentage( INT16 sX, INT16 sY ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Auto Resolve.h b/Strategic/Auto Resolve.h index a1d0acb5..d848c976 100644 --- a/Strategic/Auto Resolve.h +++ b/Strategic/Auto Resolve.h @@ -60,4 +60,4 @@ void AutoResolveMilitiaDropAndPromote(); BOOLEAN IndividualMilitiaInUse_AutoResolve( UINT32 aMilitiaId ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Campaign Init.h b/Strategic/Campaign Init.h index c0765bd2..e730c689 100644 --- a/Strategic/Campaign Init.h +++ b/Strategic/Campaign Init.h @@ -6,4 +6,4 @@ extern void InitNewCampaign(); extern void BuildUndergroundSectorInfoList(); extern void TrashUndergroundSectorInfo(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index 37be5a19..2c17739b 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -656,4 +656,4 @@ enum CreateMusic CM_ALWAYS, }; -#endif \ No newline at end of file +#endif diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index 13581a26..fac95c5a 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -2422,4 +2422,4 @@ void ResetCreatureAttackVariables() gubAdultFemalesAttackingTown = 0; gubCreatureBattleCode = CREATURE_BATTLE_CODE_NONE; gubSectorIDOfCreatureAttack = 0; -} \ No newline at end of file +} diff --git a/Strategic/Creature Spreading.h b/Strategic/Creature Spreading.h index e7e812c6..acc408e1 100644 --- a/Strategic/Creature Spreading.h +++ b/Strategic/Creature Spreading.h @@ -114,4 +114,4 @@ extern CREATURECOMPOSITION gCreatureComposition[ MAX_NUMBER_OF_CREATURE_COMPOSIT // Flugente: reset code for creature attacks void ResetCreatureAttackVariables(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Facilities.h b/Strategic/Facilities.h index 6c0d5526..887e4344 100644 --- a/Strategic/Facilities.h +++ b/Strategic/Facilities.h @@ -80,4 +80,4 @@ INT32 GetTotalFacilityHourlyCosts( BOOLEAN fPositive ); void InitFacilities(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Game Init.h b/Strategic/Game Init.h index 77532945..fa07026f 100644 --- a/Strategic/Game Init.h +++ b/Strategic/Game Init.h @@ -18,4 +18,4 @@ void InitBloodCatSectors(); void InitVIPSectors(); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Ja25 Strategic Ai.h b/Strategic/Ja25 Strategic Ai.h index 4de27d9a..2404b35a 100644 --- a/Strategic/Ja25 Strategic Ai.h +++ b/Strategic/Ja25 Strategic Ai.h @@ -333,4 +333,4 @@ extern void SetNumberOfJa25BloodCatsInSector( INT32 iSectorID, INT8 bNumBloodCat #endif -#endif \ No newline at end of file +#endif diff --git a/Strategic/Luaglobal.cpp b/Strategic/Luaglobal.cpp index 3abb4a73..3c13deea 100644 --- a/Strategic/Luaglobal.cpp +++ b/Strategic/Luaglobal.cpp @@ -742,4 +742,4 @@ void IniGlobalGameSetting(lua_State *L) lua_pushinteger(L, MORRIS_INSTRUCTION_NOTE); lua_setglobal(L, "UB_itemMORRIS_INSTRUCTION_NOTE"); #endif -} \ No newline at end of file +} diff --git a/Strategic/Map Screen Helicopter.h b/Strategic/Map Screen Helicopter.h index e8256701..05c8e7bf 100644 --- a/Strategic/Map Screen Helicopter.h +++ b/Strategic/Map Screen Helicopter.h @@ -310,4 +310,4 @@ BOOLEAN SoldierAboardAirborneHeli( SOLDIERTYPE *pSoldier ); UINT8 MoveAllInHelicopterToFootMovementGroup( INT8 bNewSquad = 0 ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface Border.h b/Strategic/Map Screen Interface Border.h index c17ef7b1..1447b461 100644 --- a/Strategic/Map Screen Interface Border.h +++ b/Strategic/Map Screen Interface Border.h @@ -107,4 +107,4 @@ void InitMapBorderButtonCoordinates(); void DisableMapBorderButtons(void); void EnableMapBorderButtons(void); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface Bottom.h b/Strategic/Map Screen Interface Bottom.h index c43ebe14..0c7dd8c6 100644 --- a/Strategic/Map Screen Interface Bottom.h +++ b/Strategic/Map Screen Interface Bottom.h @@ -76,4 +76,4 @@ void MoveToEndOfMapScreenMessageList( void ); // HEADROCK HAM 3.6: Reset coordinates for slider bar and message window void InitMapScreenInterfaceBottomCoords( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface TownMine Info.h b/Strategic/Map Screen Interface TownMine Info.h index 2c092f6b..73d210f6 100644 --- a/Strategic/Map Screen Interface TownMine Info.h +++ b/Strategic/Map Screen Interface TownMine Info.h @@ -12,4 +12,4 @@ void DisplayTownInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ); void CreateDestroyTownInfoBox( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 4e0ad4ed..5e7aafaf 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -745,4 +745,4 @@ extern BOOLEAN CanCharacterMoveInStrategic( SOLDIERTYPE *pSoldier, INT8 *pbError extern BOOLEAN MapscreenCanPassItemToCharNum( INT32 iNewCharSlot ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/MilitiaIndividual.h b/Strategic/MilitiaIndividual.h index e03e7a95..cf3b24e1 100644 --- a/Strategic/MilitiaIndividual.h +++ b/Strategic/MilitiaIndividual.h @@ -195,4 +195,4 @@ UINT32 GetDailyUpkeep_IndividualMilitia( UINT32& arNumGreen, UINT32& arNumRegula void PickIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); void DropIndividualMilitia( UINT8 aSector, UINT8 ubType, UINT16 aNumber ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/MilitiaSquads.h b/Strategic/MilitiaSquads.h index f86a8a62..499bd38c 100644 --- a/Strategic/MilitiaSquads.h +++ b/Strategic/MilitiaSquads.h @@ -50,4 +50,4 @@ void DissolveAllMilitiaGroupsInSector( INT16 sMapX, INT16 sMapY ); BOOLEAN MilitiaGroupEntersCurrentSector( UINT8 usGroupId, INT16 sMapX, INT16 sMapY ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Player Command.h b/Strategic/Player Command.h index c4bcee2f..8b56835d 100644 --- a/Strategic/Player Command.h +++ b/Strategic/Player Command.h @@ -30,4 +30,4 @@ void MakePlayerPerceptionOfSectorControlCorrect( INT16 sMapX, INT16 sMapY, INT8 void ReplaceSoldierProfileInPlayerGroup( UINT8 ubGroupID, UINT8 ubOldProfile, UINT8 ubNewProfile ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Quest Debug System.h b/Strategic/Quest Debug System.h index 46cf6a5c..2de86c5d 100644 --- a/Strategic/Quest Debug System.h +++ b/Strategic/Quest Debug System.h @@ -13,4 +13,4 @@ void NpcRecordLoggingInit( UINT8 ubNpcID, UINT8 ubMercID, UINT8 ubQuoteNum, UINT void NpcRecordLogging( UINT8 ubApproach, STR pStringA, ...); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Reinforcement.h b/Strategic/Reinforcement.h index e6017b51..caf7008f 100644 --- a/Strategic/Reinforcement.h +++ b/Strategic/Reinforcement.h @@ -14,4 +14,4 @@ UINT8 DoReinforcementAsPendingNonPlayer( INT16 sMapX, INT16 sMapY, UINT8 usTeam void AddPossiblePendingMilitiaToBattle(); GROUP* GetNonPlayerGroupInSectorForReinforcement( INT16 sMapX, INT16 sMapY, UINT8 usTeam ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic AI.h b/Strategic/Strategic AI.h index 5c7986af..9f494f72 100644 --- a/Strategic/Strategic AI.h +++ b/Strategic/Strategic AI.h @@ -181,4 +181,4 @@ typedef struct GARRISON_GROUP #define REGULAR_MILITIA_POINTS_MODIFIER 2 #define ELITE_MILITIA_POINTS_MODIFIER 3 -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Event Handler.h b/Strategic/Strategic Event Handler.h index 1f30da0f..65e78aaa 100644 --- a/Strategic/Strategic Event Handler.h +++ b/Strategic/Strategic Event Handler.h @@ -27,4 +27,4 @@ void MakeCivGroupHostileOnNextSectorEntrance( UINT8 ubCivGroup ); void RemoveAssassin( UINT8 ubProfile ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Mines.h b/Strategic/Strategic Mines.h index b7ad4048..63351652 100644 --- a/Strategic/Strategic Mines.h +++ b/Strategic/Strategic Mines.h @@ -218,4 +218,4 @@ BOOLEAN AreThereMinersInsideThisMine( UINT8 ubMineIndex ); // use this to determine whether or not the player has spoken to a head miner BOOLEAN SpokenToHeadMiner( UINT8 ubMineIndex ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Pathing.cpp b/Strategic/Strategic Pathing.cpp index f39d47b5..37c260bf 100644 --- a/Strategic/Strategic Pathing.cpp +++ b/Strategic/Strategic Pathing.cpp @@ -2221,4 +2221,4 @@ PathStPtr GetLastNodeOfPath(PathStPtr pNode) } return pNode; -} \ No newline at end of file +} diff --git a/Strategic/Strategic Status.h b/Strategic/Strategic Status.h index e3ad182f..a7bb86a3 100644 --- a/Strategic/Strategic Status.h +++ b/Strategic/Strategic Status.h @@ -167,4 +167,4 @@ UINT8 RankIndexToSoldierClass( UINT8 ubRankIndex ); void UpdateLastDayOfPlayerActivity( UINT16 usDay ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Town Loyalty.h b/Strategic/Strategic Town Loyalty.h index 2cde0c52..2d420c2f 100644 --- a/Strategic/Strategic Town Loyalty.h +++ b/Strategic/Strategic Town Loyalty.h @@ -224,4 +224,4 @@ void MaximizeLoyaltyForDeidrannaKilled( void ); // HEADROCK HAM 3.6: Loyalty hit for owing too much money on facility work void HandleFacilityDebtLoyaltyHit( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Strategic Turns.h b/Strategic/Strategic Turns.h index febe75c1..26d2399c 100644 --- a/Strategic/Strategic Turns.h +++ b/Strategic/Strategic Turns.h @@ -8,4 +8,4 @@ void HandleStrategicTurn( ); void SyncStrategicTurnTimes( ); void HandleStrategicTurnImplicationsOfExitingCombatMode( void ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/Town Militia.h b/Strategic/Town Militia.h index 33824893..a9ef3536 100644 --- a/Strategic/Town Militia.h +++ b/Strategic/Town Militia.h @@ -135,4 +135,4 @@ FLOAT GetIntel(); void AddRaidPersonnel( INT32 aBloodcats, INT32 aZombie, INT32 aBandits ); void GetRaidPersonnel( INT32& arBloodcats, INT32& arZombie, INT32& arBandits ); -#endif \ No newline at end of file +#endif diff --git a/Strategic/XML_Creatures.cpp b/Strategic/XML_Creatures.cpp index d0b482f2..d6fcc9d4 100644 --- a/Strategic/XML_Creatures.cpp +++ b/Strategic/XML_Creatures.cpp @@ -648,4 +648,4 @@ BOOLEAN ReadInCreaturePlacements(STR fileName) XML_ParserFree(parser); return TRUE; -} \ No newline at end of file +} diff --git a/Strategic/XML_SquadNames.cpp b/Strategic/XML_SquadNames.cpp index d41cd8bc..8d82d6b7 100644 --- a/Strategic/XML_SquadNames.cpp +++ b/Strategic/XML_SquadNames.cpp @@ -160,4 +160,4 @@ BOOLEAN ReadInSquadNamesStats(STR fileName) BOOLEAN WriteSquadNamesStats() { return( TRUE ); -} \ No newline at end of file +} diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index 16188e05..9bf934e0 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -228,4 +228,4 @@ void RetreatBandageCallback( UINT8 ubResult ); bool isWidescreenUI(void); -#endif \ No newline at end of file +#endif diff --git a/Strategic/strategic town reputation.h b/Strategic/strategic town reputation.h index 853a4ac2..2ad89fa9 100644 --- a/Strategic/strategic town reputation.h +++ b/Strategic/strategic town reputation.h @@ -33,4 +33,4 @@ void HandleSpreadOfTownsOpinionForCurrentMercs( void ); void HandleSpreadOfTownOpinionForMercForSoldier( SOLDIERTYPE *pSoldier ); */ -#endif \ No newline at end of file +#endif diff --git a/Strategic/strategic.h b/Strategic/strategic.h index 082b3f95..c8d86357 100644 --- a/Strategic/strategic.h +++ b/Strategic/strategic.h @@ -65,4 +65,4 @@ void HandleSoldierDeadComments( SOLDIERTYPE *pSoldier ); BOOLEAN HandleStrategicDeath( SOLDIERTYPE *pSoldier ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Action Items.h b/Tactical/Action Items.h index cb90e2c5..551a4fc0 100644 --- a/Tactical/Action Items.h +++ b/Tactical/Action Items.h @@ -40,4 +40,4 @@ typedef enum #endif } ItemActionType; -#endif \ No newline at end of file +#endif diff --git a/Tactical/Air Raid.h b/Tactical/Air Raid.h index 919c8f15..14fc7cbd 100644 --- a/Tactical/Air Raid.h +++ b/Tactical/Air Raid.h @@ -62,4 +62,4 @@ BOOLEAN LoadAirRaidInfoFromSaveGameFile( HWFILE hFile ); void EndAirRaid( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Animation Cache.h b/Tactical/Animation Cache.h index bf2753b8..78ad2ac3 100644 --- a/Tactical/Animation Cache.h +++ b/Tactical/Animation Cache.h @@ -26,4 +26,4 @@ void UnLoadCachedAnimationSurfaces( UINT16 usSoldierID, AnimationSurfaceCacheTyp -#endif \ No newline at end of file +#endif diff --git a/Tactical/Arms Dealer Init.h b/Tactical/Arms Dealer Init.h index cccc3af2..1a409002 100644 --- a/Tactical/Arms Dealer Init.h +++ b/Tactical/Arms Dealer Init.h @@ -393,4 +393,4 @@ extern void GuaranteeAtLeastXItemsOfIndex( UINT8 ubArmsDealer, UINT16 usItemInd extern void GuaranteeAtMostNumOfItemsForItem( UINT8 ubArmsDealer, INT16 sItemIndex, UINT8 ubAtMostNumItems ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Auto Bandage.h b/Tactical/Auto Bandage.h index 796e9dff..057990b1 100644 --- a/Tactical/Auto Bandage.h +++ b/Tactical/Auto Bandage.h @@ -25,4 +25,4 @@ UINT16 GetBestRetreatingMercDoctor( SOLDIERTYPE* pPatient ); void HandleRetreatBandaging( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Boxing.h b/Tactical/Boxing.h index 89787494..8c9222f6 100644 --- a/Tactical/Boxing.h +++ b/Tactical/Boxing.h @@ -43,4 +43,4 @@ extern BOOLEAN BoxerExists( void ); extern UINT8 CountPeopleInBoxingRing( void ); extern void ClearAllBoxerFlags( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Bullets.h b/Tactical/Bullets.h index db087445..4bff3c42 100644 --- a/Tactical/Bullets.h +++ b/Tactical/Bullets.h @@ -107,4 +107,4 @@ BOOLEAN SaveBulletStructureToSaveGameFile( HWFILE hFile ); BOOLEAN LoadBulletStructureFromSavedGameFile( HWFILE hFile ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Civ Quotes.h b/Tactical/Civ Quotes.h index 0c466651..8cc83770 100644 --- a/Tactical/Civ Quotes.h +++ b/Tactical/Civ Quotes.h @@ -179,4 +179,4 @@ void BeginChatQuote( SOLDIERTYPE *pCiv, INT16 sX, INT16 sY ); BOOLEAN CivQuoteActive(); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Dialogue Control.h b/Tactical/Dialogue Control.h index 1b469faf..f2aca38e 100644 --- a/Tactical/Dialogue Control.h +++ b/Tactical/Dialogue Control.h @@ -489,4 +489,4 @@ void SetExternMapscreenSpeechPanelXY( INT16 sXPos, INT16 sYPos ); void RemoveJerryMiloBrokenLaptopOverlay(); #endif -#endif \ No newline at end of file +#endif diff --git a/Tactical/End Game.h b/Tactical/End Game.h index a5c8da35..d7bdf22b 100644 --- a/Tactical/End Game.h +++ b/Tactical/End Game.h @@ -25,4 +25,4 @@ void HandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLe void BeginHandleQueenBitchDeath( SOLDIERTYPE *pKillerSoldier, INT32 sGridNo, INT8 bLevel ); #endif -#endif \ No newline at end of file +#endif diff --git a/Tactical/Enemy Soldier Save.h b/Tactical/Enemy Soldier Save.h index 9d22adf6..1c82ced2 100644 --- a/Tactical/Enemy Soldier Save.h +++ b/Tactical/Enemy Soldier Save.h @@ -22,4 +22,4 @@ BOOLEAN SaveEnemySoldiersToTempFile( INT16 sSectorX, INT16 sSectorY, INT8 bSecto extern BOOLEAN gfRestoringEnemySoldiersFromTempFile; -#endif \ No newline at end of file +#endif diff --git a/Tactical/EnemyItemDrops.cpp b/Tactical/EnemyItemDrops.cpp index 30e61581..0d720289 100644 --- a/Tactical/EnemyItemDrops.cpp +++ b/Tactical/EnemyItemDrops.cpp @@ -6,4 +6,4 @@ WEAPON_DROPS gEnemyWeaponDrops[MAX_DROP_ITEMS]; AMMO_DROPS gEnemyAmmoDrops[MAX_DROP_ITEMS]; EXPLOSIVE_DROPS gEnemyExplosiveDrops[MAX_DROP_ITEMS]; ARMOUR_DROPS gEnemyArmourDrops[MAX_DROP_ITEMS]; -MISC_DROPS gEnemyMiscDrops[MAX_DROP_ITEMS]; \ No newline at end of file +MISC_DROPS gEnemyMiscDrops[MAX_DROP_ITEMS]; diff --git a/Tactical/EnemyItemDrops.h b/Tactical/EnemyItemDrops.h index f2bc9169..7b531cb4 100644 --- a/Tactical/EnemyItemDrops.h +++ b/Tactical/EnemyItemDrops.h @@ -49,4 +49,4 @@ extern EXPLOSIVE_DROPS gEnemyExplosiveDrops[MAX_DROP_ITEMS]; extern ARMOUR_DROPS gEnemyArmourDrops[MAX_DROP_ITEMS]; extern MISC_DROPS gEnemyMiscDrops[MAX_DROP_ITEMS]; -#endif \ No newline at end of file +#endif diff --git a/Tactical/Handle Doors.h b/Tactical/Handle Doors.h index 95a68305..6376ee6c 100644 --- a/Tactical/Handle Doors.h +++ b/Tactical/Handle Doors.h @@ -26,4 +26,4 @@ void HandleDoorChangeFromGridNo( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN f -#endif \ No newline at end of file +#endif diff --git a/Tactical/Handle UI Plan.h b/Tactical/Handle UI Plan.h index b4ccc3b2..5861c34b 100644 --- a/Tactical/Handle UI Plan.h +++ b/Tactical/Handle UI Plan.h @@ -14,4 +14,4 @@ void EndUIPlan( ); BOOLEAN InUIPlanMode( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Handle UI.h b/Tactical/Handle UI.h index 5937d911..896cf34b 100644 --- a/Tactical/Handle UI.h +++ b/Tactical/Handle UI.h @@ -382,4 +382,4 @@ void GetGridNoScreenXY( INT32 sGridNo, INT16 *pScreenX, INT16 *pScreenY ); //Legion by Jazz void GetMercOknoDirection( UINT8 ubSoldierID, BOOLEAN *pfGoDown, BOOLEAN *pfGoUp ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Control.h b/Tactical/Interface Control.h index 5fc96c36..8131ab3c 100644 --- a/Tactical/Interface Control.h +++ b/Tactical/Interface Control.h @@ -73,4 +73,4 @@ void DrawExplosionWarning( INT32 sGridno, INT8 sLevel, INT8 sDelay ); // For now, we aren't using usColour, but that will likely change in the future void DrawTraitRadius( INT32 sGridno, INT8 sLevel, INT32 sRadius, INT16 sThickness, UINT16 usColour ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Cursors.h b/Tactical/Interface Cursors.h index 0c89da40..507ab6ea 100644 --- a/Tactical/Interface Cursors.h +++ b/Tactical/Interface Cursors.h @@ -249,4 +249,4 @@ extern UINT32 gusCurMousePos; UINT16 GetSnapCursorIndex( UINT16 usAdditionalData ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Panels.h b/Tactical/Interface Panels.h index 923eb108..5e5699e0 100644 --- a/Tactical/Interface Panels.h +++ b/Tactical/Interface Panels.h @@ -168,4 +168,4 @@ extern UINT8 gubDescBoxTotalAdvLines; // Jenilee: determine the cost of moving this item around in our inventory UINT16 GetInvMovementCost(OBJECTTYPE* pObj, INT16 old_pos, INT16 new_pos); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface Utils.h b/Tactical/Interface Utils.h index a8e128ca..5a421c0d 100644 --- a/Tactical/Interface Utils.h +++ b/Tactical/Interface Utils.h @@ -27,4 +27,4 @@ void UnLoadCarPortraits( void ); void DrawItemOutlineZoomedInventory( INT16 sX, INT16 sY, INT16 sWidth, INT16 sHeight, INT16 sColor, UINT32 uiBuffer ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Interface.h b/Tactical/Interface.h index 0df8a4c6..18f4bd33 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -581,4 +581,4 @@ void NCTHShowMounted( SOLDIERTYPE* pSoldier, UINT16* ptrBuf, UINT32 uiPitch, INT BOOLEAN HasBackgroundFlag( UINT8 usProfile, UINT64 aFlag ); INT16 GetBackgroundValue( UINT8 usProfile, UINT16 aNr ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Inventory Choosing.h b/Tactical/Inventory Choosing.h index 6f75e339..396f13fe 100644 --- a/Tactical/Inventory Choosing.h +++ b/Tactical/Inventory Choosing.h @@ -126,4 +126,4 @@ void MoveMilitiaEquipment(INT16 sSourceX, INT16 sSourceY, INT16 sTargetX, INT16 // take militia items from sector void TakeMilitiaEquipmentfromSector( INT16 sMapX, INT16 sMapY, INT8 sMapZ, SOLDIERCREATE_STRUCT *pp, INT8 bSoldierClass ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 4f086238..2c5f2156 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -151,4 +151,4 @@ extern void InitGridNoUB(); #endif -#endif \ No newline at end of file +#endif diff --git a/Tactical/Keys.h b/Tactical/Keys.h index 8937d292..cd92ae38 100644 --- a/Tactical/Keys.h +++ b/Tactical/Keys.h @@ -281,4 +281,4 @@ void AttachStringToDoor( INT32 sGridNo ); void DropKeysInKeyRing( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, INT8 bVisible, BOOLEAN fAddToDropList, INT32 iDropListSlot, BOOLEAN fUseUnLoaded ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/LOS.h b/Tactical/LOS.h index 64c3fc80..41748872 100644 --- a/Tactical/LOS.h +++ b/Tactical/LOS.h @@ -261,4 +261,4 @@ void DamageRiotShield( SOLDIERTYPE* pSoldier, INT32& rsDamage, INT32& rsSecondar extern INT8 GetStealth(SOLDIERTYPE* pSoldier); extern INT8 GetSightAdjustmentBasedOnLBE(SOLDIERTYPE* pSoldier); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Map Information.h b/Tactical/Map Information.h index bbda9ca2..76d4e36b 100644 --- a/Tactical/Map Information.h +++ b/Tactical/Map Information.h @@ -66,4 +66,4 @@ BOOLEAN ValidateEntryPointGridNo( INT32 *sGridNo ); extern BOOLEAN gfWorldLoaded; -#endif \ No newline at end of file +#endif diff --git a/Tactical/Militia Control.h b/Tactical/Militia Control.h index 68113765..b309e288 100644 --- a/Tactical/Militia Control.h +++ b/Tactical/Militia Control.h @@ -28,4 +28,4 @@ BOOLEAN CreateDestroyMilitiaControlPopUpBoxes( void ); BOOLEAN CheckIfRadioIsEquipped( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/MiniGame.h b/Tactical/MiniGame.h index a1f634ae..550634db 100644 --- a/Tactical/MiniGame.h +++ b/Tactical/MiniGame.h @@ -43,4 +43,4 @@ void SetInteractivePicture( std::string aStr, bool aVal ); void MiniGame_Init_Picture(); UINT32 MiniGame_Handle_Picture(); -#endif //__MINIGAME_H \ No newline at end of file +#endif //__MINIGAME_H diff --git a/Tactical/Morale.h b/Tactical/Morale.h index db146a76..c423faa3 100644 --- a/Tactical/Morale.h +++ b/Tactical/Morale.h @@ -160,4 +160,4 @@ void DailyMoraleUpdate( SOLDIERTYPE *pSoldier ); void DecayTacticalMoraleModifiers( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/PathAIDebug.h b/Tactical/PathAIDebug.h index 2bc3342e..0eec71c0 100644 --- a/Tactical/PathAIDebug.h +++ b/Tactical/PathAIDebug.h @@ -1 +1 @@ -//#define PATHAI_VISIBLE_DEBUG \ No newline at end of file +//#define PATHAI_VISIBLE_DEBUG diff --git a/Tactical/Rain.h b/Tactical/Rain.h index f7c78c74..de20e8b6 100644 --- a/Tactical/Rain.h +++ b/Tactical/Rain.h @@ -5,4 +5,4 @@ BOOLEAN IsItAllowedToRenderRain(); void RenderRain(); void ResetRain(); -#endif \ No newline at end of file +#endif diff --git a/Tactical/ShopKeeper Quotes.h b/Tactical/ShopKeeper Quotes.h index 48bd83f6..a7a05a10 100644 --- a/Tactical/ShopKeeper Quotes.h +++ b/Tactical/ShopKeeper Quotes.h @@ -83,4 +83,4 @@ enum #define ARNIE_QUOTE_NOT_REPAIRED_YET 33 -#endif \ No newline at end of file +#endif diff --git a/Tactical/SkillCheck.h b/Tactical/SkillCheck.h index d1e203b7..e166c09b 100644 --- a/Tactical/SkillCheck.h +++ b/Tactical/SkillCheck.h @@ -46,4 +46,4 @@ enum SkillChecks -#endif \ No newline at end of file +#endif diff --git a/Tactical/SkillMenu.h b/Tactical/SkillMenu.h index c24958d9..13676ff9 100644 --- a/Tactical/SkillMenu.h +++ b/Tactical/SkillMenu.h @@ -197,4 +197,4 @@ public: void EquipmentListMenu(); void EquipmentListMenuCancel(); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Ani.h b/Tactical/Soldier Ani.h index f18e5802..0865019f 100644 --- a/Tactical/Soldier Ani.h +++ b/Tactical/Soldier Ani.h @@ -15,4 +15,4 @@ BOOLEAN HandleCheckForDeathCommonCode( SOLDIERTYPE *pSoldier ); void KickOutWheelchair( SOLDIERTYPE *pSoldier ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index d98f9c01..06398454 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -600,4 +600,4 @@ INT32 ChooseHairColor( UINT8 usBodyType, INT32 skin ); // Flugente: set palettes for vest/shirt void SetClothes( SOLDIERTYPE* pSoldier, INT8 aVest, INT8 aPants, INT8 aHair = -1, INT8 aSkin = -1 ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Find.h b/Tactical/Soldier Find.h index de256761..e4e64dc4 100644 --- a/Tactical/Soldier Find.h +++ b/Tactical/Soldier Find.h @@ -53,4 +53,4 @@ void GetGridNoScreenPos( INT32 sGridNo, UINT8 ubLevel, INT16 *psScreenX, INT16 * -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Functions.h b/Tactical/Soldier Functions.h index 5bf64b68..a48fb12a 100644 --- a/Tactical/Soldier Functions.h +++ b/Tactical/Soldier Functions.h @@ -25,4 +25,4 @@ void HandleCrowShadowVisibility( SOLDIERTYPE *pSoldier ); BOOLEAN DoesSoldierWearGasMask(SOLDIERTYPE *pSoldier);//dnl ch40 200909 -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 785359da..85b2e5cf 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -3325,4 +3325,4 @@ void SectorAddDownedPilot( INT16 sMapX, INT16 sMapY, INT16 sMapZ ) // remove the flag. We can only find the pilot the first time we visit this sector after the heli was shut down pSector->usSectorInfoFlag &= ~SECTORINFO_ENEMYHELI_SHOTDOWN; } -} \ No newline at end of file +} diff --git a/Tactical/Soldier Init List.h b/Tactical/Soldier Init List.h index ac47d25d..d501c910 100644 --- a/Tactical/Soldier Init List.h +++ b/Tactical/Soldier Init List.h @@ -69,4 +69,4 @@ void SectorAddPrisonersofWar( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); // Flugente: decide wether to add a downed pilot if a helicopter was shot down here void SectorAddDownedPilot( INT16 sMapX, INT16 sMapY, INT16 sMapZ ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Soldier macros.h b/Tactical/Soldier macros.h index af0a32fe..a436a3cd 100644 --- a/Tactical/Soldier macros.h +++ b/Tactical/Soldier macros.h @@ -41,4 +41,4 @@ //#define OK_ENTERABLE_VEHICLE( p ) ( ( p->flags.uiStatusFlags & SOLDIER_VEHICLE ) && !TANK( p ) && p->stats.bLife >= OKLIFE ) #define OK_ENTERABLE_VEHICLE( p ) ( ( p->flags.uiStatusFlags & SOLDIER_VEHICLE ) && (!ARMED_VEHICLE( p ) || !(p->flags.uiStatusFlags & SOLDIER_ENEMY) ) && p->stats.bLife >= OKLIFE ) -#endif \ No newline at end of file +#endif diff --git a/Tactical/Spread burst.h b/Tactical/Spread burst.h index cfd040f2..fe074cfd 100644 --- a/Tactical/Spread burst.h +++ b/Tactical/Spread burst.h @@ -23,4 +23,4 @@ void AIPickBurstLocations( SOLDIERTYPE *pSoldier, INT8 bTargets, SOLDIERTYPE *pT void RenderAccumulatedBurstLocations( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Squads.h b/Tactical/Squads.h index 904cc5db..e37900d5 100644 --- a/Tactical/Squads.h +++ b/Tactical/Squads.h @@ -175,4 +175,4 @@ void CheckSquadMovementGroups( void ); //SQUAD10: Check for squads that are oversized at current resolution and move them to another squad void FixOversizedSquadsInSector( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Strategic Exit GUI.h b/Tactical/Strategic Exit GUI.h index 2bfb23df..b3cae78c 100644 --- a/Tactical/Strategic Exit GUI.h +++ b/Tactical/Strategic Exit GUI.h @@ -25,4 +25,4 @@ BOOLEAN HandleSectorExitMenu( ); void RemoveSectorExitMenu( BOOLEAN fOK ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/Structure Wrap.h b/Tactical/Structure Wrap.h index 0679e26c..5238a8be 100644 --- a/Tactical/Structure Wrap.h +++ b/Tactical/Structure Wrap.h @@ -53,4 +53,4 @@ BOOLEAN SetOpenableStructureToClosed( INT32 sGridNo, UINT8 ubLevel ); BOOLEAN IsJumpableWindowPresentAtGridNo( INT32 sGridNo , INT8 direction2, BOOLEAN fIntactWindowsAlso ); //legion 2 Windows BOOLEAN IsLegionWallPresentAtGridno( INT32 sGridNo ); //legion 2 Fence -#endif \ No newline at end of file +#endif diff --git a/Tactical/Tactical Turns.h b/Tactical/Tactical Turns.h index 173f2fd4..0a9ce4c1 100644 --- a/Tactical/Tactical Turns.h +++ b/Tactical/Tactical Turns.h @@ -4,4 +4,4 @@ void HandleTacticalEndTurn( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/TeamTurns.h b/Tactical/TeamTurns.h index 1d14dbcf..664f6b70 100644 --- a/Tactical/TeamTurns.h +++ b/Tactical/TeamTurns.h @@ -30,4 +30,4 @@ void EndTurnEvents( void ); BOOLEAN NPCFirstDraw( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/UI Cursors.h b/Tactical/UI Cursors.h index c74a1804..3c9af7cf 100644 --- a/Tactical/UI Cursors.h +++ b/Tactical/UI Cursors.h @@ -30,4 +30,4 @@ BOOLEAN GetMouseRecalcAndShowAPFlags( UINT32 *puiCursorFlags, BOOLEAN *pfShowAPs // based on how trained the shooter is. UINT32 ChanceToHitApproximation( SOLDIERTYPE * pSoldier, UINT32 uiChance ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/VehicleMenu.cpp b/Tactical/VehicleMenu.cpp index c5cb8e3c..ca4d704a 100644 --- a/Tactical/VehicleMenu.cpp +++ b/Tactical/VehicleMenu.cpp @@ -219,4 +219,4 @@ void VehicleMenu( INT32 usMapPos, SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ) pCurrentSoldier = pSoldier; pCurrentVehicle = pVehicle; gVehicleSelection.Setup(0); -} \ No newline at end of file +} diff --git a/Tactical/VehicleMenu.h b/Tactical/VehicleMenu.h index 7d5a418c..bd21ab3d 100644 --- a/Tactical/VehicleMenu.h +++ b/Tactical/VehicleMenu.h @@ -82,4 +82,4 @@ private: void VehicleMenu( INT32 usMapPos, SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVehicle ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/XML_HiddenNames.cpp b/Tactical/XML_HiddenNames.cpp index a3382066..c86f9840 100644 --- a/Tactical/XML_HiddenNames.cpp +++ b/Tactical/XML_HiddenNames.cpp @@ -212,4 +212,4 @@ void LoadHiddenNames() strcat(fileName, HIDDENNAMESFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHiddenNamesStats(zHiddenNames,fileName), HIDDENNAMESFILENAME); -} \ No newline at end of file +} diff --git a/Tactical/XML_LBEPocketPopup.cpp b/Tactical/XML_LBEPocketPopup.cpp index bcf2ed49..40c959bf 100644 --- a/Tactical/XML_LBEPocketPopup.cpp +++ b/Tactical/XML_LBEPocketPopup.cpp @@ -489,4 +489,4 @@ BOOLEAN ReadInLBEPocketPopups(STR fileName) return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_MercStartingGear.cpp b/Tactical/XML_MercStartingGear.cpp index e2430171..1713ea75 100644 --- a/Tactical/XML_MercStartingGear.cpp +++ b/Tactical/XML_MercStartingGear.cpp @@ -757,4 +757,4 @@ BOOLEAN WriteMercStartingGearStats() FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_RPCFacesSmall.cpp b/Tactical/XML_RPCFacesSmall.cpp index 0ff4d3c4..dee7f4c1 100644 --- a/Tactical/XML_RPCFacesSmall.cpp +++ b/Tactical/XML_RPCFacesSmall.cpp @@ -231,4 +231,4 @@ BOOLEAN WriteSmallFacesStats(RPC_SMALL_FACE_VALUES *pSmallFaces, STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/XML_RandomStats.cpp b/Tactical/XML_RandomStats.cpp index b1531b23..c9489e97 100644 --- a/Tactical/XML_RandomStats.cpp +++ b/Tactical/XML_RandomStats.cpp @@ -298,4 +298,4 @@ BOOLEAN WriteRandomStats( STR fileName) FileClose( hFile ); return( TRUE ); -} \ No newline at end of file +} diff --git a/Tactical/fov.h b/Tactical/fov.h index c1e115f6..82b57eff 100644 --- a/Tactical/fov.h +++ b/Tactical/fov.h @@ -20,4 +20,4 @@ void ExamineSlantRoofFOVSlots( ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/opplist.h b/Tactical/opplist.h index 9330b7e6..f63f3873 100644 --- a/Tactical/opplist.h +++ b/Tactical/opplist.h @@ -177,4 +177,4 @@ INT32 MaxDistanceVisible( void ); // HEADROCK HAM 3.6: Moved here from cpp void MakeBloodcatsHostile( void ); -#endif \ No newline at end of file +#endif diff --git a/Tactical/qarray.h b/Tactical/qarray.h index 19f57e68..8027ef55 100644 --- a/Tactical/qarray.h +++ b/Tactical/qarray.h @@ -29,4 +29,4 @@ extern QARRAY_VALUES QuoteExp[NUM_PROFILES]; -#endif \ No newline at end of file +#endif diff --git a/Tactical/rt time defines.h b/Tactical/rt time defines.h index 445ee50a..e112bc99 100644 --- a/Tactical/rt time defines.h +++ b/Tactical/rt time defines.h @@ -22,4 +22,4 @@ #define RT_COMPRESSION_TACTICAL_TURN_MODIFIER 10 -#endif \ No newline at end of file +#endif diff --git a/Tactical/soldier tile.h b/Tactical/soldier tile.h index 66ebf4cf..e20e3232 100644 --- a/Tactical/soldier tile.h +++ b/Tactical/soldier tile.h @@ -27,4 +27,4 @@ void SetDelayedTileWaiting( SOLDIERTYPE *pSoldier, INT32 sCauseGridNo, INT8 bVal BOOLEAN CanExchangePlaces( SOLDIERTYPE *pSoldier1, SOLDIERTYPE *pSoldier2, BOOLEAN fShow ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Ambient Control.cpp b/TileEngine/Ambient Control.cpp index 321ebcdc..cf42114a 100644 --- a/TileEngine/Ambient Control.cpp +++ b/TileEngine/Ambient Control.cpp @@ -721,4 +721,4 @@ void SetSSA(void) //guiCurrentSteadyStateSoundHandle = SoundPlay( zFileName, &spParms ); guiCurrentSteadyStateSoundHandle = SoundPlayStreamedFile(zFileName, &spParms); -} \ No newline at end of file +} diff --git a/TileEngine/Ambient Control.h b/TileEngine/Ambient Control.h index 2668d25e..01035d22 100644 --- a/TileEngine/Ambient Control.h +++ b/TileEngine/Ambient Control.h @@ -51,4 +51,4 @@ typedef struct -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Buildings.h b/TileEngine/Buildings.h index 998551cc..b7f9022c 100644 --- a/TileEngine/Buildings.h +++ b/TileEngine/Buildings.h @@ -29,4 +29,4 @@ void GenerateBuildings( void ); INT32 FindClosestClimbPoint( SOLDIERTYPE *pSoldier, INT32 sStartGridNo, INT32 sDesiredGridNo, BOOLEAN fClimbUp ); BOOLEAN SameBuilding( INT32 sGridNo1, INT32 sGridNo2 ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Fog Of War.h b/TileEngine/Fog Of War.h index 7ac4b40f..4dd33c30 100644 --- a/TileEngine/Fog Of War.h +++ b/TileEngine/Fog Of War.h @@ -5,4 +5,4 @@ //Removes and smooths the adjacent tiles. void RemoveFogFromGridNo( INT32 uiGridNo ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Interactive Tiles.h b/TileEngine/Interactive Tiles.h index 01ec0aa3..00700e0a 100644 --- a/TileEngine/Interactive Tiles.h +++ b/TileEngine/Interactive Tiles.h @@ -46,4 +46,4 @@ LEVELNODE *ConditionalGetCurInteractiveTileGridNoAndStructure( INT32 *psGridNo, -#endif \ No newline at end of file +#endif diff --git a/TileEngine/LightEffects.h b/TileEngine/LightEffects.h index 783f6695..fb34c466 100644 --- a/TileEngine/LightEffects.h +++ b/TileEngine/LightEffects.h @@ -58,4 +58,4 @@ BOOLEAN IsLightEffectAtTile( INT32 sGridNo ); void CreatePersonalLight( INT32 sGridNo, UINT8 ubID ); void RemovePersonalLights( UINT8 ubID ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Radar Screen.h b/TileEngine/Radar Screen.h index 666a7fc2..7d5b3adb 100644 --- a/TileEngine/Radar Screen.h +++ b/TileEngine/Radar Screen.h @@ -41,4 +41,4 @@ void ClearOutRadarMapImage( void ); // do we render the radar screen?..or the squad list? extern BOOLEAN fRenderRadarScreen; -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Render Fun.h b/TileEngine/Render Fun.h index e3d8ad4c..dda58f34 100644 --- a/TileEngine/Render Fun.h +++ b/TileEngine/Render Fun.h @@ -34,4 +34,4 @@ void ExamineGridNoForSlantRoofExtraGraphic( INT32 sCheckGridNo ); void SetRecalculateWireFrameFlagRadius(INT16 sX, INT16 sY, INT16 sRadius); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Shade Table Util.h b/TileEngine/Shade Table Util.h index c0cac312..e26e9588 100644 --- a/TileEngine/Shade Table Util.h +++ b/TileEngine/Shade Table Util.h @@ -13,4 +13,4 @@ extern BOOLEAN gfForceBuildShadeTables; BOOLEAN DeleteShadeTableDir( ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Simple Render Utils.h b/TileEngine/Simple Render Utils.h index ad1e1aa1..1e76db85 100644 --- a/TileEngine/Simple Render Utils.h +++ b/TileEngine/Simple Render Utils.h @@ -5,4 +5,4 @@ void MarkMapIndexDirty( INT32 iMapIndex ); void CenterScreenAtMapIndex( INT32 iMapIndex ); void MarkWorldDirty(); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/SmokeEffects.h b/TileEngine/SmokeEffects.h index 996a40d6..6b776e32 100644 --- a/TileEngine/SmokeEffects.h +++ b/TileEngine/SmokeEffects.h @@ -77,4 +77,4 @@ BOOLEAN CheckSmokeEffect(INT32 sGridNo, INT8 bLevel, INT8 bType); // find smoke effect on visible screen BOOLEAN FindVisibleSmokeEffect(INT8 bType); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Structure Internals.h b/TileEngine/Structure Internals.h index fcf95687..d05a043a 100644 --- a/TileEngine/Structure Internals.h +++ b/TileEngine/Structure Internals.h @@ -250,4 +250,4 @@ typedef struct TAG_STRUCTURE_FILE_HEADER #define STRUCTURE_FILE_CONTAINS_AUXIMAGEDATA 0x01 #define STRUCTURE_FILE_CONTAINS_STRUCTUREDATA 0x02 -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Tactical Placement GUI.h b/TileEngine/Tactical Placement GUI.h index 06307750..1571bf57 100644 --- a/TileEngine/Tactical Placement GUI.h +++ b/TileEngine/Tactical Placement GUI.h @@ -26,4 +26,4 @@ extern SOLDIERTYPE *gpTacticalPlacementHilightedSoldier; //Saved value. Contains the last choice for future battles. extern UINT8 gubDefaultButton; -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Tile Cache.h b/TileEngine/Tile Cache.h index 5cca3600..9753b3b2 100644 --- a/TileEngine/Tile Cache.h +++ b/TileEngine/Tile Cache.h @@ -45,4 +45,4 @@ void CheckForAndDeleteTileCacheStructInfo( LEVELNODE *pNode, UINT16 usIndex ); void GetRootName( STR8 pDestStr, const STR8 pSrcStr ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/Tile Surface.h b/TileEngine/Tile Surface.h index e19d8f93..4ccd6ecf 100644 --- a/TileEngine/Tile Surface.h +++ b/TileEngine/Tile Surface.h @@ -14,4 +14,4 @@ void DeleteTileSurface( PTILE_IMAGERY pTileSurf ); void SetRaisedObjectFlag( char *cFilename, TILE_IMAGERY *pTileSurf ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/World Tileset Enums.h b/TileEngine/World Tileset Enums.h index a9039b98..7c90c5b3 100644 --- a/TileEngine/World Tileset Enums.h +++ b/TileEngine/World Tileset Enums.h @@ -170,4 +170,4 @@ enum }; #endif -#endif \ No newline at end of file +#endif diff --git a/TileEngine/WorldDat.h b/TileEngine/WorldDat.h index f70dfa3f..5d020aa2 100644 --- a/TileEngine/WorldDat.h +++ b/TileEngine/WorldDat.h @@ -34,4 +34,4 @@ void SetTilesetTwoTerrainValues( ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/physics.h b/TileEngine/physics.h index e27d8aad..4ff5afdf 100644 --- a/TileEngine/physics.h +++ b/TileEngine/physics.h @@ -183,4 +183,4 @@ INT32 RandomGridFromRadius( INT32 sSweetGridNo, INT8 ubMinRadius, INT8 ubMaxRad UINT32 GetArtilleryTargetGridNo( UINT32 sTargetGridNo, INT8 bRadius ); BOOLEAN GetArtilleryLaunchParams(UINT32 sStartingGridNo, UINT32 sTargetGridNo, UINT8 ubTargetLevel, INT16 sStartZ, INT16 sEndZ, UINT16 usLauncher, OBJECTTYPE* pObj, FLOAT* pdForce, FLOAT* pdDegrees); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/pits.h b/TileEngine/pits.h index 0ffb99c1..3dbff9e6 100644 --- a/TileEngine/pits.h +++ b/TileEngine/pits.h @@ -17,4 +17,4 @@ extern BOOLEAN gfLoadPitsWithoutArming; void HandleFallIntoPitFromAnimation( UINT8 ubID ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/renderworld.h b/TileEngine/renderworld.h index 140e5d5f..124487e6 100644 --- a/TileEngine/renderworld.h +++ b/TileEngine/renderworld.h @@ -227,4 +227,4 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip(UINT16 *pBuffer, UINT32 uiD BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows = FALSE); BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, HVOBJECT hAlphaVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows = FALSE); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/structure.h b/TileEngine/structure.h index d9fd6793..a5bf6bd5 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -136,4 +136,4 @@ UINT8 StructureFlagToType( UINT32 uiFlag ); UINT32 GetStructureOpenSound( STRUCTURE *pStructure, BOOLEAN fClose ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/sysutil.h b/TileEngine/sysutil.h index f067d71f..5b460d63 100644 --- a/TileEngine/sysutil.h +++ b/TileEngine/sysutil.h @@ -18,4 +18,4 @@ BOOLEAN InitializeSystemVideoObjects( ); BOOLEAN InitializeGameVideoObjects( ); -#endif \ No newline at end of file +#endif diff --git a/TileEngine/worldman.h b/TileEngine/worldman.h index 7e504d12..37773459 100644 --- a/TileEngine/worldman.h +++ b/TileEngine/worldman.h @@ -179,4 +179,4 @@ BOOLEAN IsLegionLevel( INT32 sGridNo ); BOOLEAN FindStruct(INT32 sSpot, INT8 bLevel, UINT16 usIndex); BOOLEAN FindStructFlag(INT32 sSpot, INT8 bLevel, UINT32 uiFlag); -#endif \ No newline at end of file +#endif diff --git a/Utils/Animated ProgressBar.h b/Utils/Animated ProgressBar.h index ac9aab75..d1beb047 100644 --- a/Utils/Animated ProgressBar.h +++ b/Utils/Animated ProgressBar.h @@ -149,4 +149,4 @@ void SetProgressBarRenderBuffer( UINT32 ubID , UINT32 uiBufferID ); void CreateProgressBarNoBorder( UINT8 ubProgressBarID, UINT16 usLeft, UINT16 usTop, UINT16 usRight, UINT16 usBottom ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Cinematics Bink.h b/Utils/Cinematics Bink.h index f45ec3d4..7989488b 100644 --- a/Utils/Cinematics Bink.h +++ b/Utils/Cinematics Bink.h @@ -46,4 +46,4 @@ void BinkShutdownVideo(void); BINKFLIC *BinkPlayFlic(const CHAR8 *cFilename, UINT32 uiLeft, UINT32 uiTop, UINT32 uiFlags ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Cursors.h b/Utils/Cursors.h index 0a763a15..32f194a2 100644 --- a/Utils/Cursors.h +++ b/Utils/Cursors.h @@ -318,4 +318,4 @@ void SetCursorFlags( UINT32 uiCursor, UINT8 ubFlags ); void RemoveCursorFlags( UINT32 uiCursor, UINT8 ubFlags ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Debug Control.h b/Utils/Debug Control.h index 8d562fa5..3609c3d9 100644 --- a/Utils/Debug Control.h +++ b/Utils/Debug Control.h @@ -55,4 +55,4 @@ extern void AiDbgMessage( CHAR8 *Str); #endif -#endif \ No newline at end of file +#endif diff --git a/Utils/Encrypted File.cpp b/Utils/Encrypted File.cpp index 4238886b..16886459 100644 --- a/Utils/Encrypted File.cpp +++ b/Utils/Encrypted File.cpp @@ -230,4 +230,4 @@ void DecodeString(STR16 pDestString, UINT32 uiSeekAmount) // } //#endif } -} \ No newline at end of file +} diff --git a/Utils/Encrypted File.h b/Utils/Encrypted File.h index 110b31d5..26806730 100644 --- a/Utils/Encrypted File.h +++ b/Utils/Encrypted File.h @@ -7,4 +7,4 @@ BOOLEAN LoadEncryptedDataFromFile(STR pFileName, STR16 pDestString, UINT32 uiSee BOOLEAN LoadEncryptedDataFromFileRandomLine(STR pFileName, STR16 pDestString, UINT32 uiSeekAmount); void DecodeString(STR16 pDestString, UINT32 uiSeekAmount); -#endif \ No newline at end of file +#endif diff --git a/Utils/ExportStrings.h b/Utils/ExportStrings.h index f2156ed5..bd228813 100644 --- a/Utils/ExportStrings.h +++ b/Utils/ExportStrings.h @@ -6,4 +6,4 @@ namespace Loc bool ExportStrings(); } -#endif // _EXPORTSTRINGS_H_ \ No newline at end of file +#endif // _EXPORTSTRINGS_H_ diff --git a/Utils/Multi Language Graphic Utils.h b/Utils/Multi Language Graphic Utils.h index dcedbcc1..44d0bf07 100644 --- a/Utils/Multi Language Graphic Utils.h +++ b/Utils/Multi Language Graphic Utils.h @@ -50,4 +50,4 @@ enum BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Multilingual Text Code Generator.h b/Utils/Multilingual Text Code Generator.h index 653fd559..1df17a81 100644 --- a/Utils/Multilingual Text Code Generator.h +++ b/Utils/Multilingual Text Code Generator.h @@ -9,4 +9,4 @@ BOOLEAN ProcessIfMultilingualCmdLineArgDetected( STR8 str ); //macro function out #define ProcessIfMultilingualCmdLineArgDetected( a ) 0 -#endif \ No newline at end of file +#endif diff --git a/Utils/PopUpBox.h b/Utils/PopUpBox.h index 033e6227..dbdb0cdb 100644 --- a/Utils/PopUpBox.h +++ b/Utils/PopUpBox.h @@ -167,4 +167,4 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ); // min width for box void SpecifyBoxMinWidth( INT32 hBoxHandle, INT32 iMinWidth ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Quantize Wrap.h b/Utils/Quantize Wrap.h index daec31a1..92003163 100644 --- a/Utils/Quantize Wrap.h +++ b/Utils/Quantize Wrap.h @@ -18,4 +18,4 @@ void MapPalette( UINT8 *pDest, UINT8 *pSrc, INT16 sWidth, INT16 sHeight, INT16 s -#endif \ No newline at end of file +#endif diff --git a/Utils/Quantize.h b/Utils/Quantize.h index 508ebdeb..0a3e15ec 100644 --- a/Utils/Quantize.h +++ b/Utils/Quantize.h @@ -40,4 +40,4 @@ protected: void GetPaletteColors (NODE* pTree, RGBQUAD* prgb, UINT* pIndex); }; -#endif \ No newline at end of file +#endif diff --git a/Utils/STIConvert.h b/Utils/STIConvert.h index 39d44ba8..4cfb1f34 100644 --- a/Utils/STIConvert.h +++ b/Utils/STIConvert.h @@ -9,4 +9,4 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s UINT32 ETRLECompressSubImage( UINT8 * pDest, UINT32 uiDestLen, UINT8 * p8BPPBuffer, UINT16 usWidth, UINT16 usHeight, STCISubImage * pSubImage ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Sound Control.h b/Utils/Sound Control.h index 51a31a9b..656be5ce 100644 --- a/Utils/Sound Control.h +++ b/Utils/Sound Control.h @@ -465,4 +465,4 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ); -#endif \ No newline at end of file +#endif diff --git a/Utils/Text Input.h b/Utils/Text Input.h index ad6d60df..c713056c 100644 --- a/Utils/Text Input.h +++ b/Utils/Text Input.h @@ -192,4 +192,4 @@ void KillClipboard(); extern BOOLEAN gfNoScroll; -#endif \ No newline at end of file +#endif diff --git a/Utils/Timer Control.h b/Utils/Timer Control.h index 50636184..16b25c3b 100644 --- a/Utils/Timer Control.h +++ b/Utils/Timer Control.h @@ -129,4 +129,4 @@ void ZeroTimeCounter(INT32& timer); #define ZEROTIMECOUNTER(c) ZeroTimeCounter(c) void SetTileAnimCounter( INT32 iTime ); -#endif \ No newline at end of file +#endif diff --git a/Utils/XML_Language.h b/Utils/XML_Language.h index 3269c316..a039faa6 100644 --- a/Utils/XML_Language.h +++ b/Utils/XML_Language.h @@ -14,4 +14,4 @@ typedef struct extern LANGUAGE_LOCATION zlanguageText[1000]; -#endif \ No newline at end of file +#endif diff --git a/Utils/XML_SenderNameList.cpp b/Utils/XML_SenderNameList.cpp index e0bedaee..6baad540 100644 --- a/Utils/XML_SenderNameList.cpp +++ b/Utils/XML_SenderNameList.cpp @@ -167,4 +167,4 @@ BOOLEAN ReadInSenderNameList(STR fileName, BOOLEAN localizedVersion) return( TRUE ); -} \ No newline at end of file +} diff --git a/Utils/maputility.h b/Utils/maputility.h index 276af932..26084b9b 100644 --- a/Utils/maputility.h +++ b/Utils/maputility.h @@ -5,4 +5,4 @@ void GenerateAllMapsInit(void); #endif -#endif \ No newline at end of file +#endif diff --git a/Utils/message.h b/Utils/message.h index cb2e94e7..360a764d 100644 --- a/Utils/message.h +++ b/Utils/message.h @@ -118,4 +118,4 @@ void DisplayLastMessage( void ); */ -#endif \ No newline at end of file +#endif diff --git a/Utils/popup_callback.h b/Utils/popup_callback.h index 8bceddc7..f38b103e 100644 --- a/Utils/popup_callback.h +++ b/Utils/popup_callback.h @@ -337,4 +337,4 @@ }; }; -#endif \ No newline at end of file +#endif diff --git a/Utils/popup_class.cpp b/Utils/popup_class.cpp index b35cee4b..fec319e9 100644 --- a/Utils/popup_class.cpp +++ b/Utils/popup_class.cpp @@ -1861,4 +1861,4 @@ void popupMouseClickCallback(MOUSE_REGION *pRegion, INT32 iReason) if (p) { p->MenuBtnCallBack(pRegion, iReason); } -} \ No newline at end of file +} diff --git a/Utils/popup_definition.cpp b/Utils/popup_definition.cpp index 25b3f0dd..261db649 100644 --- a/Utils/popup_definition.cpp +++ b/Utils/popup_definition.cpp @@ -232,4 +232,4 @@ return applyPopupContentGenerator( popup, this->generatorId ); } - \ No newline at end of file + diff --git a/Utils/popup_definition.h b/Utils/popup_definition.h index 2b687f8f..79a3e5bd 100644 --- a/Utils/popup_definition.h +++ b/Utils/popup_definition.h @@ -106,4 +106,4 @@ protected: UINT16 generatorId; }; -#endif \ No newline at end of file +#endif diff --git a/ext/VFS/src/Core/files.cmake b/ext/VFS/src/Core/files.cmake index ce308133..ab8fa54e 100644 --- a/ext/VFS/src/Core/files.cmake +++ b/ext/VFS/src/Core/files.cmake @@ -77,4 +77,4 @@ set(${mod}_files ${INCLUDE_Core_Interface} ${SOURCE_Core_Interface} ${INCLUDE_Core_Location} ${SOURCE_Core_Location} CACHE INTERNAL "" -) \ No newline at end of file +) diff --git a/ext/export/src/ja2/Structure Internals.h b/ext/export/src/ja2/Structure Internals.h index 3d86fe57..639e74a9 100644 --- a/ext/export/src/ja2/Structure Internals.h +++ b/ext/export/src/ja2/Structure Internals.h @@ -240,4 +240,4 @@ typedef struct TAG_STRUCTURE_FILE_HEADER #define STRUCTURE_FILE_CONTAINS_AUXIMAGEDATA 0x01 #define STRUCTURE_FILE_CONTAINS_STRUCTUREDATA 0x02 -#endif \ No newline at end of file +#endif diff --git a/ext/export/src/ja2/Types.h b/ext/export/src/ja2/Types.h index b6e9ba28..78047e54 100644 --- a/ext/export/src/ja2/Types.h +++ b/ext/export/src/ja2/Types.h @@ -100,4 +100,4 @@ typedef VECTOR4 MATRIX4[4]; // 4x4 matrix typedef VECTOR4 COLOR; // rgba color array -#endif \ No newline at end of file +#endif diff --git a/sgp/Button Sound Control.cpp b/sgp/Button Sound Control.cpp index a2479e9c..b9187034 100644 --- a/sgp/Button Sound Control.cpp +++ b/sgp/Button Sound Control.cpp @@ -180,4 +180,4 @@ void PlayButtonSound( INT32 iButtonID, INT32 iSoundType ) } -} \ No newline at end of file +} diff --git a/sgp/Compression.h b/sgp/Compression.h index f1fb6210..d9b9fefc 100644 --- a/sgp/Compression.h +++ b/sgp/Compression.h @@ -49,4 +49,4 @@ PTR CompressInit( BYTE * pUncompressedData, UINT32 uiDataSize ); UINT32 Compress( PTR pCompPtr, BYTE * pBuffer, UINT32 uiBufferLen ); void CompressFini( PTR pCompPtr ); -#endif \ No newline at end of file +#endif diff --git a/sgp/DirectDraw Calls.h b/sgp/DirectDraw Calls.h index e94ed8c5..f7ba9a91 100644 --- a/sgp/DirectDraw Calls.h +++ b/sgp/DirectDraw Calls.h @@ -95,4 +95,4 @@ HRESULT BltDDSurfaceUsingSoftware( LPDIRECTDRAWSURFACE2 pDestSurface, LPRECT pDe #endif -#endif // __DirectDraw_Calls_H__ \ No newline at end of file +#endif // __DirectDraw_Calls_H__ diff --git a/sgp/DirectX Common.h b/sgp/DirectX Common.h index af2c448c..e25890da 100644 --- a/sgp/DirectX Common.h +++ b/sgp/DirectX Common.h @@ -26,4 +26,4 @@ extern "C" { } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/Ja2 Libs.h b/sgp/Ja2 Libs.h index 72d67aaa..87319f10 100644 --- a/sgp/Ja2 Libs.h +++ b/sgp/Ja2 Libs.h @@ -58,4 +58,4 @@ }; -#endif \ No newline at end of file +#endif diff --git a/sgp/english.h b/sgp/english.h index 09d1f54a..8ac75ff1 100644 --- a/sgp/english.h +++ b/sgp/english.h @@ -128,4 +128,4 @@ #define COMMA 188 #define FULLSTOP 190 -#endif \ No newline at end of file +#endif diff --git a/sgp/imgfmt.h b/sgp/imgfmt.h index 1d3b4463..6bdb6919 100644 --- a/sgp/imgfmt.h +++ b/sgp/imgfmt.h @@ -89,4 +89,4 @@ typedef struct #define STCI_PALETTE_ELEMENT_SIZE 3 #define STCI_8BIT_PALETTE_SIZE 768 -#endif \ No newline at end of file +#endif diff --git a/sgp/input.h b/sgp/input.h index a6ac866b..e045be02 100644 --- a/sgp/input.h +++ b/sgp/input.h @@ -151,4 +151,4 @@ extern BOOLEAN gfSGPInputReceived; } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/mousesystem_macros.h b/sgp/mousesystem_macros.h index 2670f71e..1e081e90 100644 --- a/sgp/mousesystem_macros.h +++ b/sgp/mousesystem_macros.h @@ -37,4 +37,4 @@ extern void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type, UINT16 Xcoord, UINT16 Ycoor } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/pcx.h b/sgp/pcx.h index 555eef6b..db3a3a59 100644 --- a/sgp/pcx.h +++ b/sgp/pcx.h @@ -37,4 +37,4 @@ BOOLEAN LoadPCXFileToImage( HIMAGE hImage, UINT16 fContents ); PcxObject *LoadPcx(STR8 pFilename); BOOLEAN BlitPcxToBuffer( PcxObject *pCurrentPcxObject, UINT8 *pBuffer, UINT16 usBufferWidth, UINT16 usBufferHeight, UINT16 usX, UINT16 usY, BOOLEAN fTransp); -#endif \ No newline at end of file +#endif diff --git a/sgp/soundman.h b/sgp/soundman.h index be09f429..ac29eb72 100644 --- a/sgp/soundman.h +++ b/sgp/soundman.h @@ -105,4 +105,4 @@ extern void SoundLog(CHAR8 *strMessage); #endif */ -#endif \ No newline at end of file +#endif diff --git a/sgp/timer.h b/sgp/timer.h index e94e9ea5..75770151 100644 --- a/sgp/timer.h +++ b/sgp/timer.h @@ -27,4 +27,4 @@ UINT32 ClockIsTicking(TIMER uiTimer); } #endif -#endif \ No newline at end of file +#endif diff --git a/sgp/vsurface_private.h b/sgp/vsurface_private.h index 29310d90..b60cc0a7 100644 --- a/sgp/vsurface_private.h +++ b/sgp/vsurface_private.h @@ -15,4 +15,4 @@ LPDIRECTDRAWPALETTE GetVideoSurfaceDDPalette( HVSURFACE hVSurface ); HVSURFACE CreateVideoSurfaceFromDDSurface( LPDIRECTDRAWSURFACE2 lpDDSurface ); -#endif \ No newline at end of file +#endif From 184b44c386e4f67f0ff13530f4bebe3424948fc1 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Sat, 14 Dec 2024 19:41:19 -0300 Subject: [PATCH 216/571] a couple consistency extension changes iniErrorReport is a log file, all other log files have .log extension, so make it consistent with that make Ja2_settings.ini's extension lowercase. OCD, sorry. --- Ja2/GameSettings.cpp | 2 +- Ja2/jascreens.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index e6ac7a4f..054da671 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -45,7 +45,7 @@ #include #include -#define GAME_SETTINGS_FILE "Ja2_Settings.INI" +#define GAME_SETTINGS_FILE "Ja2_Settings.ini" #define FEATURE_FLAGS_FILE "Ja2_Features.ini" diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index b431dd2e..b1dfe4e8 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -397,7 +397,7 @@ UINT32 InitScreenHandle(void) // Handle queued .ini file error messages int y = 40; sgp::Logger_ID ini_id = sgp::Logger::instance().createLogger(); - sgp::Logger::instance().connectFile(ini_id, L"iniErrorReport.txt", false, sgp::Logger::FLUSH_ON_DELETE); + sgp::Logger::instance().connectFile(ini_id, L"iniErrorReport.log", false, sgp::Logger::FLUSH_ON_DELETE); sgp::Logger::LogInstance logger = sgp::Logger::instance().logger(ini_id); while (! iniErrorMessages.empty()) { static BOOL iniErrorMessage_create_out_file = TRUE; @@ -407,7 +407,7 @@ UINT32 InitScreenHandle(void) if (iniErrorMessage_create_out_file) { y += 25; - swprintf( str, L"%S", "Warning: found the following ini errors. iniErrorReport.txt has been created." ); + swprintf( str, L"%S", "Warning: found the following ini errors. iniErrorReport.log has been created." ); DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_ORANGE, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED ); iniErrorMessage_create_out_file = FALSE; } From 2fcba8b9f76885018fe03a0686e2a83ed45f87f4 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Mon, 16 Dec 2024 09:54:54 +0100 Subject: [PATCH 217/571] Reworked foodsystem exclusive items: no food items if the food system is off whether the item is exclusive is defined by tag in items.xml replaced previous way of decision, which used Item[usItemIndex].foodtype > 0 as criteria that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.) --- Tactical/Item Types.h | 1 + Tactical/Items.cpp | 13 ++++++++----- Tactical/Items.h | 1 + Utils/XML_Items.cpp | 7 +++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 78f1f5d5..37ba1be2 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -871,6 +871,7 @@ extern OBJECTTYPE gTempObject; #define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments #define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments #define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments +#define ITEM_FoodSystemExclusive 0x0000080000000000 // kitty: item exclusively available with food feature // ---------------------------------------------------------------- diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 10ac4652..5dd52f89 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1271,12 +1271,14 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness ) return FALSE; - // silversurfer: no food items if the food system is off - if ( !UsingFoodSystem() && Item[ usItemIndex ].foodtype > 0 ) + + // kitty: no food items if the food system is off + // whether the item is exclusive is defined by tag + // replaced previous system which used Item[usItemIndex].foodtype > 0 as criteria + // that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.) + if (!gGameExternalOptions.fFoodSystem && ItemIsOnlyInFood(usItemIndex)) { - // Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. - if ( Food[Item[usItemIndex].foodtype].bFoodPoints > 0 ) - return FALSE; + return FALSE; } // kitty: no disease items if the disease system is off @@ -16128,3 +16130,4 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_Di BOOLEAN ItemProvidesRobotCamo(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotCamo); } BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotNightVision); } BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotLaserBonus); } +BOOLEAN ItemIsOnlyInFood(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_FoodSystemExclusive); } diff --git a/Tactical/Items.h b/Tactical/Items.h index 6aa26659..cf58ac72 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -251,6 +251,7 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem); BOOLEAN ItemProvidesRobotCamo(UINT16 usItem); BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem); BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem); +BOOLEAN ItemIsOnlyInFood(UINT16 usItem); //Existing functions without header def's, added them here, just incase I'll need to call //them from the editor. diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 412a96fa..d1ecf8a6 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -1592,6 +1592,12 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.iTransportGroupMaxProgress = (INT8)atoi(pData->szCharData); } + else if (strcmp(name, "FoodSystemExclusive") == 0) + { + pData->curElement = ELEMENT; + if ((BOOLEAN)atol(pData->szCharData)) + pData->curItem.usItemFlag2 |= ITEM_FoodSystemExclusive; + } --pData->maxReadDepth; } @@ -2225,6 +2231,7 @@ BOOLEAN WriteItemStats() if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + if (ItemIsOnlyInFood(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\r\n"); } From 0bd932f20fb4b7408e9c65cf8c1c6818523bf00d Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:13:37 +0100 Subject: [PATCH 218/571] Simplified rework foodsystem allowed items simplified the previous commit, now no more need for a tag when checking IsItemLegal for Food System, ontop of checking for foodpoints, now also check if is drug as a result, as previously, all eatable food will be excluded without food system, but now only if it isn't a drug at the same time and no more tag to check for that in items.xml needed --- Tactical/Item Types.h | 1 - Tactical/Items.cpp | 16 +++++++--------- Tactical/Items.h | 1 - Utils/XML_Items.cpp | 7 ------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 37ba1be2..78f1f5d5 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -871,7 +871,6 @@ extern OBJECTTYPE gTempObject; #define ITEM_fProvidesRobotCamo 0x0000010000000000 // rftr: robot attachments #define ITEM_fProvidesRobotNightVision 0x0000020000000000 // rftr: robot attachments #define ITEM_fProvidesRobotLaserBonus 0x0000040000000000 // rftr: robot attachments -#define ITEM_FoodSystemExclusive 0x0000080000000000 // kitty: item exclusively available with food feature // ---------------------------------------------------------------- diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 5dd52f89..1dd9c4c6 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1271,14 +1271,13 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness ) return FALSE; - - // kitty: no food items if the food system is off - // whether the item is exclusive is defined by tag - // replaced previous system which used Item[usItemIndex].foodtype > 0 as criteria - // that also restricted dual use items (i.e. drugs that also have a foodtype, like coffee, etc.) - if (!gGameExternalOptions.fFoodSystem && ItemIsOnlyInFood(usItemIndex)) - { - return FALSE; + // silversurfer: no food items if the food system is off + if (!UsingFoodSystem() && Item[usItemIndex].foodtype > 0) + { + // silversurfer: Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. + // kitty: and only if food isn't a drug at the same time, to make sure using those drugs without food system is possible + if (Food[Item[usItemIndex].foodtype].bFoodPoints > 0 && Item[usItemIndex].drugtype == 0 ) + return FALSE; } // kitty: no disease items if the disease system is off @@ -16130,4 +16129,3 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_Di BOOLEAN ItemProvidesRobotCamo(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotCamo); } BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotNightVision); } BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_fProvidesRobotLaserBonus); } -BOOLEAN ItemIsOnlyInFood(UINT16 usItem) { return HasItemFlag2(usItem, ITEM_FoodSystemExclusive); } diff --git a/Tactical/Items.h b/Tactical/Items.h index cf58ac72..6aa26659 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -251,7 +251,6 @@ BOOLEAN ItemIsOnlyInDisease(UINT16 usItem); BOOLEAN ItemProvidesRobotCamo(UINT16 usItem); BOOLEAN ItemProvidesRobotNightvision(UINT16 usItem); BOOLEAN ItemProvidesRobotLaserBonus(UINT16 usItem); -BOOLEAN ItemIsOnlyInFood(UINT16 usItem); //Existing functions without header def's, added them here, just incase I'll need to call //them from the editor. diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index d1ecf8a6..412a96fa 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -1592,12 +1592,6 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.iTransportGroupMaxProgress = (INT8)atoi(pData->szCharData); } - else if (strcmp(name, "FoodSystemExclusive") == 0) - { - pData->curElement = ELEMENT; - if ((BOOLEAN)atol(pData->szCharData)) - pData->curItem.usItemFlag2 |= ITEM_FoodSystemExclusive; - } --pData->maxReadDepth; } @@ -2231,7 +2225,6 @@ BOOLEAN WriteItemStats() if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInFood(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\r\n"); } From c7d021f5f3dccb024ee9dddac29d25eb03d1ed70 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 21 Dec 2024 23:04:07 +0200 Subject: [PATCH 219/571] Read updated items.xml format Requires accompanying GameDir change. Removed ItemFlag as an xml tag and added bitmask flags as their own individual tags. Makes modding easier when the flags can be modified without math in the xml files --- Tactical/Item Types.h | 52 ++-- Utils/XML_Items.cpp | 600 +++++++++++++++++++++++++++++------------- 2 files changed, 438 insertions(+), 214 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 78f1f5d5..44a8b23d 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -738,18 +738,18 @@ extern OBJECTTYPE gTempObject; // note that these should not be used to determine what kind of an attachment an item is, that is determined by attachmentclass and the AC_xxx flags above #define BLOOD_BAG 0x00000001 //1 // this item is a blood bag can can be used to boost surgery #define MANPAD 0x00000002 //2 // this item is a MAn-Portable Air-Defense System -#define BEARTRAP 0x00000004 //4 // a mechanical trap that does no explosion, but causes leg damage to whoever activates it +#define BEARTRAP 0x00000004 //4 // a mechanical trap that does no explosion, but causes leg damage to whoever activates it #define CAMERA 0x00000008 //8 #define WATER_DRUM 0x00000010 //16 // water drums allow to refill canteens in the sector they are in #define MEAT_BLOODCAT 0x00000020 //32 // retrieve this by gutting a bloodcat #define MEAT_COW 0x00000040 //64 // retrieve this by gutting a cow -#define BELT_FED 0x00000080 //128 // item can be fed externally +#define BELT_FED 0x00000080 //128 // item can be fed externally #define AMMO_BELT 0x00000100 //256 // this item can be used to feed externally #define AMMO_BELT_VEST 0x00000200 //512 // this is a vest that can contain AMMO_BELT items in its medium slots -#define CAMO_REMOVAL 0x00000400 //1024 // item can be used to remove camo -#define CLEANING_KIT 0x00000800 //2048 // weapon cleaning kit +#define CAMO_REMOVAL 0x00000400 //1024 // item can be used to remove camo +#define CLEANING_KIT 0x00000800 //2048 // weapon cleaning kit #define ATTENTION_ITEM 0x00001000 //4096 // this item is 'interesting' to the AI. Dumb soldiers may try to pick it up #define GAROTTE 0x00002000 //8192 // this item is a garotte @@ -758,18 +758,18 @@ extern OBJECTTYPE gTempObject; #define SKIN_BLOODCAT 0x00010000 //65536 // retrieve this by skinning (=decapitating) a bloodcat #define NO_METAL_DETECTION 0x00020000 //131072 // a planted bomb with this flag can NOT be detected via metal detector. Use sparingly! -#define JUMP_GRENADE 0x00040000 //262144 // add +25 heigth to explosion, used for bouncing grenades and jumping mines +#define JUMP_GRENADE 0x00040000 //262144 // add +25 heigth to explosion, used for bouncing grenades and jumping mines #define HANDCUFFS 0x00080000 //524288 // item can be used to capture soldiers #define TASER 0x00100000 //1048576 // item is a taser, melee hits with this will drain breath (if batteries are supplied) -#define SCUBA_BOTTLE 0x00200000 //2097152 // item is a scuba gear air bottle +#define SCUBA_BOTTLE 0x00200000 //2097152 // item is a scuba gear air bottle #define SCUBA_MASK 0x00400000 //4194304 // item is a scuba gear breathing mask #define SCUBA_FINS 0x00800000 //8388608 // this item speed up swimming, but slows walking and running -#define TRIPWIREROLL 0x01000000 //16777216 // this item is a tripwire roll +#define TRIPWIREROLL 0x01000000 //16777216 // this item is a tripwire roll #define RADIO_SET 0x02000000 //33554432 // item can be used to radio militia/squads in other sectors -#define SIGNAL_SHELL 0x04000000 //67108864 // this is a signal shell that precedes artillery barrages -#define SODA 0x08000000 //134217728 // item is a can of soda, sold in vending machines +#define SIGNAL_SHELL 0x04000000 //67108864 // this is a signal shell that precedes artillery barrages +#define SODA 0x08000000 //134217728 // item is a can of soda, sold in vending machines #define ROOF_COLLAPSE_ITEM 0x10000000 //268435456 // this item is required in the collapsing of roof tiles. It is used internally and should never be seen by the player #define DISEASEPROTECTION_1 0x20000000 //536870912 // this item protects us from getting diseases by human contact if kept in inventory @@ -787,40 +787,40 @@ extern OBJECTTYPE gTempObject; #define ITEM_sinks 0x0000004000000000 #define ITEM_showstatus 0x0000008000000000 -#define ITEM_hiddenaddon 0x0000010000000000 +#define ITEM_hiddenaddon 0x0000010000000000 #define ITEM_twohanded 0x0000020000000000 #define ITEM_notbuyable 0x0000040000000000 #define ITEM_attachment 0x0000080000000000 #define ITEM_hiddenattachment 0x0000100000000000 #define ITEM_biggunlist 0x0000200000000000 -#define ITEM_notineditor 0x0000400000000000 +#define ITEM_notineditor 0x0000400000000000 #define ITEM_defaultundroppable 0x0000800000000000 #define ITEM_unaerodynamic 0x0001000000000000 #define ITEM_electronic 0x0002000000000000 #define ITEM_cannon 0x0004000000000000 -#define ITEM_rocketrifle 0x0008000000000000 +#define ITEM_rocketrifle 0x0008000000000000 #define ITEM_fingerprintid 0x0010000000000000 #define ITEM_metaldetector 0x0020000000000000 -#define ITEM_gasmask 0x0040000000000000 +#define ITEM_gasmask 0x0040000000000000 #define ITEM_lockbomb 0x0080000000000000 #define ITEM_flare 0x0100000000000000 -#define ITEM_grenadelauncher 0x0200000000000000 +#define ITEM_grenadelauncher 0x0200000000000000 #define ITEM_mortar 0x0400000000000000 #define ITEM_duckbill 0x0800000000000000 #define ITEM_detonator 0x1000000000000000 -#define ITEM_remotedetonator 0x2000000000000000 -#define ITEM_hidemuzzleflash 0x4000000000000000 +#define ITEM_remotedetonator 0x2000000000000000 +#define ITEM_hidemuzzleflash 0x4000000000000000 #define ITEM_rocketlauncher 0x8000000000000000 // New UINT64 Item Flag => usItemFlag2 #define ITEM_singleshotrocketlauncher 0x00000001 #define ITEM_brassknuckles 0x00000002 -#define ITEM_crowbar 0x00000004 +#define ITEM_crowbar 0x00000004 #define ITEM_glgrenade 0x00000008 #define ITEM_flakjacket 0x00000010 @@ -829,17 +829,17 @@ extern OBJECTTYPE gTempObject; #define ITEM_needsbatteries 0x00000080 #define ITEM_xray 0x00000100 -#define ITEM_wirecutters 0x00000200 -#define ITEM_toolkit 0x00000400 -#define ITEM_firstaidkit 0x00000800 +#define ITEM_wirecutters 0x00000200 +#define ITEM_toolkit 0x00000400 +#define ITEM_firstaidkit 0x00000800 #define ITEM_medicalkit 0x00001000 -#define ITEM_canteen 0x00002000 -#define ITEM_jar 0x00004000 +#define ITEM_canteen 0x00002000 +#define ITEM_jar 0x00004000 #define ITEM_canandstring 0x00008000 -#define ITEM_marbles 0x00010000 -#define ITEM_walkman 0x00020000 +#define ITEM_marbles 0x00010000 +#define ITEM_walkman 0x00020000 #define ITEM_remotetrigger 0x00040000 #define ITEM_robotremotecontrol 0x00080000 @@ -849,7 +849,7 @@ extern OBJECTTYPE gTempObject; #define ITEM_antitankmine 0x00800000 #define ITEM_hardware 0x01000000 -#define ITEM_medical 0x02000000 +#define ITEM_medical 0x02000000 #define ITEM_gascan 0x04000000 #define ITEM_containsliquid 0x08000000 @@ -863,7 +863,7 @@ extern OBJECTTYPE gTempObject; #define ITEM_tripwireactivation 0x0000000400000000 // item (mine) can be activated by nearby tripwire #define ITEM_tripwire 0x0000000800000000 // item is tripwire -#define ITEM_directional 0x0000001000000000 // item is a directional mine/bomb (actual direction is set upon planting) +#define ITEM_directional 0x0000001000000000 // item is a directional mine/bomb (actual direction is set upon planting) #define ITEM_blockironsight 0x0000002000000000 // if a gun or any attachment have this property, the iron sight won't be usable (if there is at least one other usable sight) #define ITEM_fAllowClimbing 0x0000004000000000 // JMich: BackpackClimb does item allow climbing while wearing it #define ITEM_cigarette 0x0000008000000000 // Flugente: this item can be smoked diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 412a96fa..0373b4aa 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -205,7 +205,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "CamouflageKit") == 0 || strcmp(name, "LocksmithKit") == 0 || strcmp(name, "Mine") == 0 || - strcmp(name, "antitankmine" ) == 0 || + strcmp(name, "AntitankMine" ) == 0 || strcmp(name, "GasCan") == 0 || strcmp(name, "ContainsLiquid") == 0 || strcmp(name, "Rock") == 0 || @@ -248,7 +248,7 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "RecoilModifierX") == 0 || strcmp(name, "RecoilModifierY") == 0 || strcmp(name, "PercentRecoilModifier") == 0 || - strcmp(name, "barrel") == 0 || + strcmp(name, "Barrel") == 0 || strcmp(name, "usOverheatingCooldownFactor") == 0 || strcmp(name, "overheatTemperatureModificator") == 0 || strcmp(name, "overheatCooldownModificator") == 0 || @@ -284,16 +284,16 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "SleepModifier") == 0 || strcmp(name, "usSpotting") == 0 || strcmp(name, "sBackpackWeightModifier") == 0 || - strcmp(name, "fAllowClimbing") == 0 || + strcmp(name, "AllowClimbing") == 0 || strcmp(name, "cigarette" ) == 0 || strcmp(name, "usPortionSize" ) == 0 || - strcmp(name, "diseaseprotectionface" ) == 0 || - strcmp(name, "diseaseprotectionhand" ) == 0|| + strcmp(name, "DiseaseprotectionFace" ) == 0 || + strcmp(name, "DiseaseprotectionHand" ) == 0|| strcmp(name, "usRiotShieldStrength" ) == 0 || strcmp(name, "usRiotShieldGraphic" ) == 0 || - strcmp(name, "bloodbag" ) == 0 || - strcmp(name, "emptybloodbag" ) == 0 || - strcmp(name, "medicalsplint" ) == 0 || + strcmp(name, "Bloodbag" ) == 0 || + strcmp(name, "EmptyBloodbag" ) == 0 || + strcmp(name, "MedicalSplint" ) == 0 || strcmp(name, "sFireResistance" ) == 0 || strcmp(name, "usAdministrationModifier" ) == 0) || strcmp(name, "RobotDamageReduction") == 0 || @@ -1098,7 +1098,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ((BOOLEAN)atol(pData->szCharData)) pData->curItem.usItemFlag2 |= ITEM_mine; } - else if ( strcmp( name, "antitankmine" ) == 0 ) + else if ( strcmp( name, "AntitankMine" ) == 0 ) { pData->curElement = ELEMENT; if ((BOOLEAN)atol(pData->szCharData)) @@ -1277,7 +1277,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) } // Flugente - else if(strcmp(name, "barrel") == 0) + else if(strcmp(name, "Barrel") == 0) { pData->curElement = ELEMENT; if ((BOOLEAN)atol(pData->szCharData)) @@ -1342,11 +1342,6 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ((BOOLEAN)atol(pData->szCharData)) pData->curItem.usItemFlag2 |= ITEM_blockironsight; } - else if(strcmp(name, "ItemFlag") == 0) - { - pData->curElement = ELEMENT; - pData->curItem.usItemFlag = (UINT64) strtoul(pData->szCharData, NULL, 0); - } else if(strcmp(name, "FoodType") == 0) { pData->curElement = ELEMENT; @@ -1448,7 +1443,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.sBackpackWeightModifier = (INT16)atol(pData->szCharData); } - else if (strcmp(name, "fAllowClimbing") == 0) + else if (strcmp(name, "AllowClimbing") == 0) { pData->curElement = ELEMENT; if ((BOOLEAN)atol(pData->szCharData)) @@ -1466,7 +1461,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curItem.usPortionSize = (UINT8)atol( pData->szCharData ); } // Flugente: simple tags in the xml get translated into flags - else if ( strcmp( name, "diseaseprotectionface" ) == 0 ) + else if ( strcmp( name, "DiseaseprotectionFace" ) == 0 ) { pData->curElement = ELEMENT; BOOLEAN val = (BOOLEAN)atol( pData->szCharData ); @@ -1474,7 +1469,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ( val ) pData->curItem.usItemFlag |= DISEASEPROTECTION_1; } - else if ( strcmp( name, "diseaseprotectionhand" ) == 0 ) + else if ( strcmp( name, "DiseaseprotectionHand" ) == 0 ) { pData->curElement = ELEMENT; BOOLEAN val = (BOOLEAN)atol( pData->szCharData ); @@ -1492,21 +1487,224 @@ itemEndElementHandle(void *userData, const XML_Char *name) pData->curElement = ELEMENT; pData->curItem.usRiotShieldGraphic = (UINT16)atol( pData->szCharData ); } - else if ( strcmp( name, "bloodbag" ) == 0 ) + else if ( strcmp( name, "Bloodbag" ) == 0 ) { pData->curElement = ELEMENT; if ( (BOOLEAN)atol( pData->szCharData ) ) pData->curItem.usItemFlag |= BLOOD_BAG; } - else if ( strcmp( name, "emptybloodbag" ) == 0 ) + else if ( strcmp( name, "Manpad" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= MANPAD; + } + else if ( strcmp( name, "Beartrap" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= BEARTRAP; + } + else if ( strcmp( name, "Camera" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CAMERA; + } + else if ( strcmp( name, "Waterdrum" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= WATER_DRUM; + } + else if ( strcmp( name, "BloodcatMeat" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= MEAT_BLOODCAT; + } + else if ( strcmp( name, "CowMeat" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= MEAT_COW; + } + else if ( strcmp( name, "Beltfed" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= BELT_FED; + } + else if ( strcmp( name, "Ammobelt" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= AMMO_BELT; + } + else if ( strcmp( name, "AmmobeltVest" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= AMMO_BELT_VEST; + } + else if ( strcmp( name, "CamoRemoval" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CAMO_REMOVAL; + } + else if ( strcmp( name, "Cleaningkit" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CLEANING_KIT; + } + else if ( strcmp( name, "AttentionItem" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= ATTENTION_ITEM; + } + else if ( strcmp( name, "Garotte" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= GAROTTE; + } + else if ( strcmp( name, "Covert" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= COVERT; + } + else if ( strcmp( name, "Corpse" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= CORPSE; + } + else if ( strcmp( name, "BloodcatSkin" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SKIN_BLOODCAT; + } + else if ( strcmp( name, "NoMetalDetection" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= NO_METAL_DETECTION; + } + else if ( strcmp( name, "JumpGrenade" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= JUMP_GRENADE; + } + else if ( strcmp( name, "Handcuffs" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= HANDCUFFS; + } + else if ( strcmp( name, "Taser" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= TASER; + } + else if ( strcmp( name, "ScubaBottle" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SCUBA_BOTTLE; + } + else if ( strcmp( name, "ScubaMask" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SCUBA_MASK; + } + else if ( strcmp( name, "ScubaFins" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SCUBA_FINS; + } + else if ( strcmp( name, "TripwireRoll" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= TRIPWIREROLL; + } + else if ( strcmp( name, "Radioset" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= RADIO_SET; + } + else if ( strcmp( name, "SignalShell" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SIGNAL_SHELL; + } + else if ( strcmp( name, "Soda" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= SODA; + } + else if ( strcmp( name, "RoofcollapseItem" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= ROOF_COLLAPSE_ITEM; + } + else if ( strcmp( name, "LBEexplosionproof" ) == 0 ) + { + pData->curElement = ELEMENT; + + if ( (BOOLEAN)atol( pData->szCharData ) ) + pData->curItem.usItemFlag |= LBE_EXPLOSIONPROOF; + } + else if ( strcmp( name, "EmptyBloodbag" ) == 0 ) { pData->curElement = ELEMENT; if ( (BOOLEAN)atol( pData->szCharData ) ) pData->curItem.usItemFlag |= EMPTY_BLOOD_BAG; } - else if ( strcmp( name, "medicalsplint" ) == 0 ) + else if ( strcmp( name, "MedicalSplint" ) == 0 ) { pData->curElement = ELEMENT; @@ -1971,153 +2169,88 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\r\n"); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemClass); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasAttachmentClass); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasLayoutClass); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubClassIndex); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCursor); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bSoundType); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasAttachmentClass); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nasLayoutClass); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubClassIndex); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCursor); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bSoundType); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubGraphicType); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubGraphicNum); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubWeight); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubPerPocket); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ItemSize); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPrice); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCoolness); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bReliability); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRepairEase); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubWeight); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubPerPocket); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ItemSize); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPrice); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubCoolness); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bReliability); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRepairEase); - if (ItemIsDamageable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRepairable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDamagedByWater(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMetal(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemSinks(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (HasItemFlag2(cnt, ITEM_showstatus)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsHiddenAddon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsTwoHanded(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsNotBuyable(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsHiddenAttachment(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInTonsOfGuns(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInScifi(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInNIV(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsNotInEditor(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsUndroppableByDefault(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsUnaerodynamic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsElectronic(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemHasHiddenMuzzleFlash(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubAttachmentSystem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubAttachmentSystem ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].inseparable ); - FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][0] ); - FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][1] ); - FilePrintf(hFile,"\t\t%d\r\n", WeaponROF[cnt]); + FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][0] ); + FilePrintf(hFile,"\t\t%d\r\n", StoreInventory[cnt][1] ); + FilePrintf(hFile,"\t\t%d\r\n", WeaponROF[cnt]); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentnoisereduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bipod ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tohitbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].aimbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].minrangeforaimbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentnoisereduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bipod ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].tohitbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].aimbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].minrangeforaimbonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].magsizebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rateoffirebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bulletspeedbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].burstsizebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bestlaserrange ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bursttohitbonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].autofiretohitbonus); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].APBonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].rateoffirebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bulletspeedbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].burstsizebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bestlaserrange ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bursttohitbonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].autofiretohitbonus); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].APBonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentburstfireapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentautofireapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreadytimeapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreloadtimeapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentapreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentstatusdrainreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentburstfireapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentautofireapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreadytimeapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentreloadtimeapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentapreduction ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentstatusdrainreduction ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].meleedamagebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].damagebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].meleedamagebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].discardedlauncheritem ); - if (ItemIsMortar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsSingleShotRocketLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGrenadeLauncher(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDuckbill(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGLgrenade(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsATMine(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRocketRifle(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemHasFingerPrintID(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCannon(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); for(UINT8 cnt2 = 0; cnt2 < MAX_DEFAULT_ATTACHMENTS; cnt2++){ if(Item[cnt].defaultattachments[cnt2] != 0){ - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].defaultattachments[cnt2] ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].defaultattachments[cnt2] ); } } - if (ItemIsBrassKnuckles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCrowbar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRock(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bloodieditem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camobonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].urbanCamobonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].desertCamobonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].snowCamobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].camobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].urbanCamobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].desertCamobonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].snowCamobonus ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].stealthbonus ); - if (ItemIsFlakJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsLeatherJacket(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRemoteDetonator(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRemoteTrigger(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsLockBomb(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsFlare(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsRobotRemote(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsWalkman(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsThermalOptics(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGasmask(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].hearingrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].visionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nightvisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].dayvisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cavevisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brightlightvisionrangebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].itemsizebonus ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percenttunnelvision ); - FilePrintf(hFile,"\t\t%3.2f\r\n", Item[cnt].alcohol ); - - if (ItemIsHardware(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMedical(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCamoKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsLocksmithKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsToolkit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsFirstAidKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMedicalKit(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsWirecutters(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCanteen(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsGascan(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMarbles(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCanAndString(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsJar(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemHasXRay(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemNeedsBatteries(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemContainsLiquid(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsMetalDetector(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].visionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].nightvisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].dayvisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].cavevisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].brightlightvisionrangebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].itemsizebonus ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percenttunnelvision ); + FilePrintf(hFile,"\t\t%3.2f\r\n", Item[cnt].alcohol ); // HEADROCK HAM 4: Print out new values FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].scopemagfactor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].projectionfactor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentaccuracymodifier ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierX ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierY ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].PercentRecoilModifier ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].projectionfactor ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].percentaccuracymodifier ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierX ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].RecoilModifierY ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].PercentRecoilModifier ); // HEADROCK HAM 4: Print out stance-based values FilePrintf(hFile,"\t\t\r\n"); @@ -2130,7 +2263,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].percentdropcompensationmodifier[0] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].maxcounterforcemodifier[0] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].counterforceaccuracymodifier[0] ); - FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[0] ); + FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[0] ); FilePrintf(hFile,"\t\t\r\n"); FilePrintf(hFile,"\t\t\r\n"); @@ -2143,7 +2276,7 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].percentdropcompensationmodifier[1] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].maxcounterforcemodifier[1] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].counterforceaccuracymodifier[1] ); - FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[1] ); + FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[1] ); FilePrintf(hFile,"\t\t\r\n"); FilePrintf(hFile,"\t\t\r\n"); @@ -2156,58 +2289,42 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].percentdropcompensationmodifier[2] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].maxcounterforcemodifier[2] ); FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].counterforceaccuracymodifier[2] ); - FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[2] ); + FilePrintf(hFile,"\t\t\t%d\r\n", Item[cnt].aimlevelsmodifier[2] ); FilePrintf(hFile,"\t\t\r\n"); // Flugente FTW 1.2 - if (ItemIsBarrel(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].usOverheatingCooldownFactor ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatTemperatureModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatCooldownModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatJamThresholdModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatDamageThresholdModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].usOverheatingCooldownFactor ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatTemperatureModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatCooldownModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatJamThresholdModificator ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].overheatDamageThresholdModificator ); - FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].attachmentclass ); - - if (ItemHasTripwireActivation(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsTripwire(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsDirectional(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemBlocksIronsight(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemFlag ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].foodtype ); + FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].attachmentclass ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].drugtype ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].foodtype ); //JMich_SkillModifiers: Adding the values here as well - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].LockPickModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].LockPickModifier ); FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].CrowbarModifier ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].DisarmModifier ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].RepairModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].DisarmModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].RepairModifier ); FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].usHackingModifier ); - FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].usBurialModifier ); + FilePrintf(hFile, "\t\t%d\r\n", Item[cnt].usBurialModifier ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usDamageChance ); FilePrintf(hFile,"\t\t%4.2f\r\n", Item[cnt].dirtIncreaseFactor ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usActionItemFlag ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].clothestype ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].randomitem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usActionItemFlag ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].clothestype ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].randomitem ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].randomitemcoolnessmodificator ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usFlashLightRange ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemChoiceTimeSetting ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usBuddyItem ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubSleepModifier ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usSpotting ); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sBackpackWeightModifier); - FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPortionSize ); - - if (ItemAllowsClimbing(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsCigarette(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if ( HasItemFlag( cnt, DISEASEPROTECTION_1 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, DISEASEPROTECTION_2 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, BLOOD_BAG) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, EMPTY_BLOOD_BAG ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( HasItemFlag( cnt, MEDICAL_SPLINT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usFlashLightRange ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usItemChoiceTimeSetting ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usBuddyItem ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].ubSleepModifier ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usSpotting ); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].sBackpackWeightModifier); + FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usPortionSize ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usRiotShieldStrength ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].usRiotShieldGraphic ); @@ -2221,10 +2338,117 @@ BOOLEAN WriteItemStats() FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotChassisSkillGrant ); FilePrintf(hFile,"\t\t%d\r\n", Item[cnt].bRobotUtilitySkillGrant ); - if (ItemProvidesRobotCamo(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemProvidesRobotNightvision(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemProvidesRobotLaserBonus(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); - if (ItemIsOnlyInDisease(cnt)) FilePrintf(hFile, "\t\t%d\r\n", 1); + // usItemFlag + if ( HasItemFlag( cnt, BLOOD_BAG ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MANPAD ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, BEARTRAP ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CAMERA ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, WATER_DRUM ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MEAT_BLOODCAT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MEAT_COW ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, BELT_FED ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, AMMO_BELT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, AMMO_BELT_VEST ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CAMO_REMOVAL ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CLEANING_KIT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, ATTENTION_ITEM ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, GAROTTE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, COVERT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, CORPSE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SKIN_BLOODCAT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, NO_METAL_DETECTION ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, JUMP_GRENADE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, HANDCUFFS ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, TASER ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SCUBA_BOTTLE ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SCUBA_MASK ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SCUBA_FINS ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, TRIPWIREROLL ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, RADIO_SET ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SIGNAL_SHELL ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, SODA ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, ROOF_COLLAPSE_ITEM ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, DISEASEPROTECTION_1 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, DISEASEPROTECTION_2 ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, LBE_EXPLOSIONPROOF ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, EMPTY_BLOOD_BAG ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, MEDICAL_SPLINT ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDamageable( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRepairable( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDamagedByWater( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMetal( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemSinks( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( HasItemFlag( cnt, ITEM_showstatus ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsHiddenAddon( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsTwoHanded( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsNotBuyable( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsAttachment( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsHiddenAttachment( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInTonsOfGuns( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsNotInEditor( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsUndroppableByDefault( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsUnaerodynamic( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsElectronic( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCannon( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRocketRifle( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasFingerPrintID( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMetalDetector( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGasmask( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsLockBomb( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsFlare( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGrenadeLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMortar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDuckbill( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRemoteDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasHiddenMuzzleFlash( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRocketLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + + // usItemFlag2 + if ( ItemIsSingleShotRocketLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsBrassKnuckles( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCrowbar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGLgrenade( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsFlakJacket( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsLeatherJacket( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsBatteries( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemNeedsBatteries( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasXRay( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsWirecutters( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsToolkit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsFirstAidKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMedicalKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCanteen( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsJar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCanAndString( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMarbles( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsWalkman( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRemoteTrigger( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRobotRemote( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCamoKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsLocksmithKit( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMine( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsATMine( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsHardware( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsMedical( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsGascan( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemContainsLiquid( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsRock( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsThermalOptics( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInScifi( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInNIV( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsOnlyInDisease( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsBarrel( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemHasTripwireActivation( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsTripwire( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsDirectional( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemBlocksIronsight( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemAllowsClimbing( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemIsCigarette( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemProvidesRobotCamo( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemProvidesRobotNightvision( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + if ( ItemProvidesRobotLaserBonus( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); + FilePrintf(hFile,"\t\r\n"); } From 7fa8ff930b42550567bf0436972600047d66d628 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 21 Dec 2024 23:16:22 +0200 Subject: [PATCH 220/571] Remove unused tag PercentCounterForceFrequency is never read from items.xml and INVTYPE doesn't have a field for it either --- Utils/XML_Items.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 0373b4aa..a92ce594 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -353,7 +353,6 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "PercentDropCompensation") == 0 || strcmp(name, "PercentMaxCounterForce") == 0 || strcmp(name, "PercentCounterForceAccuracy") == 0 || - strcmp(name, "PercentCounterForceFrequency") == 0 || strcmp(name, "AimLevels") == 0)) { pData->curElement = ELEMENT_SUBLIST_PROPERTY; From a580052e40c3c92c6ecda00b0110c4ce82779cd1 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 19:24:40 +0200 Subject: [PATCH 221/571] Read new tags Maybe *this* time it'll finally be fixed. Sigh... --- Utils/XML_Items.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index a92ce594..0b2c3c91 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -291,7 +291,36 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at strcmp(name, "DiseaseprotectionHand" ) == 0|| strcmp(name, "usRiotShieldStrength" ) == 0 || strcmp(name, "usRiotShieldGraphic" ) == 0 || - strcmp(name, "Bloodbag" ) == 0 || + strcmp(name, "Bloodbag") == 0 || + strcmp(name, "Manpad" ) == 0 || + strcmp(name, "Beartrap") == 0 || + strcmp(name, "Camera") == 0 || + strcmp(name, "Waterdrum") == 0 || + strcmp(name, "BloodcatMeat") == 0 || + strcmp(name, "CowMeat") == 0 || + strcmp(name, "Beltfed") == 0 || + strcmp(name, "Ammobelt") == 0 || + strcmp(name, "AmmobeltVest") == 0 || + strcmp(name, "CamoRemoval") == 0 || + strcmp(name, "Cleaningkit") == 0 || + strcmp(name, "AttentionItem") == 0 || + strcmp(name, "Garotte") == 0 || + strcmp(name, "Covert") == 0 || + strcmp(name, "Corpse") == 0 || + strcmp(name, "BloodcatSkin") == 0 || + strcmp(name, "NoMetalDetection") == 0 || + strcmp(name, "JumpGrenade") == 0 || + strcmp(name, "Handcuffs") == 0 || + strcmp(name, "Taser") == 0 || + strcmp(name, "ScubaBottle") == 0 || + strcmp(name, "ScubaMask") == 0 || + strcmp(name, "ScubaFins") == 0 || + strcmp(name, "TripwireRoll") == 0 || + strcmp(name, "Radioset") == 0 || + strcmp(name, "SignalShell") == 0 || + strcmp(name, "Soda") == 0 || + strcmp(name, "RoofcollapseItem") == 0 || + strcmp(name, "LBEexplosionproof") == 0 || strcmp(name, "EmptyBloodbag" ) == 0 || strcmp(name, "MedicalSplint" ) == 0 || strcmp(name, "sFireResistance" ) == 0 || From c88fbbe7495fcbc683de4f5cc7a372829c0ec110 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:40:10 +0200 Subject: [PATCH 222/571] Fix assertion error due to too long filenames --- Editor/LoadScreen.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Editor/LoadScreen.cpp b/Editor/LoadScreen.cpp index 7c7d70b4..cba550c2 100644 --- a/Editor/LoadScreen.cpp +++ b/Editor/LoadScreen.cpp @@ -173,7 +173,15 @@ void LoadSaveScreenEntry() vfs::CVirtualProfile* prof = it.value(); memset(&FileInfo, 0, sizeof(GETFILESTRUCT)); strcpy(FileInfo.zFileName, "< "); - strcat(FileInfo.zFileName, prof->cName.utf8().c_str()); + // Cut filename off if it's too long for the buffer + if (strlen(prof->cName.utf8().c_str()) > FILENAME_BUFLEN-4) + { + strncpy(FileInfo.zFileName+1, prof->cName.utf8().c_str(), FILENAME_BUFLEN-4); + } + else + { + strcat(FileInfo.zFileName, prof->cName.utf8().c_str()); + } strcat(FileInfo.zFileName, " >"); FileInfo.zFileName[FILENAME_BUFLEN] = 0; FileInfo.uiFileAttribs = FILE_IS_DIRECTORY; From eb7837bc3ebf61697484f6995be93f83d404bff5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:41:02 +0200 Subject: [PATCH 223/571] Increase filename buffer length The mapeditor filedialog is big enough to show longer filenames than 20 characters. --- Editor/LoadScreen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor/LoadScreen.h b/Editor/LoadScreen.h index c8adac4c..24518194 100644 --- a/Editor/LoadScreen.h +++ b/Editor/LoadScreen.h @@ -1,7 +1,7 @@ #include "BuildDefines.h" #include "Fileman.h" -#define FILENAME_BUFLEN (20 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213 +#define FILENAME_BUFLEN (30 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213 #ifdef JA2EDITOR From 5b966b4df99fd0bebd9002a21101483aed9c90be Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:54:22 +0200 Subject: [PATCH 224/571] Provide MAX_TACTICAL_ENEMIES to lua --- Strategic/UndergroundInit.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Strategic/UndergroundInit.cpp b/Strategic/UndergroundInit.cpp index a5ea0904..d6b8c410 100644 --- a/Strategic/UndergroundInit.cpp +++ b/Strategic/UndergroundInit.cpp @@ -64,6 +64,7 @@ BOOLEAN LuaUnderground::InitializeSectorList() .TableOpen() .TParam("difficultyLevel", int(gGameOptions.ubDifficultyLevel)) .TParam("gameStyle", int(gGameOptions.ubGameStyle)) + .TParam("maxTacticalEnemies", int(gGameExternalOptions.ubGameMaximumNumberOfEnemies)) .TableClose(); SGP_THROW_IFFALSE(initsectorlist_func.Call(1), "call to lua function BuildUndergroundSectorList failed"); From f4f48f23c79209a0dab05d79e0369437aaf6c0e2 Mon Sep 17 00:00:00 2001 From: Marco Antonio Jaguaribe Costa Date: Tue, 24 Dec 2024 02:52:48 -0300 Subject: [PATCH 225/571] cmake: favor vertical layout and absolute paths for include_directories just the way git works should tilt us towards tall code rather than very long lines, easier for merging/conflicts --- CMakeLists.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e70ac481..403a2f55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,23 @@ set(usingMsBuild $) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE) -include_directories(Ja2 "ext/VFS/include" Utils TileEngine TacticalAI "ModularizedTacticalAI/include" Tactical Strategic sgp "Ja2/Res" Lua Laptop Multiplayer Editor Console) +include_directories( + "${CMAKE_SOURCE_DIR}/Ja2" + "${CMAKE_SOURCE_DIR}/ext/VFS/include" + "${CMAKE_SOURCE_DIR}/Utils" + "${CMAKE_SOURCE_DIR}/TileEngine" + "${CMAKE_SOURCE_DIR}/TacticalAI" + "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" + "${CMAKE_SOURCE_DIR}/Tactical" + "${CMAKE_SOURCE_DIR}/Strategic" + "${CMAKE_SOURCE_DIR}/sgp" + "${CMAKE_SOURCE_DIR}/Ja2/Res" + "${CMAKE_SOURCE_DIR}/Lua" + "${CMAKE_SOURCE_DIR}/Laptop" + "${CMAKE_SOURCE_DIR}/Multiplayer" + "${CMAKE_SOURCE_DIR}/Editor" + "${CMAKE_SOURCE_DIR}/Console" +) # external libraries add_subdirectory("ext/libpng") From c30b1c1b25a10a031e285400976145a327d64e23 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Dec 2024 22:45:31 +0200 Subject: [PATCH 226/571] Reimplement UB pricing for AIM --- Laptop/AimMembers.cpp | 96 ++++++++++++++++++++++++++++++++++++------ Utils/Text.h | 1 + Utils/_ChineseText.cpp | 1 + Utils/_DutchText.cpp | 1 + Utils/_EnglishText.cpp | 1 + Utils/_FrenchText.cpp | 1 + Utils/_GermanText.cpp | 1 + Utils/_ItalianText.cpp | 1 + Utils/_PolishText.cpp | 1 + Utils/_RussianText.cpp | 1 + 10 files changed, 92 insertions(+), 13 deletions(-) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index aa045033..02d806cb 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -148,10 +148,16 @@ #define FEE_X PRICE_X + 7 #define FEE_Y NAME_Y #define FEE_WIDTH 37 +#define FEE_X_UB PRICE_X + 40 +#define FEE_Y_UB STATS_Y + 28 +#define FEE_Y_UB_NSGI STATS_Y #define AIM_CONTRACT_X PRICE_X + 51 #define AIM_CONTRACT_Y FEE_Y #define AIM_CONTRACT_WIDTH 59 +#define AIM_CONTRACT_X_UB PRICE_X + 19 +#define AIM_OFFER_X PRICE_X + 3 +#define AIM_OFFER_WIDTH 110 #define ONEDAY_X AIM_CONTRACT_X #define ONEWEEK_X AIM_CONTRACT_X @@ -1120,7 +1126,13 @@ BOOLEAN RenderAIMMembers() UpdateMercInfo(); + //Display AIM Member text + DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + //Draw fee & contract +#ifdef JA2UB + DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); +#else DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X_NSGI, FEE_Y_NSGI, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X_NSGI, AIM_CONTRACT_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -1129,9 +1141,6 @@ BOOLEAN RenderAIMMembers() DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X_NSGI, MARKSMAN_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X_NSGI, MECHANAICAL_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); - //Display AIM Member text - DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X_NSGI, AIM_MEMBER_ACTIVE_TEXT_Y_NSGI, AIM_MEMBER_ACTIVE_TEXT_WIDTH_NSGI, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - //Display Option Gear Cost text DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_MEMBER_OPTIONAL_GEAR_X_NSGI, EXPLOSIVE_Y_NSGI, AIM_CONTRACT_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -1140,6 +1149,7 @@ BOOLEAN RenderAIMMembers() InsertDollarSignInToString( wTemp ); uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X_NSGI + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR_NSGI], AIM_M_FONT_STATIC_TEXT) + 5; DrawTextToScreen(wTemp, AIM_MEMBER_OPTIONAL_GEAR_COST_X_NSGI, EXPLOSIVE_Y_NSGI, FEE_WIDTH_NSGI, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); +#endif // JA2UB } else { @@ -1163,6 +1173,12 @@ BOOLEAN RenderAIMMembers() UpdateMercInfo(); + //Display AIM Member text + DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); + +#ifdef JA2UB + DrawTextToScreen(CharacterInfo[AIM_MEMBER_UB_MISSION_FEE], AIM_CONTRACT_X_UB, AIM_CONTRACT_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); +#else //Draw fee & contract DrawTextToScreen(CharacterInfo[AIM_MEMBER_FEE], FEE_X, FEE_Y, 0, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_CONTRACT], AIM_CONTRACT_X, AIM_CONTRACT_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_PREV_NEXT_CONTACT, AIM_M_FEE_CONTRACT_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); @@ -1172,9 +1188,6 @@ BOOLEAN RenderAIMMembers() DrawTextToScreen(CharacterInfo[AIM_MEMBER_1_WEEK], ONEWEEK_X, MARKSMAN_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); DrawTextToScreen(CharacterInfo[AIM_MEMBER_2_WEEKS], TWOWEEK_X, MECHANAICAL_Y, AIM_CONTRACT_WIDTH, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); - //Display AIM Member text - DrawTextToScreen(CharacterInfo[AIM_MEMBER_ACTIVE_MEMBERS], AIM_MEMBER_ACTIVE_TEXT_X, AIM_MEMBER_ACTIVE_TEXT_Y, AIM_MEMBER_ACTIVE_TEXT_WIDTH, AIM_MAINTITLE_FONT, AIM_M_ACTIVE_MEMBER_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); - //Display Option Gear Cost text DrawTextToScreen(CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_MEMBER_OPTIONAL_GEAR_X, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_STATIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); @@ -1183,6 +1196,7 @@ BOOLEAN RenderAIMMembers() InsertDollarSignInToString( wTemp ); uiPosX = AIM_MEMBER_OPTIONAL_GEAR_X + StringPixLength( CharacterInfo[AIM_MEMBER_OPTIONAL_GEAR], AIM_M_FONT_STATIC_TEXT) + 5; DrawTextToScreen(wTemp, uiPosX, AIM_MEMBER_OPTIONAL_GEAR_Y, 0, AIM_M_FONT_STATIC_TEXT, AIM_M_COLOR_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); +#endif } DisableAimButton(); @@ -1309,6 +1323,10 @@ BOOLEAN UpdateMercInfo(void) if(gGameExternalOptions.gfUseNewStartingGearInterface) { +#ifdef JA2UB + DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X_UB, FEE_Y_UB_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT); + DisplayWrappedString(AIM_OFFER_X, AGILITY_Y_NSGI, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); +#else //Display the salaries DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH_NSGI, FEE_X_NSGI, HEALTH_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH_NSGI, FEE_X_NSGI, AGILITY_Y_NSGI, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); @@ -1335,6 +1353,8 @@ BOOLEAN UpdateMercInfo(void) else DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X_NSGI, AIM_MEDICAL_DEPOSIT_Y_NSGI, AIM_MEDICAL_DEPOSIT_WIDTH_NSGI, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } +#endif // JA2UB + if(!g_bUseXML_Strings) { // LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); @@ -1363,6 +1383,10 @@ BOOLEAN UpdateMercInfo(void) } else { +#ifdef JA2UB + DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X_UB, FEE_Y_UB, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT); + DisplayWrappedString(AIM_OFFER_X, AGILITY_Y, AIM_OFFER_WIDTH, 2, AIM_M_FONT_DYNAMIC_TEXT, AIM_FONT_MCOLOR_WHITE, zNewTacticalMessages[TACT_MSG__AIMMEMBER_FEE_TEXT], FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); +#else //Display the salaries DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].sSalary, FEE_WIDTH, FEE_X, HEALTH_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); DrawMoneyToScreen(gMercProfiles[gbCurrentSoldier].uiWeeklySalary, FEE_WIDTH, FEE_X, AGILITY_Y, AIM_M_NUMBER_FONT, AIM_M_COLOR_DYNAMIC_TEXT ); @@ -1389,6 +1413,7 @@ BOOLEAN UpdateMercInfo(void) else DisplayWrappedString(AIM_MEDICAL_DEPOSIT_X, AIM_MEDICAL_DEPOSIT_Y, AIM_MEDICAL_DEPOSIT_WIDTH, 2, AIM_FONT12ARIAL, AIM_M_COLOR_DYNAMIC_TEXT, sMedicalString, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED); } +#endif if(!g_bUseXML_Strings) { // LoadMercBioInfo( gbCurrentSoldier, MercInfoString, AdditionalInfoString); @@ -2528,6 +2553,21 @@ BOOLEAN DisplayVideoConferencingDisplay() DisplayMercChargeAmount(); +#ifdef JA2UB + if (gubVideoConferencingMode == AIM_VIDEO_HIRE_MERC_MODE) + { + CHAR16 offerText[190]; + swprintf(offerText, zNewTacticalMessages[TACT_MSG__AIMMEMBER_ONE_TIME_FEE], gMercProfiles[gbCurrentSoldier].zNickname); + const auto xCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_X + 115; + const auto yCoord = AIM_MEMBER_VIDEO_CONF_TERMINAL_Y + 45; + const auto textAreaWidth = 245; + SetFontShadow(AIM_M_VIDEO_NAME_SHADOWCOLOR); + DisplayWrappedString(xCoord, yCoord, textAreaWidth, 2, AIM_M_FONT_DYNAMIC_TEXT, FONT_MCOLOR_BLACK, offerText, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + SetFontShadow(DEFAULT_SHADOW); + } +#endif // JA2UB + + // if( gfMercIsTalking && !gfIsAnsweringMachineActive) if( gfMercIsTalking && gGameSettings.fOptions[ TOPTION_SUBTITLES ] ) { @@ -2577,6 +2617,9 @@ BOOLEAN DisplayMercsVideoFace() void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown) { +#ifdef JA2UB + return; +#else UINT16 i, usPosY, usPosX; //First draw the select light for the contract length buttons @@ -2630,6 +2673,8 @@ void DisplaySelectLights(BOOLEAN fContractDown, BOOLEAN fBuyEquipDown) usPosY += AIM_MEMBER_BUY_EQUIPMENT_GAP; } InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y); + +#endif // JA2UB } @@ -2653,7 +2698,10 @@ UINT32 DisplayMercChargeAmount() giContractAmount = 0; //the contract charge amount - +#ifdef JA2UB + // Special offer for a limited time! Act fast! + giContractAmount = gMercProfiles[gbCurrentSoldier].uiWeeklySalary; +#else // Get the salary rate if( gubContractLength == AIM_CONTRACT_LENGTH_ONE_DAY) giContractAmount = gMercProfiles[gbCurrentSoldier].sSalary; @@ -2675,6 +2723,7 @@ UINT32 DisplayMercChargeAmount() { giContractAmount += gMercProfiles[gbCurrentSoldier].usOptionalGearCost; } +#endif } @@ -2685,10 +2734,15 @@ UINT32 DisplayMercChargeAmount() //if the merc hasnt just been hired // if( FindSoldierByProfileID( gbCurrentSoldier, TRUE ) == NULL ) { +#ifdef JA2UB + // Don't even have to pay for medical insurance! What a DEAL! + swprintf(wTemp, L"%s", wDollarTemp); +#else if( gMercProfiles[ gbCurrentSoldier ].bMedicalDeposit ) swprintf(wTemp, L"%s %s", wDollarTemp, VideoConfercingText[AIM_MEMBER_WITH_MEDICAL] ); else swprintf(wTemp, L"%s", wDollarTemp ); +#endif // JA2UB DrawTextToScreen(wTemp, AIM_CONTRACT_CHARGE_AMOUNNT_X+1, AIM_CONTRACT_CHARGE_AMOUNNT_Y+3, 0, AIM_M_VIDEO_CONTRACT_AMOUNT_FONT, AIM_M_VIDEO_CONTRACT_AMOUNT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } @@ -3887,14 +3941,14 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) MSYS_DisableRegion(&gSelectedShutUpMercRegion); //Enable the ability to click on the BIG face to go to different screen - MSYS_EnableRegion(&gSelectedFaceRegion); + MSYS_EnableRegion(&gSelectedFaceRegion); // EnableDisableCurrentVideoConferenceButtons(FALSE); - if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) - { - // Enable the current video conference buttons - EnableDisableCurrentVideoConferenceButtons(FALSE); - } + if( gubVideoConferencingPreviousMode == AIM_VIDEO_HIRE_MERC_MODE ) + { + // Enable the current video conference buttons + EnableDisableCurrentVideoConferenceButtons(FALSE); + } fVideoConferenceCreated = FALSE; @@ -4085,6 +4139,22 @@ BOOLEAN InitDeleteVideoConferencePopUp( ) // InitVideoFaceTalking(gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT); DelayMercSpeech( gbCurrentSoldier, QUOTE_LENGTH_OF_CONTRACT, 750, TRUE, FALSE ); + +#ifdef JA2UB + // Disable and hide contract length & gear purchase buttons + gfBuyEquipment = TRUE; + for (size_t i = 0; i < 3; i++) + { + DisableButton(giContractLengthButton[i]); + HideButton(giContractLengthButton[i]); + + if (i < 2) + { + DisableButton(giBuyEquipmentButton[i]); + HideButton(giBuyEquipmentButton[i]); + } + } +#endif // JA2UB } diff --git a/Utils/Text.h b/Utils/Text.h index e2c3251c..a71e194d 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -1624,6 +1624,7 @@ enum AIM_MEMBER_GEAR_KIT_THREE, AIM_MEMBER_GEAR_KIT_FOUR, AIM_MEMBER_GEAR_KIT_FIVE, + AIM_MEMBER_UB_MISSION_FEE, TEXT_NUM_AIM_MEMBER_CHARINFO, }; extern STR16 CharacterInfo[]; diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 30fd7ce4..46845d9d 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -5916,6 +5916,7 @@ STR16 CharacterInfo[] = L"装备3", // Text on Starting Gear Selection Button 3 L"装备4", // Text on Starting Gear Selection Button 4 L"装备5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 4c56a70b..c6ddf46a 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -5919,6 +5919,7 @@ STR16 CharacterInfo[] = L"Uitrusting 3", // Text on Starting Gear Selection Button 3 L"Uitrusting 4", // Text on Starting Gear Selection Button 4 L"Uitrusting 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 820bef40..91d15743 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -5916,6 +5916,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 77fc295f..fb8e314b 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -5923,6 +5923,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 62bc2deb..721d099f 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -5827,6 +5827,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; //Aim Member.c diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 1968ae29..58a63f5c 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -5905,6 +5905,7 @@ STR16 CharacterInfo[] = L"Kit 3", // Text on Starting Gear Selection Button 3 L"Kit 4", // Text on Starting Gear Selection Button 4 L"Kit 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 379f3f5a..860c2887 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -5919,6 +5919,7 @@ STR16 CharacterInfo[] = L"Zestaw nr 3", // Text on Starting Gear Selection Button 3 L"Zestaw nr 4", // Text on Starting Gear Selection Button 4 L"Zestaw nr 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 9b9b99e2..62b72e2f 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -5912,6 +5912,7 @@ STR16 CharacterInfo[] = L"Ðабор 3", // Text on Starting Gear Selection Button 3 L"Ðабор 4", // Text on Starting Gear Selection Button 4 L"Ðабор 5", // Text on Starting Gear Selection Button 5 + L"Mission Fee", // For UB fixed price contracts }; From a9ab60e5e5b5a5e5aa5603fa4222aca209f039c3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 17:31:42 +0200 Subject: [PATCH 227/571] Fix road tiles for big maps --- Editor/Road Smoothing.cpp | 40 +++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/Editor/Road Smoothing.cpp b/Editor/Road Smoothing.cpp index 5f7376f5..26787509 100644 --- a/Editor/Road Smoothing.cpp +++ b/Editor/Road Smoothing.cpp @@ -403,14 +403,42 @@ void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID ) while( gRoadMacros[ i ].sMacroID == iMacroID ) { // need to recalc MACROSTRUCT::sOffset 'cause it sticked to 160*160 old map size - INT32 sdX = gRoadMacros[ i ].sOffset % OLD_WORLD_COLS; - INT32 sdY = gRoadMacros[ i ].sOffset / OLD_WORLD_COLS; - INT32 sOffset = sdY*WORLD_COLS + sdX; + INT32 sdY = gRoadMacros[ i ].sOffset / (OLD_WORLD_COLS); + INT32 sdX = gRoadMacros[ i ].sOffset - (sdY*OLD_WORLD_COLS); + + // Take into account the dfference between old and new row size for tiles that are shifted + // by one row due to X offset + // For example: + // {RBR, 159}, + //{ RBR, -159 }, + // + // Offsets for 160x160 map + // [] [] [-159] + // [] [0] [] + // [159] [] [] // - AddToUndoList( iMapIndex + sOffset ); - RemoveAllObjectsOfTypeRange( iMapIndex + sOffset, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); + // Converted to 200x200 map + // [] [] [-199] + // [] [0] [] + // [199] [] [] + // + // Without this the original conversion would output 159 and -159 for X coordinate + if (sdX < -OLD_WORLD_COLS/2) + { + sdX -= WORLD_COLS - OLD_WORLD_COLS; + } + else if (sdX > OLD_WORLD_COLS / 2) + { + sdX += WORLD_COLS - OLD_WORLD_COLS; + } + + INT32 sOffset = sdY*WORLD_COLS + sdX; + INT32 newGridNo = iMapIndex + sOffset; + + AddToUndoList( newGridNo ); + RemoveAllObjectsOfTypeRange( newGridNo, ROADPIECES, ROADPIECES );//dnl this was but is very wrong and leading to stacking tilesets, RemoveAllObjectsOfTypeRange( i, ROADPIECES, ROADPIECES ); GetTileIndexFromTypeSubIndex( ROADPIECES, (UINT16)(i+1) , &usTileIndex ); - AddObjectToHead( iMapIndex + sOffset, usTileIndex ); + AddObjectToHead( newGridNo, usTileIndex ); i++; } } From 22af6e8ec8fe94fb7405a1f3163b54427d955f7f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:09:33 +0200 Subject: [PATCH 228/571] Implement mousewheel scroll for selection window --- Editor/editscreen.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 1cd2ceb3..8fa8204f 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -2954,6 +2954,23 @@ UINT32 WaitForSelectionWindowResponse( void ) } } + // Mousewheel scroll + if (_WheelValue > 0) + { + while (_WheelValue--) + { + ScrollSelWinUp(); + } + } + else + { + while (_WheelValue++) + { + ScrollSelWinDown(); + } + } + _WheelValue = 0; + if ( DoWindowSelection( ) ) { fSelectionWindow = FALSE; From 5499d1fba2bfb3c588f6536d29cc0acf88bce21a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 21:09:45 +0200 Subject: [PATCH 229/571] Whitespace formatting --- Editor/editscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 8fa8204f..64eba6c4 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -1,4 +1,4 @@ - #include "builddefines.h" +#include "builddefines.h" #ifdef JA2EDITOR From 4ed7b1fb987cdf42c86599b3c776324f50c6a116 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Dec 2024 22:02:01 +0200 Subject: [PATCH 230/571] Increase selection window size --- Editor/selectwin.cpp | 96 +++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 36 deletions(-) diff --git a/Editor/selectwin.cpp b/Editor/selectwin.cpp index 06ee221b..baf826a4 100644 --- a/Editor/selectwin.cpp +++ b/Editor/selectwin.cpp @@ -29,6 +29,16 @@ extern BOOLEAN fDontUseRandom; extern UINT16 GenericButtonFillColors[40]; +struct SelectionWindow +{ + SGPRect window; + SGPPoint displayAreaStart; // Area where selectable items are drawn + SGPPoint displayAreaEnd; + SGPPoint spacing; // For displayed items +}; + +SelectionWindow gSelection; + BOOLEAN gfRenderSquareArea = FALSE; INT16 iStartClickX,iStartClickY; INT16 iEndClickX,iEndClickY; @@ -40,7 +50,6 @@ INT32 iSelectWin,iCancelWin,iScrollUp,iScrollDown,iOkWin; BOOLEAN fAllDone=FALSE; BOOLEAN fButtonsPresent=FALSE; -SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint; //These definitions help define the start and end of the various wall indices. //This needs to be maintained if the walls change. @@ -172,6 +181,30 @@ UINT16 SelWinHilightFillColor = 0x23BA; //blue, formerly 0x000d a kind of mediu // void CreateJA2SelectionWindow( INT16 sWhat ) { + auto selectWinWidth = 600; + const auto selectWinHeight = SCREEN_HEIGHT - 120; // From top edge to taskbar + if (iResolution > _800x600) + { + selectWinWidth = 900; + } + auto tlX = 0; + auto tlY = 0; + auto brX = tlX + selectWinWidth; + auto brY = tlY + selectWinHeight; + gSelection.window.iLeft = tlX; + gSelection.window.iTop = tlY; + gSelection.window.iRight = brX; + gSelection.window.iBottom = brY; + gSelection.displayAreaStart.iX = tlX + 1; + gSelection.displayAreaStart.iY = tlY + 15; + gSelection.displayAreaEnd.iX = brX - 1; + gSelection.displayAreaEnd.iY= brY - 1; + gSelection.spacing.iX = 2; + gSelection.spacing.iY = 2; + + iTopWinCutOff = gSelection.displayAreaStart.iY; + iBotWinCutOff = gSelection.displayAreaEnd.iY; + DisplaySpec *pDSpec; UINT16 usNSpecs; @@ -185,32 +218,33 @@ void CreateJA2SelectionWindow( INT16 sWhat ) iButtonIcons[ SEL_WIN_DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" ); iButtonIcons[ SEL_WIN_OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" ); - iSelectWin = CreateHotSpot(0, 0, 600, 360, MSYS_PRIORITY_HIGH, + + iSelectWin = CreateHotSpot(0, 0, selectWinWidth, selectWinHeight, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, SelWinClkCallback); iOkWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_OK_ICON], 0, - BUTTON_USE_DEFAULT, 600, 0, + BUTTON_USE_DEFAULT, selectWinWidth, 0, 40, 40, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, OkClkCallback); SetButtonFastHelpText(iOkWin,pDisplaySelectionWindowButtonText[0]); iCancelWin = CreateIconButton((INT16)iButtonIcons[SEL_WIN_CANCEL_ICON], 0, - BUTTON_USE_DEFAULT, 600, 40, + BUTTON_USE_DEFAULT, selectWinWidth, 40, 40, 40, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, CnclClkCallback); SetButtonFastHelpText(iCancelWin,pDisplaySelectionWindowButtonText[1]); iScrollUp = CreateIconButton((INT16)iButtonIcons[SEL_WIN_UP_ICON], 0, - BUTTON_USE_DEFAULT, 600, 80, + BUTTON_USE_DEFAULT, selectWinWidth, 80, 40, 160, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, UpClkCallback); SetButtonFastHelpText(iScrollUp,pDisplaySelectionWindowButtonText[2]); iScrollDown = CreateIconButton((INT16)iButtonIcons[SEL_WIN_DOWN_ICON], 0, - BUTTON_USE_DEFAULT, 600, 240, + BUTTON_USE_DEFAULT, selectWinWidth, 240, 40, 160, BUTTON_NO_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK, DwnClkCallback); @@ -218,18 +252,6 @@ void CreateJA2SelectionWindow( INT16 sWhat ) fButtonsPresent = TRUE; - SelWinSpacing.iX = 2; - SelWinSpacing.iY = 2; - - SelWinStartPoint.iX = 1; - SelWinStartPoint.iY = 15; - - iTopWinCutOff = 15; - - SelWinEndPoint.iX = 599; - SelWinEndPoint.iY = 359; - - iBotWinCutOff = 359; switch( sWhat ) { @@ -347,8 +369,8 @@ void CreateJA2SelectionWindow( INT16 sWhat ) return; } - BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint, - &SelWinSpacing, CLEAR_BACKGROUND); + BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &gSelection.displayAreaStart , &gSelection.displayAreaEnd, + &gSelection.spacing, CLEAR_BACKGROUND); } @@ -849,12 +871,14 @@ void RenderSelectionWindow( void ) return; ColorFillVideoSurfaceArea(FRAME_BUFFER, - 0, 0, 600, 400, - GenericButtonFillColors[0]); + gSelection.window.iLeft, gSelection.window.iTop, gSelection.window.iRight, gSelection.window.iBottom, + GenericButtonFillColors[0] + ); DrawSelections( ); MarkButtonsDirty(); RenderButtons( ); + // Draw selection rectangle if ( gfRenderSquareArea ) { button = ButtonList[iSelectWin]; @@ -862,7 +886,7 @@ void RenderSelectionWindow( void ) return; if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) || - (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) ) + (abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY)) > 9) ) { // iSX = (INT32)iStartClickX; // iEX = (INT32)button->Area.MouseXPos; @@ -870,7 +894,7 @@ void RenderSelectionWindow( void ) // iEY = (INT32)(button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY); iSX = iStartClickX; - iSY = iStartClickY - iTopWinCutOff + SelWinStartPoint.iY; + iSY = iStartClickY - iTopWinCutOff + gSelection.displayAreaStart.iY; iEX = gusMouseXPos; iEY = gusMouseYPos; @@ -889,10 +913,10 @@ void RenderSelectionWindow( void ) iEY ^= iSY; } - iEX = min( iEX, 600 ); - iSY = max( SelWinStartPoint.iY, iSY ); - iEY = min( 359, iEY ); - iEY = max( SelWinStartPoint.iY, iEY ); + iEX = min( gSelection.displayAreaEnd.iX, iEX); + iSY = max( gSelection.displayAreaStart.iY, iSY ); + iEY = min( gSelection.displayAreaEnd.iY, iEY ); + iEY = max( gSelection.displayAreaStart.iY, iEY ); usFillColor = Get16BPPColor(FROMRGB(255, usFillGreen, 0)); usFillGreen += usDir; @@ -928,7 +952,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason ) return; iClickX = button->Area.MouseXPos; - iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; + iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY; if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN) { @@ -1035,9 +1059,9 @@ void DisplaySelectionWindowGraphicalInformation() UINT16 y; //Determine if there is a valid picture at cursor position. //iRelX = gusMouseXPos; - //iRelY = gusMouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY; + //iRelY = gusMouseYPos + iTopWinCutOff - (INT16)gSelection.displayAreaStart.iY; - y = gusMouseYPos + iTopWinCutOff - (UINT16)SelWinStartPoint.iY; + y = gusMouseYPos + iTopWinCutOff - (UINT16)gSelection.displayAreaStart.iY; pNode = pDispList; fDone = FALSE; while( (pNode != NULL) && !fDone ) @@ -1470,10 +1494,10 @@ void DrawSelections( void ) { SGPRect ClipRect, NewRect; - NewRect.iLeft = SelWinStartPoint.iX; - NewRect.iTop = SelWinStartPoint.iY; - NewRect.iRight = SelWinEndPoint.iX; - NewRect.iBottom = SelWinEndPoint.iY; + NewRect.iLeft = gSelection.displayAreaStart.iX; + NewRect.iTop = gSelection.displayAreaStart.iY; + NewRect.iRight = gSelection.displayAreaEnd.iX; + NewRect.iBottom = gSelection.displayAreaEnd.iY; GetClippingRect(&ClipRect); SetClippingRect(&NewRect); @@ -1483,7 +1507,7 @@ void DrawSelections( void ) SetObjectShade( gvoLargeFontType1, 0 ); // SetObjectShade( gvoLargeFont, 0 ); - DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &SelWinStartPoint, CLEAR_BACKGROUND ); + DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &gSelection.displayAreaStart, CLEAR_BACKGROUND ); SetObjectShade( gvoLargeFontType1, 4 ); From 6b9997b9c59655e8688bc28679f9facbb86520ef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:11:31 -0300 Subject: [PATCH 231/571] we don't use USE_CODE_PAGE anymore --- Laptop/IMP Begin Screen.cpp | 4 ---- Utils/Text Input.cpp | 20 -------------------- sgp/sgp.cpp | 30 ------------------------------ 3 files changed, 54 deletions(-) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index c140ee92..846666ec 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -577,7 +577,6 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) if( uiKey != '#') #else - #ifndef USE_CODE_PAGE if( uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || @@ -585,9 +584,6 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) uiKey == ' ' || uiKey == '"' || uiKey == 39 // This is ' which cannot be written explicitly here of course ) - #else - if( charSet::IsFromSet( uiKey, charSet::CS_SPACE|charSet::CS_ALPHA_NUM|charSet::CS_SPECIAL_ALPHA ) ) - #endif #endif { // if the current string position is at max or great, do nothing diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index 3efcb415..7f403388 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -937,11 +937,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) UINT32 key = Event->usParam; UINT16 type = gpActive->usInputType; //Handle space key -#ifndef USE_CODE_PAGE if( key == SPACE && type & INPUTTYPE_SPACES ) -#else - if( charSet::IsFromSet(key, charSet::CS_SPACE) && type & INPUTTYPE_SPACES ) -#endif { AddChar( key ); return TRUE; @@ -953,11 +949,7 @@ BOOLEAN HandleTextInput( InputAtom *Event ) return TRUE; } //Handle numerics -#ifndef USE_CODE_PAGE if( key >= '0' && key <= '9' && type & INPUTTYPE_NUMERICSTRICT ) -#else - if( charSet::IsFromSet(key, charSet::CS_NUMERIC) && type & INPUTTYPE_NUMERICSTRICT ) -#endif { AddChar( key ); return TRUE; @@ -965,22 +957,14 @@ BOOLEAN HandleTextInput( InputAtom *Event ) //Handle alphas if( type & INPUTTYPE_ALPHA ) { -#ifndef USE_CODE_PAGE if( key >= 'A' && key <= 'Z' ) -#else - if( charSet::IsFromSet(key, charSet::CS_ALPHA_UC) ) -#endif { if( type & INPUTTYPE_LOWERCASE ) key -= 32; // won't work for non-ascii alpha characters AddChar( key ); return TRUE; } -#ifndef USE_CODE_PAGE if( key >= 'a' && key <= 'z' ) -#else - if( charSet::IsFromSet(key, charSet::CS_ALPHA_LC) ) -#endif { if( type & INPUTTYPE_UPPERCASE ) key += 32; // won't work for non-ascii alpha characters @@ -992,14 +976,10 @@ BOOLEAN HandleTextInput( InputAtom *Event ) if( type & INPUTTYPE_SPECIAL ) { //More can be added, but not all of the fonts support these -#ifndef USE_CODE_PAGE if( key >= 0x21 && key <= 0x2f || // ! " # $ % & ' ( ) * + , - . / key >= 0x3a && key <= 0x40 || // : ; < = > ? @ key >= 0x5b && key <= 0x5f || // [ \ ] ^ _ key >= 0x7b && key <= 0x7d ) // { | } -#else - if( charSet::IsFromSet(key, charSet::CS_SPECIAL_ALPHA|charSet::CS_SPECIAL_NON_CHAR) ) -#endif { AddChar( key ); return TRUE; diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index 6686d637..de26331d 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -367,14 +367,6 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP case WM_SYSKEYDOWN: case WM_KEYDOWN: -#ifdef USE_CODE_PAGE - if(s_DebugKeyboardInput) - { - static vfs::Log& debugKeys = *vfs::Log::Create(L"DebugKeys.txt"); - static int input_counter = 1; - debugKeys << (input_counter++) << " : " << (int)wParam << vfs::Log::endl; - } -#endif // USE_CODE_PAGE KeyDown(wParam, lParam); gfSGPInputReceived = TRUE; break; @@ -514,24 +506,6 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow) } } -#ifdef USE_CODE_PAGE - charSet::InitializeCharSets(); - - if(!s_CodePage.empty()) - { - try - { - CodePageReader cpr; - cpr.ReadCodePage(s_CodePage); - } - catch(std::exception& ex) - { - std::wstringstream wss; - wss << L"Could not process codepage file \"" << s_CodePage() << L"\""; - SGP_RETHROW(wss.str().c_str(), ex); - } - } -#endif // USE_CODE_PAGE if(g_bUseXML_Strings) { @@ -1255,10 +1229,6 @@ void GetRuntimeSettings( ) // haydent: mouse scrolling iDisableMouseScrolling = (int)oProps.getIntProperty("Ja2 Settings","DISABLE_MOUSE_SCROLLING", iDisableMouseScrolling); -#ifdef USE_CODE_PAGE - s_DebugKeyboardInput = oProps.getBoolProperty(L"Ja2 Settings", L"DEBUG_KEYS", false); - s_CodePage = oProps.getStringProperty(L"Ja2 Settings", L"CODE_PAGE"); -#endif // USE_CODE_PAGE // WANNE: Highspeed Timer always ON (no more optional in the ja2.ini) // get timer/clock initialization state From 0993789430b0f493375680aabfb4da967f827910 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:00:41 -0300 Subject: [PATCH 232/571] remove Language Defines file we don't do it like that anymore, the build system takes care of it --- Ja2/CMakeLists.txt | 1 - Ja2/Language Defines.cpp | 21 ------- Ja2/Language Defines.h | 119 --------------------------------------- 3 files changed, 141 deletions(-) delete mode 100644 Ja2/Language Defines.cpp delete mode 100644 Ja2/Language Defines.h diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index d4b60792..7f8806f9 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -14,7 +14,6 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Language Defines.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp" diff --git a/Ja2/Language Defines.cpp b/Ja2/Language Defines.cpp deleted file mode 100644 index 2c7be02d..00000000 --- a/Ja2/Language Defines.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Language Defines.h" - -#if defined(ENGLISH) -# pragma message(" (Language set to ENGLISH, You'll need english CDs)") -#elif defined(GERMAN) -# pragma message(" (Language set to GERMAN, You'll need Topware/german CDs)") -#elif defined(RUSSIAN) -# pragma message(" (Language set to RUSSIAN, You'll need russian CDs)") -#elif defined(DUTCH) -# pragma message(" (Language set to DUTCH, You'll need dutch CDs)") -#elif defined(POLISH) -# pragma message(" (Language set to POLISH, You'll need polish CDs)") -#elif defined(FRENCH) -# pragma message(" (Language set to FRENCH, You'll need french CDs)") -#elif defined(ITALIAN) -# pragma message(" (Language set to ITALIAN, You'll need italian CDs)") -#elif defined(CHINESE) -# pragma message(" (Language set to CHINESE, You'll need chinese CDs)") -#else -# error "At least You have to specify a Language somewhere. See comments above." -#endif diff --git a/Ja2/Language Defines.h b/Ja2/Language Defines.h deleted file mode 100644 index 8032d699..00000000 --- a/Ja2/Language Defines.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef __LANGUAGE_DEFINES_H -#define __LANGUAGE_DEFINES_H - -#pragma once - -/* ============================================================================ - * ONLY ONE OF THESE LANGUAGES CAN BE DEFINED AT A TIME! - * BUT now You can define it _here_ by uncommenting one _or_ (better): - * You can comment them all out and then set it _global_ in "Preprocessor - * options" (do it for ALL projects in the workspace and both debug & release) - * _or_ - * give it do Your MAKEFILE, f.i. make ENGLISH, but keep in mind that some - * weird make tools will require 'make ENGLISH=1' instead - * - * using one of the two later methods will keep this SVN file unchanged for the - * future, only Your private project files (workspace/solution) will differ - * from the SVN stuff. - * (2006-10-10, Sergeant_Kolja) - */ - - -/* The recommend approach for VS2010 multi-language builds is to use the command line or the ja2.props file. - - By default the language is ENGLISH and the Language Prefix is EN. - - There are 3 ways you can build the JA2 1.13 executable file: - - // ------------------------------------------------------- - // 1. Using the command line - // ------------------------------------------------------- - - For example, where msbuild is located in %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ if not on your path - msbuild.exe /p:Configuration=Release ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=PL /p:JA2Language=POLISH ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=RU /p:JA2Language=RUSSIAN ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=NL /p:JA2Language=DUTCH ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=FR /p:JA2Language=FRENCH ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=IT /p:JA2Language=ITALIAN ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=CN /p:JA2Language=CHINESE ja2_VS2010.sln - - Note: If you want to build "Unfinished Business" version, just append the /p:JA2Config=JA2UB in the command line - msbuild.exe /p:Configuration=Release /p:JA2Config=JA2UB ja2_VS2010.sln - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB ja2_VS2010.sln - - Note2: You can also specify the target output name with the parameter /p:TargetName - msbuild.exe /p:Configuration=Release /p:JA2LangPrefix=DE /p:JA2Language=GERMAN /p:JA2Config=JA2UB /p:TargetName="JA2UB_113" ja2_VS2010.sln - - // -------------------------------------------------------- - // 2. Editing the ja2.props file and then build in VS 2010 - // ------------------------------------------------------- - - 1. Open the "ja2.props" file in a text editor and set the tags to your likeing. - - For example: If you want to build Russian Version (normal JA2, not UB) then set the following: - - - - - - RU - - - RUSSIAN - - - 2. Save the file - 3. Build the project in Visual Studio 2010 - - // -------------------------------------------------------- - // 3. The "old" way for building the executable - // ------------------------------------------------------- - - 1. Enable the "#undef ENGLISH" define below, so English will not be used anymore - 2. Set the desired language below - 3. If you want to build "Unfinished Business" version, enable "#define JA2UB" and "#define JA2UBMAPS" in builddefines.h" - 4. Build the executable in VS 2005 / 2008 / 2010 - 5. The output will be placed in the "Build\bin\" folder -*/ - -// Only enable this "undef", if you use the 3. way of building the executable! -#undef ENGLISH - -#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE) -/* please set one manually here (by uncommenting) if not willingly to set Workspace wide */ - -#define ENGLISH -//#define GERMAN -//#define RUSSIAN -//#define DUTCH -//#define FRENCH -//#define ITALIAN -//#define POLISH - -// INFO: For Chinese 1.13 version, you also have to set USE_WINFONTS = 1 in ja2.ini inside your JA2 installation directory! -//#define CHINESE - -#endif - -//**ddd direct link libraries -#pragma comment (lib, "user32.lib") -#pragma comment (lib, "gdi32.lib") -#pragma comment (lib, "advapi32.lib") -#pragma comment (lib, "shell32.lib") - -/* ==================================================================== - * Regardless of if we did it Workspace wide or by uncommenting above, - * HERE we must see, what language was selected. If one, we - */ -#if !defined(ENGLISH) && !defined(GERMAN) && !defined(RUSSIAN) && !defined(DUTCH) && !defined(POLISH) && !defined(FRENCH) && !defined(ITALIAN) && !defined(CHINESE) -# error "At least You have to specify a Language somewhere. See comments above." -#endif - -//if the language represents words as single chars -/*#ifdef TAIWAN - #define SINGLE_CHAR_WORDS -#endif*/ - -#endif From 897f684705594f5e898342c5cab0e16b061816f5 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:01:01 -0300 Subject: [PATCH 233/571] remove all #include's for Language Defines scripted diff: find . -type f -iname "*.h" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \; find . -type f -iname "*.cpp" -exec sed -i -E '/#include.*language\ defines\.h/I d' {} \; --- Ja2/Cheats.h | 1 - Ja2/Credits.cpp | 1 - Ja2/FeaturesScreen.cpp | 1 - Ja2/GameSettings.cpp | 1 - Ja2/Options Screen.cpp | 1 - Ja2/builddefines.h | 2 -- Ja2/jascreens.cpp | 1 - Laptop/AimMembers.cpp | 1 - Tactical/Interface Enhanced.cpp | 1 - Tactical/Interface Items.cpp | 1 - Utils/Encrypted File.cpp | 1 - Utils/ImportStrings.cpp | 1 - Utils/Multi Language Graphic Utils.cpp | 1 - Utils/Multilingual Text Code Generator.cpp | 1 - Utils/Utils All.h | 1 - Utils/_ChineseText.cpp | 1 - Utils/_DutchText.cpp | 1 - Utils/_EnglishText.cpp | 1 - Utils/_FrenchText.cpp | 1 - Utils/_GermanText.cpp | 1 - Utils/_ItalianText.cpp | 1 - Utils/_Ja25ChineseText.cpp | 1 - Utils/_Ja25DutchText.cpp | 1 - Utils/_Ja25EnglishText.cpp | 1 - Utils/_Ja25FrenchText.cpp | 1 - Utils/_Ja25GermanText.cpp | 1 - Utils/_Ja25ItalianText.cpp | 1 - Utils/_Ja25PolishText.cpp | 1 - Utils/_Ja25RussianText.cpp | 1 - Utils/_PolishText.cpp | 1 - Utils/_RussianText.cpp | 1 - 31 files changed, 32 deletions(-) diff --git a/Ja2/Cheats.h b/Ja2/Cheats.h index 74760ab6..2cd58cd1 100644 --- a/Ja2/Cheats.h +++ b/Ja2/Cheats.h @@ -1,7 +1,6 @@ #ifndef _CHEATS__H_ #define _CHEATS__H_ -#include "Language Defines.h" extern UINT8 gubCheatLevel; diff --git a/Ja2/Credits.cpp b/Ja2/Credits.cpp index 7a1f8d25..f2d1fdeb 100644 --- a/Ja2/Credits.cpp +++ b/Ja2/Credits.cpp @@ -1,6 +1,5 @@ #include "Types.h" #include "Credits.h" - #include "Language Defines.h" #include "vsurface.h" #include "mousesystem.h" #include "Text.h" diff --git a/Ja2/FeaturesScreen.cpp b/Ja2/FeaturesScreen.cpp index 92d0b60f..50535f97 100644 --- a/Ja2/FeaturesScreen.cpp +++ b/Ja2/FeaturesScreen.cpp @@ -26,7 +26,6 @@ #include "Text.h" #include "Interface Control.h" #include "Message.h" -#include "Language Defines.h" #include "Multi Language Graphic Utils.h" #include "Map Information.h" #include "Sys Globals.h" diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index 054da671..35f99674 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -10,7 +10,6 @@ #include "GameVersion.h" #include "LibraryDataBase.h" #include "Debug.h" - #include "Language Defines.h" #include "HelpScreen.h" #include "INIReader.h" #include "Shade Table Util.h" diff --git a/Ja2/Options Screen.cpp b/Ja2/Options Screen.cpp index 43fd9b1f..6a9ce3d1 100644 --- a/Ja2/Options Screen.cpp +++ b/Ja2/Options Screen.cpp @@ -29,7 +29,6 @@ #include "Text.h" #include "Interface Control.h" #include "Message.h" - #include "Language Defines.h" #include "Multi Language Graphic Utils.h" #include "Map Information.h" #include "SmokeEffects.h" diff --git a/Ja2/builddefines.h b/Ja2/builddefines.h index 5e48f506..eb71defe 100644 --- a/Ja2/builddefines.h +++ b/Ja2/builddefines.h @@ -1,8 +1,6 @@ #ifndef _BUILDDEFINES_H #define _BUILDDEFINES_H -#include "Language Defines.h" - //----- Briefing Room (Mission based JA2 like in JA/DG) - by Jazz ----- // Once enabled here and also enabled in the ja2_options.ini (BRIEFING_ROOM), // you can access the briefing room feature from the laptop diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index b1dfe4e8..4e1d8897 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -45,7 +45,6 @@ #include "Sound Control.h" #include "WordWrap.h" #include "text.h" - #include "Language Defines.h" #include "IniReader.h" #include "sgp_logger.h" diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 02d806cb..05d63151 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -36,7 +36,6 @@ #include "Strategic Status.h" #include "Merc Contract.h" #include "Strategic Merc Handler.h" - #include "Language Defines.h" #include "Assignments.h" #include "Sound Control.h" #include "Quests.h" diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index c6eee82c..f992338c 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -44,7 +44,6 @@ #include "soldier macros.h" #include "squads.h" #include "MessageBoxScreen.h" - #include "Language Defines.h" #include "GameSettings.h" #include "Map Screen Interface Map Inventory.h" #include "Quests.h" diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 18f635db..78f7933d 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -57,7 +57,6 @@ #include "game clock.h" #include "squads.h" #include "MessageBoxScreen.h" - #include "Language Defines.h" #include "GameSettings.h" #include "Map Screen Interface Map Inventory.h" #include "Quests.h" diff --git a/Utils/Encrypted File.cpp b/Utils/Encrypted File.cpp index 16886459..20fba544 100644 --- a/Utils/Encrypted File.cpp +++ b/Utils/Encrypted File.cpp @@ -2,7 +2,6 @@ #include "FileMan.h" #include "Debug.h" -#include "Language Defines.h" // anv: for selecting random line #include "Random.h" diff --git a/Utils/ImportStrings.cpp b/Utils/ImportStrings.cpp index 1d4131c4..cbe3a711 100644 --- a/Utils/ImportStrings.cpp +++ b/Utils/ImportStrings.cpp @@ -1,6 +1,5 @@ #include "ImportStrings.h" #include "LocalizedStrings.h" -#include "Language Defines.h" #include #include diff --git a/Utils/Multi Language Graphic Utils.cpp b/Utils/Multi Language Graphic Utils.cpp index 102c7d3f..4d444fb9 100644 --- a/Utils/Multi Language Graphic Utils.cpp +++ b/Utils/Multi Language Graphic Utils.cpp @@ -4,7 +4,6 @@ #include "Types.h" #include "Multi Language Graphic Utils.h" -#include "Language Defines.h" //SB #include "FileMan.h" diff --git a/Utils/Multilingual Text Code Generator.cpp b/Utils/Multilingual Text Code Generator.cpp index 256f9280..2bdfcb2a 100644 --- a/Utils/Multilingual Text Code Generator.cpp +++ b/Utils/Multilingual Text Code Generator.cpp @@ -32,7 +32,6 @@ CREATED: Feb 16, 1999 #include "builddefines.h" #include #include "types.h" -#include "Language Defines.h" #include "debug.h" #include "Fileman.h" diff --git a/Utils/Utils All.h b/Utils/Utils All.h index 208f4990..3b6750c6 100644 --- a/Utils/Utils All.h +++ b/Utils/Utils All.h @@ -41,7 +41,6 @@ #include "opplist.h" #include "himage.h" #include "vsurface_private.h" -#include "Language Defines.h" #include "text.h" #include "Screens.h" #include "Maputility.h" diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 46845d9d..622b69f5 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("CHINESE") - #include "Language Defines.h" #if defined( CHINESE ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index c6ddf46a..976ea802 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("DUTCH") - #include "Language Defines.h" #if defined( DUTCH ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 91d15743..0f5f947e 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ENGLISH") - #include "Language Defines.h" #if defined( ENGLISH ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index fb8e314b..6a259577 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("FRENCH") - #include "Language Defines.h" #ifdef FRENCH #include "text.h" #include "Fileman.h" diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 721d099f..53bb2601 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("GERMAN") - #include "Language Defines.h" #ifdef GERMAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 58a63f5c..6f9cbb10 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ITALIAN") - #include "Language Defines.h" #if defined( ITALIAN ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25ChineseText.cpp b/Utils/_Ja25ChineseText.cpp index 919f2d14..1bfcf23e 100644 --- a/Utils/_Ja25ChineseText.cpp +++ b/Utils/_Ja25ChineseText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("CHINESE") - #include "Language Defines.h" #ifdef CHINESE #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25DutchText.cpp b/Utils/_Ja25DutchText.cpp index a2234862..396f8ac5 100644 --- a/Utils/_Ja25DutchText.cpp +++ b/Utils/_Ja25DutchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("DUTCH") - #include "Language Defines.h" #ifdef DUTCH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25EnglishText.cpp b/Utils/_Ja25EnglishText.cpp index b58a080d..70a0c7e2 100644 --- a/Utils/_Ja25EnglishText.cpp +++ b/Utils/_Ja25EnglishText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ENGLISH") - #include "Language Defines.h" #ifdef ENGLISH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25FrenchText.cpp b/Utils/_Ja25FrenchText.cpp index f20af04a..17f9fa2a 100644 --- a/Utils/_Ja25FrenchText.cpp +++ b/Utils/_Ja25FrenchText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("FRENCH") - #include "Language Defines.h" #ifdef FRENCH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25GermanText.cpp b/Utils/_Ja25GermanText.cpp index b402f410..663aba59 100644 --- a/Utils/_Ja25GermanText.cpp +++ b/Utils/_Ja25GermanText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("GERMAN") - #include "Language Defines.h" #ifdef GERMAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25ItalianText.cpp b/Utils/_Ja25ItalianText.cpp index 4ffb9454..06d7f298 100644 --- a/Utils/_Ja25ItalianText.cpp +++ b/Utils/_Ja25ItalianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("ITALIAN") - #include "Language Defines.h" #ifdef ITALIAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25PolishText.cpp b/Utils/_Ja25PolishText.cpp index 9446a5b2..f7835402 100644 --- a/Utils/_Ja25PolishText.cpp +++ b/Utils/_Ja25PolishText.cpp @@ -2,7 +2,6 @@ // WANNE: Yes we need this here exclusivly in Polish version, because we do not have a codepage in the code like for other versions. //#pragma setlocale("POLISH") - #include "Language Defines.h" #ifdef POLISH #include "text.h" #include "Fileman.h" diff --git a/Utils/_Ja25RussianText.cpp b/Utils/_Ja25RussianText.cpp index 8ce7b35f..77e48edd 100644 --- a/Utils/_Ja25RussianText.cpp +++ b/Utils/_Ja25RussianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("RUSSIAN") - #include "Language Defines.h" #ifdef RUSSIAN #include "text.h" #include "Fileman.h" diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 860c2887..8445de0d 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2,7 +2,6 @@ // WANNE: Yes we need this here exclusivly in Polish version, because we do not have a codepage in the code like for other versions. //#pragma setlocale("POLISH") - #include "Language Defines.h" #if defined( POLISH ) #include "text.h" #include "Fileman.h" diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 62b72e2f..110c38e7 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -1,7 +1,6 @@ // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build! //#pragma setlocale("RUSSIAN") - #include "Language Defines.h" #if defined( RUSSIAN ) #include "text.h" #include "Fileman.h" From dc72a43a19f39294bdb8e8fb951e46b3dc6aae22 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 02:27:52 -0300 Subject: [PATCH 234/571] silence narrowing conversions in MSVC we all know they're there, whenever someone fixes it (lol), this should be removed --- CMakeLists.txt | 4 ++++ TODO | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 403a2f55..eaff0652 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ if(ADDRESS_SANITIZER) add_compile_options($,$>,-fsanitize=address,>) endif() +if(MSVC) + add_compile_options("/wd4838") +endif() + # whether we are using MSBuild as a generator set(usingMsBuild $) diff --git a/TODO b/TODO index 8b137891..e4bb3a3c 100644 --- a/TODO +++ b/TODO @@ -1 +1,4 @@ +# stuff that needs doing +# priority (LOW,HIGH) and description +LOW readd the C4838 (https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4838) warning to CMakeLists.txt once they're all fixed in the code From a83dfbefb0dc4cf8ace9ffbe3291f07e93da7493 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 18:14:29 -0300 Subject: [PATCH 235/571] add option to enable link time optimization a bit slower to compile for developing so defaults to 'false', but might be a good idea for the releases. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index eaff0652..6cd0d74e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,14 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +include(CheckIPOSupported) +check_ipo_supported(RESULT LinkTimeOptimization OUTPUT IpoError LANGUAGES C CXX) +if(LinkTimeOptimization) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +else() + message(WARNING "IPO is not supported: ${IpoError}") +endif() + option(ADDRESS_SANITIZER OFF) if(ADDRESS_SANITIZER) message(STATUS "AddressSanitizer ENABLED for non-Release builds") From dd5cabc6ba67ca37cf5c33b58852aa7481592fb3 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 07:26:42 -0300 Subject: [PATCH 236/571] actually make link-time optimization default to OFF sorry, I lied in the last commit. didn't mean to --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cd0d74e..139335b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,12 +9,15 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +option(LTO_OPTION "Enable link-time optimization if supported by compiler" OFF) + include(CheckIPOSupported) check_ipo_supported(RESULT LinkTimeOptimization OUTPUT IpoError LANGUAGES C CXX) -if(LinkTimeOptimization) +if(LinkTimeOptimization AND LTO_OPTION) + message(STATUS "Configuring WITH link-time optimization") set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) else() - message(WARNING "IPO is not supported: ${IpoError}") + message(STATUS "Configuring WITHOUT link-time optimization ${IpoError}") endif() option(ADDRESS_SANITIZER OFF) From 3cfde817bab38f12ba360f63cda45a3dce0a9454 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:19:51 +0200 Subject: [PATCH 237/571] Set table mouse_region priorities lower than bookmark bar --- Laptop/BaseTable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Laptop/BaseTable.cpp b/Laptop/BaseTable.cpp index 14f3697f..8bf31a55 100644 --- a/Laptop/BaseTable.cpp +++ b/Laptop/BaseTable.cpp @@ -627,7 +627,7 @@ TestTable::Display( ) { MSYS_DefineRegion( &it->mMouseRegion[i - mFirstEntryShown], usPosX, usPosY, usPosX + it->GetRequiredLength(), usPosY + heightperrow, - MSYS_PRIORITY_HIGHEST, CURSOR_WWW, + MSYS_PRIORITY_HIGHEST-3, CURSOR_WWW, MSYS_NO_CALLBACK, ( *it ).RegionClickCallBack ); MSYS_AddRegion( &it->mMouseRegion[i - mFirstEntryShown] ); From 4d4e039da7a02725729e12f6715b6b5c5f516d42 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 10:18:34 -0300 Subject: [PATCH 238/571] add an internationalization constant gather all ENGLISH|GERMAN|CHINESE etc preprocessor hell into a single library, so to restrict the number of targets that need to be built 8x this still has UB/EDITOR definitions so that still needs to be dealt with before we can build it only 8 times --- CMakeLists.txt | 2 ++ i18n/CMakeLists.txt | 4 ++++ i18n/include/language.hpp | 17 +++++++++++++++++ i18n/language.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 i18n/CMakeLists.txt create mode 100644 i18n/include/language.hpp create mode 100644 i18n/language.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 139335b3..f1842724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ include_directories( "${CMAKE_SOURCE_DIR}/Multiplayer" "${CMAKE_SOURCE_DIR}/Editor" "${CMAKE_SOURCE_DIR}/Console" + "${CMAKE_SOURCE_DIR}/i18n/include" ) # external libraries @@ -85,6 +86,7 @@ Editor Console Tactical ModularizedTacticalAI +i18n ) foreach(lib IN LISTS Ja2_Libs) add_subdirectory(${lib}) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt new file mode 100644 index 00000000..e3100765 --- /dev/null +++ b/i18n/CMakeLists.txt @@ -0,0 +1,4 @@ +set(i18nSrc +"${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" +PARENT_SCOPE +) diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp new file mode 100644 index 00000000..469d104e --- /dev/null +++ b/i18n/include/language.hpp @@ -0,0 +1,17 @@ +#pragma once + +namespace i18n { +enum class Lang +{ + en, + de, + ru, + nl, + pl, + fr, + it, + zh +}; +} + +extern const i18n::Lang g_lang; diff --git a/i18n/language.cpp b/i18n/language.cpp new file mode 100644 index 00000000..4850fbca --- /dev/null +++ b/i18n/language.cpp @@ -0,0 +1,24 @@ +#include + +/* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language + * (ideally text and voice separately) be set in the options menu would be + * ideal. */ +const i18n::Lang g_lang{ + #if defined(ENGLISH) + i18n::Lang::en +#elif defined(CHINESE) + i18n::Lang::zh +#elif defined(DUTCH) + i18n::Lang::nl +#elif defined(FRENCH) + i18n::Lang::fr +#elif defined(GERMAN) + i18n::Lang::de +#elif defined(ITALIAN) + i18n::Lang::it +#elif defined(POLISH) + i18n::Lang::pl +#elif defined(RUSSIAN) + i18n::Lang::ru +#endif +}; From 3acd2cea97308548be8303e2d62d2e0373495332 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 10:22:25 -0300 Subject: [PATCH 239/571] move Ja 2 Libs.* to i18n it has preprocessor silliness in it --- i18n/CMakeLists.txt | 1 + {sgp => i18n}/Ja2 Libs.cpp | 0 {sgp => i18n/include}/Ja2 Libs.h | 0 sgp/CMakeLists.txt | 1 - 4 files changed, 1 insertion(+), 1 deletion(-) rename {sgp => i18n}/Ja2 Libs.cpp (100%) rename {sgp => i18n/include}/Ja2 Libs.h (100%) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index e3100765..6c40cf61 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -1,4 +1,5 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" PARENT_SCOPE ) diff --git a/sgp/Ja2 Libs.cpp b/i18n/Ja2 Libs.cpp similarity index 100% rename from sgp/Ja2 Libs.cpp rename to i18n/Ja2 Libs.cpp diff --git a/sgp/Ja2 Libs.h b/i18n/include/Ja2 Libs.h similarity index 100% rename from sgp/Ja2 Libs.h rename to i18n/include/Ja2 Libs.h diff --git a/sgp/CMakeLists.txt b/sgp/CMakeLists.txt index ddf04225..c1df77f3 100644 --- a/sgp/CMakeLists.txt +++ b/sgp/CMakeLists.txt @@ -14,7 +14,6 @@ set(sgpSrc "${CMAKE_CURRENT_SOURCE_DIR}/himage.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/impTGA.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/input.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/LibraryDataBase.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/line.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MemMan.cpp" From 4624fe92f05c10f8b86be2b628e23aa93bf8c335 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:08:08 -0300 Subject: [PATCH 240/571] leave CHINESE struct member UINT8 Width[0x80] this might cause a horrifying alignment bug, but I doubt it --- sgp/WinFont.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/sgp/WinFont.cpp b/sgp/WinFont.cpp index bd046f7c..574235cf 100644 --- a/sgp/WinFont.cpp +++ b/sgp/WinFont.cpp @@ -37,9 +37,7 @@ typedef struct COLORVAL BackColor; UINT8 Height; UINT8 InternalLeading; -#ifdef CHINESE UINT8 Width[0x80]; -#endif } HWINFONT; LONG gWinFontAdjust; From 5d19c1fe2587a7660ea4c7cd49cf12ec8eb33493 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:19:05 -0300 Subject: [PATCH 241/571] make conditional CHINESE preprocessor def into global constant --- Strategic/Map Screen Interface Bottom.cpp | 1 + Strategic/Map Screen Interface Bottom.h | 6 ------ Strategic/mapscreen.cpp | 1 + Utils/message.cpp | 1 + i18n/include/language.hpp | 2 ++ i18n/language.cpp | 8 ++++++++ 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 1cb96593..e045f060 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -55,6 +55,7 @@ #include "connect.h" +#include struct UILayout_BottomButtons { diff --git a/Strategic/Map Screen Interface Bottom.h b/Strategic/Map Screen Interface Bottom.h index 0c7dd8c6..aee14fc0 100644 --- a/Strategic/Map Screen Interface Bottom.h +++ b/Strategic/Map Screen Interface Bottom.h @@ -4,12 +4,6 @@ #include "types.h" #include "Soldier Control.h" - -#ifdef CHINESE //zwwoooooo: Chinese fonts relatively high , so to reduce the number of rows -#define MAX_MESSAGES_ON_MAP_BOTTOM 6 -#else -#define MAX_MESSAGES_ON_MAP_BOTTOM 9 -#endif #ifdef JA2UB extern INT8 gbExitingMapScreenToWhere; #endif diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index bdf89983..9e180ddd 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -115,6 +115,7 @@ #include "connect.h" //hayden #include "InterfaceItemImages.h" #include "vobject.h" +#include #ifdef JA2UB #include "laptop.h" diff --git a/Utils/message.cpp b/Utils/message.cpp index 2befaa26..4b09a0b9 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -22,6 +22,7 @@ #include "GameSettings.h" #include "sgp_logger.h" +#include typedef struct { UINT32 uiFont; diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index 469d104e..c1b3e468 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -15,3 +15,5 @@ enum class Lang } extern const i18n::Lang g_lang; + +extern const int MAX_MESSAGES_ON_MAP_BOTTOM; diff --git a/i18n/language.cpp b/i18n/language.cpp index 4850fbca..1368db18 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -22,3 +22,11 @@ const i18n::Lang g_lang{ i18n::Lang::ru #endif }; + +const int MAX_MESSAGES_ON_MAP_BOTTOM{ +#if defined(CHINESE) // zwwoooooo: Chinese fonts relatively high , so to reduce the number of rows + 6 +#else + 9 +#endif +}; From bf6de9f3422f7bfdababa5b4f292bf0dea83c1c8 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 07:45:38 -0300 Subject: [PATCH 242/571] Move GetLanguagePrefix function into i18n --- Ja2/Init.cpp | 30 ++---------------------------- Tactical/XML.h | 8 -------- i18n/include/language.hpp | 4 ++++ i18n/language.cpp | 22 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 44a90d76..1d803358 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -78,6 +78,8 @@ #include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes() #include "Animation Data.h" // added by Flugente +#include + extern INT16 APBPConstants[TOTAL_APBP_VALUES] = {0}; extern INT16 gubMaxActionPoints[TOTALBODYTYPES];//MAXBODYTYPES = 28... JUST GETTING IT TO WORK NOW. GOTTHARD 7/2/08 extern BOOLEAN GetCDromDriveLetter( STR8 pString ); @@ -134,34 +136,6 @@ static void AddLanguagePrefix(STR fileName, const STR language) memmove( fileComponent, language, strlen( language) ); } -static const STR GetLanguagePrefix() -{ -#ifdef ENGLISH - return ""; -#endif -#ifdef GERMAN - return GERMAN_PREFIX; -#endif -#ifdef RUSSIAN - return RUSSIAN_PREFIX; -#endif -#ifdef DUTCH - return DUTCH_PREFIX; -#endif -#ifdef POLISH - return POLISH_PREFIX; -#endif -#ifdef FRENCH - return FRENCH_PREFIX; -#endif -#ifdef ITALIAN - return ITALIAN_PREFIX; -#endif -#ifdef CHINESE - return CHINESE_PREFIX; -#endif -} - static void AddLanguagePrefix(STR fileName) { AddLanguagePrefix( fileName, GetLanguagePrefix()); diff --git a/Tactical/XML.h b/Tactical/XML.h index 963417ef..d1ab96b9 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -58,14 +58,6 @@ typedef PARSE_STAGE; #define TABLEDATA_DIRECTORY "TableData\\" #define TABLEDATA_LAPTOP_DIRECTORY "Laptop\\" -#define GERMAN_PREFIX "German." -#define RUSSIAN_PREFIX "Russian." -#define DUTCH_PREFIX "Dutch." -#define POLISH_PREFIX "Polish." -#define FRENCH_PREFIX "French." -#define ITALIAN_PREFIX "Italian." -#define CHINESE_PREFIX "Chinese." - #define ATTACHMENTSFILENAME "Items\\Attachments.xml" #define ATTACHMENTINFOFILENAME "Items\\AttachmentInfo.xml" #define ITEMSFILENAME "Items\\Items.xml" diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index c1b3e468..bd895bcc 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -1,5 +1,7 @@ #pragma once +#include + namespace i18n { enum class Lang { @@ -17,3 +19,5 @@ enum class Lang extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; + +auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 1368db18..555b33c2 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -30,3 +30,25 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ 9 #endif }; + +auto GetLanguagePrefix() -> const STR { + return +#if defined(ENGLISH) + "" +#elif defined(CHINESE) + "Chinese." +#elif defined(DUTCH) + "Dutch." +#elif defined(FRENCH) + "French." +#elif defined(GERMAN) + "German." +#elif defined(ITALIAN) + "Italian." +#elif defined(POLISH) + "Polish." +#elif defined(RUSSIAN) + "Russian." +#endif + ; +} From cd69f5f3aeabd64816fd02d7308407451bf6ecad Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:36:59 -0300 Subject: [PATCH 243/571] Make Chinese specific strings compile-time instead of conditional eventually we'll switch between CHINESE and other languages during runtime, so even if language is not chinese, these symbols must still be there these symbol names aren't used so this is fine --- Utils/Text.h | 24 ++++++++++++------------ Utils/_ChineseText.cpp | 14 -------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Utils/Text.h b/Utils/Text.h index a71e194d..8d32695a 100644 --- a/Utils/Text.h +++ b/Utils/Text.h @@ -2584,18 +2584,18 @@ extern STR16 MPServerMessage[]; extern STR16 MPClientMessage[]; // WANNE: Some Chinese specific strings that needs to be in unicode! -extern STR16 ChineseSpecString1; -extern STR16 ChineseSpecString2; -extern STR16 ChineseSpecString3; -extern STR16 ChineseSpecString4; -extern STR16 ChineseSpecString5; -extern STR16 ChineseSpecString6; -extern STR16 ChineseSpecString7; -extern STR16 ChineseSpecString8; -extern STR16 ChineseSpecString9; -extern STR16 ChineseSpecString10; -extern STR16 ChineseSpecString11; -extern STR16 ChineseSpecString12; +inline constexpr STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +inline constexpr STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente enum { diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 622b69f5..3b7f881c 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -12159,18 +12159,4 @@ STR16 szRobotText[] = L"机器人附加%s技能效果。", //L"The robot gains the benefit of the %s skill trait.", }; -// WANNE: Some Chinese specific strings that needs to be in unicode! -STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; -STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; -STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; -STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; -STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente -STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente - #endif //CHINESE From d008d10b31bd311f742334a2268e8b4be375c0c4 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 08:07:47 -0300 Subject: [PATCH 244/571] Replace a ton of trivial #ifdefs with runtime checks This one is big, but unless I missed something, should be all be trivial. scripted-diff with the following, then manually tweaked whatever needed: ``` if [ $# -ne 3 ]; then echo "Usage: $0 '' '' ''" exit 1 fi pattern="$1" replacement="$2" filename="$3" if [ ! -f "$filename" ]; then echo "Error: File $filename does not exist." exit 1 fi sed -i '/'"$pattern"'/ { :loop $ !{ N /'"$pattern"'.*\n.*#endif/ { s/'"$pattern"'/'"$replacement"'/ s/#else/} else {/ s/#endif/}/ P D } /'"$pattern"'/ b loop } }' "$filename" echo "Replacement complete in $filename" ``` h/t to Grok2 for the sed command --- Ja2/Init.cpp | 148 ++++---- Ja2/Intro.cpp | 7 +- Ja2/JA2 Splash.cpp | 7 +- Ja2/SaveLoadGame.cpp | 9 +- Ja2/jascreens.cpp | 7 +- Laptop/AimMembers.cpp | 7 +- Laptop/BobbyRGuns.cpp | 7 +- Laptop/BobbyRMailOrder.cpp | 13 +- Laptop/IMP Text System.cpp | 7 +- Strategic/Map Screen Interface Map.cpp | 13 +- Strategic/Strategic Town Loyalty.cpp | 7 +- Strategic/mapscreen.cpp | 18 +- Tactical/Handle Doors.cpp | 7 +- Tactical/Interface Enhanced.cpp | 499 +++++++++++++------------ Tactical/Interface Items.cpp | 13 +- Tactical/Interface Panels.cpp | 20 +- sgp/WinFont.cpp | 15 +- sgp/sgp.cpp | 5 +- 18 files changed, 413 insertions(+), 396 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 1d803358..bf74dbf3 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -228,7 +228,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, AMMOFILENAME); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) @@ -242,9 +242,9 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, AMMOFILENAME); SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); } -#else +} else { SGP_THROW_IFFALSE(ReadInAmmoStats(fileName),AMMOFILENAME); -#endif +} // Lesh: added this, begin strcpy(fileName, directoryName); @@ -268,14 +268,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) // the uiIndex (for reference), szItemName, szLongItemName, szItemDesc, szBRName, and szBRDesc tags -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInItemStats(fileName,TRUE), fileName); } -#endif +} //if(!WriteItemStats()) // return FALSE; @@ -340,14 +340,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat( fileName, DISEASEFILENAME ); SGP_THROW_IFFALSE( ReadInDiseaseStats( fileName,FALSE ), DISEASEFILENAME ); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInDiseaseStats(fileName,TRUE), DISEASEFILENAME); } -#endif +} strcpy(fileName, directoryName); strcat(fileName, STRUCTUREDECONSTRUCTFILENAME); @@ -385,14 +385,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LOADSCREENHINTSFILENAME); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName, FALSE),LOADSCREENHINTSFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInLoadScreenHints(fileName,TRUE), fileName); } - #endif + } strcpy(fileName, directoryName); strcat(fileName, ARMOURSFILENAME); @@ -422,14 +422,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) } } -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInLBEPocketStats(fileName,TRUE), fileName); } -#endif +} // THE_BOB : added for pocket popup definitions LBEPocketPopup.clear(); @@ -437,7 +437,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if (FileExists(fileName)) @@ -452,10 +452,10 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, LBEPOCKETPOPUPFILENAME); SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); } -#else +} else { // WANNE: Load english file SGP_THROW_IFFALSE(ReadInLBEPocketPopups(fileName),LBEPOCKETPOPUPFILENAME); -#endif +} #ifdef JA2UB @@ -471,14 +471,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, MERCSTARTINGGEARFILENAME); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName, FALSE), MERCSTARTINGGEARFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercStartingGearStats(fileName,TRUE), fileName); } - #endif + } #endif @@ -495,14 +495,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, ATTACHMENTSLOTSFILENAME); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName, FALSE),ATTACHMENTSLOTSFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInAttachmentSlotsStats(fileName,TRUE), fileName); } - #endif + } // Flugente: created separate gun and item choices for different soldier classes - read in different xmls strcpy(fileName, directoryName); @@ -676,14 +676,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, CITYTABLEFILENAME); SGP_THROW_IFFALSE(ReadInMapStructure(fileName, FALSE),CITYTABLEFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInStrategicMapSectorTownNames(fileName,TRUE), fileName); } -#endif +} // Lesh: Strategic movement costs will be read in Strategic\Strategic Movement Costs.cpp, // function BOOLEAN InitStrategicMovementCosts(); @@ -734,14 +734,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, FALSE),SHIPPINGDESTINATIONSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInShippingDestinations(fileName, TRUE),fileName); } -#endif +} strcpy(fileName, directoryName); strcat(fileName, DELIVERYMETHODSFILENAME); @@ -754,14 +754,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,FALSE), FACILITYTYPESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInFacilityTypes(fileName,TRUE), fileName); } -#endif +} // HEADROCK HAM 3.4: Read in facility locations strcpy(fileName, directoryName); @@ -775,14 +775,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,FALSE,0), SECTORNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSectorNames(fileName,TRUE, 0), fileName); } -#endif +} // HEADROCK HAM 5: Read in Coolness by Sector strcpy(fileName, directoryName); @@ -804,7 +804,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME25); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { @@ -812,7 +812,7 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) if(!ReadInMercProfiles(fileName,TRUE)) return FALSE; } - #endif + } } strcpy(fileName, directoryName); @@ -830,14 +830,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName, FALSE), MERCPROFILESFILENAME); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercProfiles(fileName,TRUE), fileName); } - #endif + } // HEADROCK PROFEX: Read in Merc Opinion data to replace PROF.DAT data strcpy(fileName, directoryName); @@ -900,14 +900,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,FALSE), ENEMYNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyNames(fileName,TRUE), fileName); } -#endif +} } @@ -919,14 +919,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,FALSE), CIVGROUPNAMESFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCivGroupNamesStats(fileName,TRUE), fileName); } -#endif +} } @@ -936,14 +936,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,FALSE), EMAILSENDERNAMELIST); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInSenderNameList(fileName,TRUE), fileName); } -#endif +} if (gGameExternalOptions.fEnemyRank == TRUE) { @@ -953,14 +953,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,FALSE), ENEMYRANKFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInEnemyRank(fileName,TRUE), fileName); } -#endif +} } // Flugente: backgrounds @@ -969,14 +969,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,FALSE), BACKGROUNDSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInBackgrounds(fileName,TRUE), BACKGROUNDSFILENAME); } -#endif +} // Flugente: individual militia strcpy( fileName, directoryName ); @@ -990,14 +990,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,FALSE), CAMPAIGNSTATSEVENTSFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInCampaignStatsEvents(fileName,TRUE), CAMPAIGNSTATSEVENTSFILENAME); } -#endif +} // WANNE: Only in a singleplayer game... // Externalised taunts @@ -1018,14 +1018,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, FileInfo.zFileName); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); } - #endif + } while( GetFileNext(&FileInfo) ) { strcpy(fileName, directoryName); @@ -1033,14 +1033,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) strcat(fileName, FileInfo.zFileName); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,FALSE), fileName); - #ifndef ENGLISH + if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInTaunts(fileName,TRUE), fileName); } - #endif + } } GetFileClose(&FileInfo); } @@ -1052,14 +1052,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHistorys(fileName,FALSE), HISTORYNAMEFILENAME); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInHistorys(fileName,TRUE), fileName); } -#endif +} // IMP Portraits List by Jazz strcpy(fileName, directoryName); @@ -1067,14 +1067,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,FALSE), IMPPORTRAITS); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInIMPPortraits(fileName,TRUE), fileName); } -#endif +} LoadIMPPortraitsTEMP( ); @@ -1159,14 +1159,14 @@ BOOLEAN LoadExternalGameplayData(STR directoryName, BOOLEAN isMultiplayer) SGP_THROW_IFFALSE(ReadInFaceGear(zNewFaceGear, fileName), FACEGEARFILENAME); //WriteFaceGear(); -#ifndef ENGLISH +if( g_lang != i18n::Lang::en ) { AddLanguagePrefix(fileName); if ( FileExists(fileName) ) { DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("LoadExternalGameplayData, fileName = %s", fileName)); SGP_THROW_IFFALSE(ReadInMercAvailability(fileName,TRUE), fileName); } -#endif +} UINT32 i; for(i=0; i BOOLEAN Style_JA = TRUE; extern INT8 Test = 0; @@ -726,11 +727,11 @@ void DisplaySirtechSplashScreen() * (2006-10-10, Sergeant_Kolja) */ #ifdef _DEBUG - # if defined(ENGLISH) + if( g_lang == i18n::Lang::en ) { AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) ); - # elif defined(GERMAN) + } else if( g_lang == i18n::Lang::de ) { AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) ); - # endif + } #endif AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) ); return; diff --git a/Ja2/JA2 Splash.cpp b/Ja2/JA2 Splash.cpp index 4ef6714a..c7d9634d 100644 --- a/Ja2/JA2 Splash.cpp +++ b/Ja2/JA2 Splash.cpp @@ -5,6 +5,7 @@ #include "Timer Control.h" #include "Multi Language Graphic Utils.h" #include +#include UINT32 guiSplashFrameFade = 10; UINT32 guiSplashStartTime = 0; @@ -13,10 +14,10 @@ extern HVSURFACE ghFrameBuffer; //Simply create videosurface, load image, and draw it to the screen. void InitJA2SplashScreen() { -#ifdef ENGLISH +if( g_lang == i18n::Lang::en ) { ClearMainMenu(); -#else +} else { UINT32 uiLogoID = 0; HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions @@ -69,7 +70,7 @@ void InitJA2SplashScreen() GetVideoSurface( &hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); -#endif // ENGLISH +} // ENGLISH InvalidateScreen(); RefreshScreen( NULL ); diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index dc30a1e7..a0dd2cb5 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -152,6 +152,7 @@ #endif #include "LuaInitNPCs.h" +#include #ifdef JA2UB @@ -7205,7 +7206,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) } } -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { // Fix neutral flags if ( guiCurrentSaveGameVersion < 94 ) { @@ -7215,7 +7216,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile ) Menptr[ cnt].aiData.bNeutral = FALSE; } } -#endif +} //#ifdef JA2UB //if the soldier has the NON weapon version of the merc knofe or merc umbrella //ConvertWeapons( &Menptr[ cnt ] ); @@ -9896,9 +9897,9 @@ UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader ) } } - #ifdef GERMAN + if( g_lang == i18n::Lang::de ) { uiEncryptionSet *= 11; - #endif + } uiEncryptionSet = uiEncryptionSet % 10; diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index 4e1d8897..87d04505 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -48,6 +48,7 @@ #include "IniReader.h" #include "sgp_logger.h" +#include #define _UNICODE // Networking Stuff @@ -331,7 +332,7 @@ UINT32 InitScreenHandle(void) if ( ubCurrentScreen == 255 ) { - #ifdef ENGLISH + if( g_lang == i18n::Lang::en ) { if( gfDoneWithSplashScreen ) { ubCurrentScreen = 0; @@ -341,9 +342,9 @@ UINT32 InitScreenHandle(void) SetCurrentCursorFromDatabase( VIDEO_NO_CURSOR ); return( INTRO_SCREEN ); } - #else + } else { ubCurrentScreen = 0; - #endif + } } if ( ubCurrentScreen == 0 ) diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 05d63151..0c1e2f37 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -49,6 +49,7 @@ #include "Encrypted File.h" #include "InterfaceItemImages.h" #include +#include // //****** Defines ****** @@ -5461,20 +5462,20 @@ void DisplayPopUpBoxExplainingMercArrivalLocationAndTime( ) //create the string to display to the user, looks like.... // L"%s should arrive at the designated drop-off point ( sector %d:%d %s ) on day %d, at approximately %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { //Germans version has a different argument order swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], gMercProfiles[ pSoldier->ubProfile ].zNickname, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString, zSectorIDString ); -#else +} else { swprintf( szLocAndTime, pMessageStrings[ MSG_JUST_HIRED_MERC_ARRIVAL_LOCATION_POPUP ], gMercProfiles[ pSoldier->ubProfile ].zNickname, zSectorIDString, LaptopSaveInfo.sLastHiredMerc.uiArrivalTime / 1440, zTimeString ); -#endif +} diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index d336e436..ac9855fc 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -20,6 +20,7 @@ // HEADROCK HAM 4 #include "input.h" #include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item + #include #define BOBBYR_DEFAULT_MENU_COLOR 255 @@ -2516,11 +2517,11 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, //if it's a used item, display how damaged the item is if( fUsed ) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( sTemp, ChineseSpecString2, LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality );//zww - #else + } else { swprintf( sTemp, L"*%3d%%%%", LaptopSaveInfo.BobbyRayUsedInventory[ usBobbyIndex ].ubItemQuality ); - #endif + } DrawTextToScreen(sTemp, (UINT16)(BOBBYR_ITEM_NAME_X-2), (UINT16)(usPosY - BOBBYR_ORDER_NUM_Y_OFFSET), BOBBYR_ORDER_NUM_WIDTH, BOBBYR_ITEM_NAME_TEXT_FONT, BOBBYR_ITEM_NAME_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } diff --git a/Laptop/BobbyRMailOrder.cpp b/Laptop/BobbyRMailOrder.cpp index a7610e23..a145c7a7 100644 --- a/Laptop/BobbyRMailOrder.cpp +++ b/Laptop/BobbyRMailOrder.cpp @@ -30,6 +30,7 @@ #include "GameSettings.h" #include #include +#include /* typedef struct @@ -488,11 +489,11 @@ BOOLEAN EnterBobbyRMailOrder() SetButtonCursor(guiBobbyRClearOrder, CURSOR_LAPTOP_SCREEN); SpecifyDisabledButtonStyle( guiBobbyRClearOrder, DISABLED_STYLE_NONE ); //inshy: fix position of text for buttons -#ifdef FRENCH +if(g_lang == i18n::Lang::fr) { SpecifyButtonTextOffsets( guiBobbyRClearOrder, 13, 10, TRUE ); -#else +} else { SpecifyButtonTextOffsets( guiBobbyRClearOrder, 39, 10, TRUE ); -#endif +} // Accept Order button guiBobbyRAcceptOrderImage = LoadButtonImage("LAPTOP\\AcceptOrderButton.sti", 2,0,-1,1,-1 ); @@ -504,11 +505,11 @@ BOOLEAN EnterBobbyRMailOrder() DEFAULT_MOVE_CALLBACK, BtnBobbyRAcceptOrderCallback); SetButtonCursor( guiBobbyRAcceptOrder, CURSOR_LAPTOP_SCREEN); //inshy: fix position of text for buttons -#ifdef FRENCH +if(g_lang == i18n::Lang::fr) { SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 15, 24, TRUE ); -#else +} else { SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 43, 24, TRUE ); -#endif +} SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED ); if( gbSelectedCity == -1 ) diff --git a/Laptop/IMP Text System.cpp b/Laptop/IMP Text System.cpp index 4fd013b8..9555ef80 100644 --- a/Laptop/IMP Text System.cpp +++ b/Laptop/IMP Text System.cpp @@ -38,6 +38,7 @@ #include "GameSettings.h" #endif +#include #define IMP_SEEK_AMOUNT 5 * 80 * 2 @@ -204,18 +205,18 @@ void PrintImpText( void ) LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 81, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_6, FONT14ARIAL, FONT_BLACK, FALSE, 0); //inshy (18.01.2009): fix position for russian text - #ifdef RUSSIAN + if( g_lang == i18n::Lang::ru ) { // male LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 225, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); // female LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 335, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); - #else + } else { // male LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 240, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_10, FONT14ARIAL, FONT_BLACK, FALSE, 0); // female LoadAndDisplayIMPText( LAPTOP_SCREEN_UL_X + 360, LAPTOP_SCREEN_WEB_UL_Y + 259, ( 640 ), IMP_BEGIN_11, FONT14ARIAL, FONT_BLACK, FALSE, 0); - #endif + } break; case ( IMP_PERSONALITY ): diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 0ec76fd7..73af166a 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -56,6 +56,7 @@ #include "MilitiaSquads.h" #include "LaptopSave.h" +#include // added by Flugente extern CHAR16 gzSectorNames[256][4][MAX_SECTOR_NAME_LENGTH]; @@ -1199,11 +1200,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen1"); // don't show loyalty string until loyalty tracking for that town has been started if( gTownLoyalty[ bTown ].fStarted && gfTownUsesLoyalty[ bTown ]) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( sStringA, L"%d%£¥%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); - #else + } else { swprintf( sStringA, L"%d%%%% %s", gTownLoyalty[ bTown ].ubRating, gsLoyalString[ 0 ]); - #endif + } // if loyalty is too low to train militia, and militia training is allowed here if ( ( gTownLoyalty[ bTown ].ubRating < iMinLoyaltyToTrain ) && MilitiaTrainingAllowedInTown( bTown ) ) @@ -4873,11 +4874,11 @@ void BlitMineText( INT16 sMapX, INT16 sMapY ) // if potential is not nil, show percentage of the two if (GetMaxPeriodicRemovalFromMine(ubMineIndex) > 0) { - #ifdef CHINESE + if ( g_lang == i18n::Lang::zh ) { swprintf( wSubString, L" (%d%£¥%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); - #else + } else { swprintf( wSubString, L" (%d%%%%)", (PredictDailyIncomeFromAMine(ubMineIndex, TRUE) * 100 ) / GetMaxDailyRemovalFromMine(ubMineIndex) ); - #endif + } wcscat( wString, wSubString ); } diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index d4542de0..9de36dc0 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -40,6 +40,7 @@ #include "Luaglobal.h" #include "LuaInitNPCs.h" #include "Interface.h" +#include #include "GameInitOptionsScreen.h" extern WorldItems gAllWorldItems; @@ -1631,12 +1632,12 @@ void AdjustLoyaltyForCivsEatenByMonsters( INT16 sSectorX, INT16 sSectorY, UINT8 swprintf( str, gpStrategicString[STR_PB_BANDIT_KILLCIVS_IN_SECTOR], ubHowMany, pSectorString ); else { -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { //diffrent order of words in Chinese swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], pSectorString, ubHowMany ); -#else +} else { swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], ubHowMany, pSectorString ); -#endif +} } DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback ); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 9e180ddd..bdd2a631 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9665,27 +9665,27 @@ void BltCharInvPanel() // print armor/weight/camo labels mprintf(UI_CHARINV.Text.ArmorLabel.iX, UI_CHARINV.Text.ArmorLabel.iY, pInvPanelTitleStrings[ 0 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, L"%%" ); - #endif + } mprintf(UI_CHARINV.Text.WeightLabel.iX, UI_CHARINV.Text.WeightLabel.iY, pInvPanelTitleStrings[ 1 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, L"%%" ); - #endif + } mprintf(UI_CHARINV.Text.CamoLabel.iX, UI_CHARINV.Text.CamoLabel.iY, pInvPanelTitleStrings[ 2 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, ChineseSpecString1 ); - #else + } else { mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, L"%%" ); - #endif + } const auto width = UI_CHARINV.Text.PercentWidth; const auto height = UI_CHARINV.Text.PercentHeight; diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index 4d63103b..ba62ff48 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -33,6 +33,7 @@ #include "GameSettings.h" #include "fresh_header.h" #include "connect.h" +#include #ifdef JA2UB #include "Explosion Control.h" @@ -1492,7 +1493,7 @@ void SetDoorString( INT32 sGridNo ) // ATE: If here, we try to say, opened or closed... if ( gfUIIntTileLocation2 == FALSE ) { -#ifdef GERMAN +if( g_lang == i18n::Lang::de ) { wcscpy( gzIntTileLocation2, TacticalStr[ DOOR_DOOR_MOUSE_DESCRIPTION ] ); gfUIIntTileLocation2 = TRUE; @@ -1535,7 +1536,7 @@ void SetDoorString( INT32 sGridNo ) gfUIIntTileLocation = TRUE; } } -#else +} else { // Try to get doors status here... pDoorStatus = GetDoorStatus( sGridNo ); @@ -1576,7 +1577,7 @@ void SetDoorString( INT32 sGridNo ) } } -#endif +} } } diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index f992338c..37fc0757 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -54,6 +54,7 @@ #include "Food.h" // added by Flugente #include "Multi Language Graphic Utils.h" +#include //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -6586,11 +6587,11 @@ void DrawPropertyValueInColour( INT16 iValue, UINT8 ubNumLine, UINT8 ubNumRegion if( fPercentSign && wcscmp( pStr, L"--" ) != 0 && wcscmp( pStr, L"=" ) != 0 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } mprintf( usX, usY, pStr ); @@ -6681,11 +6682,11 @@ void DrawPropertyValueInColour_X( INT16 iValue, UINT8 numBullets, UINT8 ubNumLin if ( fPercentSign && wcscmp( pStr, L"--" ) != 0 && wcscmp( pStr, L"=" ) != 0 ) { -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); -#else +} else { wcscat( pStr, L"%" ); -#endif +} } mprintf( usX, usY, pStr ); @@ -10356,11 +10357,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10368,11 +10369,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10484,11 +10485,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10496,11 +10497,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10612,11 +10613,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10624,11 +10625,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10745,11 +10746,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10757,11 +10758,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10816,11 +10817,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10828,11 +10829,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode && cnt2 != 1 ) { @@ -10888,11 +10889,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10900,11 +10901,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -10958,11 +10959,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -10970,11 +10971,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11027,11 +11028,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11039,11 +11040,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11096,11 +11097,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11108,11 +11109,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11520,11 +11521,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11532,11 +11533,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11764,11 +11765,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11776,11 +11777,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11833,11 +11834,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11845,11 +11846,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -11961,11 +11962,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -11973,11 +11974,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12031,11 +12032,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12043,11 +12044,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12101,11 +12102,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12113,11 +12114,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12171,11 +12172,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12183,11 +12184,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12241,11 +12242,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"-%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12253,11 +12254,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12490,11 +12491,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] > 0) { @@ -12502,11 +12503,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", abs(iModifier[cnt2]) ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12679,11 +12680,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12691,11 +12692,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12749,11 +12750,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12761,11 +12762,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12819,11 +12820,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12831,11 +12832,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12889,11 +12890,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12901,11 +12902,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -12959,11 +12960,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -12971,11 +12972,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13029,11 +13030,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13041,11 +13042,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13099,11 +13100,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13111,11 +13112,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13169,11 +13170,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13181,11 +13182,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13239,11 +13240,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13251,11 +13252,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13309,11 +13310,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13321,11 +13322,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13379,11 +13380,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13391,11 +13392,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13449,11 +13450,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iModifier[cnt2] < 0) { @@ -13461,11 +13462,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%d", iModifier[cnt2] ); wcscat( pStr, L"%" ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13538,11 +13539,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13551,11 +13552,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13615,11 +13616,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13628,11 +13629,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13692,11 +13693,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13705,11 +13706,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13769,11 +13770,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13782,11 +13783,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.0f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13843,11 +13844,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13856,11 +13857,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13917,11 +13918,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -13930,11 +13931,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -13988,11 +13989,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14001,11 +14002,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14059,11 +14060,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14072,11 +14073,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14130,11 +14131,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14143,11 +14144,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14211,11 +14212,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"+%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if (iFloatModifier[cnt2] < 0) { @@ -14224,11 +14225,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) swprintf( pStr, L"%4.2f", iFloatModifier[cnt2] ); FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, pStr, BLOCKFONT2, &usX, &usY); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%" ); - #endif + } } else if( fComparisonMode ) { @@ -14594,11 +14595,11 @@ void DrawAdvancedValues( OBJECTTYPE *gpItemDescObject ) if( !( fComparisonMode && iModifier[0] == 0 ) ) { wcscat( pStr, L"%" ); -#ifdef CHINESE +if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); -#else +} else { wcscat( pStr, L"%" ); -#endif +} } mprintf( usX, usY, pStr ); } diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 78f7933d..87cc1279 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -82,6 +82,7 @@ #include "Sound Control.h" #include "Multi Language Graphic Utils.h" +#include #ifdef JA2UB #include "Ja25_Tactical.h" @@ -7409,11 +7410,11 @@ void RenderItemDescriptionBox( ) FindFontRightCoordinates( gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sTop, gODBItemDescRegions[0][0].sRight - gODBItemDescRegions[0][0].sLeft, gODBItemDescRegions[0][0].sBottom - gODBItemDescRegions[0][0].sTop ,pStr, BLOCKFONT2, &usX, &usY); } - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { wcscat( pStr, ChineseSpecString1 ); - #else + } else { wcscat( pStr, L"%%" ); - #endif + } mprintf( usX, usY, pStr ); } @@ -11178,11 +11179,11 @@ void SetupPickupPage( INT8 bPage ) } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString3, sValue ); - #else + } else { swprintf( pStr, L"%d%%", sValue ); - #endif + } } SetRegionFastHelpText( &(gItemPickupMenu.Regions[ cnt - iStart ]), pStr ); diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 13d9d2cb..5eb07868 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -73,6 +73,8 @@ //legion by Jazz #include "Interface Utils.h" +#include + //forward declarations of common classes to eliminate includes class OBJECTTYPE; class SOLDIERTYPE; @@ -2747,27 +2749,27 @@ void RenderSMPanel( BOOLEAN *pfDirty ) mprintf( SM_ARMOR_LABEL_X - StringPixLength( pInvPanelTitleStrings[0], BLOCKFONT2 ) / 2, SM_ARMOR_LABEL_Y, pInvPanelTitleStrings[ 0 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_ARMOR_PERCENT_X, SM_ARMOR_PERCENT_Y, L"%%" ); - #endif + } mprintf( SM_WEIGHT_LABEL_X - StringPixLength( pInvPanelTitleStrings[1], BLOCKFONT2 ), SM_WEIGHT_LABEL_Y, pInvPanelTitleStrings[ 1 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_WEIGHT_PERCENT_X, SM_WEIGHT_PERCENT_Y, L"%%" ); - #endif + } mprintf( SM_CAMMO_LABEL_X - StringPixLength( pInvPanelTitleStrings[2], BLOCKFONT2 ), SM_CAMMO_LABEL_Y, pInvPanelTitleStrings[ 2 ] ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, ChineseSpecString1 ); - #else + } else { mprintf( SM_CAMMO_PERCENT_X, SM_CAMMO_PERCENT_Y, L"%%" ); - #endif + } UpdateStatColor( gpSMCurrentMerc->timeChanges.uiChangeAgilityTime, (BOOLEAN)(gpSMCurrentMerc->usValueGoneUp & AGIL_INCREASE ? TRUE : FALSE), (BOOLEAN)((gGameOptions.fNewTraitSystem && (gpSMCurrentMerc->ubCriticalStatDamage[DAMAGED_STAT_AGILITY] > 0)) ? TRUE : FALSE), gpSMCurrentMerc->bExtraAgility != 0 ); // SANDRO diff --git a/sgp/WinFont.cpp b/sgp/WinFont.cpp index 574235cf..0760c928 100644 --- a/sgp/WinFont.cpp +++ b/sgp/WinFont.cpp @@ -22,6 +22,7 @@ #include "font.h" #include "Font Control.h" #include "GameSettings.h" +#include #include @@ -353,7 +354,7 @@ INT32 CreateWinFont( LOGFONT &logfont ) HDC hdc = GetDC(NULL); SelectObject(hdc, hFont); -#ifdef CHINESE +if(g_lang == i18n::Lang::zh) { SIZE RectSize; wchar_t str[2]=L"\1"; for (int i = 1; i<0x80; i++) @@ -365,7 +366,7 @@ INT32 CreateWinFont( LOGFONT &logfont ) str[0] = L'啊'; GetTextExtentPoint32W( hdc, str, 1, &RectSize ); WinFonts[iFont].Width[0] = (UINT8)RectSize.cx; -#endif +} TEXTMETRIC tm; GetTextMetrics(hdc, &tm); @@ -467,7 +468,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) if (pWinFont == NULL) return(0); -#ifdef CHINESE +if(g_lang == i18n::Lang::zh) { wchar_t *p=string2; UINT32 size = 0; while (*p!=0) @@ -482,7 +483,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) p++; } return size; -#else +} else { SIZE RectSize; HDC hdc = GetDC(NULL); @@ -491,7 +492,7 @@ INT16 WinFontStringPixLength( STR16 string2, INT32 iFont ) ReleaseDC(NULL, hdc); return( (INT16)RectSize.cx ); -#endif +} } @@ -502,11 +503,11 @@ INT16 GetWinFontHeight(INT32 iFont) pWinFont = GetWinFont(iFont); if (pWinFont == NULL) return(0); -#ifdef CHINESE //zwwooooo: Correct tactical interface font height to fixed Chinese characters smearing bug +if(g_lang == i18n::Lang::zh) { //zwwooooo: Correct tactical interface font height to fixed Chinese characters smearing bug if (iFont == WinFontMap[TINYFONT1] || iFont == WinFontMap[SMALLFONT1] || iFont == WinFontMap[FONT14ARIAL]) { return pWinFont->Height + 2; } -#endif +} return pWinFont->Height; } diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index de26331d..be1fcf5a 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -58,6 +58,7 @@ #endif #include +#include static void MAGIC(std::string const& aarrrrgggh = "") {} @@ -858,13 +859,13 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC } #endif -# ifdef ENGLISH + if( g_lang == i18n::Lang::en ) { try { SetIntroType( INTRO_SPLASH ); } HANDLE_FATAL_ERROR; -# endif + } gfApplicationActive = TRUE; gfProgramIsRunning = TRUE; From 73f7812165bb8731f9c8745096de8b2aee0baac5 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 08:11:49 -0300 Subject: [PATCH 245/571] Slightly less straightforward CHINESE conversion in Interface Items.cpp A bit clunkier, had to repeat function calls because of how preprocessor tricks don't map 1:1 with actual C++. --- Tactical/Interface Items.cpp | 226 +++++++++++++++++++++++++++-------- 1 file changed, 174 insertions(+), 52 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 87cc1279..62dc9fa9 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -12281,12 +12281,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString11, - #else + ItemNames[ usItem ], + AmmoCaliber[ Weapon[ usItem ].ubCalibre ], + sValue, + sThreshold, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } else { swprintf( pStr, L"%s (%s) [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ], sValue, @@ -12305,16 +12321,12 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString4, - #else - swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], AmmoCaliber[ Weapon[ usItem ].ubCalibre ], sValue, @@ -12332,6 +12344,28 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + + swprintf( pStr, L"%s (%s) [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + AmmoCaliber[ Weapon[ usItem ].ubCalibre ], + sValue, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } + } } break; @@ -12380,12 +12414,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, L"%s [%d%£¥(%d%£¥)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], sValue, sThreshold, @@ -12403,15 +12433,31 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + sThreshold, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, L"%s [%d%£¥]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", - #endif - ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 9 ], //Accuracy String @@ -12428,6 +12474,25 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 9 ], //Accuracy String + accuracy, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), + gWeaponStatsDesc[ 10 ], //Range String + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GunRange( pObject, NULL )/10 : GunRange( pObject, NULL ), // SANDRO - added argument //Modified Range + gGameSettings.fOptions[ TOPTION_SHOW_WEAPON_RANGE_IN_TILES ] ? GetModifiedGunRange(usItem)/10 : GetModifiedGunRange(usItem), //Gun Range + gWeaponStatsDesc[ 6 ], //AP String + (Weapon[ usItem ].ubReadyTime * (100 - GetPercentReadyTimeAPReduction( pObject )) / 100), // Ready AP's + apStr, //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12438,13 +12503,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier { if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString9, - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, sThreshold, gWeaponStatsDesc[ 11 ], //Damage String @@ -12455,16 +12516,26 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + sThreshold, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), //Melee damage + gWeaponStatsDesc[ 6 ], //AP String + BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString5, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 11 ], //Damage String GetDamage(pObject), //Melee damage @@ -12474,6 +12545,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 11 ], //Damage String + GetDamage(pObject), //Melee damage + gWeaponStatsDesc[ 6 ], //AP String + BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], pObject, pSoldier ), //AP's + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12513,13 +12597,9 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier UINT16 explDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubDamage, 0 ); UINT16 explStunDamage = (UINT16) GetModifiedExplosiveDamage( Explosive[Item[ usItem ].ubClassIndex].ubStunDamage, 1 ); - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString5, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", - #endif - - ItemNames[ usItem ], + ItemNames[ usItem ], sValue, gWeaponStatsDesc[ 11 ], //Damage String explDamage, @@ -12529,6 +12609,19 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d\n%s %d\n%s %1.1f %s", + ItemNames[ usItem ], + sValue, + gWeaponStatsDesc[ 11 ], //Damage String + explDamage, + gWeaponStatsDesc[ 13 ], //Stun Damage String + explStunDamage, //Stun Damage + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } break; @@ -12558,12 +12651,8 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier if ( gGameExternalOptions.fAdvRepairSystem && sThreshold < 100 ) { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString10, - #else - swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", - #endif - ItemNames[ usItem ], //Item long name sValue, //Item condition sThreshold, //repair threshold @@ -12577,15 +12666,27 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%(%d%%)]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + sThreshold, //repair threshold + pInvPanelTitleStrings[ 4 ], //Protection string + iProtection, //Protection rating in % based on best armor + Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) + pInvPanelTitleStrings[ 3 ], //Camo string + GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus + gWeaponStatsDesc[ 12 ], //Weight string + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } else { - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString6, - #else - swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", - #endif - ItemNames[ usItem ], //Item long name sValue, //Item condition pInvPanelTitleStrings[ 4 ], //Protection string @@ -12598,6 +12699,21 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %d%% (%d/%d)\n%s %d%%\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + pInvPanelTitleStrings[ 4 ], //Protection string + iProtection, //Protection rating in % based on best armor + Armour[ Item[ usItem ].ubClassIndex ].ubProtection * sValue / 100, + Armour[ Item[ usItem ].ubClassIndex ].ubProtection, //Protection (raw data) + pInvPanelTitleStrings[ 3 ], //Camo string + GetCamoBonus(pObject)+GetUrbanCamoBonus(pObject)+GetDesertCamoBonus(pObject)+GetSnowCamoBonus(pObject), //Camo bonus + gWeaponStatsDesc[ 12 ], //Weight string + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } } break; @@ -12610,17 +12726,23 @@ void GetHelpTextForItem( STR16 pzStr, OBJECTTYPE *pObject, SOLDIERTYPE *pSoldier default: { // The final, and typical case, is that of an item with a percent status - #ifdef CHINESE + if( g_lang == i18n::Lang::zh ) { swprintf( pStr, ChineseSpecString7, - #else - swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", - #endif ItemNames[ usItem ], //Item long name sValue, //Item condition gWeaponStatsDesc[ 12 ], //Weight String fWeight, //Weight GetWeightUnitString() //Weight units ); + } else { + swprintf( pStr, L"%s [%d%%]\n%s %1.1f %s", + ItemNames[ usItem ], //Item long name + sValue, //Item condition + gWeaponStatsDesc[ 12 ], //Weight String + fWeight, //Weight + GetWeightUnitString() //Weight units + ); + } } break; } From 33e8c1dc3999ef7ab5430bad9b8fbfeb76701b74 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:20:31 -0300 Subject: [PATCH 246/571] Move all the translated strings over to i18n It's where all conditional language preprocessor goes --- Utils/CMakeLists.txt | 17 ----------------- i18n/CMakeLists.txt | 17 +++++++++++++++++ {Utils => i18n}/ExportStrings.cpp | 0 {Utils => i18n}/_ChineseText.cpp | 0 {Utils => i18n}/_DutchText.cpp | 0 {Utils => i18n}/_EnglishText.cpp | 0 {Utils => i18n}/_FrenchText.cpp | 0 {Utils => i18n}/_GermanText.cpp | 0 {Utils => i18n}/_ItalianText.cpp | 0 {Utils => i18n}/_Ja25ChineseText.cpp | 0 {Utils => i18n}/_Ja25DutchText.cpp | 0 {Utils => i18n}/_Ja25EnglishText.cpp | 0 {Utils => i18n}/_Ja25FrenchText.cpp | 0 {Utils => i18n}/_Ja25GermanText.cpp | 0 {Utils => i18n}/_Ja25ItalianText.cpp | 0 {Utils => i18n}/_Ja25PolishText.cpp | 0 {Utils => i18n}/_Ja25RussianText.cpp | 0 {Utils => i18n}/_PolishText.cpp | 0 {Utils => i18n}/_RussianText.cpp | 0 {Utils => i18n/include}/ExportStrings.h | 0 {Utils => i18n/include}/_Ja25DutchText.h | 0 {Utils => i18n/include}/_Ja25EnglishText.h | 0 {Utils => i18n/include}/_Ja25FrenchText.h | 0 {Utils => i18n/include}/_Ja25GermanText.h | 0 {Utils => i18n/include}/_Ja25ItalianText.h | 0 {Utils => i18n/include}/_Ja25PolishText.h | 0 {Utils => i18n/include}/_Ja25RussianText.h | 0 27 files changed, 17 insertions(+), 17 deletions(-) rename {Utils => i18n}/ExportStrings.cpp (100%) rename {Utils => i18n}/_ChineseText.cpp (100%) rename {Utils => i18n}/_DutchText.cpp (100%) rename {Utils => i18n}/_EnglishText.cpp (100%) rename {Utils => i18n}/_FrenchText.cpp (100%) rename {Utils => i18n}/_GermanText.cpp (100%) rename {Utils => i18n}/_ItalianText.cpp (100%) rename {Utils => i18n}/_Ja25ChineseText.cpp (100%) rename {Utils => i18n}/_Ja25DutchText.cpp (100%) rename {Utils => i18n}/_Ja25EnglishText.cpp (100%) rename {Utils => i18n}/_Ja25FrenchText.cpp (100%) rename {Utils => i18n}/_Ja25GermanText.cpp (100%) rename {Utils => i18n}/_Ja25ItalianText.cpp (100%) rename {Utils => i18n}/_Ja25PolishText.cpp (100%) rename {Utils => i18n}/_Ja25RussianText.cpp (100%) rename {Utils => i18n}/_PolishText.cpp (100%) rename {Utils => i18n}/_RussianText.cpp (100%) rename {Utils => i18n/include}/ExportStrings.h (100%) rename {Utils => i18n/include}/_Ja25DutchText.h (100%) rename {Utils => i18n/include}/_Ja25EnglishText.h (100%) rename {Utils => i18n/include}/_Ja25FrenchText.h (100%) rename {Utils => i18n/include}/_Ja25GermanText.h (100%) rename {Utils => i18n/include}/_Ja25ItalianText.h (100%) rename {Utils => i18n/include}/_Ja25PolishText.h (100%) rename {Utils => i18n/include}/_Ja25RussianText.h (100%) diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 688f9555..ebf13645 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -7,7 +7,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/dsutil.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Encrypted File.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Event Pump.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Font Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ImportStrings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/INIReader.cpp" @@ -37,20 +36,4 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/XML_Items.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Language.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_SenderNameList.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_ChineseText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_DutchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_EnglishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_FrenchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_GermanText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_ItalianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ChineseText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25DutchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25EnglishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25FrenchText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25GermanText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ItalianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25PolishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" PARENT_SCOPE) diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 6c40cf61..8f36adea 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -1,5 +1,22 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/language.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Ja2 Libs.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/ExportStrings.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_ChineseText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_DutchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_EnglishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_FrenchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_GermanText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_ItalianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ChineseText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25DutchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25EnglishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25FrenchText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25GermanText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25ItalianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25PolishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" PARENT_SCOPE ) diff --git a/Utils/ExportStrings.cpp b/i18n/ExportStrings.cpp similarity index 100% rename from Utils/ExportStrings.cpp rename to i18n/ExportStrings.cpp diff --git a/Utils/_ChineseText.cpp b/i18n/_ChineseText.cpp similarity index 100% rename from Utils/_ChineseText.cpp rename to i18n/_ChineseText.cpp diff --git a/Utils/_DutchText.cpp b/i18n/_DutchText.cpp similarity index 100% rename from Utils/_DutchText.cpp rename to i18n/_DutchText.cpp diff --git a/Utils/_EnglishText.cpp b/i18n/_EnglishText.cpp similarity index 100% rename from Utils/_EnglishText.cpp rename to i18n/_EnglishText.cpp diff --git a/Utils/_FrenchText.cpp b/i18n/_FrenchText.cpp similarity index 100% rename from Utils/_FrenchText.cpp rename to i18n/_FrenchText.cpp diff --git a/Utils/_GermanText.cpp b/i18n/_GermanText.cpp similarity index 100% rename from Utils/_GermanText.cpp rename to i18n/_GermanText.cpp diff --git a/Utils/_ItalianText.cpp b/i18n/_ItalianText.cpp similarity index 100% rename from Utils/_ItalianText.cpp rename to i18n/_ItalianText.cpp diff --git a/Utils/_Ja25ChineseText.cpp b/i18n/_Ja25ChineseText.cpp similarity index 100% rename from Utils/_Ja25ChineseText.cpp rename to i18n/_Ja25ChineseText.cpp diff --git a/Utils/_Ja25DutchText.cpp b/i18n/_Ja25DutchText.cpp similarity index 100% rename from Utils/_Ja25DutchText.cpp rename to i18n/_Ja25DutchText.cpp diff --git a/Utils/_Ja25EnglishText.cpp b/i18n/_Ja25EnglishText.cpp similarity index 100% rename from Utils/_Ja25EnglishText.cpp rename to i18n/_Ja25EnglishText.cpp diff --git a/Utils/_Ja25FrenchText.cpp b/i18n/_Ja25FrenchText.cpp similarity index 100% rename from Utils/_Ja25FrenchText.cpp rename to i18n/_Ja25FrenchText.cpp diff --git a/Utils/_Ja25GermanText.cpp b/i18n/_Ja25GermanText.cpp similarity index 100% rename from Utils/_Ja25GermanText.cpp rename to i18n/_Ja25GermanText.cpp diff --git a/Utils/_Ja25ItalianText.cpp b/i18n/_Ja25ItalianText.cpp similarity index 100% rename from Utils/_Ja25ItalianText.cpp rename to i18n/_Ja25ItalianText.cpp diff --git a/Utils/_Ja25PolishText.cpp b/i18n/_Ja25PolishText.cpp similarity index 100% rename from Utils/_Ja25PolishText.cpp rename to i18n/_Ja25PolishText.cpp diff --git a/Utils/_Ja25RussianText.cpp b/i18n/_Ja25RussianText.cpp similarity index 100% rename from Utils/_Ja25RussianText.cpp rename to i18n/_Ja25RussianText.cpp diff --git a/Utils/_PolishText.cpp b/i18n/_PolishText.cpp similarity index 100% rename from Utils/_PolishText.cpp rename to i18n/_PolishText.cpp diff --git a/Utils/_RussianText.cpp b/i18n/_RussianText.cpp similarity index 100% rename from Utils/_RussianText.cpp rename to i18n/_RussianText.cpp diff --git a/Utils/ExportStrings.h b/i18n/include/ExportStrings.h similarity index 100% rename from Utils/ExportStrings.h rename to i18n/include/ExportStrings.h diff --git a/Utils/_Ja25DutchText.h b/i18n/include/_Ja25DutchText.h similarity index 100% rename from Utils/_Ja25DutchText.h rename to i18n/include/_Ja25DutchText.h diff --git a/Utils/_Ja25EnglishText.h b/i18n/include/_Ja25EnglishText.h similarity index 100% rename from Utils/_Ja25EnglishText.h rename to i18n/include/_Ja25EnglishText.h diff --git a/Utils/_Ja25FrenchText.h b/i18n/include/_Ja25FrenchText.h similarity index 100% rename from Utils/_Ja25FrenchText.h rename to i18n/include/_Ja25FrenchText.h diff --git a/Utils/_Ja25GermanText.h b/i18n/include/_Ja25GermanText.h similarity index 100% rename from Utils/_Ja25GermanText.h rename to i18n/include/_Ja25GermanText.h diff --git a/Utils/_Ja25ItalianText.h b/i18n/include/_Ja25ItalianText.h similarity index 100% rename from Utils/_Ja25ItalianText.h rename to i18n/include/_Ja25ItalianText.h diff --git a/Utils/_Ja25PolishText.h b/i18n/include/_Ja25PolishText.h similarity index 100% rename from Utils/_Ja25PolishText.h rename to i18n/include/_Ja25PolishText.h diff --git a/Utils/_Ja25RussianText.h b/i18n/include/_Ja25RussianText.h similarity index 100% rename from Utils/_Ja25RussianText.h rename to i18n/include/_Ja25RussianText.h From 5fb989a1fc429de8512abe958c1d7a23ccc6bd94 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 08:29:55 -0300 Subject: [PATCH 247/571] Move Text.h over to i18n too Never use relative paths for #includes. Didn't touch the rest because out of scope. --- ModularizedTacticalAI/src/LegacyAIPlan.cpp | 2 +- {Utils => i18n/include}/Text.h | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {Utils => i18n/include}/Text.h (100%) diff --git a/ModularizedTacticalAI/src/LegacyAIPlan.cpp b/ModularizedTacticalAI/src/LegacyAIPlan.cpp index f08340ee..d672870e 100644 --- a/ModularizedTacticalAI/src/LegacyAIPlan.cpp +++ b/ModularizedTacticalAI/src/LegacyAIPlan.cpp @@ -15,7 +15,7 @@ #include "../../TileEngine/Isometric Utils.h" // defines NOWHERE #include "../../Utils/Debug Control.h" // LiveMessage #include "../../Utils/Font Control.h" // ScreenMsg about deadlock -#include "../../Utils/Text.h" // Sniper warning +#include // Sniper warning #include "../../Utils/message.h" // ditto diff --git a/Utils/Text.h b/i18n/include/Text.h similarity index 100% rename from Utils/Text.h rename to i18n/include/Text.h From cf0b4dfc4039a486f034089dd7930744ba4b4cef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:25:43 -0300 Subject: [PATCH 248/571] Manual unrolling preprocessor stuff and added function This function is just for GERMAN but it has a unique name so it's no problem. Had to slightly change how MercID gets populated --- Ja2/jascreens.cpp | 2 -- Laptop/AimMembers.cpp | 16 +++++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index 87d04505..9e7df483 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -959,7 +959,6 @@ void DoneFadeOutForDemoExitScreen( void ) // unused //extern INT8 gbFadeSpeed; -#ifdef GERMAN void DisplayTopwareGermanyAddress() { VOBJECT_DESC vo_desc; @@ -994,7 +993,6 @@ void DisplayTopwareGermanyAddress() ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); } -#endif UINT32 DemoExitScreenHandle(void) { diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 0c1e2f37..490d0a63 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -5367,11 +5367,17 @@ BOOLEAN DisplayShadedStretchedMercFace( UINT8 ubMercID, UINT16 usPosX, UINT16 us void DemoHiringOfMercs( ) { INT16 i; - #ifdef GERMAN - UINT8 MercID[]={ 7, 10, 4, 14, 50 }; - #else - UINT8 MercID[]={ 7, 10, 4, 42, 33 }; - #endif + UINT8 MercID[5]; + MercID[0] = 7; + MercID[1] = 10; + MercID[2] = 4; + if( g_lang == i18n::Lang::de ) { + MercID[3] = 14; + MercID[4] = 50; + } else { + MercID[3] = 42; + MercID[4] = 33; + } MERC_HIRE_STRUCT HireMercStruct; static BOOLEAN fHaveCalledBefore=FALSE; From 4b563fefc897b9ac6106c3cb0573880eaf0ba6f1 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 09:41:32 -0300 Subject: [PATCH 249/571] Slightly clunkier fix for RUSSIAN conditional --- Tactical/Dialogue Control.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index cb646341..00b32f72 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -67,6 +67,7 @@ #include "ub_config.h" #include "history.h" +#include //forward declarations of common classes to eliminate includes class OBJECTTYPE; @@ -2407,8 +2408,8 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN { if ( fWavFile ) { -#ifdef RUSSIAN - if ( ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || + if ( g_lang == i18n::Lang::ru && + ( gMercProfiles[ubCharacterNum].Type == PROFILETYPE_RPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_NPC || gMercProfiles[ubCharacterNum].Type == PROFILETYPE_VEHICLE ) && gMercProfiles[ ubCharacterNum ].ubMiscFlags & PROFILE_MISC_FLAG_RECRUITED ) { @@ -2426,7 +2427,7 @@ CHAR8 *GetDialogueDataFilename( UINT8 ubCharacterNum, UINT16 usQuoteNum, BOOLEAN #endif } else -#endif + { // build name of wav file (characternum + quotenum) sprintf( zFileNameHelper, "SPEECH\\%03d_%03d", usVoiceSet, usQuoteNum ); From ecdc8916f2b6b3b1fd3da359423f1393d12b2525 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 25 Dec 2024 09:59:23 -0300 Subject: [PATCH 250/571] Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n Just awful --- Laptop/BobbyR.h | 1 + Laptop/BobbyRGuns.cpp | 7 ------- i18n/include/language.hpp | 2 ++ i18n/language.cpp | 9 +++++++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Laptop/BobbyR.h b/Laptop/BobbyR.h index 486a9a80..6d011960 100644 --- a/Laptop/BobbyR.h +++ b/Laptop/BobbyR.h @@ -25,6 +25,7 @@ void RenderBobbyR(); #define BOBBYR_GRIDLOC_X LAPTOP_SCREEN_UL_X + 4 #define BOBBYR_GRIDLOC_Y LAPTOP_SCREEN_WEB_UL_Y + 5 //LAPTOP_SCREEN_WEB_UL_Y + 45 +#define BOBBYR_ORDER_NUM_WIDTH 15 /* extern UINT16 gusFirstGunIndex; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index ac9855fc..15613004 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -87,7 +87,6 @@ #define BOBBYR_ITEM_NAME_X BOBBYR_GRIDLOC_X + 6 #define BOBBYR_ITEM_NAME_Y_OFFSET 54 -#define BOBBYR_ORDER_NUM_WIDTH 15 #define BOBBYR_ORDER_NUM_X BOBBYR_GRIDLOC_X + 120 - BOBBYR_ORDER_NUM_WIDTH //BOBBYR_ITEM_STOCK_TEXT_X #define BOBBYR_ORDER_NUM_Y_OFFSET 1 @@ -116,12 +115,6 @@ #define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1 #define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40 -#ifdef CHINESE - #define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH - 10 //BOBBYR_ITEM_QTY_NUM_X -#else - #define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X -#endif - #define BOBBY_RAY_NOT_PURCHASED 255 #define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200 diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index bd895bcc..e88fbe5a 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -20,4 +20,6 @@ extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; +extern const int BOBBYR_ITEMS_BOUGHT_X; + auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 555b33c2..25b0c816 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -1,5 +1,8 @@ #include +#include +#include + /* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language * (ideally text and voice separately) be set in the options menu would be * ideal. */ @@ -31,6 +34,12 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ #endif }; +const int BOBBYR_ITEMS_BOUGHT_X{BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH +#ifdef CHINESE + - 10 +#endif +}; + auto GetLanguagePrefix() -> const STR { return #if defined(ENGLISH) From b15c4ef96c2d3e4a599201388ef5ab7c522c6988 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 31 Dec 2024 08:44:03 -0300 Subject: [PATCH 251/571] the really gnarly CHINESE #ifdef conversions these seem to be right, chinese text appears to be flowing correctly --- Utils/WordWrap.cpp | 88 +++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/Utils/WordWrap.cpp b/Utils/WordWrap.cpp index 3368c2f9..900193c7 100644 --- a/Utils/WordWrap.cpp +++ b/Utils/WordWrap.cpp @@ -5,6 +5,7 @@ #include "Stdio.h" #include "WinFont.h" +#include #define SINGLE_CHARACTER_WORD_FOR_WORDWRAP @@ -224,8 +225,9 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW } - if((usCurrentWidthPixels > usLineWidthPixels) -#ifdef CHINESE + if( (g_lang != i18n::Lang::zh && usCurrentWidthPixels > usLineWidthPixels) + || + (g_lang == i18n::Lang::zh && usCurrentWidthPixels > usLineWidthPixels && TempString[usCurIndex] != L',' && TempString[usCurIndex] != L'。' && TempString[usCurIndex] != L'ï¼›' @@ -237,8 +239,8 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW && TempString[usCurIndex] != L'?' && TempString[usCurIndex] != L')' && TempString[usCurIndex] != L')' -#endif )//||(DestString[ usDestIndex ]==NEWLINE_CHAR )||(fNewLine)) +) { //if an error has occured, and the string is too long @@ -250,11 +252,10 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW usLastMaxWidthIndex = usDestIndex; //Go back to begining of word - while( (DestString[ usDestIndex ] != L' ') && (usCurIndex > 0) && (usDestIndex > 0) -#ifdef CHINESE - && DestString[usDestIndex] < 255 -#endif - ) + while( + (g_lang != i18n::Lang::zh && DestString[ usDestIndex ] != L' ' && usCurIndex > 0 && usDestIndex > 0) + || + (g_lang == i18n::Lang::zh && DestString[ usDestIndex ] != L' ' && usCurIndex > 0 && usDestIndex > 0 && DestString[usDestIndex] < 255)) { OneChar[0] = DestString[ usDestIndex ]; @@ -263,8 +264,7 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW usCurIndex--; usDestIndex--; } -#ifdef CHINESE - if (DestString[usDestIndex] > 255) + if (g_lang == i18n::Lang::zh && DestString[usDestIndex] > 255) { if (DestString[usDestIndex] == L',' || DestString[usDestIndex] == L',' @@ -282,7 +282,7 @@ WRAPPED_STRING *LineWrap(INT32 iFont, UINT16 usLineWidthPixels, UINT16 *pusLineW else {usCurIndex--;} } -#endif + usEndIndex = usDestIndex; // OJW - 20090427 @@ -576,21 +576,19 @@ UINT16 IanDisplayWrappedString(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UIN { // each character goes towards building a new word -#ifdef CHINESE //zwwooooo: Chinese Text is not need SPACE to segmentation words, so need another process - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] < 255) { +//zwwooooo: Chinese Text is not need SPACE to segmentation words, so need another process + if ( + (g_lang == i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] < 255) + || + (g_lang != i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) + ) { zWordString[usDestCounter++] = pString[usSourceCounter]; } else { + if(g_lang == i18n::Lang::zh) { zWordString[usDestCounter++] = pString[usSourceCounter]; -#else - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) - { - zWordString[usDestCounter++] = pString[usSourceCounter]; - } - else - { -#endif + } // we hit a space (or end of record), so this is the END of a word! // is this a special CODE? @@ -924,12 +922,11 @@ DEF: commented out for Beta. Nov 30 // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE //zwwooooo: Chinese Text don't need add space -#else +if(g_lang != i18n::Lang::zh) { // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; -#endif +} // RE-terminate the string zWordString[usDestCounter] = 0; @@ -1381,33 +1378,33 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt } else // not a special character { -#ifdef CHINESE wchar_t currentChar=pString[usSourceCounter]; - if (currentChar> 255 ) + if (g_lang == i18n::Lang::zh && currentChar> 255 ) { if (usDestCounter == 0) {zWordString[usDestCounter++] = currentChar;} else {usSourceCounter--;} } -#endif // terminate the string TEMPORARILY zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE - if (currentChar <= 255) -#endif + if (g_lang != i18n::Lang::zh || + g_lang == i18n::Lang::zh && currentChar <= 255) { // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; + } // RE-terminate the string zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? - if ((usLineLengthPixels + usWordLengthPixels) < usWidth -#ifdef CHINESE + if ( + (g_lang != i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) < usWidth) + || + (g_lang == i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) < usWidth || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L'。' @@ -1420,7 +1417,7 @@ INT16 IanDisplayWrappedStringToPages(UINT16 usPosX, UINT16 usPosY, UINT16 usWidt || pString[usSourceCounter] == L'?' || pString[usSourceCounter] == L')' || pString[usSourceCounter] == L')' -#endif +) ) { // yes we can fit this word. @@ -1506,10 +1503,10 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT do { // each character goes towards building a new word - if (pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 -#ifdef CHINESE - && pString[usSourceCounter] <= 255 -#endif + if ( + (g_lang != i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0) + || + (g_lang == i18n::Lang::zh && pString[usSourceCounter] != TEXT_SPACE && pString[usSourceCounter] != 0 && pString[usSourceCounter] <= 255) ) { zWordString[usDestCounter++] = pString[usSourceCounter]; @@ -1723,24 +1720,20 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT } else // not a special character { -#ifdef CHINESE wchar_t currentChar = pString[usSourceCounter]; - if (currentChar > 255 ) + if (g_lang == i18n::Lang::zh && currentChar > 255 ) { if (usDestCounter == 0) {zWordString[usDestCounter++] = currentChar;} else {usSourceCounter--;} } -#endif // terminate the string TEMPORARILY zWordString[usDestCounter] = 0; // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); -#ifdef CHINESE - if (currentChar <= 255) -#endif + if (g_lang == i18n::Lang::zh && currentChar <= 255) // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; @@ -1748,8 +1741,10 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT zWordString[usDestCounter] = 0; // can we fit it onto the length of our "line" ? - if ((usLineLengthPixels + usWordLengthPixels) <= usWidth -#ifdef CHINESE + if ( + (g_lang != i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) <= usWidth) + || + (g_lang == i18n::Lang::zh && (usLineLengthPixels + usWordLengthPixels) <= usWidth || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L',' || pString[usSourceCounter] == L'。' @@ -1759,8 +1754,7 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT || pString[usSourceCounter] == L':' || pString[usSourceCounter] == L')' || pString[usSourceCounter] == L')' -#endif - ) + )) { // yes we can fit this word. From 70f09471c21c9f7ceea931a1b143d9d8d5db0ee0 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 27 Dec 2024 09:22:06 -0300 Subject: [PATCH 252/571] just cast g_lang into lua's language code because magically I got the enum order right first try --- Strategic/LuaInitNPCs.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 519dc005..721a5a44 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -96,6 +96,7 @@ extern "C" { #include "Merc Contract.h" #include "message.h" #include "Town Militia.h" +#include extern UINT8 gubWaitingForAllMercsToExitCode; @@ -13208,26 +13209,7 @@ static int l_GetUsedLanguage( lua_State *L ) { if ( lua_gettop( L ) ) { - INT32 val = 0; - -#if defined(ENGLISH) - val = 0; -#elif defined(GERMAN) - val = 1; -#elif defined(RUSSIAN) - val = 2; -#elif defined(DUTCH) - val = 3; -#elif defined(POLISH) - val = 4; -#elif defined(FRENCH) - val = 5; -#elif defined(ITALIAN) - val = 6; -#elif defined(CHINESE) - val = 7; -#endif - + INT32 val = static_cast(g_lang); lua_pushinteger( L, val ); } From 4a7625cef0b41205b90d7059e9a1bd06cfa9da2d Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:27:00 -0300 Subject: [PATCH 253/571] Slightly clunky RUSSIAN conversion --- Laptop/IMP Begin Screen.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 846666ec..41141ab5 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -24,6 +24,7 @@ #include "text.h" #include "LaptopSave.h" +#include #define FULL_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 138 #define NICK_NAME_CURSOR_Y LAPTOP_SCREEN_WEB_UL_Y + 195 @@ -552,7 +553,7 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) //Heinz (18.01.2009): Russian layout // ViSoR (07.01.2012) : Russian and Belarussian layouts // -#if defined(RUSSIAN) || defined(BELARUSSIAN) +if(g_lang == i18n::Lang::ru) { // ViSoR (02.02.2013): Fix for Cyrillic layouts DWORD threadId = GetWindowThreadProcessId( ghWindow, 0 ); DWORD layout = (DWORD)GetKeyboardLayout( threadId ) & 0xFFFF; @@ -574,17 +575,16 @@ void HandleBeginScreenTextEvent( UINT32 uiKey ) } else if( !CheckIsKeyValid( uiKey ) ) uiKey = '#'; - - if( uiKey != '#') -#else - if( uiKey >= 'A' && uiKey <= 'Z' || +} + if( (g_lang != i18n::Lang::ru && + uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || uiKey == '_' || uiKey == '.' || uiKey == ' ' || uiKey == '"' || uiKey == 39 // This is ' which cannot be written explicitly here of course - ) -#endif + ) || + uiKey != '#') { // if the current string position is at max or great, do nothing switch( ubTextEnterMode ) From cccec0ef111fd7e7c83d3c39d145c53dfa351ace Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:29:24 -0300 Subject: [PATCH 254/571] straggler in Utils/Font Control.cpp --- Utils/Font Control.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Utils/Font Control.cpp b/Utils/Font Control.cpp index 87c140f5..efb10ba5 100644 --- a/Utils/Font Control.cpp +++ b/Utils/Font Control.cpp @@ -5,6 +5,7 @@ #include "vsurface.h" #include "wcheck.h" #include "Font Control.h" +#include INT32 giCurWinFont = 0; //BOOLEAN gfUseWinFonts = FALSE; @@ -77,8 +78,8 @@ HVOBJECT gvoBlockFontNarrow; INT32 gp14PointHumanist; HVOBJECT gvo14PointHumanist; -#if defined( JA2EDITOR ) && defined( ENGLISH ) - INT32 gpHugeFont; +#if defined( JA2EDITOR ) + INT32 gpHugeFont; HVOBJECT gvoHugeFont; #endif @@ -94,8 +95,8 @@ UINT16 CreateFontPaletteTables(HVOBJECT pObj ); extern UINT16 gzFontName[32]; auto GetHugeFont() -> INT32 { -#if defined(JA2EDITOR) && defined(ENGLISH) - return gpHugeFont; +#if defined(JA2EDITOR) + return g_lang == i18n::Lang::en ? gpHugeFont : gp16PointArial; #else return gp16PointArial; #endif @@ -216,10 +217,12 @@ BOOLEAN InitializeFonts( ) gvo14PointHumanist = GetFontObject( gp14PointHumanist ); CHECKF( CreateFontPaletteTables( gvo14PointHumanist ) ); - #if defined( JA2EDITOR ) && defined( ENGLISH ) + #if defined( JA2EDITOR ) + if(g_lang == i18n::Lang::en) { gpHugeFont = LoadFontFile( "FONTS\\HUGEFONT.sti" ); gvoHugeFont = GetFontObject( gpHugeFont ); CHECKF( CreateFontPaletteTables( gvoHugeFont ) ); + } #endif // Set default for font system @@ -254,8 +257,10 @@ void ShutdownFonts( ) UnloadFont( gp14PointArial); UnloadFont( gpBlockyFont); UnloadFont( gp12PointArialFixedFont ); - #if defined( JA2EDITOR ) && defined( ENGLISH ) + #if defined( JA2EDITOR ) + if(g_lang == i18n::Lang::en) { UnloadFont( gpHugeFont ); + } #endif // ATE: Shutdown any win fonts From 9ed713f9522418250773c20f0b77f54379b426f6 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 02:41:35 -0300 Subject: [PATCH 255/571] move Utils/Multi Language Graphic Utils.* to i18n has language preprocessor silliness, straight to jail --- Utils/CMakeLists.txt | 1 - i18n/CMakeLists.txt | 1 + {Utils => i18n}/Multi Language Graphic Utils.cpp | 0 {Utils => i18n/include}/Multi Language Graphic Utils.h | 0 4 files changed, 1 insertion(+), 1 deletion(-) rename {Utils => i18n}/Multi Language Graphic Utils.cpp (100%) rename {Utils => i18n/include}/Multi Language Graphic Utils.h (100%) diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index ebf13645..537e2335 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -15,7 +15,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/MapUtility.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MercTextBox.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/message.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Multi Language Graphic Utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Multilingual Text Code Generator.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Music Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/PopUpBox.cpp" diff --git a/i18n/CMakeLists.txt b/i18n/CMakeLists.txt index 8f36adea..6d200975 100644 --- a/i18n/CMakeLists.txt +++ b/i18n/CMakeLists.txt @@ -18,5 +18,6 @@ set(i18nSrc "${CMAKE_CURRENT_SOURCE_DIR}/_Ja25RussianText.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/_PolishText.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/_RussianText.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Multi Language Graphic Utils.cpp" PARENT_SCOPE ) diff --git a/Utils/Multi Language Graphic Utils.cpp b/i18n/Multi Language Graphic Utils.cpp similarity index 100% rename from Utils/Multi Language Graphic Utils.cpp rename to i18n/Multi Language Graphic Utils.cpp diff --git a/Utils/Multi Language Graphic Utils.h b/i18n/include/Multi Language Graphic Utils.h similarity index 100% rename from Utils/Multi Language Graphic Utils.h rename to i18n/include/Multi Language Graphic Utils.h From 10037291f38ded8a7316d2f091b7689969aa7cef Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 26 Dec 2024 03:54:28 -0300 Subject: [PATCH 256/571] remove preprocessor from i18n Multi Language Graphic Utils.cpp --- i18n/Multi Language Graphic Utils.cpp | 33 ++++++++++----------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/i18n/Multi Language Graphic Utils.cpp b/i18n/Multi Language Graphic Utils.cpp index 4d444fb9..af383bd7 100644 --- a/i18n/Multi Language Graphic Utils.cpp +++ b/i18n/Multi Language Graphic Utils.cpp @@ -6,10 +6,11 @@ //SB #include "FileMan.h" +#include BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) { - #if defined( ENGLISH ) + if( g_lang == i18n::Lang::en ) { switch( usMLGGraphicID ) { case MLG_AIMSYMBOL: @@ -141,7 +142,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #elif defined( GERMAN ) + } else if( g_lang == i18n::Lang::de ) { switch( usMLGGraphicID ) { case MLG_AIMSYMBOL: @@ -279,7 +280,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #else + } else { UINT8 zLanguage[64]; @@ -292,29 +293,19 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) // // "GERMAN\\IMPSymbol_German.sti" - #if defined( DUTCH ) + if(g_lang == i18n::Lang::nl) { sprintf( (char *)zLanguage, "DUTCH" ); - #elif defined( FRENCH ) + } else if(g_lang == i18n::Lang::fr) { sprintf( (char *)zLanguage, "FRENCH" ); - #elif defined( GERMAN ) - sprintf( (char *)zLanguage, "GERMAN" ); - #elif defined( ITALIAN ) + } else if(g_lang == i18n::Lang::it) { sprintf( (char *)zLanguage, "ITALIAN" ); - #elif defined( JAPANESE ) - sprintf( (char *)zLanguage, "JAPANESE" ); - #elif defined( KOREAN ) - sprintf( (char *)zLanguage, "KOREAN" ); - #elif defined( POLISH ) + } else if(g_lang == i18n::Lang::pl) { sprintf( (char *)zLanguage, "POLISH" ); - #elif defined( RUSSIAN ) + } else if(g_lang == i18n::Lang::ru) { sprintf( (char *)zLanguage, "RUSSIAN" ); - #elif defined( SPANISH ) - sprintf( (char *)zLanguage, "SPANISH" ); - #elif defined( CHINESE ) + } else if(g_lang == i18n::Lang::zh) { sprintf( (char *)zLanguage, "CHINESE" ); - #else - # error "At least You have to specify a Language somewhere. See comments above." - #endif + } //SB: Also check for russian Gold version, like English switch( usMLGGraphicID ) @@ -584,7 +575,7 @@ BOOLEAN GetMLGFilename( SGPFILENAME filename, UINT16 usMLGGraphicID ) return TRUE; } - #endif + } return FALSE; } From e9686c0dcad7a2e396d2fa3c1175e1bafb6f395f Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 14:38:08 -0300 Subject: [PATCH 257/571] reformat CMakeLists.txt --- CMakeLists.txt | 128 ++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f1842724..71e351a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,12 +22,12 @@ endif() option(ADDRESS_SANITIZER OFF) if(ADDRESS_SANITIZER) - message(STATUS "AddressSanitizer ENABLED for non-Release builds") - add_compile_options($,$>,-fsanitize=address,>) + message(STATUS "AddressSanitizer ENABLED for non-Release builds") + add_compile_options($,$>,-fsanitize=address,>) endif() if(MSVC) - add_compile_options("/wd4838") + add_compile_options("/wd4838") endif() # whether we are using MSBuild as a generator @@ -39,22 +39,22 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE) include_directories( - "${CMAKE_SOURCE_DIR}/Ja2" - "${CMAKE_SOURCE_DIR}/ext/VFS/include" - "${CMAKE_SOURCE_DIR}/Utils" - "${CMAKE_SOURCE_DIR}/TileEngine" - "${CMAKE_SOURCE_DIR}/TacticalAI" - "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" - "${CMAKE_SOURCE_DIR}/Tactical" - "${CMAKE_SOURCE_DIR}/Strategic" - "${CMAKE_SOURCE_DIR}/sgp" - "${CMAKE_SOURCE_DIR}/Ja2/Res" - "${CMAKE_SOURCE_DIR}/Lua" - "${CMAKE_SOURCE_DIR}/Laptop" - "${CMAKE_SOURCE_DIR}/Multiplayer" - "${CMAKE_SOURCE_DIR}/Editor" - "${CMAKE_SOURCE_DIR}/Console" - "${CMAKE_SOURCE_DIR}/i18n/include" + "${CMAKE_SOURCE_DIR}/Ja2" + "${CMAKE_SOURCE_DIR}/ext/VFS/include" + "${CMAKE_SOURCE_DIR}/Utils" + "${CMAKE_SOURCE_DIR}/TileEngine" + "${CMAKE_SOURCE_DIR}/TacticalAI" + "${CMAKE_SOURCE_DIR}/ModularizedTacticalAI/include" + "${CMAKE_SOURCE_DIR}/Tactical" + "${CMAKE_SOURCE_DIR}/Strategic" + "${CMAKE_SOURCE_DIR}/sgp" + "${CMAKE_SOURCE_DIR}/Ja2/Res" + "${CMAKE_SOURCE_DIR}/Lua" + "${CMAKE_SOURCE_DIR}/Laptop" + "${CMAKE_SOURCE_DIR}/Multiplayer" + "${CMAKE_SOURCE_DIR}/Editor" + "${CMAKE_SOURCE_DIR}/Console" + "${CMAKE_SOURCE_DIR}/i18n/include" ) # external libraries @@ -76,20 +76,20 @@ add_subdirectory(Multiplayer) # by header files rely on Application and Language preprocessor definitions, and # therefore need to be compiled multiple times. Very Bad. set(Ja2_Libs -TileEngine -TacticalAI -Utils -Strategic -sgp -Laptop -Editor -Console -Tactical -ModularizedTacticalAI -i18n + TileEngine + TacticalAI + Utils + Strategic + sgp + Laptop + Editor + Console + Tactical + ModularizedTacticalAI + i18n ) foreach(lib IN LISTS Ja2_Libs) - add_subdirectory(${lib}) + add_subdirectory(${lib}) endforeach() add_subdirectory(Ja2) @@ -111,43 +111,43 @@ set(debugFlags $,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBU # every library-language-executable combination is its own compilation target # TODO: refactor preprocessor usage onto, ideally, a single translation unit foreach(lang IN LISTS LangTargets) - foreach(exe IN LISTS ApplicationTargets) - set(Executable ${exe}_${lang}) + foreach(exe IN LISTS ApplicationTargets) + set(Executable ${exe}_${lang}) - # executable for an application/language combination, e.g. JA2_ENGLISH.exe - add_executable(${Executable} WIN32) - target_sources(${Executable} PRIVATE ${Ja2Src}) + # executable for an application/language combination, e.g. JA2_ENGLISH.exe + add_executable(${Executable} WIN32) + target_sources(${Executable} PRIVATE ${Ja2Src}) - # Good libraries have already been built, can be simply linked here - target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) - target_link_options(${Executable} PRIVATE $) + # Good libraries have already been built, can be simply linked here + target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) + target_link_options(${Executable} PRIVATE $) - # for each app/lang combination, the Very Bad libraries need to be built, - # with the appropriate preprocessor definitions - foreach(lib IN LISTS Ja2_Libs) - # syntactic sugar to hopefully make this more readable - set(VeryBadLib ${Executable}_${lib}) - set(isEditor $) - set(isUb $) - set(isUbEditor $) + # for each app/lang combination, the Very Bad libraries need to be built, + # with the appropriate preprocessor definitions + foreach(lib IN LISTS Ja2_Libs) + # syntactic sugar to hopefully make this more readable + set(VeryBadLib ${Executable}_${lib}) + set(isEditor $) + set(isUb $) + set(isUbEditor $) - # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib - add_library(${VeryBadLib}) - target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) + # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib + add_library(${VeryBadLib}) + target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) - target_compile_definitions(${VeryBadLib} PUBLIC - $ - $ - $ - ${debugFlags} - ${lang} - ) - target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) - endforeach() + target_compile_definitions(${VeryBadLib} PUBLIC + $ + $ + $ + ${debugFlags} + ${lang} + ) + target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) + endforeach() - # for sgp only - target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") - target_link_libraries(${Executable}_sgp PUBLIC libpng) - target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) - endforeach() + # for sgp only + target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") + target_link_libraries(${Executable}_sgp PUBLIC libpng) + target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) + endforeach() endforeach() From 959c29434eddce5a1537e2af72d5e6858a092502 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 29 Dec 2024 16:33:29 -0300 Subject: [PATCH 258/571] Adjust the build system Language is now just built once per app (still some JA2UB conditionals going on in there) but building everything should now take eight times less work --- .gitignore | 2 + CMakeLists.txt | 125 ++++++++++++++++++++++++--------------------- Ja2/CMakeLists.txt | 14 ----- TODO | 1 + 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/.gitignore b/.gitignore index 6466f05c..5ef609a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +dummy.cpp + # CLion /.idea/ /cmake-build-*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 71e351a8..9f642790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,33 +66,44 @@ target_link_libraries(bfVFS PRIVATE 7z) # ja2export utility add_subdirectory("ext/export/src") -# static libraries whose source files, header files or header files included -# by header files do not rely on Applications or Languages preprocessor definitions, -# and therefore only need to be compiled once. Good. +# static libraries whose translation units don't rely on Application preprocessor definitions. add_subdirectory(Lua) add_subdirectory(Multiplayer) -# static libraries whose source files, header files or header files included -# by header files rely on Application and Language preprocessor definitions, and -# therefore need to be compiled multiple times. Very Bad. +set(Ja2_Libraries +"${CMAKE_SOURCE_DIR}/binkw32.lib" +"${CMAKE_SOURCE_DIR}/libexpatMT.lib" +"${CMAKE_SOURCE_DIR}/lua51.lib" +"${CMAKE_SOURCE_DIR}/lua51.vc9.lib" +"${CMAKE_SOURCE_DIR}/SMACKW32.LIB" +"Dbghelp.lib" +"Winmm.lib" +"ws2_32.lib" +bfVFS +Lua +Multiplayer +) + +# static libraries whose translation units rely on Application preprocessor definitions. set(Ja2_Libs - TileEngine - TacticalAI - Utils - Strategic - sgp - Laptop - Editor Console - Tactical + Editor + Ja2 + Laptop ModularizedTacticalAI - i18n + sgp + Strategic + Tactical + TacticalAI + TileEngine + Utils ) foreach(lib IN LISTS Ja2_Libs) add_subdirectory(${lib}) endforeach() -add_subdirectory(Ja2) +# language library relies on Application _and_ Language preprocessor definition. very bad. +add_subdirectory(i18n) # simple function to validate Languages and Application choices include(cmake/ValidateOptions.cmake) @@ -107,47 +118,47 @@ ValidateOptions("${ValidApplications}" "Applications" "${Applications}" "Applica # preprocessor definitions for Debug build, per the legacy MSBuild set(debugFlags $,JA2BETAVERSION;JA2TESTVERSION;DEBUG_ATTACKBUSY,>) -# Due to widespread preprocessor definition abuse in the codebase, practically -# every library-language-executable combination is its own compilation target -# TODO: refactor preprocessor usage onto, ideally, a single translation unit -foreach(lang IN LISTS LangTargets) - foreach(exe IN LISTS ApplicationTargets) - set(Executable ${exe}_${lang}) +foreach(app IN LISTS ApplicationTargets) + set(isEditor $) + set(isUb $) + set(isUbEditor $) + set(compilationFlags + $ + $ + $ + ) - # executable for an application/language combination, e.g. JA2_ENGLISH.exe - add_executable(${Executable} WIN32) - target_sources(${Executable} PRIVATE ${Ja2Src}) - - # Good libraries have already been built, can be simply linked here - target_link_libraries(${Executable} PRIVATE ${Ja2_Libraries} $) - target_link_options(${Executable} PRIVATE $) - - # for each app/lang combination, the Very Bad libraries need to be built, - # with the appropriate preprocessor definitions - foreach(lib IN LISTS Ja2_Libs) - # syntactic sugar to hopefully make this more readable - set(VeryBadLib ${Executable}_${lib}) - set(isEditor $) - set(isUb $) - set(isUbEditor $) - - # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib - add_library(${VeryBadLib}) - target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) - - target_compile_definitions(${VeryBadLib} PUBLIC - $ - $ - $ - ${debugFlags} - ${lang} - ) - target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) - endforeach() - - # for sgp only - target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") - target_link_libraries(${Executable}_sgp PUBLIC libpng) - target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION) + foreach(lib IN LISTS Ja2_Libs) + # library for an application, e.g. JA2UB_sgp + set(game_library ${app}_${lib}) + add_library(${game_library}) + target_sources(${game_library} PRIVATE ${${lib}Src}) + target_compile_definitions(${game_library} PRIVATE ${compilationFlags} ${debugFlags}) endforeach() + + foreach(lang IN LISTS LangTargets) + # executable for an application/language combination, e.g. JA2_ENGLISH.exe + set(exe ${app}_${lang}) + file(WRITE dummy.cpp "") + add_executable(${exe} WIN32 dummy.cpp) + target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) + target_link_options(${exe} PRIVATE $) + + # language library for an application, e.g. JA2MAPEDITOR_ENGLISH_i18n + set(language_library ${exe}_i18n) + add_library(${language_library}) + target_sources(${language_library} PRIVATE ${i18nSrc}) + target_compile_definitions(${language_library} PRIVATE ${compilationFlags} ${debugFlags} ${lang}) + target_link_libraries(${exe} PRIVATE ${language_library}) + + # go through all game libraries again and link them to the app/language executable + foreach(lib IN LISTS Ja2_Libs) + target_link_libraries(${exe} PRIVATE ${app}_${lib}) + endforeach() + endforeach() + + # for SGP only + target_link_libraries(${app}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") + target_link_libraries(${app}_sgp PRIVATE libpng) + target_compile_definitions(${app}_sgp PRIVATE NO_ZLIB_COMPRESSION) endforeach() diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index 7f8806f9..c990339d 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -36,17 +36,3 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp" ${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc PARENT_SCOPE) - -set(Ja2_Libraries -"${CMAKE_SOURCE_DIR}/libexpatMT.lib" -"Dbghelp.lib" -Lua -"${CMAKE_SOURCE_DIR}/lua51.lib" -"${CMAKE_SOURCE_DIR}/lua51.vc9.lib" -"Winmm.lib" -"${CMAKE_SOURCE_DIR}/SMACKW32.LIB" -"${CMAKE_SOURCE_DIR}/binkw32.lib" -bfVFS -"ws2_32.lib" -Multiplayer -PARENT_SCOPE) diff --git a/TODO b/TODO index e4bb3a3c..e2e87827 100644 --- a/TODO +++ b/TODO @@ -2,3 +2,4 @@ # priority (LOW,HIGH) and description LOW readd the C4838 (https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4838) warning to CMakeLists.txt once they're all fixed in the code +HIGH get rid of ENGLISH, GERMAN, etc preprocessor definitions completely. that way i18n can be built just once and language can be changed in the options screen pending game restart (hotloading will likely require more work) From 7aafa7aada5940777f2c35da098077b4e6d091fc Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 1 Jan 2025 17:17:45 -0300 Subject: [PATCH 259/571] fix the GitHub actions for VS2022's quirk too missed this change in 98cdffe5, fix it now --- .github/workflows/build_language.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 1b7d6ee4..d233ef0f 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -59,7 +59,7 @@ jobs: run: | set -eux - touch CMakeUserPresets.json + touch CMakePresets.json JA2Language=$(echo '${{ inputs.language }}' | tr '[:lower:]' '[:upper:]') JA2Application=$(echo '${{ matrix.application }}' | tr '[:lower:]' '[:upper:]') From a7b0091a27a1942a5ed5521b86df9393dbf5bdcd Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Wed, 1 Jan 2025 17:08:38 -0300 Subject: [PATCH 260/571] use link-time optimization when creating a release it's a lot slower, but we don't release often --- .github/workflows/build_language.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index d233ef0f..0f97c733 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -54,6 +54,16 @@ jobs: sed -i "s|@Build@|${GAME_BUILD:0:255}|" Ja2/GameVersion.cpp cat Ja2/GameVersion.cpp + - name: Turn on link-time optimization? + if: fromJSON(inputs.assemble) + shell: bash + run: | + set -eux + + echo " + LTO=ON + " >> $GITHUB_ENV + - name: Prepare build properties shell: bash run: | @@ -77,7 +87,7 @@ jobs: arch: x86 - name: Prepare build run: | - cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application" + cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application" -DLTO_OPTION="$Env:LTO" - name: Build run: | cmake --build build/ -- -v From b908bcecb92bd286bbbdd95a757f7aae8c068f8c Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 2 Jan 2025 07:33:39 -0300 Subject: [PATCH 261/571] fix missing icon in executable the Ja2.rc file needs to be in the add_executable target for the icon to appear, and that one requires WinMain. so get rid of dummy.cpp and put sgp/sgp.cpp in there --- .gitignore | 2 -- CMakeLists.txt | 6 ++++-- Ja2/CMakeLists.txt | 1 - sgp/CMakeLists.txt | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5ef609a7..6466f05c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -dummy.cpp - # CLion /.idea/ /cmake-build-*/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f642790..532067ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,8 +139,10 @@ foreach(app IN LISTS ApplicationTargets) foreach(lang IN LISTS LangTargets) # executable for an application/language combination, e.g. JA2_ENGLISH.exe set(exe ${app}_${lang}) - file(WRITE dummy.cpp "") - add_executable(${exe} WIN32 dummy.cpp) + add_executable(${exe} WIN32 + sgp/sgp.cpp + Ja2/Res/Ja2.rc + ) target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) target_link_options(${exe} PRIVATE $) diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index c990339d..9b798987 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -34,5 +34,4 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp" -${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc PARENT_SCOPE) diff --git a/sgp/CMakeLists.txt b/sgp/CMakeLists.txt index c1df77f3..2a493d63 100644 --- a/sgp/CMakeLists.txt +++ b/sgp/CMakeLists.txt @@ -21,7 +21,6 @@ set(sgpSrc "${CMAKE_CURRENT_SOURCE_DIR}/PCX.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/PngLoader.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Random.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/sgp.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/sgp_logger.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/shading.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/soundman.cpp" From ed73bd07ae27ab584394e67593d1fb0a3b84dc46 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 2 Jan 2025 08:05:05 -0300 Subject: [PATCH 262/571] Revert "Make Chinese specific strings compile-time instead of conditional" When these lines were edited, I likely opened _ChineseText.cpp in the wrong encoding, and therefore saved it in the wrong encoding, mangling the characters This reverts commit cd69f5f3aeabd64816fd02d7308407451bf6ecad. --- i18n/_ChineseText.cpp | 14 ++++++++++++++ i18n/include/Text.h | 24 ++++++++++++------------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index 3b7f881c..622b69f5 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -12159,4 +12159,18 @@ STR16 szRobotText[] = L"机器人附加%s技能效果。", //L"The robot gains the benefit of the %s skill trait.", }; +// WANNE: Some Chinese specific strings that needs to be in unicode! +STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode +STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; +STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; +STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; +STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; +STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente +STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente +STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente +STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente + #endif //CHINESE diff --git a/i18n/include/Text.h b/i18n/include/Text.h index 8d32695a..a71e194d 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -2584,18 +2584,18 @@ extern STR16 MPServerMessage[]; extern STR16 MPClientMessage[]; // WANNE: Some Chinese specific strings that needs to be in unicode! -inline constexpr STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -inline constexpr STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode -inline constexpr STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -inline constexpr STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; -inline constexpr STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente -inline constexpr STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente -inline constexpr STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente -inline constexpr STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente -inline constexpr STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +extern STR16 ChineseSpecString1; +extern STR16 ChineseSpecString2; +extern STR16 ChineseSpecString3; +extern STR16 ChineseSpecString4; +extern STR16 ChineseSpecString5; +extern STR16 ChineseSpecString6; +extern STR16 ChineseSpecString7; +extern STR16 ChineseSpecString8; +extern STR16 ChineseSpecString9; +extern STR16 ChineseSpecString10; +extern STR16 ChineseSpecString11; +extern STR16 ChineseSpecString12; enum { From 846abf5f1ce449eb5e49d08f5ca3023b1b790ccd Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 2 Jan 2025 09:02:36 -0300 Subject: [PATCH 263/571] Convert Text.h to utf-8-sig and move ChineseSpecString* there This time without mangling the characters --- i18n/_ChineseText.cpp | 14 -------------- i18n/include/Text.h | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index 622b69f5..3b7f881c 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -12159,18 +12159,4 @@ STR16 szRobotText[] = L"机器人附加%s技能效果。", //L"The robot gains the benefit of the %s skill trait.", }; -// WANNE: Some Chinese specific strings that needs to be in unicode! -STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode -STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; -STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; -STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; -STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; -STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente -STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente -STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente - #endif //CHINESE diff --git a/i18n/include/Text.h b/i18n/include/Text.h index a71e194d..6d97672a 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -1,4 +1,4 @@ -#ifndef __TEXT_H +#ifndef __TEXT_H #define __TEXT_H #include "items.h" @@ -2584,18 +2584,18 @@ extern STR16 MPServerMessage[]; extern STR16 MPClientMessage[]; // WANNE: Some Chinese specific strings that needs to be in unicode! -extern STR16 ChineseSpecString1; -extern STR16 ChineseSpecString2; -extern STR16 ChineseSpecString3; -extern STR16 ChineseSpecString4; -extern STR16 ChineseSpecString5; -extern STR16 ChineseSpecString6; -extern STR16 ChineseSpecString7; -extern STR16 ChineseSpecString8; -extern STR16 ChineseSpecString9; -extern STR16 ChineseSpecString10; -extern STR16 ChineseSpecString11; -extern STR16 ChineseSpecString12; +inline constexpr STR16 ChineseSpecString1 = L"%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString2 = L"*%3d%ï¼…%%"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString3 = L"%d%ï¼…"; //defined in _ChineseText.cpp as this file is already unicode +inline constexpr STR16 ChineseSpecString4 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString5 = L"%s [%d%ï¼…]\n%s %d\n%s %d\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString6 = L"%s [%d%ï¼…]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString7 = L"%s [%d%ï¼…]\n%s %1.1f %s"; +inline constexpr STR16 ChineseSpecString8 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente +inline constexpr STR16 ChineseSpecString9 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString10 = L"%s [%d%ï¼…(%d%ï¼…)]\n%s %d%ï¼… (%d/%d)\n%s %d%ï¼…\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString11 = L"%s (%s) [%d%ï¼…(%d%ï¼…)]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s"; // added by Flugente +inline constexpr STR16 ChineseSpecString12 = L"%s (%s) [%d%ï¼…]\n%s %d\n%s %d\n%s %d (%d)\n%s (%d) %s\n%s %1.1f %s\n%s %.2f%%"; // added by Flugente enum { From 4a16698cdb055d5c130dd872c76939845e447726 Mon Sep 17 00:00:00 2001 From: majcosta <34732933+majcosta@users.noreply.github.com> Date: Fri, 3 Jan 2025 21:03:09 -0300 Subject: [PATCH 264/571] CHINESE: actually display BobbyR amount purchased correctly at runtime (#398) * Revert "Move CHINESE BOBBYR_ITEMS_BOUGHT_X conditional definition to i18n" This reverts commit ecdc8916f2b6b3b1fd3da359423f1393d12b2525. * actually display the amount purchased correctly at runtime --- Laptop/BobbyR.h | 1 - Laptop/BobbyRGuns.cpp | 9 ++++++++- i18n/include/language.hpp | 2 -- i18n/language.cpp | 9 --------- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Laptop/BobbyR.h b/Laptop/BobbyR.h index 6d011960..486a9a80 100644 --- a/Laptop/BobbyR.h +++ b/Laptop/BobbyR.h @@ -25,7 +25,6 @@ void RenderBobbyR(); #define BOBBYR_GRIDLOC_X LAPTOP_SCREEN_UL_X + 4 #define BOBBYR_GRIDLOC_Y LAPTOP_SCREEN_WEB_UL_Y + 5 //LAPTOP_SCREEN_WEB_UL_Y + 45 -#define BOBBYR_ORDER_NUM_WIDTH 15 /* extern UINT16 gusFirstGunIndex; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index 15613004..c8ae1e61 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -87,6 +87,7 @@ #define BOBBYR_ITEM_NAME_X BOBBYR_GRIDLOC_X + 6 #define BOBBYR_ITEM_NAME_Y_OFFSET 54 +#define BOBBYR_ORDER_NUM_WIDTH 15 #define BOBBYR_ORDER_NUM_X BOBBYR_GRIDLOC_X + 120 - BOBBYR_ORDER_NUM_WIDTH //BOBBYR_ITEM_STOCK_TEXT_X #define BOBBYR_ORDER_NUM_Y_OFFSET 1 @@ -115,6 +116,8 @@ #define BOBBYR_ITEM_QTY_NUM_X BOBBYR_GRIDLOC_X + 105//BOBBYR_ITEM_COST_TEXT_X + 1 #define BOBBYR_ITEM_QTY_NUM_Y BOBBYR_ITEM_QTY_TEXT_Y//BOBBYR_ITEM_COST_TEXT_Y + 40 +#define BOBBYR_ITEMS_BOUGHT_X BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH//BOBBYR_ITEM_QTY_NUM_X + #define BOBBY_RAY_NOT_PURCHASED 255 #define BOBBY_RAY_MAX_AMOUNT_OF_ITEMS_TO_PURCHASE 200 @@ -2500,7 +2503,11 @@ void DisplayItemNameAndInfo(UINT16 usPosY, UINT16 usIndex, UINT16 usBobbyIndex, if( ubPurchaseNumber != BOBBY_RAY_NOT_PURCHASED) { swprintf(sTemp, L"% 4d", BobbyRayPurchases[ ubPurchaseNumber ].ubNumberPurchased); - DrawTextToScreen(sTemp, BOBBYR_ITEMS_BOUGHT_X, (UINT16)usPosY, 0, FONT14ARIAL, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + auto bobbyRItemsBoughtX{ BOBBYR_ITEMS_BOUGHT_X }; + if (g_lang == i18n::Lang::zh) { + bobbyRItemsBoughtX -= 10; + } + DrawTextToScreen(sTemp, bobbyRItemsBoughtX, (UINT16)usPosY, 0, FONT14ARIAL, BOBBYR_ITEM_DESC_TEXT_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); } } diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index e88fbe5a..bd895bcc 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -20,6 +20,4 @@ extern const i18n::Lang g_lang; extern const int MAX_MESSAGES_ON_MAP_BOTTOM; -extern const int BOBBYR_ITEMS_BOUGHT_X; - auto GetLanguagePrefix() -> const STR; diff --git a/i18n/language.cpp b/i18n/language.cpp index 25b0c816..555b33c2 100644 --- a/i18n/language.cpp +++ b/i18n/language.cpp @@ -1,8 +1,5 @@ #include -#include -#include - /* FIXME: The ugliest of ugly hacks. Getting rid of this and letting language * (ideally text and voice separately) be set in the options menu would be * ideal. */ @@ -34,12 +31,6 @@ const int MAX_MESSAGES_ON_MAP_BOTTOM{ #endif }; -const int BOBBYR_ITEMS_BOUGHT_X{BOBBYR_GRIDLOC_X + 105 - BOBBYR_ORDER_NUM_WIDTH -#ifdef CHINESE - - 10 -#endif -}; - auto GetLanguagePrefix() -> const STR { return #if defined(ENGLISH) From f471b74f5b98bf968996859ab355af725b413417 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Fri, 3 Jan 2025 21:34:38 -0300 Subject: [PATCH 265/571] fix inconsistent case for a few files you can now build in a case-sensitive filesystem --- CMakeLists.txt | 4 ++-- Ja2/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 532067ab..05825100 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ target_link_libraries(bfVFS PRIVATE 7z) add_subdirectory("ext/export/src") # static libraries whose translation units don't rely on Application preprocessor definitions. -add_subdirectory(Lua) +add_subdirectory(lua) add_subdirectory(Multiplayer) set(Ja2_Libraries @@ -141,7 +141,7 @@ foreach(app IN LISTS ApplicationTargets) set(exe ${app}_${lang}) add_executable(${exe} WIN32 sgp/sgp.cpp - Ja2/Res/Ja2.rc + Ja2/Res/ja2.rc ) target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) target_link_options(${exe} PRIVATE $) diff --git a/Ja2/CMakeLists.txt b/Ja2/CMakeLists.txt index 9b798987..db892953 100644 --- a/Ja2/CMakeLists.txt +++ b/Ja2/CMakeLists.txt @@ -27,7 +27,7 @@ set(Ja2Src "${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/Screens.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/TimeLogging.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp" From fd6ffd8d69c1b6729070758965cf7753e9c768d0 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sun, 5 Jan 2025 05:42:16 +0100 Subject: [PATCH 266/571] automatically add needed dll override for Linux/macOS/Android (WINE) --- Utils/CMakeLists.txt | 1 + Utils/wine.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++ Utils/wine.h | 15 ++++++++++ sgp/sgp.cpp | 10 +++++++ 4 files changed, 91 insertions(+) create mode 100644 Utils/wine.cpp create mode 100644 Utils/wine.h diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 537e2335..05262392 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -29,6 +29,7 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/Text Utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Timer Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Utilities.cpp" +"${CMAKE_CURRENT_SOURCE_DIR}/wine.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/WordWrap.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLProperties.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLWriter.cpp" diff --git a/Utils/wine.cpp b/Utils/wine.cpp new file mode 100644 index 00000000..17c5c4af --- /dev/null +++ b/Utils/wine.cpp @@ -0,0 +1,65 @@ +#include +#include +#include "wine.h" + + +BOOL wine_add_dll_overrides() +{ + BOOL dd = wine_add_dll_override(L"ddraw"); + //BOOL ws = wine_add_dll_override(L"wsock32"); + + return dd; // || ws; +} + +BOOL wine_add_dll_override(const WCHAR* dll_name) +{ + if (!IS_WINE) + return FALSE; + + WCHAR exe_path[MAX_PATH] = { 0 }; + if (!GetModuleFileNameW(NULL, exe_path, _countof(exe_path) - 1)) + return FALSE; + + WCHAR exe_file_name[MAX_PATH] = { 0 }; + WCHAR exe_file_ext[MAX_PATH] = { 0 }; + _wsplitpath(exe_path, NULL, NULL, exe_file_name, exe_file_ext); + + WCHAR reg_path[512] = { 0 }; + _snwprintf( + reg_path, + _countof(reg_path) - 1, + L"SOFTWARE\\Wine\\AppDefaults\\%s%s\\DllOverrides", + exe_file_name, + exe_file_ext); + + BOOL result = FALSE; + HKEY hkey; + LONG status = + RegCreateKeyExW( + HKEY_CURRENT_USER, + reg_path, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE | KEY_READ, + NULL, + &hkey, + NULL); + + if (status == ERROR_SUCCESS) + { + if (RegQueryValueExW(hkey, dll_name, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + { + WCHAR v[] = L"native, builtin"; + if (RegSetValueExW(hkey, dll_name, 0, REG_SZ, (LPCBYTE)v, sizeof(v)) == ERROR_SUCCESS && + RegQueryValueExW(hkey, dll_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) + { + result = TRUE; + } + } + + RegCloseKey(hkey); + } + + return result; +} diff --git a/Utils/wine.h b/Utils/wine.h new file mode 100644 index 00000000..2929c543 --- /dev/null +++ b/Utils/wine.h @@ -0,0 +1,15 @@ +#ifndef WINE_H +#define WINE_H + +#define IS_WINE (GetProcAddress(GetModuleHandleA("ntdll.dll"), "wine_get_version") != 0) + +// ### types ### + +// ### Variables ### + +// ### Functions ### + +BOOL wine_add_dll_overrides(); +BOOL wine_add_dll_override(const WCHAR* dll_name); + +#endif diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index be1fcf5a..8f3f77ba 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -49,6 +49,7 @@ #include "Lua Interpreter.h" #include "connect.h" #include "english.h" +#include "wine.h" #include "BuildDefines.h" #include "Intro.h" @@ -766,7 +767,16 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC HWND hPrevInstanceWindow; UINT32 uiTimer = 0; + // Make sure the game works out of the box on Linux/macOS/Android (WINE) + if (wine_add_dll_overrides()) + { + /* newly added dll overrides only work after a restart */ + char exe_path[MAX_PATH] = { 0 }; + GetModuleFileNameA(NULL, exe_path, _countof(exe_path)); + ShellExecuteA(NULL, "open", exe_path, pCommandLine, NULL, sCommandShow); + return 0; + } vfs::Log::setSharedString( getGameID() ); //if(!vfs::Aspects::getMutexFactory()) From 22e67f66fae5ca2d476f77d42b4cb1ea0ef1321e Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 5 Jan 2025 07:42:07 -0300 Subject: [PATCH 267/571] Move wine.cpp into its own library avoid extra compilations that way --- CMakeLists.txt | 2 ++ Utils/CMakeLists.txt | 1 - wine/CMakeLists.txt | 4 ++++ {Utils => wine/include}/wine.h | 0 {Utils => wine}/wine.cpp | 0 5 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 wine/CMakeLists.txt rename {Utils => wine/include}/wine.h (100%) rename {Utils => wine}/wine.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05825100..5cbfd1fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,7 @@ add_subdirectory("ext/export/src") # static libraries whose translation units don't rely on Application preprocessor definitions. add_subdirectory(lua) add_subdirectory(Multiplayer) +add_subdirectory(wine) set(Ja2_Libraries "${CMAKE_SOURCE_DIR}/binkw32.lib" @@ -82,6 +83,7 @@ set(Ja2_Libraries bfVFS Lua Multiplayer +wine ) # static libraries whose translation units rely on Application preprocessor definitions. diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 05262392..537e2335 100644 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -29,7 +29,6 @@ set(UtilsSrc "${CMAKE_CURRENT_SOURCE_DIR}/Text Utils.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Timer Control.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Utilities.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/wine.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/WordWrap.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLProperties.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/XMLWriter.cpp" diff --git a/wine/CMakeLists.txt b/wine/CMakeLists.txt new file mode 100644 index 00000000..6206a988 --- /dev/null +++ b/wine/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(wine + wine.cpp +) +target_include_directories(wine PUBLIC include) diff --git a/Utils/wine.h b/wine/include/wine.h similarity index 100% rename from Utils/wine.h rename to wine/include/wine.h diff --git a/Utils/wine.cpp b/wine/wine.cpp similarity index 100% rename from Utils/wine.cpp rename to wine/wine.cpp From ac6a1504df49f38127a29af29bfb9f4d477574bd Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 5 Jan 2025 09:10:31 -0300 Subject: [PATCH 268/571] add a space to string to prevent compilation errors in GB2312 --- Laptop/IMP Begin Screen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 41141ab5..3037f6b6 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -560,7 +560,7 @@ if(g_lang == i18n::Lang::ru) { if( layout == 0x419 ) // Russian { unsigned char TranslationTable[] = - " #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨"; + " #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨ "; uiKey = TranslateKey( uiKey, TranslationTable ); uiKey = GetCyrillicUnicodeChar( uiKey ); @@ -568,7 +568,7 @@ if(g_lang == i18n::Lang::ru) { else if( layout == 0x423 ) // Belarussian { unsigned char TranslationTable[] = - " #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#Ô²ÑÂÓÀÏÐØÎËÄÜÒ¡ÇÉÊÛÅÃÌÖ×Íßõ#'#_¸ô³ñâóàïðøîëäüò¢çéêûåãìö÷íÿÕ#'¨"; + " #Ý####ý####á-þ.0123456789ÆæÁ#Þ,#Ô²ÑÂÓÀÏÐØÎËÄÜÒ¡ÇÉÊÛÅÃÌÖ×Íßõ#'#_¸ô³ñâóàïðøîëäüò¢çéêûåãìö÷íÿÕ#'¨ "; uiKey = TranslateKey( uiKey, TranslationTable ); uiKey = GetCyrillicUnicodeChar( uiKey ); From db40cd433e17ccf4670512284b9d75cbe852d692 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 5 Jan 2025 17:04:15 +0200 Subject: [PATCH 269/571] Move mapscreen bottom coordinates' initialization Fixes radar map's initial position in strategic screen being in the top right corner. --- Ja2/Init.cpp | 5 +++++ Strategic/mapscreen.cpp | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index bf74dbf3..2a4f7527 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -51,6 +51,7 @@ #include "Multilingual Text Code Generator.h" #include "editscreen.h" #include "Arms Dealer Init.h" +#include "Map Screen Interface Bottom.h" #include "MPXmlTeams.hpp" #include "Strategic Mines LUA.h" #include "UndergroundInit.h" @@ -1474,6 +1475,10 @@ UINT32 InitializeJA2(void) return( ERROR_SCREEN ); } + // InitRadarScreenCoords() depend on Mapscreen Interface Bottom coordinates -> need to initiate them first + // before calling InitTacticalEngine() + InitMapScreenInterfaceBottomCoords(); + // Init tactical engine if ( !InitTacticalEngine( ) ) { diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index bdd2a631..4e1f329c 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -4793,9 +4793,6 @@ UINT32 MapScreenHandle(void) InitPreviousPaths(); - // HEADROCK HAM 3.6: Init coordinates for new variable-sized message window - InitMapScreenInterfaceBottomCoords(); - // if arrival sector is invalid, reset to A9 if ( ( gsMercArriveSectorX < 1 ) || ( gsMercArriveSectorY < 1 ) || ( gsMercArriveSectorX > 16 ) || ( gsMercArriveSectorY > 16 ) ) From dcf202990f3ef8fa1e82e3e6ca2740bd4cfb1ed8 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 5 Jan 2025 17:06:49 +0200 Subject: [PATCH 270/571] Remove duplicate header includes --- Ja2/Init.cpp | 2 -- Strategic/Map Screen Interface Bottom.cpp | 1 - Strategic/mapscreen.cpp | 6 ------ 3 files changed, 9 deletions(-) diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index 2a4f7527..a80bf217 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -35,7 +35,6 @@ #include "tile cache.h" #include "strategicmap.h" #include "Map Information.h" - #include "laptop.h" #include "Shade Table Util.h" #include "Exit Grids.h" #include "Summary Info.h" @@ -77,7 +76,6 @@ #include "AimArchives.h" #include "connect.h" #include "DynamicDialogueWidget.h" // added by Flugente for InitMyBoxes() -#include "Animation Data.h" // added by Flugente #include diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index e045f060..49ee8f29 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -50,7 +50,6 @@ #include "Ja25 Strategic Ai.h" #include "MapScreen Quotes.h" #include "SaveLoadGame.h" -#include "strategicmap.h" #endif #include "connect.h" diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 4e1f329c..f22cde56 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -11,10 +11,8 @@ #include "font.h" #include "screenids.h" #include "screens.h" - #include "gameloop.h" #include "overhead.h" #include "sysutil.h" - #include "input.h" #include "Event Pump.h" #include "Font Control.h" #include "Timer Control.h" @@ -44,18 +42,15 @@ #include "PopUpBox.h" #include "Game Clock.h" #include "items.h" - #include "vobject.h" #include "Cursor Control.h" #include "text.h" #include "strategic.h" #include "strategicmap.h" - #include "interface.h" #include "strategic pathing.h" #include "Map Screen Interface Bottom.h" #include "Map Screen Interface Border.h" #include "Map Screen Interface Map.h" #include "Map Screen Interface.h" - #include "Strategic Pathing.h" #include "Assignments.h" #include "points.h" #include "Squads.h" @@ -114,7 +109,6 @@ #include "connect.h" //hayden #include "InterfaceItemImages.h" -#include "vobject.h" #include #ifdef JA2UB From 8897769f0de672149107494bad6f62382c3fd7d9 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sun, 5 Jan 2025 10:43:11 -0300 Subject: [PATCH 271/571] make sure CI to assemble release on 'v*' tag push or manually also put bash script through shellcheck to be more posix compliant --- .github/workflows/build.yml | 33 ++++++++++++++++------------ .github/workflows/build_language.yml | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c25feead..3f0fc20f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,25 +34,30 @@ jobs: name: Set global variables run: | set -eux - - full_release='${{ ( github.repository == '1dot13/source' && github.ref_name == 'master' ) || startsWith(github.ref, 'refs/tags/v') }}' - - if [[ '${{ inputs.build_all_languages }}' == 'true' || ( '${{ inputs.build_all_languages }}' == '' && "$full_release" == 'true' ) ]] + + all_languages="${{ inputs.build_all_languages }}" + assemble_release="${{ inputs.assemble_release }}" + repo="${{ github.repository }}" + refname="${{ github.ref_name }}" + is_tag="${{ startsWith(github.ref, 'refs/tags/v') }}" + + if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$refname" = "master" ] && [ "$is_tag" = "true" ]; } then - languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]'; + full_release="true" + else + full_release="false" + fi + + if [ "$all_languages" = "true" ] || [ "$full_release" = "true" ] + then + languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]' else # English + some other language for compilation testing languages_json_array='["German", "English"]' fi - echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT - - if [[ '${{ inputs.assemble_release }}' == 'true' || ( '${{ inputs.assemble_release }}' == '' && "$full_release" == 'true' ) ]] - then - assemble_release='true' - else - assemble_release='false' - fi - echo "assemble_release=$assemble_release" >> $GITHUB_OUTPUT + + echo "languages_json_array=$languages_json_array" >> "$GITHUB_OUTPUT" + echo "assemble_release=$full_release" >> "$GITHUB_OUTPUT" - name: Clone repos metadata run: | diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 0f97c733..931a6522 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -11,7 +11,7 @@ on: assemble: description: 'assemble full package' required: true - default: true + default: false type: boolean continue-on-error: description: 'allows a language to fail, used when building all languages' From 552951795cf12687457cfa29ec644986cdf7a96b Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 7 Jan 2025 13:16:32 -0300 Subject: [PATCH 272/571] yet another fix for the github actions github.ref_name isn't 'master' when a tag is pushed, but the tag name, so it won't trigger a release build when a 'v*' tag is pushed --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f0fc20f..c35d330d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,10 +38,9 @@ jobs: all_languages="${{ inputs.build_all_languages }}" assemble_release="${{ inputs.assemble_release }}" repo="${{ github.repository }}" - refname="${{ github.ref_name }}" is_tag="${{ startsWith(github.ref, 'refs/tags/v') }}" - if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$refname" = "master" ] && [ "$is_tag" = "true" ]; } + if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$is_tag" = "true" ]; } then full_release="true" else From 1976dee738bcbcaf707cfb4c2e356a75862b71ec Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 7 Jan 2025 14:12:35 -0300 Subject: [PATCH 273/571] make sure these steps run otherwise there is no 'source' working directory for the final step --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c35d330d..eae31e92 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,14 +190,12 @@ jobs: merge-multiple: true - name: Checkout Repo - if: github.ref == 'refs/heads/master' uses: actions/checkout@v4 with: path: source fetch-depth: 1 sparse-checkout: 'README.md' - name: Create latest pre-release - if: github.ref == 'refs/heads/master' working-directory: source run: | gh release delete latest --cleanup-tag || true From 7aa0e183523c2882910bebd3d4df46be574d67d9 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 7 Jan 2025 16:45:59 -0300 Subject: [PATCH 274/571] Revert "make sure these steps run" This reverts commit 1976dee738bcbcaf707cfb4c2e356a75862b71ec. Revert "yet another fix for the github actions" This reverts commit 552951795cf12687457cfa29ec644986cdf7a96b. Revert "make sure CI to assemble release on 'v*' tag push or manually" This reverts commit 8897769f0de672149107494bad6f62382c3fd7d9. --- .github/workflows/build.yml | 34 +++++++++++++--------------- .github/workflows/build_language.yml | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eae31e92..c25feead 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,29 +34,25 @@ jobs: name: Set global variables run: | set -eux - - all_languages="${{ inputs.build_all_languages }}" - assemble_release="${{ inputs.assemble_release }}" - repo="${{ github.repository }}" - is_tag="${{ startsWith(github.ref, 'refs/tags/v') }}" - - if [ "$assemble_release" = "true" ] || { [ "$repo" = "1dot13/source" ] && [ "$is_tag" = "true" ]; } + + full_release='${{ ( github.repository == '1dot13/source' && github.ref_name == 'master' ) || startsWith(github.ref, 'refs/tags/v') }}' + + if [[ '${{ inputs.build_all_languages }}' == 'true' || ( '${{ inputs.build_all_languages }}' == '' && "$full_release" == 'true' ) ]] then - full_release="true" - else - full_release="false" - fi - - if [ "$all_languages" = "true" ] || [ "$full_release" = "true" ] - then - languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]' + languages_json_array='["Chinese", "German", "English", "French", "Polish", "Italian", "Dutch", "Russian"]'; else # English + some other language for compilation testing languages_json_array='["German", "English"]' fi - - echo "languages_json_array=$languages_json_array" >> "$GITHUB_OUTPUT" - echo "assemble_release=$full_release" >> "$GITHUB_OUTPUT" + echo "languages_json_array=$languages_json_array" >> $GITHUB_OUTPUT + + if [[ '${{ inputs.assemble_release }}' == 'true' || ( '${{ inputs.assemble_release }}' == '' && "$full_release" == 'true' ) ]] + then + assemble_release='true' + else + assemble_release='false' + fi + echo "assemble_release=$assemble_release" >> $GITHUB_OUTPUT - name: Clone repos metadata run: | @@ -190,12 +186,14 @@ jobs: merge-multiple: true - name: Checkout Repo + if: github.ref == 'refs/heads/master' uses: actions/checkout@v4 with: path: source fetch-depth: 1 sparse-checkout: 'README.md' - name: Create latest pre-release + if: github.ref == 'refs/heads/master' working-directory: source run: | gh release delete latest --cleanup-tag || true diff --git a/.github/workflows/build_language.yml b/.github/workflows/build_language.yml index 931a6522..0f97c733 100644 --- a/.github/workflows/build_language.yml +++ b/.github/workflows/build_language.yml @@ -11,7 +11,7 @@ on: assemble: description: 'assemble full package' required: true - default: false + default: true type: boolean continue-on-error: description: 'allows a language to fail, used when building all languages' From ff8376d625fa7d6e9f72f6aa49c76e0b18accc90 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 9 Jan 2025 20:15:37 -0300 Subject: [PATCH 275/571] Keep UB specific enum value for all builds but at the end, not beginning as to not make a mess along with an intro.lua change in gamedir/Data-UB/Scripts this gets rid of a nasty preprocessor conditional in a header file --- Ja2/Intro.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Ja2/Intro.h b/Ja2/Intro.h index 77048105..da50d8bf 100644 --- a/Ja2/Intro.h +++ b/Ja2/Intro.h @@ -12,13 +12,11 @@ void StopIntroVideo(); //enums used for when the intro screen can come up, used with 'gbIntroScreenMode' enum EIntroType { -#ifdef JA2UB - INTRO_HELI_CRASH, -#endif INTRO_BEGINNING, //set when viewing the intro at the begining of the game INTRO_ENDING, //set when viewing the end game video. - INTRO_SPLASH, + // Unfinished Business + INTRO_HELI_CRASH }; From ebd2e25e0fab1147f251682a2050803a6233bc2b Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Thu, 9 Jan 2025 21:26:45 -0300 Subject: [PATCH 276/571] Fix a wrong #ifdef to runtime check conversion I didn't get this right the first time, non-Chinese text was looking funny in dialog boxes --- Utils/WordWrap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utils/WordWrap.cpp b/Utils/WordWrap.cpp index 900193c7..b0e8e432 100644 --- a/Utils/WordWrap.cpp +++ b/Utils/WordWrap.cpp @@ -1733,7 +1733,8 @@ UINT16 IanWrappedStringHeight(UINT16 usPosX, UINT16 usPosY, UINT16 usWidth, UINT // get the length (in pixels) of this word usWordLengthPixels = WFStringPixLength(zWordString,uiLocalFont); - if (g_lang == i18n::Lang::zh && currentChar <= 255) + if (g_lang != i18n::Lang::zh || + g_lang == i18n::Lang::zh && currentChar <= 255) // add a space (in case we add another word to it) zWordString[usDestCounter++] = 32; From 222daead0e7ec1547cda22f99849bfa034de3048 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 27 Jan 2025 18:29:35 +0200 Subject: [PATCH 277/571] Remove unused ItemFlags Detonator and Remote Detonator are specified by AttachmentClass No items in items.xml actually even contained these flags. --- Tactical/Arms Dealer Init.cpp | 2 +- Tactical/Interface Enhanced.cpp | 12 ++++++------ Tactical/Item Types.h | 4 ++-- Tactical/Items.cpp | 6 ++---- Tactical/Items.h | 2 -- Utils/XML_Items.cpp | 14 -------------- 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index 59b64a9a..18744069 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -1015,7 +1015,7 @@ UINT32 GetArmsDealerItemTypeFromItemNumber( UINT16 usItem ) return( ARMS_DEALER_MEDICAL ); else if (ItemIsAttachment(usItem)) return( ARMS_DEALER_ATTACHMENTS ); - else if (ItemIsDetonator(usItem) || ItemIsRemoteDetonator(usItem) || ItemIsRemoteTrigger(usItem)) + else if ( IsAttachmentClass( usItem, (AC_DETONATOR | AC_REMOTEDET) ) || ItemIsRemoteTrigger(usItem)) return( ARMS_DEALER_DETONATORS ); else return( ARMS_DEALER_MISC ); diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index 37fc0757..85b1d188 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -2527,7 +2527,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// REMOTE DETONATOR - if (ItemIsRemoteDetonator(gpItemDescObject->usItem)) + if ( IsAttachmentClass( gpItemDescObject->usItem, AC_REMOTEDET ) ) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 15 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 15 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -2536,7 +2536,7 @@ void InternalInitEDBTooltipRegion( OBJECTTYPE * gpItemDescObject, UINT32 guiCurr } //////////////////// TIMER DETONATOR - if (ItemIsDetonator(gpItemDescObject->usItem)) + if ( IsAttachmentClass( gpItemDescObject->usItem, AC_DETONATOR )) { swprintf( pStr, L"%s%s", szUDBGenSecondaryStatsTooltipText[ 16 ], szUDBGenSecondaryStatsExplanationsTooltipText[ 16 ]); SetRegionFastHelpText( &(gUDBFasthelpRegions[ iFirstDataRegion + cnt ]), pStr ); @@ -6246,16 +6246,16 @@ void DrawSecondaryStats( OBJECTTYPE * gpItemDescObject ) } //////////////////// REMOTE DETONATOR - if ( (ItemIsRemoteDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || - ( fComparisonMode && ItemIsRemoteDetonator(gpComparedItemDescObject->usItem) ) ) + if ( (IsAttachmentClass( gpItemDescObject->usItem, AC_REMOTEDET ) && !fComparisonMode ) || + ( fComparisonMode && IsAttachmentClass( gpComparedItemDescObject->usItem, AC_REMOTEDET )) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 15, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; } //////////////////// TIMER DETONATOR - if ( (ItemIsDetonator(gpItemDescObject->usItem) && !fComparisonMode ) || - ( fComparisonMode && ItemIsDetonator(gpComparedItemDescObject->usItem)) ) + if ( (IsAttachmentClass( gpItemDescObject->usItem, AC_DETONATOR ) && !fComparisonMode ) || + ( fComparisonMode && IsAttachmentClass( gpComparedItemDescObject->usItem, AC_DETONATOR )) ) { BltVideoObjectFromIndex( guiSAVEBUFFER, guiItemInfoSecondaryIcon, 16, gItemDescGenSecondaryRegions[cnt].sLeft+sOffsetX, gItemDescGenSecondaryRegions[cnt].sTop+sOffsetY, VO_BLT_SRCTRANSPARENCY, NULL ); cnt++; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 44a8b23d..b71a3cad 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -812,8 +812,8 @@ extern OBJECTTYPE gTempObject; #define ITEM_mortar 0x0400000000000000 #define ITEM_duckbill 0x0800000000000000 -#define ITEM_detonator 0x1000000000000000 -#define ITEM_remotedetonator 0x2000000000000000 +//UNUSED #define ITEM_detonator 0x1000000000000000 +//UNUSED #define ITEM_remotedetonator 0x2000000000000000 #define ITEM_hidemuzzleflash 0x4000000000000000 #define ITEM_rocketlauncher 0x8000000000000000 diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 1dd9c4c6..c1fe83a0 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -12076,7 +12076,7 @@ BOOLEAN IsDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (ItemIsDetonator(iter->usItem) && iter->exists() ) + if ( IsAttachmentClass( iter->usItem, AC_DETONATOR ) && iter->exists() ) { return( TRUE ); } @@ -12092,7 +12092,7 @@ BOOLEAN IsRemoteDetonatorAttached( OBJECTTYPE * pObj ) // return TRUE; for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != (*pObj)[0]->attachments.end(); ++iter) { - if (ItemIsRemoteDetonator(iter->usItem) && iter->exists() ) + if ( IsAttachmentClass( iter->usItem, AC_REMOTEDET ) && iter->exists() ) { return( TRUE ); } @@ -16081,8 +16081,6 @@ BOOLEAN ItemIsFlare(UINT16 usItem) { return HasItemFlag(usItem, ITEM_flare); } BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_grenadelauncher); } BOOLEAN ItemIsMortar(UINT16 usItem) { return HasItemFlag(usItem, ITEM_mortar); } BOOLEAN ItemIsDuckbill(UINT16 usItem) { return HasItemFlag(usItem, ITEM_duckbill); } -BOOLEAN ItemIsDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_detonator); } -BOOLEAN ItemIsRemoteDetonator(UINT16 usItem) { return HasItemFlag(usItem, ITEM_remotedetonator); } BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem) { return HasItemFlag(usItem, ITEM_hidemuzzleflash); } BOOLEAN ItemIsRocketLauncher(UINT16 usItem) { return HasItemFlag(usItem, ITEM_rocketlauncher); } // usItemFlag2 diff --git a/Tactical/Items.h b/Tactical/Items.h index 6aa26659..9db8c798 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -204,8 +204,6 @@ BOOLEAN ItemIsFlare(UINT16 usItem); BOOLEAN ItemIsGrenadeLauncher(UINT16 usItem); BOOLEAN ItemIsMortar(UINT16 usItem); BOOLEAN ItemIsDuckbill(UINT16 usItem); -BOOLEAN ItemIsDetonator(UINT16 usItem); -BOOLEAN ItemIsRemoteDetonator(UINT16 usItem); BOOLEAN ItemHasHiddenMuzzleFlash(UINT16 usItem); BOOLEAN ItemIsRocketLauncher(UINT16 usItem); BOOLEAN ItemIsSingleShotRocketLauncher(UINT16 usItem); diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 0b2c3c91..52f14ece 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -863,18 +863,6 @@ itemEndElementHandle(void *userData, const XML_Char *name) if ((BOOLEAN)atol(pData->szCharData)) pData->curItem.usItemFlag |= ITEM_duckbill; } - else if(strcmp(name, "Detonator") == 0) - { - pData->curElement = ELEMENT; - if ((BOOLEAN)atol(pData->szCharData)) - pData->curItem.usItemFlag |= ITEM_detonator; - } - else if(strcmp(name, "RemoteDetonator") == 0) - { - pData->curElement = ELEMENT; - if ((BOOLEAN)atol(pData->szCharData)) - pData->curItem.usItemFlag |= ITEM_remotedetonator; - } else if(strcmp(name, "ThermalOptics") == 0) { pData->curElement = ELEMENT; @@ -2427,8 +2415,6 @@ BOOLEAN WriteItemStats() if ( ItemIsGrenadeLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemIsMortar( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemIsDuckbill( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( ItemIsDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); - if ( ItemIsRemoteDetonator( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemHasHiddenMuzzleFlash( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); if ( ItemIsRocketLauncher( cnt ) ) FilePrintf( hFile, "\t\t%d\r\n", 1 ); From e3a542bf5d60a718cf76e38ea49e833f9b4f6e21 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 14 Feb 2025 16:42:58 +0200 Subject: [PATCH 278/571] Exclude robots from trying to activate panic triggers --- TacticalAI/DecideAction.cpp | 41 ++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index af862c89..c30aaa68 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -2548,32 +2548,35 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier) } // if we're an alerted enemy, and there are panic bombs or a trigger around - if ( (!PTR_CIVILIAN || pSoldier->ubProfile == WARDEN) && ( ( gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || (pSoldier->ubID == gTacticalStatus.ubTheChosenOne) || (pSoldier->ubProfile == WARDEN) ) && - (gTacticalStatus.fPanicFlags & (PANIC_BOMBS_HERE | PANIC_TRIGGERS_HERE ) ) ) ) + if ( !ENEMYROBOT(pSoldier) ) { - if ( pSoldier->ubProfile == WARDEN && gTacticalStatus.ubTheChosenOne == NOBODY ) + if ( (!PTR_CIVILIAN || pSoldier->ubProfile == WARDEN) && ( ( gTacticalStatus.Team[pSoldier->bTeam].bAwareOfOpposition || (pSoldier->ubID == gTacticalStatus.ubTheChosenOne) || (pSoldier->ubProfile == WARDEN) ) && + (gTacticalStatus.fPanicFlags & (PANIC_BOMBS_HERE | PANIC_TRIGGERS_HERE ) ) ) ) { - PossiblyMakeThisEnemyChosenOne( pSoldier ); + if ( pSoldier->ubProfile == WARDEN && gTacticalStatus.ubTheChosenOne == NOBODY ) + { + PossiblyMakeThisEnemyChosenOne( pSoldier ); + } + + // do some special panic AI decision making + bActionReturned = PanicAI(pSoldier,ubCanMove); + + // if we decided on an action while in there, we're done + if (bActionReturned != -1) + return(bActionReturned); } - // do some special panic AI decision making - bActionReturned = PanicAI(pSoldier,ubCanMove); - - // if we decided on an action while in there, we're done - if (bActionReturned != -1) - return(bActionReturned); - } - - if ( pSoldier->ubProfile != NO_PROFILE ) - { - if ( (pSoldier->ubProfile == QUEEN || pSoldier->ubProfile == JOE) && ubCanMove ) + if ( pSoldier->ubProfile != NO_PROFILE ) { - if ( gWorldSectorX == 3 && gWorldSectorY == MAP_ROW_P && gbWorldSectorZ == 0 && !gfUseAlternateQueenPosition ) + if ( (pSoldier->ubProfile == QUEEN || pSoldier->ubProfile == JOE) && ubCanMove ) { - bActionReturned = HeadForTheStairCase( pSoldier ); - if ( bActionReturned != AI_ACTION_NONE ) + if ( gWorldSectorX == 3 && gWorldSectorY == MAP_ROW_P && gbWorldSectorZ == 0 && !gfUseAlternateQueenPosition ) { - return( bActionReturned ); + bActionReturned = HeadForTheStairCase( pSoldier ); + if ( bActionReturned != AI_ACTION_NONE ) + { + return( bActionReturned ); + } } } } From 9c951adfea0d149d65f0886c6af5a9d3ecdd3c43 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:07:54 +0200 Subject: [PATCH 279/571] Read correct variable from CTHconstants.ini --- Ja2/GameSettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index 35f99674..c437d542 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -3793,7 +3793,7 @@ void LoadCTHConstants() gGameCTHConstants.RECOIL_COUNTER_ACCURACY_WIS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_WIS",1.0, 0.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AGI = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AGI",1.0, 0.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_EXP_LEVEL = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_EXP_LEVEL",2.0, 0.0, 100.0); - gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0); + gGameCTHConstants.RECOIL_COUNTER_ACCURACY_AUTO_WEAPONS_DIVISOR = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_AUTO_WEAPONS_DIVISOR",2.0, 1.0, 100.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_TRACER_BONUS = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_TRACER_BONUS",10.0, -1000.0, 1000.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_ANTICIPATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_ANTICIPATION",25.0, -1000.0, 1000.0); gGameCTHConstants.RECOIL_COUNTER_ACCURACY_COMPENSATION = iniReader.ReadFloat("Shooting Mechanism","RECOIL_COUNTER_ACCURACY_COMPENSATION",2.0, 0.0, 5.0); From fffb3a45fb5dea75cc6c389d6a22c5f5eda2059b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 24 Feb 2025 21:12:06 +0200 Subject: [PATCH 280/571] Remove 8bit mode Obsolete and doesn't work * Remove gbPixelDepth * Remove 8-bit to 8-bit blitters * FileNameForBPP now only calls strcopy --- Ja2/Fade Screen.cpp | 10 +- Strategic/mapscreen.cpp | 8 +- Tactical/Interface.cpp | 19 +- TileEngine/Radar Screen.cpp | 165 +- TileEngine/Render Dirty.cpp | 97 +- TileEngine/overhead map.cpp | 3 +- TileEngine/renderworld.cpp | 1049 ++-- Utils/Utilities.cpp | 23 +- Utils/Utilities.h | 2 - ext/export/src/export/sti/stci_image_utils.h | 5 - sgp/Button System.cpp | 155 +- sgp/Font.cpp | 70 +- sgp/line.cpp | 260 - sgp/line.h | 2 - sgp/sgp.cpp | 5 - sgp/sgp.h | 1 - sgp/video.cpp | 9 +- sgp/vobject.cpp | 52 +- sgp/vobject_blitters.cpp | 5255 ------------------ sgp/vobject_blitters.h | 57 +- 20 files changed, 644 insertions(+), 6603 deletions(-) diff --git a/Ja2/Fade Screen.cpp b/Ja2/Fade Screen.cpp index f201e7bd..2f44de73 100644 --- a/Ja2/Fade Screen.cpp +++ b/Ja2/Fade Screen.cpp @@ -681,13 +681,9 @@ BOOLEAN UpdateSaveBufferWithBackbuffer(void) pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth==16) - { - // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); UnLockVideoSurface(FRAME_BUFFER); UnLockVideoSurface(guiSAVEBUFFER); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index f22cde56..ebff1280 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9048,12 +9048,8 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f // clip to view region ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); - if(gbPixelDepth==16) - { - // DB Need to add a radar color for 8-bit - RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); - InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); - } + RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); + InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); UnLockVideoSurface( FRAME_BUFFER ); diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index cfa3098e..9d0c27db 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -461,14 +461,7 @@ BOOLEAN InitializeTacticalInterface( ) // failing the CHECKF after this will cause you to lose your mouse - if ( GETPIXELDEPTH() == 8 ) - { - strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT_8.pcx" ); - } - else if ( GETPIXELDEPTH() == 16 ) - { - strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" ); - } + strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" ); if( !AddVideoSurface( &vs_desc, &guiINTEXT ) ) AssertMsg( 0, "Missing INTERFACE\\In_text.sti"); @@ -3562,10 +3555,7 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW } if ( pSoldier->ubID == gusSelectedSoldier ) { - if(gbPixelDepth==16) - RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf); - else - RectangleDraw8( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color8, pDestBuf); + RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf); } } @@ -5812,10 +5802,7 @@ void DrawBar( INT32 x, INT32 y, INT32 width, INT32 height, UINT16 color8, UINT16 { for( INT32 i=0; i < height; i++ ) { - if(gbPixelDepth==16) - LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf ); - else if(gbPixelDepth==8) - LineDraw8( TRUE, x, y+i, x+width-1, y+i, color8, pDestBuf ); + LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf ); } } } diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index c485d8ca..12877324 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -493,30 +493,21 @@ void RenderRadarScreen( ) if( !( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { - if(gbPixelDepth==16) + // WANNE: Correct radar rectangle size if it is too large to fit in radar screen [2007-05-14] + if (fAllowRadarMovementHor == FALSE) { - // WANNE: Correct radar rectangle size if it is too large to fit in radar screen [2007-05-14] - if (fAllowRadarMovementHor == FALSE) - { - sRadarTLX = RADAR_WINDOW_TM_X; - sRadarBRX = RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH; - } - - if (fAllowRadarMovementVer == FALSE) - { - sRadarTLY = RADAR_WINDOW_TM_Y; - sRadarBRY = RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT; - } - - usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); - RectangleDraw( TRUE, sRadarTLX, sRadarTLY, sRadarBRX, sRadarBRY - 1, usLineColor, pDestBuf ); + sRadarTLX = RADAR_WINDOW_TM_X; + sRadarBRX = RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH; } - else if(gbPixelDepth==8) + + if (fAllowRadarMovementVer == FALSE) { - // DB Need to change this to a color from the 8-but standard palette - usLineColor = COLOR_GREEN; - RectangleDraw8( TRUE, sRadarTLX + 1, sRadarTLY + 1, sRadarBRX + 1, sRadarBRY + 1, usLineColor, pDestBuf ); + sRadarTLY = RADAR_WINDOW_TM_Y; + sRadarBRY = RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT; } + + usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); + RectangleDraw( TRUE, sRadarTLX, sRadarTLY, sRadarBRX, sRadarBRY - 1, usLineColor, pDestBuf ); } // Cycle fFlash variable @@ -556,24 +547,20 @@ void RenderRadarScreen( ) sXSoldRadar += RADAR_WINDOW_TM_X; sYSoldRadar += gsRadarY; - // if we are in 16 bit mode....kind of redundant - if(gbPixelDepth==16) + if( ( fFlashHighLightInventoryItemOnradarMap ) ) { - if( ( fFlashHighLightInventoryItemOnradarMap ) ) - { - usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); + usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); - } - else - { - // DB Need to add a radar color for 8-bit - usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); - } + } + else + { + // DB Need to add a radar color for 8-bit + usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); + } - if( iCurrentlyHighLightedItem == iCounter ) - { - RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar + 1, sYSoldRadar + 1, usLineColor, pDestBuf ); - } + if( iCurrentlyHighLightedItem == iCounter ) + { + RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar + 1, sYSoldRadar + 1, usLineColor, pDestBuf ); } } } @@ -632,77 +619,67 @@ void RenderRadarScreen( ) sXSoldRadar += gsRadarX; sYSoldRadar += gsRadarY; - if(gbPixelDepth==16) - { - // DB Need to add a radar color for 8-bit - // Are we a selected guy? - if ( pSoldier->ubID == gusSelectedSoldier ) + // Are we a selected guy? + if ( pSoldier->ubID == gusSelectedSoldier ) + { + if ( gfRadarCurrentGuyFlash ) { - if ( gfRadarCurrentGuyFlash ) - { - usLineColor = 0; - } - else - { - // If on roof, make darker.... - if ( pSoldier->pathing.bLevel > 0 ) - { - usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); - } - else - { - usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - } - } + usLineColor = 0; } else { - usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - - if ( pSoldier->bTeam == CIV_TEAM ) - { - // Override civ team with red if hostile... - if ( pSoldier->bSide != gbPlayerNum && !pSoldier->aiData.bNeutral ) - usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); - // if uncovered, different colour (so the player doesn't have to search for us) - else if ( gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) - usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); - } - - // Flugente 18-04-15: observed an odd bug: if we play with a release build and see a creature for the first time, their overhead/radar map pins do not have the correct colour. - // Bizarrely enough, the issue seems dependent on the colour value (pink, RGB: 255/0/255) itself. - // Saving and reloading solves the issue, but I am not sure why. As a fix we now use a slightly dampened pink. - if ( pSoldier->bTeam == CREATURE_TEAM ) - { - usLineColor = Get16BPPColor( FROMRGB( 247, 0, 247 ) ); - } - - // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us - if ( pSoldier->usSoldierFlagMask & SOLDIER_ASSASSIN && pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER ) - usLineColor = Get16BPPColor( gTacticalStatus.Team[ MILITIA_TEAM ].RadarColor ); - - // Render different color if an enemy and he's unconscious - if ( pSoldier->bTeam != gbPlayerNum && pSoldier->stats.bLife < OKLIFE ) - { - usLineColor = Get16BPPColor( FROMRGB( 128, 128, 128 ) ); - } - // If on roof, make darker.... - if ( pSoldier->bTeam == gbPlayerNum && pSoldier->pathing.bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); } + else + { + usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); + } + } + } + else + { + usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); + + if ( pSoldier->bTeam == CIV_TEAM ) + { + // Override civ team with red if hostile... + if ( pSoldier->bSide != gbPlayerNum && !pSoldier->aiData.bNeutral ) + usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); + // if uncovered, different colour (so the player doesn't have to search for us) + else if ( gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) + usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); } - RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); - } - else if(gbPixelDepth==8) - { - // DB Need to change this to a color from the 8-but standard palette - usLineColor = COLOR_BLUE; - RectangleDraw8( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); + // Flugente 18-04-15: observed an odd bug: if we play with a release build and see a creature for the first time, their overhead/radar map pins do not have the correct colour. + // Bizarrely enough, the issue seems dependent on the colour value (pink, RGB: 255/0/255) itself. + // Saving and reloading solves the issue, but I am not sure why. As a fix we now use a slightly dampened pink. + if ( pSoldier->bTeam == CREATURE_TEAM ) + { + usLineColor = Get16BPPColor( FROMRGB( 247, 0, 247 ) ); + } + + // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us + if ( pSoldier->usSoldierFlagMask & SOLDIER_ASSASSIN && pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER ) + usLineColor = Get16BPPColor( gTacticalStatus.Team[ MILITIA_TEAM ].RadarColor ); + + // Render different color if an enemy and he's unconscious + if ( pSoldier->bTeam != gbPlayerNum && pSoldier->stats.bLife < OKLIFE ) + { + usLineColor = Get16BPPColor( FROMRGB( 128, 128, 128 ) ); + } + + // If on roof, make darker.... + if ( pSoldier->bTeam == gbPlayerNum && pSoldier->pathing.bLevel > 0 ) + { + usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); + } } + + RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); } } } diff --git a/TileEngine/Render Dirty.cpp b/TileEngine/Render Dirty.cpp index 1e22feb6..8fb82dad 100644 --- a/TileEngine/Render Dirty.cpp +++ b/TileEngine/Render Dirty.cpp @@ -604,20 +604,9 @@ BOOLEAN UpdateSaveBuffer(void) pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth==16) - { - // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); - } - else if(gbPixelDepth==8) - { - // BLIT HERE - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, gsVIEWPORT_WINDOW_END_Y ); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -643,22 +632,11 @@ BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT1 pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -695,22 +673,11 @@ BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack ) pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -730,22 +697,11 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiSAVEBUFFER); UnLockVideoSurface(guiRENDERBUFFER); @@ -1342,18 +1298,11 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) usHeight = sBottom - sTop; usWidth = sRight - sLeft; - if(gbPixelDepth==16) - { - - Blt16BPPTo16BPP((UINT16 *)(UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, - sLeft, sTop, - uiLeftSkip, uiTopSkip, - usWidth, usHeight ); - } - else if(gbPixelDepth==8) - { - } + Blt16BPPTo16BPP((UINT16 *)(UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, + sLeft, sTop, + uiLeftSkip, uiTopSkip, + usWidth, usHeight ); // Once done, check for pending deletion if ( gVideoOverlays[uiCount].fDeletionPending ) diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 313161c1..b2f7e8e7 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -1367,8 +1367,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart GetCurrentVideoSettings(&usWidth, &usHeight, &ubBitDepth); pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth == 16)// BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, usWidth, usHeight); + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, usWidth, usHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); } diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index 85eb7bd9..ce88dc76 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -2398,617 +2398,528 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } else { - if (gbPixelDepth == 16) + /*if(fConvertTo16) { - /*if(fConvertTo16) + ConvertVObjectRegionTo16BPP(hVObject, usImageIndex, 4); + if(CheckFor16BPPRegion(hVObject, usImageIndex, 4, &us16BPPIndex)) { - ConvertVObjectRegionTo16BPP(hVObject, usImageIndex, 4); - if(CheckFor16BPPRegion(hVObject, usImageIndex, 4, &us16BPPIndex)) - { - Blt16BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, us16BPPIndex, &gClippingRect); - } - }*/ - - if (fMultiTransShadowZBlitter) - { - if (fZBlitter) - { - if (fObscuredBlitter) - { - if (hVObjectAlpha == NULL) { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha == NULL) { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - } - } - else - { - //Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); - } + Blt16BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, us16BPPIndex, &gClippingRect); } - else if (fMultiZBlitter) + }*/ + + if (fMultiTransShadowZBlitter) + { + if (fZBlitter) { - if (fZBlitter) + if (fObscuredBlitter) { - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + if (hVObjectAlpha == NULL) { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); } - else - { - if (fWallTile) - { - if (sZStripIndex == -1) - { - Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sZStripIndex); - } - } - else - { - Blt8BPPDataTo16BPPBufferTransZIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } + else { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); } } else { - Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + if (hVObjectAlpha == NULL) { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); + } + else { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); + } } } else { - bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - if (bBlitClipVal == TRUE) - { - if (fPixelate) - { - if (fTranslucencyType) - { - //if(fZWrite) - // Blt8BPPDataTo16BPPBufferTransZClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - //else - Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - //if(fZWrite) - // Blt8BPPDataTo16BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - //else - Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fMerc) - { - if (fZBlitter) - { - if (fZWrite) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (fObscuredBlitter) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - - UnLockVideoSurface(guiSAVEBUFFER); - - // Turn it off! - pNode->uiFlags &= (~LEVELNODE_UPDATESAVEBUFFERONCE); - } - - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - } - else if (fShadowBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fIntensityBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fZBlitter) - { - if (fZWrite) - { - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else - { - Blt8BPPDataTo16BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - UnLockVideoSurface(guiSAVEBUFFER); - } - - } - else - Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - } - else if (bBlitClipVal == FALSE) - { - if (fPixelate) - { - if (fTranslucencyType) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferTransZTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferTransZNBTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferTransZPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fMerc) - { - // Flugente: draw riot shield UNDER the soldier - if ( pSoldier && - pSoldier->bVisible != -1 && - ( pSoldier->ubDirection == NORTH || - pSoldier->ubDirection == NORTHWEST || - pSoldier->ubDirection == WEST ) - && pSoldier->IsRiotShieldEquipped() ) - { - ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); - } - - if (fZBlitter) - { - if (fZWrite) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (fObscuredBlitter) - { - if (hVObjectAlpha != NULL) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - - UnLockVideoSurface(guiSAVEBUFFER); - - } - - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - - } - - // Flugente: draw riot shield OVER the soldier - if ( pSoldier && - pSoldier->bVisible != -1 && - ( pSoldier->ubDirection == EAST || - pSoldier->ubDirection == SOUTHEAST || - pSoldier->ubDirection == SOUTH || - pSoldier->ubDirection == SOUTHWEST || - pSoldier->ubDirection == NORTHEAST ) - && pSoldier->IsRiotShieldEquipped() ) - { - ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); - } - } - else if (fShadowBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fIntensityBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferIntensityZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferIntensityZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferIntensity((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fZBlitter) - { - if (fZWrite) - { - // TEST - //Blt8BPPDataTo16BPPBufferTransZPixelate( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - } - else - Blt8BPPDataTo16BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - UnLockVideoSurface(guiSAVEBUFFER); - } - - } - else - Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } + //Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); } } - else // 8bpp section + else if (fMultiZBlitter) { - if (fPixelate) + if (fZBlitter) { - if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else if (BltIsClipped(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect)) - { - if (fMerc) + if (fObscuredBlitter) { - Blt8BPPDataTo8BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable); - } - else if (fShadowBlitter) - if (fZWrite) - Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - else if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + { + if (fWallTile) + { + if (sZStripIndex == -1) + { + Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sZStripIndex); + } + } + else + { + Blt8BPPDataTo16BPPBufferTransZIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } } else { - if (fMerc) - { + Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } + else + { + bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - // why to 16BPP here?? - if (hVObjectAlpha != NULL) + if (bBlitClipVal == TRUE) + { + if (fPixelate) + { + if (fTranslucencyType) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); + //if(fZWrite) + // Blt8BPPDataTo16BPPBufferTransZClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + //else + Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); + //if(fZWrite) + // Blt8BPPDataTo16BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + //else + Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } + } + else if (fMerc) + { + if (fZBlitter) + { + if (fZWrite) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (fObscuredBlitter) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + } - // Blt8BPPDataTo8BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - // hVObject, - // sXPos, sYPos, - // usImageIndex, - // pShadeTable); + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + + UnLockVideoSurface(guiSAVEBUFFER); + + // Turn it off! + pNode->uiFlags &= (~LEVELNODE_UPDATESAVEBUFFERONCE); + } + + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } } else if (fShadowBlitter) { - if (fZWrite) - Blt8BPPDataTo8BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + else + Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } else - Blt8BPPDataTo8BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } + else if (fIntensityBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + else + Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + else + { + Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } } else if (fZBlitter) { if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + if (fObscuredBlitter) + { + Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + else + { + Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } else - Blt8BPPDataTo8BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + Blt8BPPDataTo16BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + + UnLockVideoSurface(guiSAVEBUFFER); + } + } else - Blt8BPPDataTo8BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + + } + else if (bBlitClipVal == FALSE) + { + if (fPixelate) + { + if (fTranslucencyType) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferTransZTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferTransZNBTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferTransZPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fMerc) + { + // Flugente: draw riot shield UNDER the soldier + if ( pSoldier && + pSoldier->bVisible != -1 && + ( pSoldier->ubDirection == NORTH || + pSoldier->ubDirection == NORTHWEST || + pSoldier->ubDirection == WEST ) + && pSoldier->IsRiotShieldEquipped() ) + { + ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); + } + + if (fZBlitter) + { + if (fZWrite) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (fObscuredBlitter) + { + if (hVObjectAlpha != NULL) { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + } + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + + UnLockVideoSurface(guiSAVEBUFFER); + + } + + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + + } + + // Flugente: draw riot shield OVER the soldier + if ( pSoldier && + pSoldier->bVisible != -1 && + ( pSoldier->ubDirection == EAST || + pSoldier->ubDirection == SOUTHEAST || + pSoldier->ubDirection == SOUTH || + pSoldier->ubDirection == SOUTHWEST || + pSoldier->ubDirection == NORTHEAST ) + && pSoldier->IsRiotShieldEquipped() ) + { + ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); + } + } + else if (fShadowBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fIntensityBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferIntensityZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferIntensityZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferIntensity((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fZBlitter) + { + if (fZWrite) + { + // TEST + //Blt8BPPDataTo16BPPBufferTransZPixelate( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + if (fObscuredBlitter) + { + Blt8BPPDataTo16BPPBufferTransZPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + } + else + Blt8BPPDataTo16BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + UnLockVideoSurface(guiSAVEBUFFER); + } + + } + else + Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); } } diff --git a/Utils/Utilities.cpp b/Utils/Utilities.cpp index a2634b5f..f8ed4476 100644 --- a/Utils/Utilities.cpp +++ b/Utils/Utilities.cpp @@ -15,8 +15,6 @@ extern BOOLEAN GetCDromDriveLetter( STR8 pString ); -#define DATA_8_BIT_DIR "8-Bit\\" - BOOLEAN PerformTimeLimitedCheck(); // WANNE: Given a string, replaces all instances of "oldpiece" with "newpiece" @@ -97,26 +95,7 @@ BOOLEAN PerformTimeLimitedCheck(); //#define TIME_LIMITED_VERSION void FilenameForBPP(STR pFilename, STR pDestination) { -CHAR8 Drive[128], Dir[128], Name[128], Ext[128]; - - if(GETPIXELDEPTH()==16) - { - // no processing for 16 bit names - strcpy(pDestination, pFilename); - } - else - { - _splitpath(pFilename, Drive, Dir, Name, Ext); - - strcat(Name, "_8"); - - strcpy(pDestination, Drive); - //strcat(pDestination, Dir); - strcat(pDestination, DATA_8_BIT_DIR); - strcat(pDestination, Name); - strcat(pDestination, Ext); - } - + strcpy(pDestination, pFilename); } BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColFile ) diff --git a/Utils/Utilities.h b/Utils/Utilities.h index 3ffc30e0..d0d5dda0 100644 --- a/Utils/Utilities.h +++ b/Utils/Utilities.h @@ -5,8 +5,6 @@ #include "sgp.h" -#define GETPIXELDEPTH( ) ( gbPixelDepth ) - // WANNE: Maximum number of characters in german description (German xml files) #define MAXLINE 200 diff --git a/ext/export/src/export/sti/stci_image_utils.h b/ext/export/src/export/sti/stci_image_utils.h index 38c6e7a1..258baec7 100644 --- a/ext/export/src/export/sti/stci_image_utils.h +++ b/ext/export/src/export/sti/stci_image_utils.h @@ -42,10 +42,5 @@ namespace ja2xp UINT32 UnpackETRLEImageToBuffer(UINT8 *pBuffer, image_type *pImage, UINT16 ueETRLEIndex); UINT32 UnpackETRLEImageToRGBABuffer(UINT8 *pBuffer, image_type *pImage, UINT16 ueETRLEIndex); - /** - * NOTE: implemented in msvc inline assembler - * does not work with gcc -> use 'UnpackETRLEImageToBuffer' - */ - BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, image_type *hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); }; #endif // _STCI_IMAGE_UTILS_H_ diff --git a/sgp/Button System.cpp b/sgp/Button System.cpp index dd3d5b04..9ccc6bc3 100644 --- a/sgp/Button System.cpp +++ b/sgp/Button System.cpp @@ -794,10 +794,7 @@ BOOLEAN InitializeButtonImageManager(INT32 DefaultBuffer, INT32 DefaultPitch, IN return(FALSE); } - if(GETPIXELDEPTH()==16) - GenericButtonFillColors[0]=GenericButtonOffNormal[0]->p16BPPPalette[Pix]; - else if(GETPIXELDEPTH()==8) - GenericButtonFillColors[0]=COLOR_DKGREY; + GenericButtonFillColors[0]=GenericButtonOffNormal[0]->p16BPPPalette[Pix]; return(TRUE); } @@ -3689,145 +3686,63 @@ void DrawGenericButton(GUI_BUTTON *b) else ImgNum=1; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - (INT32)b->YLoc, - (UINT16)ImgNum, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - (INT32)b->YLoc, - (UINT16)ImgNum, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + (INT32)b->YLoc, + (UINT16)ImgNum, &ClipRect ); if(q==0) ImgNum=5; else ImgNum=6; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - cy, (UINT16)ImgNum, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - cy, (UINT16)ImgNum, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + cy, (UINT16)ImgNum, &ClipRect ); } // Blit the right side corners - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)b->YLoc, - 2, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)b->YLoc, - 2, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)b->YLoc, + 2, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, cy, 7, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, cy, 7, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, cy, 7, &ClipRect ); // Draw the vertical members of the button's borders NumChunksHigh--; if(hremain!=0) { q=NumChunksHigh; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 3, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 3, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 3, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 4, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 4, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 4, &ClipRect ); } for(q=1;qXLoc, - (INT32)(b->YLoc + (q*iBorderHeight)), - 3, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight)), - 3, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight)), + 3, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight)), - 4, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight)), - 4, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight)), + 4, &ClipRect ); } // Unlock buffer diff --git a/sgp/Font.cpp b/sgp/Font.cpp index 5caa433b..d853c542 100644 --- a/sgp/Font.cpp +++ b/sgp/Font.cpp @@ -1042,15 +1042,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1156,15 +1148,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1214,15 +1198,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1271,15 +1247,7 @@ CHAR16 string[512]; desty+=GetHeight(FontObjs[FontType], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontType], transletter); } @@ -1323,15 +1291,7 @@ CHAR16 string[512]; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1390,15 +1350,7 @@ UINT16 usOldForeColor; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1469,15 +1421,7 @@ UINT8 *pDestBuf; return 0; } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } diff --git a/sgp/line.cpp b/sgp/line.cpp index 76c344f7..b96a7cc1 100644 --- a/sgp/line.cpp +++ b/sgp/line.cpp @@ -30,11 +30,6 @@ void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, int Color, int ScreenWidth); -void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); -void DrawVerticalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); - void SetClippingRegionAndImageWidth( int iImageWidth, @@ -426,258 +421,3 @@ void RectangleDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, shor LineDraw( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); LineDraw( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); } - -/*********************************************************************************** -* 8-Bit Versions -* -* -* -* Added by Derek Beland -***********************************************************************************/ - -/* Draws a rectangle between the specified endpoints in color Color. */ -void RectangleDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) -{ - LineDraw8( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr); - LineDraw8( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); -} - -/* Draws a line between the specified endpoints in color Color. */ -void LineDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) -{ - int Temp, AdjUp, AdjDown, ErrorTerm, XAdvance, XDelta, YDelta; - int WholeStep, InitialPixelCount, FinalPixelCount, i, RunLength; - int ScreenWidth = giImageWidth; - UINT8 col1 = Color & 0x00FF; - - if ( fClip ) - { - if ( !Clip2D( &XStart, &YStart, &XEnd, &YEnd ) ) - return; - } - - /* We'll always draw top to bottom, to reduce the number of cases we have to - handle, and to make lines between the same endpoints draw the same pixels */ - if (YStart > YEnd) { - Temp = YStart; - YStart = YEnd; - YEnd = Temp; - Temp = XStart; - XStart = XEnd; - XEnd = Temp; - } - - // point to the bitmap address first pixel to draw - ScreenPtr = ScreenPtr + YStart*giImageWidth + XStart; - - /* Figure out whether we're going left or right, and how far we're - going horizontally */ - if ((XDelta = XEnd - XStart) < 0) - { - XAdvance = -1; - XDelta = -XDelta; - } - else - { - XAdvance = 1; - } - /* Figure out how far we're going vertically */ - YDelta = YEnd - YStart; - - /* Special-case horizontal, vertical, and diagonal lines, for speed - and to avoid nasty boundary conditions and division by 0 */ - if (XDelta == 0) - { - /* Vertical line */ - for (i=0; i<=YDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += giImageWidth; - } - return; - } - if (YDelta == 0) - { - /* Horizontal line */ - for (i=0; i<=XDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += XAdvance; - } - return; - } - if (XDelta == YDelta) - { - /* Diagonal line */ - for (i=0; i<=XDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += (XAdvance + giImageWidth); - } - return; - } - - /* Determine whether the line is X or Y major, and handle accordingly */ - if (XDelta >= YDelta) - { - /* X major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = XDelta / YDelta; - - /* Error term adjust each time Y steps by 1; used to tell when one - extra pixel should be drawn as part of a run, to account for - fractional steps along the X axis per 1-pixel steps along Y */ - AdjUp = (XDelta % YDelta) * 2; - - /* Error term adjust when the error term turns over, used to factor - out the X step made at that time */ - AdjDown = YDelta * 2; - - /* Initial error term; reflects an initial step of 0.5 along the Y - axis */ - ErrorTerm = (XDelta % YDelta) - (YDelta * 2); - - /* The initial and last runs are partial, because Y advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; - - /* If the basic run length is even and there's no fractional - advance, we have one pixel that could go to either the initial - or last partial run, which we'll arbitrarily allocate to the - last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there're an odd number of pixels per run, we have 1 pixel that can't - be allocated to either the initial or last partial run, so we'll add 0.5 - to error term so this pixel will be handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += YDelta; - } - /* Draw the first, partial run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - /* Draw all full runs */ - for (i=0; i<(YDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } - else - { - /* Y major line */ - - /* Minimum # of pixels in a run in this line */ - WholeStep = YDelta / XDelta; - - /* Error term adjust each time X steps by 1; used to tell when 1 extra - pixel should be drawn as part of a run, to account for - fractional steps along the Y axis per 1-pixel steps along X */ - AdjUp = (YDelta % XDelta) * 2; - - /* Error term adjust when the error term turns over, used to factor - out the Y step made at that time */ - AdjDown = XDelta * 2; - - /* Initial error term; reflects initial step of 0.5 along the X axis */ - ErrorTerm = (YDelta % XDelta) - (XDelta * 2); - - /* The initial and last runs are partial, because X advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; - - /* If the basic run length is even and there's no fractional advance, we - have 1 pixel that could go to either the initial or last partial run, - which we'll arbitrarily allocate to the last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there are an odd number of pixels per run, we have one pixel - that can't be allocated to either the initial or last partial - run, so we'll add 0.5 to the error term so this pixel will be - handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += XDelta; - } - /* Draw the first, partial run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - - /* Draw all full runs */ - for (i=0; i<(XDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawVerticalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } -} - - -/* Draws a horizontal run of pixels, then advances the bitmap pointer to - the first pixel of the next run. */ -void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth) -{ - int i; - UINT8 *WorkingScreenPtr = *ScreenPtr; - UINT8 col1 = Color & 0x00FF; - - for (i=0; ipETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - usZLevel=usZValue; -// usZLinesToGo=WORLD_TILE_Y; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZLevel - ja BlitNTL2 - - mov ax, usZLevel - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - // check for incrementing of z level - dec usZLinesToGo - jnz RSLoop2 - -// mov ax, usZLevel -// add ax, Z_SUBLEVELS -// mov usZLevel, ax - -// mov ax, WORLD_TILE_Y -// mov usZLinesToGo, ax - -RSLoop2: - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - /********************************************************************************************** InitZBuffer @@ -1953,4911 +1676,6 @@ BZR1: - - -//***************************************************************************** -//** 8 Bit Blitters -//** -//***************************************************************************** - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBuffer - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - static UINT32 uiOffset; - static UINT32 usHeight, usWidth; - static UINT8 *SrcPtr, *DestPtr; - static UINT32 LineSkip; - static ETRLEObject *pTrav; - static INT32 iTempX, iTempY; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - LineSkip=(uiDestPitchBYTES-(usWidth)); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ebx, ebx - xor ecx, ecx - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - - movsb - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - movsw - -BlitNTL3: - - or cl, cl - jz BlitDispatch - - xor ebx, ebx - -//BlitNTL4: - - rep movsd - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - xor al, al - rep stosb - - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferMonoShadow - - Uses a bitmap an 8BPP template for blitting. Anywhere a 1 appears in the bitmap, a shadow - is blitted to the destination (a black pixel). Any other value above zero is considered a - forground color, and zero is background. If the parameter for the background color is zero, - transparency is used for the background. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubForeground, UINT8 ubBackground) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov al, [esi] - cmp al, 1 - jne BlitNTL6 - - xor al, al - mov [edi], al - jmp BlitNTL5 - -BlitNTL6: - or al, al - jz BlitNTL7 - - mov al, ubForeground - mov [edi], al - jmp BlitNTL5 - -BlitNTL7: - cmp ubBackground, 0 - je BlitNTL5 - - mov al, ubBackground - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - and ecx, 07fH - - mov al, ubBackground - or al, al - jz BlitTrans1 - - rep stosb - jmp BlitDispatch - - -BlitTrans1: - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferMonoShadowClip - - Uses a bitmap an 8BPP template for blitting. Anywhere a 1 appears in the bitmap, a shadow - is blitted to the destination (a black pixel). Any other value above zero is considered a - forground color, and zero is background. If the parameter for the background color is zero, - transparency is used for the background. - - **********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadowClip( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubForeground, UINT8 ubBackground) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - xor eax, eax - mov al, [esi] - cmp al, 1 - jne BlitNTL3 - - // write shadow pixel - xor al, al - mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - or al, al - jz BlitNTL4 - - // write foreground pixel - mov al, ubForeground - mov [edi], al - jmp BlitNTL2 - -BlitNTL4: - cmp ubBackground, 0 - je BlitNTL2 - - //write background pixel - mov al, ubBackground - mov [edi], al - -BlitNTL2: - inc esi - inc edi - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - sub LSCount, ecx - - mov al, ubBackground - or al, al - jz BTrans2 - - rep stosb - jmp BlitDispatch - -BTrans2: - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - uiLineFlag=(iTempY&1); - - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL5 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL5 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL5 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL5 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZClipPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL2 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL2 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClipPixelate - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP=hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL2 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL2 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - - - - - - - - - - - - - - - - -/****************************************************************************** - Blt8BPPDataTo8BPPBufferTransparentClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. Clips the brush. - -*******************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP -// mov edx, pointer to shade table here - xor eax, eax - mov ebx, TopSkip - xor ecx, ecx - - or ebx, ebx // check for nothing clipped on top - jz LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec ebx - jnz TopSkipLoop - - - - -LeftSkipSetup: - - mov Unblitted, 0 - mov ebx, LeftSkip // check for nothing clipped on the left - or ebx, ebx - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, ebx - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, ebx // skip partial run, jump into normal loop for rest - sub ecx, ebx - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub ebx, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, ebx - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, ebx // skip partial run, jump into normal loop for rest - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub ebx, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov ebx, BlitLength - mov Unblitted, 0 - -BlitDispatch: - - or ebx, ebx // Check to see if we're done blitting - jz RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, ebx - jbe BNTrans1 - - sub ecx, ebx - mov Unblitted, ecx - mov ecx, ebx - -BNTrans1: - sub ebx, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - inc esi - inc edi - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - add esi, 2 - add edi, 2 - -BlitNTL3: - - or cl, cl - jz BlitLineEnd - -BlitNTL4: - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - add esi, 4 - add edi, 4 - - dec cl - jnz BlitNTL4 - -BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, ebx - jbe BTrans1 - - mov ecx, ebx - -BTrans1: - - sub ebx, ecx - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransparent - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *pPal8BPP; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - LineSkip=(uiDestPitchBYTES-(usWidth)); - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ebx, ebx - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - -// movsb - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - inc esi - inc edi - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - -// movsw - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - add esi, 2 - add edi, 2 - -BlitNTL3: - - or cl, cl - jz BlitDispatch - -BlitNTL4: - -// rep movsd - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - add esi, 4 - add edi, 4 - - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZ - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ, uiZComp; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - uiZComp=(UINT32)usZValue; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - -// do a byte - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL4 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - -BlitNTL4: - inc esi - inc ebx - inc edi - inc ebx - -// do a word -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL6 - -// word - first pixel - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL3 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -// word - second -BlitNTL3: - mov ax, [ebx+2] - cmp eax, uiZComp - ja BlitNTL12 - - mov eax, uiZComp - mov [ebx+2], ax - - xor eax, eax - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - -BlitNTL12: - - inc esi - inc edi - inc esi - inc edi - add ebx, 4 - -// do a dword -BlitNTL6: - or cl, cl - jz BlitDispatch - -BlitNTL7: - -// dword - first pixel - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL8 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -// dword - second -BlitNTL8: - mov ax, [ebx+2] - cmp eax, uiZComp - ja BlitNTL9 - - mov eax, uiZComp - mov [ebx+2], ax - - xor eax, eax - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - -BlitNTL9: -// dword - third pixel - mov ax, [ebx+4] - cmp eax, uiZComp - ja BlitNTL10 - - mov eax, uiZComp - mov [ebx+4], ax - - xor eax, eax - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - -// dword - fourth -BlitNTL10: - mov ax, [ebx+6] - cmp eax, uiZComp - ja BlitNTL11 - - mov eax, uiZComp - mov [ebx+6], ax - - xor eax, eax - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - -BlitNTL11: - add esi, 4 - add edi, 4 - add ebx, 8 - dec cl - jnz BlitNTL7 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNB - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBColor - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Any pixels that fail the Z test - are written to with the specified color. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubColor) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - jmp BlitNTL6 - -BlitNTL5: - xor ah, ah - mov al, ubColor - mov al, [edx+eax] - mov [edi], al - -BlitNTL6: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClipColor - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubColor) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - xor eax, eax - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - jmp BlitNTL3 - -BlitNTL2: - - xor ah, ah - mov al, ubColor - mov al, [edx+eax] - mov [edi], al - -BlitNTL3: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZ - - Creates a shadow using a brush, but modifies the destination buffer only if the current - Z level is equal to higher than what's in the Z buffer at that pixel location. It - updates the Z buffer with the new Z level. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZNB - - Creates a shadow using a brush, but modifies the destination buffer only if the current - Z level is equal to higher than what's in the Z buffer at that pixel location. - The Z buffer is NOT updated with the new information. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZNBClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, the Z value is - NOT updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZ - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. If the source pixel is 254, - it is considered a shadow, and the destination buffer is darkened rather than blitted on. - The Z-buffer is 16 bit, and must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL6 - - mov al, [edi] -// mov al, ColorTable[eax] ********************************************* - mov [edi], al - jmp BlitNTL5 - - -BlitNTL6: - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZNB - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - NOT updated, for any non-transparent pixels. If the source pixel is 254, - it is considered a shadow, and the destination buffer is darkened rather than blitted on. - The Z-buffer is 16 bit, and must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL6 - -// mov al, [edi] -// mov al, ColorTable[eax] ********************************************* -// mov [edi], al - jmp BlitNTL5 - - -BlitNTL6: - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Pixels with a value of - 254 are shaded instead of blitted. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL3 - - mov al, [edi] -// mov ax, ColorTable[eax] ************************************************ - mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZNBClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the - pixel's Z level is below that of the current pixel, it is written on, and the Z value is - NOT updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Pixels with a value of - 254 are shaded instead of blitted. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL3 - -// mov al, [edi] -// mov ax, ColorTable[eax] ************************************************ -// mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadow - - Modifies the destination buffer. Darkens the destination pixels by 25%, using the source - image as a mask. Any Non-zero index pixels are used to darken destination pixels. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex) -{ - UINT8 *pPal8BPP; - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, usHeight - xor ecx, ecx - mov edx, OFFSET ShadeTable - -BlitDispatch: - - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - - add esi, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - add edi, 2 - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax*2] - mov [edi+2], ax - - add edi, 4 - -BlitNTL3: - - or cl, cl - jz BlitDispatch - -BlitNTL4: - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax*2] - mov [edi+2], ax - - mov ax, [edi+4] - mov ax, [edx+eax*2] - mov [edi+4], ax - - mov ax, [edi+6] - mov ax, [edx+eax*2] - mov [edi+6], ax - - add edi, 8 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH -// shl ecx, 1 - add ecx, ecx - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec ebx - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowClip - - Modifies the destination buffer. Darkens the destination pixels by 25%, using the source - image as a mask. Any Non-zero index pixels are used to darken destination pixels. Blitter - clips brush if it doesn't fit on the viewport. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT8 *pPal8BPP; - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, TopSkip - xor ecx, ecx - - or ebx, ebx // check for nothing clipped on top - jz LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec ebx - jnz TopSkipLoop - - - - -LeftSkipSetup: - - mov Unblitted, 0 - mov ebx, LeftSkip // check for nothing clipped on the left - or ebx, ebx - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, ebx - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, ebx // skip partial run, jump into normal loop for rest - sub ecx, ebx - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub ebx, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, ebx - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, ebx // skip partial run, jump into normal loop for rest - mov ebx, BlitLength - jmp BlitTransparent - - -LSTrans1: - sub ebx, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov ebx, BlitLength - mov Unblitted, 0 - -BlitDispatch: - - or ebx, ebx // Check to see if we're done blitting - jz RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: - - cmp ecx, ebx - jbe BNTrans1 - - sub ecx, ebx - mov Unblitted, ecx - mov ecx, ebx - -BNTrans1: - sub ebx, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - inc esi - add edi, 2 - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax] - mov [edi+2], ax - - add esi, 2 - add edi, 4 - -BlitNTL3: - - or cl, cl - jz BlitLineEnd - -BlitNTL4: - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax] - mov [edi+2], ax - - mov ax, [edi+4] - mov ax, [edx+eax] - mov [edi+4], ax - - mov ax, [edi+6] - mov ax, [edx+eax] - mov [edi+6], ax - - add esi, 4 - add edi, 8 - dec cl - jnz BlitNTL4 - -BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - cmp ecx, ebx - jbe BTrans1 - - mov ecx, ebx - -BTrans1: - - sub ebx, ecx -// shl ecx, 1 - add ecx, ecx - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - - - //***************************************************************************** //** 16 Bit Blitters //** @@ -16788,79 +11606,6 @@ BOOLEAN UpdateBackupSurface( HVOBJECT hVObject ) */ -BOOLEAN FillRect8BPP(UINT8 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT8 color) -{ -INT32 x1real, y1real, x2real, y2real; -UINT32 linelength, lines, lineskip; -UINT8 *startoffset; - - // check parameters - Assert(pBuffer!=NULL); - Assert(uiDestPitchBYTES > 0); - Assert(x2 > x1); - Assert(y2 > y1); - - // clip edges of rect if hanging off screen - - x1real=__max(0, x1); - x2real=__min(639, x2); - y1real=__max(0, y1); - y2real=__min(479, y2); - - startoffset=pBuffer+(y1real*uiDestPitchBYTES)+x1real; - lines=y2real-y1real+1; - linelength=x2real-x1real+1; - lineskip=uiDestPitchBYTES-linelength; - - __asm { - mov edi, startoffset - mov al, color - mov ah, al - shl eax, 16 - mov al, color - mov ah, al - mov edx, lines - mov ebx, linelength - -// edi = destination pointer -// eax = dword of color value -// ebx = line length -// ecx = column counter -// edx = row counter - -LineLoop: - - mov ecx, ebx - - clc - rcr ecx, 1 - jnc FL2 - - mov [edi], al - inc edi - -FL2: - clc - rcr ecx, 1 - jnc FL3 - mov [edi], ax - add edi, 2 - -FL3: - or ecx, ecx - jz FillLineEnd - - rep stosd - -FillLineEnd: - add edi, lineskip - dec edx - jnz LineLoop - - } - return(TRUE); -} - BOOLEAN FillRect16BPP(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color) { INT32 x1real, y1real, x2real, y2real; diff --git a/sgp/vobject_blitters.h b/sgp/vobject_blitters.h index 2f7c1e1c..6a1b81d6 100644 --- a/sgp/vobject_blitters.h +++ b/sgp/vobject_blitters.h @@ -53,50 +53,9 @@ CHAR8 BltIsClippedOrOffScreen( HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 UINT16 *InitZBuffer(UINT32 uiPitch, UINT32 uiHeight); BOOLEAN ShutdownZBuffer(UINT16 *pBuffer); -// 8-Bit to 8-Bit Blitters - -//BOOLEAN Blt8BPPDataTo8BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubColor); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubColor); - -// pixelation blitters -BOOLEAN Blt8BPPDataTo8BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - - -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadowClip( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubForeground, UINT8 ubBackground); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo16BPPBufferTransMirror( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - // 8-Bit to 16-Bit Blitters +BOOLEAN Blt8BPPDataTo16BPPBufferTransMirror( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 usColor); BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 usColor); @@ -152,19 +111,13 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadow(UINT16 *pBuffer, UINT32 uiDestPitchB BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowAlpha(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, HVOBJECT hAlphaVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows); BOOLEAN Blt8BPPDataTo16BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN DDBlt8BPPDataTo16BPPBufferShadow( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT8 level, COLORVAL maskrgb, UINT16 usX, UINT16 usY, SGPRect *srcRect); BOOLEAN Blt8BPPTo8BPP(UINT8 *pDest, UINT32 uiDestPitch, UINT8 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); BOOLEAN Blt16BPPTo16BPP(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans); BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans); -BOOLEAN Blt16BPPTo16BPPFog(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT8 *pFog, UINT16 usFogPitch); BOOLEAN Blt16BPPTo16BPPMirror(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt16BPPBufferPixelateRectWithColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8], UINT16 usColor ); BOOLEAN Blt16BPPBufferPixelateRect(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8]); @@ -186,12 +139,6 @@ BOOLEAN Blt8BPPDataSubTo16BPPBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, H BOOLEAN Blt8BPPDataTo16BPPBufferHalf( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVSURFACE hSrcVSurface, UINT8 *pSrcBuffer, UINT32 uiSrcPitch, INT32 iX, INT32 iY); BOOLEAN Blt8BPPDataTo16BPPBufferHalfRect( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVSURFACE hSrcVSurface, UINT8 *pSrcBuffer, UINT32 uiSrcPitch, INT32 iX, INT32 iY, SGPRect *pRect); -BOOLEAN DDBlt8BPPDataTo16BPPBuffer( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT16 usX, UINT16 usY, SGPRect *srcRect ); -BOOLEAN DDBlt8BPPDataTo16BPPBufferFullTransparent( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT16 usX, UINT16 usY, SGPRect *srcRect ); -BOOLEAN DDFillSurface( HVOBJECT hDestVObject, blt_fx *pBltFx ); -BOOLEAN DDFillSurfaceRect( HVOBJECT hDestVObject, blt_fx *pBltFx ); -BOOLEAN BltVObjectUsingDD( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT32 fBltFlags, INT32 iDestX, INT32 iDestY, RECT *SrcRect ); - BOOLEAN BlitZRect(UINT16 *pZBuffer, UINT32 uiPitch, INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom, UINT16 usZValue); @@ -202,7 +149,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pS BOOLEAN Blt16BPPDataTo16BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt16BPPDataTo16BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt16BPPDataTo16BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); // ATE: New blitters for showing an outline at color 254 BOOLEAN Blt8BPPDataTo16BPPBufferOutline( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, INT16 s16BPPColor, BOOLEAN fDoOutline ); @@ -226,7 +172,6 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha(UINT16 *pBuffer, BOOLEAN Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt8BPPDataTo16BPPBufferTransZPixelateObscured( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN FillRect8BPP(UINT8 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT8 color); BOOLEAN FillRect16BPP(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color); /* From 586a46bb78ef51b9246361866c0c358cdfb1da1d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 24 Feb 2025 23:08:22 +0200 Subject: [PATCH 281/571] Remove last reference to gbPixelDepth --- Editor/editscreen.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 64eba6c4..563561ed 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -1069,10 +1069,7 @@ void ShowCurrentDrawingMode( void ) // Set the color for the window's border. Blueish color = Normal, Red = Fake lighting is turned on usFillColor = GenericButtonFillColors[0]; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); - if(gbPixelDepth==16) - RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf ); - else if(gbPixelDepth==8) - RectangleDraw8( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf ); + RectangleDraw( FALSE, iScreenWidthOffset + 0, 2 * iScreenHeightOffset + 400, iScreenWidthOffset + 99, 2 * iScreenHeightOffset + 458, usFillColor, pDestBuf ); UnLockVideoSurface( FRAME_BUFFER ); From 4823ef49297040257fb5a9bdcc6f2a05d2b22520 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 6 Mar 2025 17:38:52 +0200 Subject: [PATCH 282/571] Add check for vest position attachments --- Tactical/LogicalBodyTypes/Filter.cpp | 12 ++++++++++++ Tactical/LogicalBodyTypes/Filter.h | 4 ++++ Tactical/LogicalBodyTypes/FilterDB.cpp | 8 ++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Tactical/LogicalBodyTypes/Filter.cpp b/Tactical/LogicalBodyTypes/Filter.cpp index d0a60a9e..3d666cbf 100644 --- a/Tactical/LogicalBodyTypes/Filter.cpp +++ b/Tactical/LogicalBodyTypes/Filter.cpp @@ -258,6 +258,18 @@ bool Filter::Match(SOLDIERTYPE* pSoldier) { case REQ_LEGPOSATTACHMENT3: cmp_val = CompareAttachment(pSoldier, LEGPOS, 3); break; + case REQ_VESTPOSATTACHMENT0: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 0 ); + break; + case REQ_VESTPOSATTACHMENT1: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 1 ); + break; + case REQ_VESTPOSATTACHMENT2: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 2 ); + break; + case REQ_VESTPOSATTACHMENT3: + cmp_val = CompareAttachment( pSoldier, VESTPOS, 3 ); + break; default: if (q < NUM_REQTYPESINV) { cmp_val = pSoldier->inv[q].usItem; diff --git a/Tactical/LogicalBodyTypes/Filter.h b/Tactical/LogicalBodyTypes/Filter.h index b8a865d2..cbc896bb 100644 --- a/Tactical/LogicalBodyTypes/Filter.h +++ b/Tactical/LogicalBodyTypes/Filter.h @@ -75,6 +75,10 @@ public: REQ_LEGPOSATTACHMENT1, REQ_LEGPOSATTACHMENT2, REQ_LEGPOSATTACHMENT3, + REQ_VESTPOSATTACHMENT0, + REQ_VESTPOSATTACHMENT1, + REQ_VESTPOSATTACHMENT2, + REQ_VESTPOSATTACHMENT3, NUM_REQTYPES, // 3rd byte is for operator flags _REQ_BTWN = 0x20000, diff --git a/Tactical/LogicalBodyTypes/FilterDB.cpp b/Tactical/LogicalBodyTypes/FilterDB.cpp index 747d19f1..b5f23d73 100644 --- a/Tactical/LogicalBodyTypes/FilterDB.cpp +++ b/Tactical/LogicalBodyTypes/FilterDB.cpp @@ -270,7 +270,7 @@ namespace LogicalBodyTypes { /***************************************** Filter enum criterion types ******************************************/ - LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 43, + LOGBT_ENUMDB_ADD("IntegerFilterCriterionTypes", 47, Filter::REQ_HELMETPOS, Filter::REQ_VESTPOS, Filter::REQ_LEGPOS, @@ -313,7 +313,11 @@ namespace LogicalBodyTypes { Filter::REQ_LEGPOSATTACHMENT0, Filter::REQ_LEGPOSATTACHMENT1, Filter::REQ_LEGPOSATTACHMENT2, - Filter::REQ_LEGPOSATTACHMENT3 + Filter::REQ_LEGPOSATTACHMENT3, + Filter::REQ_VESTPOSATTACHMENT0, + Filter::REQ_VESTPOSATTACHMENT1, + Filter::REQ_VESTPOSATTACHMENT2, + Filter::REQ_VESTPOSATTACHMENT3 ); /***************************************** From f21cb3864769cd907779ef9775fc718dcb5eaa00 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 5 Apr 2025 16:16:02 +0300 Subject: [PATCH 283/571] Increase TileNo to UINT32 Bigmap grid number values go over uint16 max --- TileEngine/lighting.cpp | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index f873eaf1..b1bcdd67 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -1,3 +1,4 @@ +#pragma optimize("", off) #include "builddefines.h" /**************************************************************************************** @@ -460,36 +461,36 @@ UINT16 usNumNodes; ***************************************************************************************/ BOOLEAN LightTileBlocked(INT16 iSrcX, INT16 iSrcY, INT16 iX, INT16 iY) { -UINT16 usTileNo, usSrcTileNo; +UINT32 uiTileNo, uiSrcTileNo; Assert(gpWorldLevelData!=NULL); - usTileNo=MAPROWCOLTOPOS(iY, iX); - usSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); + uiTileNo=MAPROWCOLTOPOS(iY, iX); + uiSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); - if (TileIsOutOfBounds(usTileNo)) + if (TileIsOutOfBounds(uiTileNo)) { return( FALSE ); } - if (TileIsOutOfBounds(usSrcTileNo)) + if (TileIsOutOfBounds(uiSrcTileNo)) { return( FALSE ); } - if(gpWorldLevelData[ usTileNo ].sHeight > gpWorldLevelData[ usSrcTileNo ].sHeight) + if(gpWorldLevelData[ uiTileNo ].sHeight > gpWorldLevelData[ uiSrcTileNo ].sHeight) return(TRUE); { - UINT16 usTileNo; + UINT32 uiTileNo; LEVELNODE *pStruct; - usTileNo=MAPROWCOLTOPOS(iY, iX); + uiTileNo=MAPROWCOLTOPOS(iY, iX); - pStruct = gpWorldLevelData[ usTileNo ].pStructHead; + pStruct = gpWorldLevelData[ uiTileNo ].pStructHead; if ( pStruct != NULL ) { // IF WE ARE A WINDOW, DO NOT BLOCK! - if ( FindStructure( usTileNo, STRUCTURE_WALLNWINDOW ) != NULL ) + if ( FindStructure( uiTileNo, STRUCTURE_WALLNWINDOW ) != NULL ) { return( FALSE ); } @@ -509,8 +510,8 @@ BOOLEAN LightTileHasWall( INT16 iSrcX, INT16 iSrcY, INT16 iX, INT16 iY) { //LEVELNODE *pStruct; //UINT32 uiType; -UINT16 usTileNo; -UINT16 usSrcTileNo; +UINT32 uiTileNo; +UINT32 uiSrcTileNo; INT8 bDirection; UINT8 ubTravelCost; //INT8 bWallCount = 0; @@ -518,20 +519,20 @@ UINT8 ubTravelCost; Assert(gpWorldLevelData!=NULL); - usTileNo=MAPROWCOLTOPOS(iY, iX); - usSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); + uiTileNo=MAPROWCOLTOPOS(iY, iX); + uiSrcTileNo=MAPROWCOLTOPOS(iSrcY, iSrcX); - if ( usTileNo == usSrcTileNo ) + if ( uiTileNo == uiSrcTileNo ) { return( FALSE ); } - if ( TileIsOutOfBounds(usTileNo)) + if ( TileIsOutOfBounds(uiTileNo)) { return( FALSE ); } - if ( TileIsOutOfBounds(usSrcTileNo)) + if ( TileIsOutOfBounds(uiSrcTileNo)) { return( FALSE ); } @@ -541,7 +542,7 @@ UINT8 ubTravelCost; bDirection = atan8( iSrcX, iSrcY, iX, iY ); - ubTravelCost = gubWorldMovementCosts[ usTileNo ][ bDirection ][ 0 ]; + ubTravelCost = gubWorldMovementCosts[ uiTileNo ][ bDirection ][ 0 ]; if ( ubTravelCost == TRAVELCOST_WALL ) { @@ -550,7 +551,7 @@ UINT8 ubTravelCost; if ( IS_TRAVELCOST_DOOR( ubTravelCost ) ) { - ubTravelCost = DoorTravelCost( NULL, usTileNo, ubTravelCost, TRUE, NULL ); + ubTravelCost = DoorTravelCost( NULL, uiTileNo, ubTravelCost, TRUE, NULL ); if ( ubTravelCost == TRAVELCOST_OBSTACLE || ubTravelCost == TRAVELCOST_DOOR ) { From 5ed70befb4d8b6180325d2f3abd40dd5cf608b28 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Wed, 9 Apr 2025 19:52:23 +0200 Subject: [PATCH 284/571] Fixed tagged releases (#429) Fixed tagged releases --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c25feead..53acfa5e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -211,9 +211,7 @@ jobs: - name: Upload to tagged release if: startsWith(github.ref, 'refs/tags/v') - working-directory: source run: | - exit 0 - gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber + gh release upload "$GITHUB_REF_NAME" dist/* --clobber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 07320ba99665f40c68aca94566adb2248eb0aa9d Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:33:28 +0300 Subject: [PATCH 285/571] Limit TeamList mouseregions to correct amount --- Strategic/mapscreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 15eda907..52e9deb0 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -10968,7 +10968,7 @@ void CreateMouseRegionsForTeamList( void ) // will create mouse regions for assignments, path plotting, character info selection // the info region...is the background for the list itself // OJW - MP - int max_rows = giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; + int max_rows = maxNumberOfMercVisibleInStrategyList; if (is_networked) max_rows = 7; // check this value is correct / unhardcode it From 9df885a2647b296fe504fd2a9235a4c2bb795ba4 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:33:05 +0200 Subject: [PATCH 286/571] Fixed tagged releases #2 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53acfa5e..9eeb84e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,7 +186,6 @@ jobs: merge-multiple: true - name: Checkout Repo - if: github.ref == 'refs/heads/master' uses: actions/checkout@v4 with: path: source @@ -211,7 +210,8 @@ jobs: - name: Upload to tagged release if: startsWith(github.ref, 'refs/tags/v') + working-directory: source run: | - gh release upload "$GITHUB_REF_NAME" dist/* --clobber + gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ec4dc8b058fbd55583f06e53c90e72609d3146ba Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 9 Apr 2025 23:10:32 +0300 Subject: [PATCH 287/571] Provide gMapViewRegion through mapscreen.h --- Strategic/Map Screen Interface Map Inventory.cpp | 2 -- Strategic/mapscreen.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index cdfe41bd..ee7caaf2 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -1180,7 +1180,6 @@ void CreateMapInventoryPoolSlots( ) INT16 sXA = 0, sYA = 0; INT16 sULX = 0, sULY = 0; INT16 sBRX = 0, sBRY = 0; - extern MOUSE_REGION gMapViewRegion; //Moa: removed MapInventoryPoolMask, instead we disable map mouseregion and enable again when deleting stash regions MSYS_DisableRegion( &gMapViewRegion ); //MSYS_DefineRegion( &MapInventoryPoolMask, @@ -1217,7 +1216,6 @@ void CreateMapInventoryPoolSlots( ) void DestroyMapInventoryPoolSlots( void ) { INT32 iCounter = 0; - extern MOUSE_REGION gMapViewRegion; for( iCounter = 0; iCounter < MAP_INVENTORY_POOL_SLOT_COUNT; iCounter++ ) { diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index ac0b53e5..efbad087 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -123,6 +123,8 @@ struct UILayout_CharList int widthTimeRemaining; }; +extern MOUSE_REGION gMapViewRegion; + extern BOOLEAN fCharacterInfoPanelDirty; extern BOOLEAN fTeamPanelDirty; extern BOOLEAN fMapPanelDirty; From da3c3bace8bb15237449a20ef6817ecf09e21c84 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 9 Apr 2025 23:11:11 +0300 Subject: [PATCH 288/571] Use mouse position for squad movement popup box initial location --- Strategic/Map Screen Interface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 42c65f78..2c4b1051 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -3683,7 +3683,7 @@ void SetUpMovingListsForSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ ) void CreatePopUpBoxForMovementBox( void ) { - SGPPoint MovePosition = { UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width / 2, UI_MAP.ViewRegion.y + 100 }; + SGPPoint MovePosition = { gMapViewRegion.MouseXPos, gMapViewRegion.MouseYPos }; SGPPoint Position; SGPRect Dimensions; @@ -4186,7 +4186,7 @@ void MoveMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { // highlight string - HighLightBoxLine( ghMoveBox, iValue ); + HighLightBoxLine( ghMoveBox, iValue ); } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { From 3e45217a9a663abbfa4676bb09fb9e626775b876 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 12 Apr 2025 23:48:12 +0300 Subject: [PATCH 289/571] Add compilationFlags to {exe} (#428) * Add compilationFlags to {exe} sgp.cpp is not recognizing JA2EDITOR preprocessor definition otherwise and therefore does not read EDITOR_SCREEN_RESOLUTION when starting map editor * Add debugFlags too --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cbfd1fa..9be4f1c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,6 +147,7 @@ foreach(app IN LISTS ApplicationTargets) ) target_link_libraries(${exe} PRIVATE ${Ja2_Libraries} $) target_link_options(${exe} PRIVATE $) + target_compile_definitions(${exe} PRIVATE ${compilationFlags} ${debugFlags}) # language library for an application, e.g. JA2MAPEDITOR_ENGLISH_i18n set(language_library ${exe}_i18n) From 865288e6227d6c792637d172d949f627cdf3b5c9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 13 Apr 2025 18:00:01 +0300 Subject: [PATCH 290/571] Implement multicolumn popupbox Mainly aimed for strategic movement popup box to accommodate increased team sizes --- Strategic/Map Screen Interface.cpp | 511 ++++++++++-- Utils/PopUpBox.cpp | 1220 ++++++++++++++++++---------- Utils/PopUpBox.h | 24 +- 3 files changed, 1246 insertions(+), 509 deletions(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 2c4b1051..ecca6342 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -1,4 +1,4 @@ - #include "Map Screen Interface.h" +#include "Map Screen Interface.h" #include "string.h" #include "Map Screen Interface Map.h" #include "Render Dirty.h" @@ -127,7 +127,7 @@ INT32 iUpdateBoxWaitingList[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ]; FASTHELPREGION pFastHelpMapScreenList[ MAX_MAPSCREEN_FAST_HELP ]; // the move menu region -MOUSE_REGION gMoveMenuRegion[ MAX_POPUP_BOX_STRING_COUNT ]; +MOUSE_REGION gMoveMenuRegion[ MAX_POPUP_BOX_COLUMNS*MAX_POPUP_BOX_STRING_COUNT ]; MOUSE_REGION gMapScreenHelpTextMask; @@ -3685,79 +3685,79 @@ void CreatePopUpBoxForMovementBox( void ) { SGPPoint MovePosition = { gMapViewRegion.MouseXPos, gMapViewRegion.MouseYPos }; SGPPoint Position; - SGPRect Dimensions; + SGPRect Dimensions = { 0,0, 100, 95 }; // create the pop up box and mouse regions for movement list // create basic box - CreatePopUpBox(&ghMoveBox, AssignmentDimensions, MovePosition, ( POPUP_BOX_FLAG_CLIP_TEXT|POPUP_BOX_FLAG_RESIZE )); + CreatePopUpBox( &ghMoveBox, Dimensions, MovePosition, (POPUP_BOX_FLAG_CLIP_TEXT | POPUP_BOX_FLAG_RESIZE) ); - // which buffer will box render to - SetBoxBuffer(ghMoveBox, FRAME_BUFFER); + // which buffer will box render to + SetBoxBuffer( ghMoveBox, FRAME_BUFFER ); - // border type? - SetBorderType(ghMoveBox,guiPOPUPBORDERS); + // border type? + SetBorderType( ghMoveBox, guiPOPUPBORDERS ); - // background texture - SetBackGroundSurface(ghMoveBox, guiPOPUPTEX); + // background texture + SetBackGroundSurface( ghMoveBox, guiPOPUPTEX ); - // margin sizes - SetMargins( ghMoveBox, 6, 6, 4, 4 ); + // margin sizes + SetMargins( ghMoveBox, 6, 6, 4, 4 ); - // space between lines - SetLineSpace(ghMoveBox, 2); + // space between lines + SetLineSpace( ghMoveBox, 2 ); - // set current box to this one - SetCurrentBox( ghMoveBox ); + // set current box to this one + SetCurrentBox( ghMoveBox ); - // add strings - AddStringsToMoveBox( ); + // add strings + AddStringsToMoveBox(); + // set font type + SetBoxFont( ghMoveBox, MAP_SCREEN_FONT ); - // set font type - SetBoxFont(ghMoveBox, MAP_SCREEN_FONT); + // set highlight color + SetBoxHighLight( ghMoveBox, FONT_WHITE ); - // set highlight color - SetBoxHighLight(ghMoveBox, FONT_WHITE); + // unhighlighted color + SetBoxForeground( ghMoveBox, FONT_LTGREEN ); - // unhighlighted color - SetBoxForeground(ghMoveBox, FONT_LTGREEN); + // make the header line WHITE + SetBoxLineForeground( ghMoveBox, 0, FONT_WHITE ); - // make the header line WHITE - SetBoxLineForeground( ghMoveBox, 0, FONT_WHITE ); - - // make the done and cancel lines YELLOW - SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 1, FONT_YELLOW ); + // make the done and cancel lines YELLOW + SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 1, FONT_YELLOW ); if ( IsAnythingSelectedForMoving() ) { SetBoxLineForeground( ghMoveBox, GetNumberOfLinesOfTextInBox( ghMoveBox ) - 2, FONT_YELLOW ); } - // background color - SetBoxBackground(ghMoveBox, FONT_BLACK); + // background color + SetBoxBackground( ghMoveBox, FONT_BLACK ); - // shaded color..for darkened text - SetBoxShade( ghMoveBox, FONT_BLACK ); + // shaded color..for darkened text + SetBoxShade( ghMoveBox, FONT_BLACK ); - SetBoxSecondColumnForeground(ghMoveBox, FONT_LTGREEN); - SetBoxSecondColumnBackground(ghMoveBox, FONT_BLACK); - SetBoxSecondColumnHighLight(ghMoveBox, FONT_WHITE); - SetBoxSecondColumnShade(ghMoveBox, FONT_BLACK); - SetBoxSecondColumnFont(ghMoveBox, MAP_SCREEN_FONT); - SetBoxSecondColumnMinimumOffset(ghMoveBox, 1); - SetBoxSecondColumnOffsetAdjustment(ghMoveBox, -50); + for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + SetBoxColumnForeground( ghMoveBox, FONT_LTGREEN, i ); + SetBoxColumnBackground( ghMoveBox, FONT_BLACK, i ); + SetBoxColumnHighLight( ghMoveBox, FONT_WHITE, i ); + SetBoxColumnShade( ghMoveBox, FONT_BLACK, i ); + SetBoxColumnFont( ghMoveBox, MAP_SCREEN_FONT, i ); + } - // resize box to text - ResizeBoxToText( ghMoveBox ); + ResizeBoxToText( ghMoveBox ); - GetBoxPosition( ghMoveBox, &Position); + GetBoxPosition( ghMoveBox, &Position ); GetBoxSize( ghMoveBox, &Dimensions ); + // adjust position to try to keep it in the map area as best as possible if ( Position.iX + Dimensions.iRight >= (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) ) { - Position.iX = max(UI_MAP.ViewRegion.x, (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) - Dimensions.iRight ); + Position.iX = max( UI_MAP.ViewRegion.x, (UI_MAP.ViewRegion.x + UI_MAP.ViewRegion.width) - Dimensions.iRight ); SetBoxPosition( ghMoveBox, Position ); } @@ -3769,6 +3769,7 @@ void CreatePopUpBoxForMovementBox( void ) } +UINT32 gColumnEntries[MAX_POPUP_BOX_COLUMNS]; void AddStringsToMoveBox( void ) { @@ -3776,9 +3777,15 @@ void AddStringsToMoveBox( void ) CHAR16 sString[ 128 ], sStringB[ 128 ]; UINT32 hStringHandle; BOOLEAN fFirstOne = TRUE; - const INT32 firstColumnMaxEntries = 4 * gGameOptions.ubSquadSize; + const INT32 columnMaxEntries = 5 * gGameOptions.ubSquadSize; INT32 entries = 0; bool isFirstColumnFull = false; + bool secondColumnFull = false; + bool thirdColumnFull = false; + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + gColumnEntries[i] = 0; + } // set the current box SetCurrentBox( ghMoveBox ); @@ -3786,24 +3793,31 @@ void AddStringsToMoveBox( void ) // clear all the strings out of the box RemoveAllCurrentBoxStrings(); - // add title GetShortSectorString( sSelMapX, sSelMapY, sStringB ); swprintf( sString, L"%s %s", pMovementMenuStrings[ 0 ], sStringB ); - AddMonoString(&hStringHandle, sString ); - AddSecondColumnMonoString(&hStringHandle, L""); - + AddStringToBoxColumn(&hStringHandle, sString, 0 ); + // Add empty lines to other columns + for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + AddStringToBoxColumn( &hStringHandle, L"", i); + } // blank line - AddMonoString(&hStringHandle, L"" ); - AddSecondColumnMonoString(&hStringHandle, L""); + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + AddStringToBoxColumn( &hStringHandle, L"", i ); + } // add Select all line if (giNumberOfSquadsInSectorMoving > 1) { swprintf(sString, L"%s", pMovementMenuStrings[4]); - AddMonoString(&hStringHandle, sString); - AddSecondColumnMonoString(&hStringHandle, L""); + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + AddStringToBoxColumn( &hStringHandle, L"", i ); + } } @@ -3825,13 +3839,25 @@ void AddStringsToMoveBox( void ) else swprintf( sString, L"%s", pSquadMenuStrings[iSquadMovingList[ iCount ] ] ); } + // Determine which column to add if (!isFirstColumnFull) { - AddMonoString(&hStringHandle, sString); + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; } else { - AddMonoStringToSecondColumn(&hStringHandle, sString ); + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; } entries += 1; @@ -3850,21 +3876,41 @@ void AddStringsToMoveBox( void ) swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); } - if (!isFirstColumnFull) + if ( !isFirstColumnFull ) { - AddMonoString(&hStringHandle, sString); + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; } else { - AddMonoStringToSecondColumn(&hStringHandle, sString); + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; } entries += 1; } } - if (entries > firstColumnMaxEntries) + if (entries > columnMaxEntries && !isFirstColumnFull) { isFirstColumnFull = true; + gColumnEntries[0] = entries; + } + else if ( entries - gColumnEntries[0] > columnMaxEntries && !secondColumnFull ) + { + secondColumnFull = true; + } + else if ( entries - gColumnEntries[0] - gColumnEntries[1] > columnMaxEntries && !thirdColumnFull ) + { + thirdColumnFull = true; } } @@ -3875,15 +3921,33 @@ void AddStringsToMoveBox( void ) // add this vehicle if( fVehicleIsMoving[ iCount ] ) { - // swprintf( sString, L"*%s*", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); swprintf( sString, L"*%s*", gNewVehicle[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ].NewVehicleStrings ); } else { - // swprintf( sString, L"%s", pVehicleStrings[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ] ); swprintf( sString, L"%s", gNewVehicle[ pVehicleList[ iVehicleMovingList[ iCount ] ].ubVehicleType ].NewVehicleStrings); } - AddMonoString(&hStringHandle, sString ); + + if ( !isFirstColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; + } + else + { + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; + } + entries += 1; // now add all the grunts in it for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) @@ -3899,9 +3963,44 @@ void AddStringsToMoveBox( void ) { swprintf( sString, L" %s", pSoldierMovingList[ iCountB ]->name ); } - AddMonoString(&hStringHandle, sString ); + + if ( !isFirstColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 0 ); + } + else if ( !secondColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 1 ); + gColumnEntries[1] += 1; + } + else if ( !thirdColumnFull ) + { + AddStringToBoxColumn( &hStringHandle, sString, 2 ); + gColumnEntries[2] += 1; + } + else + { + AddStringToBoxColumn( &hStringHandle, sString, 3 ); + gColumnEntries[3] += 1; + } + entries += 1; } } + + + if ( entries > columnMaxEntries && !isFirstColumnFull ) + { + isFirstColumnFull = true; + gColumnEntries[0] = entries; + } + else if ( entries - gColumnEntries[0] > columnMaxEntries && !secondColumnFull ) + { + secondColumnFull = true; + } + else if ( entries - gColumnEntries[0] - gColumnEntries[1] > columnMaxEntries && !thirdColumnFull ) + { + thirdColumnFull = true; + } } @@ -3999,7 +4098,6 @@ void BuildMouseRegionsForMoveBox( void ) SetCurrentBox( ghMoveBox ); - // box heading MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); @@ -4024,67 +4122,303 @@ void BuildMouseRegionsForMoveBox( void ) // calc total number of "moving" lines in the box iTotalNumberOfLines = giNumberOfSoldiersInSectorMoving + giNumberOfSquadsInSectorMoving + giNumberOfVehiclesInSectorMoving; - // add the blank lines + // add the blank line iTotalNumberOfLines += iCounter; // now add the strings + const UINT32 firstColumnWidth = GetBoxSecondColumnCurrentOffset( ghMoveBox ); + bool firstColumnFull = false; + bool secondColumnFull = false; + bool thirdColumnFull = false; + INT32 entries = 0; + // Take into account any possible entries in the columnns after 1st for entries that come after squads + const UINT32 rowOffset = gColumnEntries[1] + gColumnEntries[2] + gColumnEntries[3]; + while( iCounter < iTotalNumberOfLines ) { // define regions for squad lines for( iCount = 0; iCount < giNumberOfSquadsInSectorMoving; iCount++ ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + // First column coordinates + UINT16 tlx = iBoxXPosition; + UINT16 tly = iBoxYPosition + iFontHeight * iCounter; + UINT16 brx = iBoxXPosition + firstColumnWidth; + UINT16 bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2*firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); // Column index + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1]); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } + MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, SQUAD_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCount ); - iCounter++; + + iCounter++; + entries += 1; + + // Squad soldiers for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { if( pSoldierMovingList[ iCountB ]->bAssignment == iSquadMovingList[ iCount ] ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + tlx = iBoxXPosition; + tly = iBoxYPosition + iFontHeight * iCounter; + brx = iBoxXPosition + firstColumnWidth; + bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, SOLDIER_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCountB ); + + iCounter++; + entries += 1; } } + + if ( entries >= gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2] && gColumnEntries[2] > 0 ) + { + thirdColumnFull = true; + } + else if ( entries >= gColumnEntries[0] + gColumnEntries[1] && gColumnEntries[1] > 0 ) + { + secondColumnFull = true; + } + else if ( entries >= gColumnEntries[0] && gColumnEntries[0] > 0 ) + { + firstColumnFull = true; + } } + + // Vehicles for( iCount = 0; iCount < giNumberOfVehiclesInSectorMoving; iCount++ ) { // define regions for vehicle lines - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + UINT16 tlx = iBoxXPosition; + UINT16 tly = iBoxYPosition + iFontHeight * (iCounter); + UINT16 brx = iBoxXPosition + iBoxWidth; + UINT16 bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } + MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, VEHICLE_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCount ); iCounter++; + entries += 1; + // Soldiers inside a vehicle for( iCountB = 0; iCountB < giNumberOfSoldiersInSectorMoving; iCountB++ ) { if( ( pSoldierMovingList[ iCountB ]->bAssignment == VEHICLE ) &&( pSoldierMovingList[ iCountB ]->iVehicleId == iVehicleMovingList[ iCount ] ) ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, - MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); + tlx = iBoxXPosition; + tly = iBoxYPosition + iFontHeight * iCounter; + brx = iBoxXPosition + firstColumnWidth; + bry = iBoxYPosition + iFontHeight * (iCounter + 1); + + if ( thirdColumnFull ) + { + tlx = iBoxXPosition + 3 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2])); + } + else if ( secondColumnFull ) + { + tlx = iBoxXPosition + 2 * firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - (gColumnEntries[0] + gColumnEntries[1])); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - (gColumnEntries[0] + gColumnEntries[1])); + } + else if ( firstColumnFull ) + { + tlx = iBoxXPosition + firstColumnWidth; + brx = tlx + firstColumnWidth; + tly = iBoxYPosition + iFontHeight * (iCounter - gColumnEntries[0]); + bry = iBoxYPosition + iFontHeight * (iCounter + 1 - gColumnEntries[0]); + } + + + MSYS_DefineRegion( &gMoveMenuRegion[iCounter], tlx, tly, brx, bry, MSYS_PRIORITY_HIGHEST, + MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + if ( thirdColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] - gColumnEntries[2] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 3 ); + } + else if ( secondColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] - gColumnEntries[1] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 2 ); + } + else if ( firstColumnFull ) + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter - gColumnEntries[0] ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 1 ); + } + else + { + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 0, iCounter ); + MSYS_SetRegionUserData( &gMoveMenuRegion[iCounter], 3, 0 ); + } + MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, SOLDIER_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, iCountB ); iCounter++; + entries += 1; } } + + if ( entries >= gColumnEntries[0] + gColumnEntries[1] + gColumnEntries[2] && gColumnEntries[2] > 0 ) + { + thirdColumnFull = true; + } + else if ( entries >= gColumnEntries[0] + gColumnEntries[1] && gColumnEntries[1] > 0 ) + { + secondColumnFull = true; + } + else if ( entries >= gColumnEntries[0] && gColumnEntries[0] > 0 ) + { + firstColumnFull = true; + } } @@ -4097,7 +4431,7 @@ void BuildMouseRegionsForMoveBox( void ) // this line gets place only once... if( !fDefinedOtherRegion ) { - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + firstColumnWidth), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4109,7 +4443,7 @@ void BuildMouseRegionsForMoveBox( void ) fDefinedOtherRegion = TRUE; } - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + firstColumnWidth), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4123,7 +4457,7 @@ void BuildMouseRegionsForMoveBox( void ) // blank line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; @@ -4131,7 +4465,7 @@ void BuildMouseRegionsForMoveBox( void ) if ( IsAnythingSelectedForMoving() ) { // DONE line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4143,13 +4477,13 @@ void BuildMouseRegionsForMoveBox( void ) else { // blank line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK ); iCounter++; } // CANCEL line - MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * iCounter ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 ) ), MSYS_PRIORITY_HIGHEST, + MSYS_DefineRegion( &gMoveMenuRegion[ iCounter ], ( INT16 )( iBoxXPosition ), ( INT16 )( iBoxYPosition + iFontHeight * (iCounter - rowOffset) ), ( INT16 )( iBoxXPosition + iBoxWidth ), ( INT16 )( iBoxYPosition + iFontHeight * ( iCounter + 1 - rowOffset ) ), MSYS_PRIORITY_HIGHEST, MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines @@ -4161,10 +4495,10 @@ void BuildMouseRegionsForMoveBox( void ) void ClearMouseRegionsForMoveBox( void ) { - INT32 iCounter = 0; - + UINT32 iCounter = 0; + UINT32 lines = GetTotalNumberOfLinesOfTextInBox( ghMoveBox ); // run through list of mouse regions - for( iCounter = 0; iCounter < ( INT32 )(GetNumberOfLinesOfTextInBox( ghMoveBox ) + GetNumberOfSecondaryLinesOfTextInBox(ghMoveBox)); iCounter++) + for( iCounter = 0; iCounter < lines; iCounter++) { // remove this region MSYS_RemoveRegion( &gMoveMenuRegion[ iCounter ] ); @@ -4182,11 +4516,12 @@ void MoveMenuMvtCallback(MOUSE_REGION * pRegion, INT32 iReason ) iValue = MSYS_GetRegionUserData( pRegion, 0 ); + INT32 column = MSYS_GetRegionUserData( pRegion, 3 ); if (iReason & MSYS_CALLBACK_REASON_GAIN_MOUSE ) { // highlight string - HighLightBoxLine( ghMoveBox, iValue ); + HighLightBoxLine( ghMoveBox, iValue, column ); } else if (iReason & MSYS_CALLBACK_REASON_LOST_MOUSE ) { diff --git a/Utils/PopUpBox.cpp b/Utils/PopUpBox.cpp index cc1225cd..168cad0a 100644 --- a/Utils/PopUpBox.cpp +++ b/Utils/PopUpBox.cpp @@ -1,4 +1,4 @@ - #include "PopUpBox.h" +#include "PopUpBox.h" #include "sysutil.h" @@ -18,13 +18,14 @@ BOOLEAN DrawBoxText(UINT32 uiCounter); void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ); void RemoveCurrentBoxSecondaryText( INT32 hStringHandle ); +void RemoveCurrentBoxText( INT32 hStringHandle, UINT8 column ); void InitPopUpBoxList() { - memset(&PopUpBoxList, 0, sizeof(PopUpBoxPt)); - return; + memset( &PopUpBoxList, 0, sizeof( PopUpBoxPt ) ); + return; } @@ -113,10 +114,17 @@ BOOLEAN CreatePopUpBox(INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position SetBoxSize(iCount, Dimensions); SetBoxFlags(iCount, uiFlags); - for(iCounter=0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++) + for ( UINT8 col = 0; col < MAX_POPUP_BOX_COLUMNS; ++col ) { - PopUpBoxList[iCount]->Text[iCounter]=NULL; - PopUpBoxList[iCount]->pSecondColumnString[iCounter]=NULL; + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; ++iCounter) + { + PopUpBoxList[iCount]->Text[col][iCounter] = NULL; + } + } + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + PopUpBoxList[iCount]->pSecondColumnString[iCounter] = NULL; } SetCurrentBox(iCount); @@ -179,18 +187,18 @@ void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) { // shade iLineNumber Line in box indexed by hBoxHandle - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + Assert( PopUpBoxList[hBoxHandle] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if ( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber] != NULL ) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag = TRUE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag = TRUE; } } @@ -203,13 +211,13 @@ void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag = FALSE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag = FALSE; } } @@ -223,13 +231,13 @@ void SecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag = TRUE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag = TRUE; } } @@ -242,13 +250,13 @@ void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) Assert( PopUpBoxList[ hBoxHandle ] ); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag = FALSE; + PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag = FALSE; } } @@ -342,52 +350,50 @@ void SetBackGroundSurface(INT32 hBoxHandle, INT32 iBackGroundSurfaceIndex) // adds a FIRST column string to the CURRENT popup box -void AddMonoString(UINT32 *hStringHandle, STR16 pString) +void AddMonoString( UINT32 *hStringHandle, STR16 pString ) { - STR16 pLocalString=NULL; - POPUPSTRINGPTR pStringSt=NULL; - INT32 iCounter=0; + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); - // find first free slot in list - for( iCounter = 0; ( iCounter < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[iCounter] != NULL ); iCounter++ ); + // find first free slot in list + for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[0][iCounter] != NULL); iCounter++ ); - if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) - { - // using too many text lines, or not freeing them up properly - Assert(0); + if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) + { + // using too many text lines, or not freeing them up properly + Assert( 0 ); + return; + } + + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) + return; + + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) + return; + + wcscpy( pLocalString, pString ); + + RemoveCurrentBoxPrimaryText( iCounter ); + + PopUpBoxList[guiCurrentBox]->Text[0][iCounter] = pStringSt; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fColorFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->pString = pLocalString; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fHighLightFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fSecondaryShadeFlag = FALSE; + + *hStringHandle = iCounter; + PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; return; - } - - pStringSt=(POPUPSTRING *)(MemAlloc(sizeof(POPUPSTRING))); - if (pStringSt == NULL) - return; - - pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); - if (pLocalString == NULL) - return; - - wcscpy(pLocalString, pString); - - RemoveCurrentBoxPrimaryText( iCounter ); - - PopUpBoxList[guiCurrentBox]->Text[iCounter]=pStringSt; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fColorFlag=FALSE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->pString=pLocalString; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fHighLightFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fSecondaryShadeFlag = FALSE; - - *hStringHandle=iCounter; - - PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; - - return; } @@ -405,7 +411,7 @@ void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); // find the LAST USED text string index - for( iCounter = 0; ( iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[ iCounter + 1 ] != NULL ); iCounter++ ); + for( iCounter = 0; ( iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[0][ iCounter + 1 ] != NULL ); iCounter++ ); if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) { @@ -483,6 +489,98 @@ void AddMonoStringToSecondColumn(UINT32* hStringHandle, STR16 pString) return; } +// Adds a string to the first available slot in the column +void AddStringToBoxColumn( UINT32 *hStringHandle, STR16 pString, UINT8 column ) +{ + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; + + + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column >= MAX_POPUP_BOX_COLUMNS ) + return; + + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + + // find first free slot in list + for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[column][iCounter] != NULL); iCounter++ ); + + if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) + { + // using too many text lines, or not freeing them up properly + Assert( 0 ); + return; + } + + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) + return; + + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) + return; + + wcscpy( pLocalString, pString ); + + RemoveCurrentBoxText( iCounter, column ); + + PopUpBoxList[guiCurrentBox]->Text[column][iCounter] = pStringSt; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fColorFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->pString = pLocalString; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fHighLightFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fSecondaryShadeFlag = FALSE; + + *hStringHandle = iCounter; + PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; + return; +} + +// Adds string to the current popup box column besides first. !!! String's position is the LAST used position in the 1st column !!! +void AddColumnMonoString( UINT32 *hStringHandle, STR16 pString, UINT8 column ) +{ + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; + + + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column < 1 || column >= MAX_POPUP_BOX_COLUMNS) + return; + + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + + // find the LAST USED text string index + for ( iCounter = 0; (iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[0][iCounter + 1] != NULL); iCounter++ ); + + if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) + { + // using too many text lines, or not freeing them up properly + Assert( 0 ); + return; + } + + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) + return; + + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) + return; + + wcscpy( pLocalString, pString ); + + RemoveCurrentBoxText( iCounter, column ); + + PopUpBoxList[guiCurrentBox]->Text[column][iCounter] = pStringSt; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fColorFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->pString = pLocalString; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fShadeFlag = FALSE; + PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fHighLightFlag = FALSE; + + *hStringHandle = iCounter; + return; +} + // Adds a COLORED first column string to the CURRENT box void AddColorString(INT32 *hStringHandle, STR16 pString) @@ -498,7 +596,7 @@ void AddColorString(INT32 *hStringHandle, STR16 pString) Assert( PopUpBoxList[guiCurrentBox] != NULL ); // find first free slot in list - for( iCounter = 0; ( iCounter < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[iCounter] != NULL ); iCounter++ ); + for( iCounter = 0; ( iCounter < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[0][iCounter] != NULL ); iCounter++ ); if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) { @@ -519,9 +617,9 @@ void AddColorString(INT32 *hStringHandle, STR16 pString) RemoveCurrentBoxPrimaryText( iCounter ); - PopUpBoxList[guiCurrentBox]->Text[iCounter]=pStringSt; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->fColorFlag=TRUE; - PopUpBoxList[guiCurrentBox]->Text[iCounter]->pString=pLocalString; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]=pStringSt; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fColorFlag=TRUE; + PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->pString=pLocalString; *hStringHandle=iCounter; @@ -550,9 +648,9 @@ void ResizeBoxForSecondStrings( INT32 hBoxHandle ) // check string sizes for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( pBox->Text[ iCounter ] ) + if( pBox->Text[0][ iCounter ] ) { - uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[ iCounter ]->pString, pBox->Text[ iCounter ]->uiFont ); + uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[0][ iCounter ]->pString, pBox->Text[0][ iCounter ]->uiFont ); if( uiThisWidth > pBox->uiSecondColumnCurrentOffset ) { @@ -562,6 +660,52 @@ void ResizeBoxForSecondStrings( INT32 hBoxHandle ) } } +static void ResizeStrategicMvtBoxForSecondStrings( INT32 hBoxHandle ) +{ + INT32 iCounter = 0; + PopUpBoxPt pBox; + UINT32 uiBaseWidth, uiThisWidth; + + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + pBox = (PopUpBoxList[hBoxHandle]); + Assert( pBox ); + + // Determine last line for next loop + UINT8 last = MAX_POPUP_BOX_STRING_COUNT; + for ( iCounter = 1; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( pBox->Text[0][iCounter] == nullptr ) + { + // Do not consider the last blank, "cancel" & "Plot Travel route" lines + last = iCounter - 3; + break; + } + } + + uiBaseWidth = pBox->uiLeftMargin + pBox->uiSecondColumnMinimunOffset; + + // check string sizes, skip title line + for ( iCounter = 1; iCounter < last; iCounter++ ) + { + if ( pBox->Text[0][iCounter] ) + { + uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[0][iCounter]->pString, pBox->Text[0][iCounter]->uiFont ); + + if ( uiThisWidth > pBox->uiSecondColumnCurrentOffset ) + { + // Maintain width if something is selected and the '*' characters have been added + if ( wcsncmp( pBox->Text[0][iCounter]->pString, L" *", 3 ) == 0 ) + { + uiThisWidth -= 10; + } + pBox->uiSecondColumnCurrentOffset = uiThisWidth; + } + } + } +} UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ) @@ -575,7 +719,7 @@ UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ) // check string size for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( PopUpBoxList[ hBoxHandle ]->Text[ iCounter ] == NULL ) + if( PopUpBoxList[ hBoxHandle ]->Text[0][ iCounter ] == NULL ) { break; } @@ -605,29 +749,51 @@ UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle) return(iCounter); } - - -void SetBoxFont(INT32 hBoxHandle, UINT32 uiFont) +UINT32 GetTotalNumberOfLinesOfTextInBox( INT32 hBoxHandle ) { - UINT32 uiCounter; + UINT32 lines = 0; + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return(0); - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + // count number of lines + // check string size + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + for ( INT32 iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->Text[i][iCounter] == NULL ) + { + break; + } + lines += 1; + } + } + + return(lines); +} + + +void SetBoxFont( INT32 hBoxHandle, UINT32 uiFont ) +{ + UINT32 uiCounter; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) - { - if ( PopUpBoxList[hBoxHandle]->Text[uiCounter] != NULL) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->uiFont=uiFont; + if ( PopUpBoxList[hBoxHandle]->Text[0][uiCounter] != NULL ) + { + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->uiFont = uiFont; + } } - } - // set up the 2nd column font - SetBoxSecondColumnFont( hBoxHandle, uiFont ); + // set up the 2nd column font + SetBoxSecondColumnFont( hBoxHandle, uiFont ); - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; - return; + return; } void SetBoxSecondColumnMinimumOffset( INT32 hBoxHandle, UINT32 uiWidth ) @@ -657,36 +823,55 @@ void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x) return; } -void SetBoxSecondColumnFont(INT32 hBoxHandle, UINT32 uiFont) +void SetBoxSecondColumnFont( INT32 hBoxHandle, UINT32 uiFont ) { - UINT32 iCounter=0; + UINT32 iCounter = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->uiFont=uiFont; + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->uiFont = uiFont; + } } - } - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; - return; + return; } +void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->Text[column][uiCounter] != NULL ) + { + PopUpBoxList[hBoxHandle]->Text[column][uiCounter]->uiFont = uiFont; + } + } + + PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + return; +} + + + UINT32 GetBoxFont( INT32 hBoxHandle ) { if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return( 0 ); Assert( PopUpBoxList[ hBoxHandle ] ); - Assert( PopUpBoxList[ hBoxHandle ]->Text[ 0 ] ); + Assert( PopUpBoxList[ hBoxHandle ]->Text[0][ 0 ] ); // return font id of first line of text of box - return( PopUpBoxList[hBoxHandle]->Text[ 0 ]->uiFont ); + return( PopUpBoxList[hBoxHandle]->Text[0][ 0 ]->uiFont ); } @@ -697,9 +882,9 @@ void SetBoxLineForeground( INT32 iBox, INT32 iStringValue, UINT8 ubColor ) return; Assert( PopUpBoxList[ iBox ] ); - Assert( PopUpBoxList[ iBox ]->Text[iStringValue] ); + Assert( PopUpBoxList[ iBox ]->Text[0][iStringValue] ); - PopUpBoxList[iBox]->Text[iStringValue]->ubForegroundColor=ubColor; + PopUpBoxList[iBox]->Text[0][iStringValue]->ubForegroundColor=ubColor; return; } @@ -714,9 +899,9 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[iBox]->Text[uiCounter]!=NULL) + if (PopUpBoxList[iBox]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[iBox]->Text[uiCounter]->ubSecondaryShade=ubColor; + PopUpBoxList[iBox]->Text[0][uiCounter]->ubSecondaryShade=ubColor; } } return; @@ -731,9 +916,9 @@ void SetPopUpStringFont(INT32 hStringHandle, UINT32 uiFont) return; Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->uiFont=uiFont; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->uiFont=uiFont; return; } @@ -752,114 +937,114 @@ void SetPopUpSecondColumnStringFont(INT32 hStringHandle, UINT32 uiFont) -void SetStringSecondaryShade(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondaryShade( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubSecondaryShade=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubSecondaryShade = ubColor; + return; } -void SetStringForeground(INT32 hStringHandle, UINT8 ubColor) +void SetStringForeground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubForegroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubForegroundColor = ubColor; + return; } -void SetStringBackground(INT32 hStringHandle, UINT8 ubColor) +void SetStringBackground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubBackgroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubBackgroundColor = ubColor; + return; } -void SetStringHighLight(INT32 hStringHandle, UINT8 ubColor) +void SetStringHighLight( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubHighLight=ubColor; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubHighLight = ubColor; + return; } -void SetStringShade(INT32 hStringHandle, UINT8 ubShade) +void SetStringShade( INT32 hStringHandle, UINT8 ubShade ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->ubShade=ubShade; - return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubShade = ubShade; + return; } -void SetStringSecondColumnForeground(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondColumnForeground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubForegroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubForegroundColor = ubColor; + return; } -void SetStringSecondColumnBackground(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondColumnBackground( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubBackgroundColor=ubColor; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubBackgroundColor = ubColor; + return; } -void SetStringSecondColumnHighLight(INT32 hStringHandle, UINT8 ubColor) +void SetStringSecondColumnHighLight( INT32 hStringHandle, UINT8 ubColor ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubHighLight=ubColor; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubHighLight = ubColor; + return; } -void SetStringSecondColumnShade(INT32 hStringHandle, UINT8 ubShade) +void SetStringSecondColumnShade( INT32 hStringHandle, UINT8 ubShade ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubShade=ubShade; - return; + PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubShade = ubShade; + return; } @@ -875,9 +1060,9 @@ void SetBoxForeground(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubForegroundColor=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubForegroundColor=ubColor; } } return; @@ -894,9 +1079,9 @@ void SetBoxBackground(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubBackgroundColor=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubBackgroundColor=ubColor; } } return; @@ -913,9 +1098,9 @@ void SetBoxHighLight(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubHighLight=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubHighLight=ubColor; } } return; @@ -932,105 +1117,194 @@ void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor) for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[hBoxHandle]->Text[uiCounter]!=NULL) + if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) { - PopUpBoxList[hBoxHandle]->Text[uiCounter]->ubShade=ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubShade=ubColor; } } return; } -void SetBoxSecondColumnForeground(INT32 hBoxHandle, UINT8 ubColor) +void SetBoxSecondColumnForeground( INT32 hBoxHandle, UINT8 ubColor ) { - UINT32 iCounter=0; + UINT32 iCounter = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; Assert( PopUpBoxList[hBoxHandle] != NULL ); - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubForegroundColor=ubColor; + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubForegroundColor = ubColor; + } } - } - return; -} - -void SetBoxSecondColumnBackground(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 iCounter=0; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubBackgroundColor=ubColor; - } - } - - return; -} - -void SetBoxSecondColumnHighLight(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 iCounter=0; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubHighLight=ubColor; - } - } - - return; -} - -void SetBoxSecondColumnShade(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 iCounter=0; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubShade=ubColor; - } - } - return; -} - - -void HighLightLine(INT32 hStringHandle) -{ - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) return; - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fHighLightFlag=TRUE; - return; +} + +void SetBoxSecondColumnBackground( INT32 hBoxHandle, UINT8 ubColor ) +{ + UINT32 iCounter = 0; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + Assert( PopUpBoxList[hBoxHandle] != NULL ); + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubBackgroundColor = ubColor; + } + } + + return; +} + +void SetBoxSecondColumnHighLight( INT32 hBoxHandle, UINT8 ubColor ) +{ + UINT32 iCounter = 0; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + Assert( PopUpBoxList[hBoxHandle] != NULL ); + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubHighLight = ubColor; + } + } + + return; +} + +void SetBoxSecondColumnShade( INT32 hBoxHandle, UINT8 ubColor ) +{ + UINT32 iCounter = 0; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + Assert( PopUpBoxList[hBoxHandle] != NULL ); + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + { + PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubShade = ubColor; + } + } + return; +} + + +void SetBoxColumnForeground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubForegroundColor = ubColor; + } + } + return; +} + +void SetBoxColumnBackground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubBackgroundColor = ubColor; + } + } + return; +} + +void SetBoxColumnHighLight( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubHighLight = ubColor; + } + } + return; +} + +void SetBoxColumnShade( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[hBoxHandle]; + Assert( box != NULL ); + + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + { + if ( box->Text[column][uiCounter] != NULL ) + { + box->Text[column][uiCounter]->ubShade = ubColor; + } + } + return; +} + + + +void HighLightLine( INT32 hStringHandle, UINT8 column ) +{ + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + + if ( !box->Text[column][hStringHandle] ) + return; + box->Text[column][hStringHandle]->fHighLightFlag = TRUE; + return; +} + +void HighLight2ndLine( INT32 hStringHandle ) +{ + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + + if ( !box->pSecondColumnString[hStringHandle] ) + return; + box->pSecondColumnString[hStringHandle]->fHighLightFlag = TRUE; + return; } BOOLEAN GetShadeFlag( INT32 hStringHandle ) @@ -1040,10 +1314,10 @@ BOOLEAN GetShadeFlag( INT32 hStringHandle ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) + if(!PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]) return( FALSE ); - return( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fShadeFlag); + return( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fShadeFlag); } BOOLEAN GetSecondaryShadeFlag( INT32 hStringHandle ) @@ -1053,27 +1327,42 @@ BOOLEAN GetSecondaryShadeFlag( INT32 hStringHandle ) Assert( PopUpBoxList[guiCurrentBox] != NULL ); - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) + if(!PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]) return( FALSE ); - return( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fSecondaryShadeFlag ); + return( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fSecondaryShadeFlag ); } -void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber ) +void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) { if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return; // highlight iLineNumber Line in box indexed by hBoxHandle - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[column][iLineNumber]!=NULL) { // set current box SetCurrentBox( hBoxHandle ); // highlight line - HighLightLine( iLineNumber ); + HighLightLine( iLineNumber, column ); + } + + return; +} + +void HighLight2ndBoxLine( INT32 hBoxHandle, INT32 iLineNumber ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; + + // highlight iLineNumber Line in box indexed by hBoxHandle + if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iLineNumber] != NULL ) + { + SetCurrentBox( hBoxHandle ); + HighLight2ndLine( iLineNumber ); } return; @@ -1084,9 +1373,9 @@ BOOLEAN GetBoxShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return(FALSE); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { - return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fShadeFlag ); + return( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag ); } @@ -1098,40 +1387,50 @@ BOOLEAN GetBoxSecondaryShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) return(FALSE); - if( PopUpBoxList[hBoxHandle]->Text[iLineNumber]!=NULL) + if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) { - return( PopUpBoxList[hBoxHandle]->Text[iLineNumber]->fSecondaryShadeFlag ); + return( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag ); } return( FALSE ); } -void UnHighLightLine(INT32 hStringHandle) +void UnHighLightLine( INT32 hStringHandle ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( PopUpBoxList[guiCurrentBox] != NULL ); - if(!PopUpBoxList[guiCurrentBox]->Text[hStringHandle]) + if ( !PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ) + return; + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fHighLightFlag = FALSE; return; - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->fHighLightFlag=FALSE; - return; } -void UnHighLightBox(INT32 hBoxHandle) +void UnHighLightBox( INT32 hBoxHandle ) { - INT32 iCounter=0; + INT32 iCounter = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - for(iCounter=0; iCounter Text[iCounter]) - PopUpBoxList[hBoxHandle]->Text[iCounter]->fHighLightFlag=FALSE; - } + auto box = PopUpBoxList[hBoxHandle]; + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( box->Text[i][iCounter] ) + box->Text[i][iCounter]->fHighLightFlag = FALSE; + } + } + + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + { + if ( box->pSecondColumnString[iCounter] ) + box->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; + } } void UnHighLightSecondColumnLine(INT32 hStringHandle) @@ -1180,7 +1479,7 @@ void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps) // shuffle all strings down a slot to fill in the gap for ( uiCounter = hStringHandle; uiCounter < ( MAX_POPUP_BOX_STRING_COUNT - 1 ); uiCounter++ ) { - PopUpBoxList[guiCurrentBox]->Text[uiCounter]=PopUpBoxList[guiCurrentBox]->Text[uiCounter+1]; + PopUpBoxList[guiCurrentBox]->Text[0][uiCounter]=PopUpBoxList[guiCurrentBox]->Text[0][uiCounter+1]; PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter]=PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter+1]; } } @@ -1189,39 +1488,43 @@ void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps) } - void RemoveAllCurrentBoxStrings( void ) { UINT32 uiCounter; - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || !PopUpBoxList[guiCurrentBox] ) return; - for(uiCounter=0; uiCounter = MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - GetCurrentBox(&hOldBoxHandle); - SetCurrentBox(hBoxHandle); + GetCurrentBox( &hOldBoxHandle ); + SetCurrentBox( hBoxHandle ); - RemoveAllCurrentBoxStrings(); + RemoveAllCurrentBoxStrings(); - MemFree(PopUpBoxList[hBoxHandle]); - PopUpBoxList[hBoxHandle]=NULL; + MemFree( PopUpBoxList[hBoxHandle] ); + PopUpBoxList[hBoxHandle] = NULL; - if(hOldBoxHandle !=hBoxHandle) - SetCurrentBox(hOldBoxHandle); + if ( hOldBoxHandle != hBoxHandle ) + SetCurrentBox( hOldBoxHandle ); - return; + return; } @@ -1288,15 +1591,15 @@ void DisplayBoxes(UINT32 uiBuffer) void DisplayOnePopupBox( UINT32 uiIndex, UINT32 uiBuffer ) { - if ( ( uiIndex < 0 ) || ( uiIndex >= MAX_POPUP_BOX_COUNT ) ) + if ( (uiIndex < 0) || (uiIndex >= MAX_POPUP_BOX_COUNT) ) return; - if ( PopUpBoxList[ uiIndex ] != NULL ) + if ( PopUpBoxList[uiIndex] != NULL ) { - if( ( PopUpBoxList[ uiIndex ]->uiBuffer == uiBuffer) && ( PopUpBoxList[ uiIndex ]->fShowBox ) ) + if ( (PopUpBoxList[uiIndex]->uiBuffer == uiBuffer) && (PopUpBoxList[uiIndex]->fShowBox) ) { - DrawBox( uiIndex ); - DrawBoxText( uiIndex ); + DrawBox( uiIndex ); + DrawBoxText( uiIndex ); } } } @@ -1356,7 +1659,7 @@ BOOLEAN DrawBox(UINT32 uiCounter) usTopX=(UINT16)PopUpBoxList[uiCounter]->Position.iX; usTopY=(UINT16)PopUpBoxList[uiCounter]->Position.iY; - usWidth=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->Dimensions.iLeft + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); + usWidth = ((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iRight - PopUpBoxList[uiCounter]->Dimensions.iLeft + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); usHeight=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->Dimensions.iTop)); //CHRISL: Adjust position for screen limits @@ -1440,171 +1743,224 @@ BOOLEAN DrawBox(UINT32 uiCounter) -BOOLEAN DrawBoxText(UINT32 uiCounter) +BOOLEAN DrawBoxText( UINT32 uiCounter ) { - UINT32 uiCount=0; - INT16 uX, uY; - CHAR16 sString[100]; + UINT32 uiCount = 0; + INT16 uX, uY; + CHAR16 sString[100]; - if ( ( uiCounter < 0 ) || ( uiCounter >= MAX_POPUP_BOX_COUNT ) ) + if ( (uiCounter < 0) || (uiCounter >= MAX_POPUP_BOX_COUNT) ) return(FALSE); + Assert( PopUpBoxList[uiCounter] != NULL ); - Assert( PopUpBoxList[uiCounter] != NULL ); - - //clip text? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CLIP_TEXT) - { - SetFontDestBuffer(PopUpBoxList[uiCounter]->uiBuffer,PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin-1, PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->uiTopMargin, PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->uiRightMargin,PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->uiBottomMargin, FALSE); - } - - for(uiCount=0; uiCount Text[uiCount]) + auto box = PopUpBoxList[uiCounter]; + //clip text? + if ( box->uiFlags & POPUP_BOX_FLAG_CLIP_TEXT ) { - // set font - SetFont(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont); + const auto x1 = box->Position.iX + box->uiLeftMargin - 1; + const auto y1 = box->Position.iY + box->uiTopMargin; + const auto x2 = box->Position.iX + box->Dimensions.iRight - box->uiRightMargin; + const auto y2 = box->Position.iY + box->Dimensions.iBottom - box->uiBottomMargin; + SetFontDestBuffer( box->uiBuffer, x1, y1, x2, y2, FALSE ); + } - // are we highlighting?...shading?..or neither - if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fShadeFlag == FALSE) &&( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == FALSE ) ) - { - // neither - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubForegroundColor); - } - else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fHighLightFlag == TRUE ) ) - { - // highlight - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubHighLight); - } - else if( ( PopUpBoxList[ uiCounter ]->Text[ uiCount ]->fSecondaryShadeFlag == TRUE ) ) - { - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubSecondaryShade); - } - else - { - //shading - SetFontForeground(PopUpBoxList[uiCounter]->Text[uiCount]->ubShade); - } + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) + { - // set background - SetFontBackground(PopUpBoxList[uiCounter]->Text[uiCount]->ubBackgroundColor); - - // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->Text[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->Text[uiCount]->pString)+1); - - // centering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) + for ( uiCount = 0; uiCount < MAX_POPUP_BOX_STRING_COUNT; uiCount++ ) { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->Text[uiCount]->uiFont) ,&uX, &uY); - } - else - { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->Text[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); - } + auto entry = box->Text[i][uiCount]; + // there is text in this line? + if ( entry ) + { + // set font + SetFont( entry->uiFont ); - // print - mprintf(uX,uY,PopUpBoxList[uiCounter]->Text[uiCount]->pString); + // are we highlighting?...shading?..or neither + if ( (entry->fHighLightFlag == FALSE) && (entry->fShadeFlag == FALSE) && (entry->fSecondaryShadeFlag == FALSE) ) + { + // neither + SetFontForeground( entry->ubForegroundColor ); + } + else if ( (entry->fHighLightFlag == TRUE) ) + { + // highlight + SetFontForeground( entry->ubHighLight ); + } + else if ( (entry->fSecondaryShadeFlag == TRUE) ) + { + SetFontForeground( entry->ubSecondaryShade ); + } + else + { + //shading + SetFontForeground( entry->ubShade ); + } + + // set background + SetFontBackground( entry->ubBackgroundColor ); + + // copy string + wcsncpy( sString, entry->pString, wcslen( entry->pString ) + 1 ); + + // centering? + if ( box->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT ) + { + INT16 sLeft = box->Position.iX + box->uiLeftMargin; + INT16 sTop = box->Position.iY + uiCount * GetFontHeight( entry->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace; + INT16 sWidth = box->Dimensions.iRight - (box->uiRightMargin + box->uiLeftMargin + 2); + INT16 sHeight = GetFontHeight( entry->uiFont ); + FindFontCenterCoordinates( sLeft, sTop, sWidth, sHeight, (sString), ((INT32)entry->uiFont), &uX, &uY ); + } + else + { + uX = box->Position.iX + box->uiLeftMargin + box->uiSecondColumnCurrentOffset*i; + uY = ((INT16)(box->Position.iY + uiCount * GetFontHeight( entry->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)); + } + + // print + mprintf( uX, uY, entry->pString ); + } + } + } + + for ( uiCount = 0; uiCount < MAX_POPUP_BOX_STRING_COUNT; uiCount++ ) + { + // there is secondary text in this line? + if ( box->pSecondColumnString[uiCount] ) + { + // set font + SetFont( box->pSecondColumnString[uiCount]->uiFont ); + + // are we highlighting?...shading?..or neither + if ( (box->pSecondColumnString[uiCount]->fHighLightFlag == FALSE) && (box->pSecondColumnString[uiCount]->fShadeFlag == FALSE) ) + { + // neither + SetFontForeground( box->pSecondColumnString[uiCount]->ubForegroundColor ); + } + else if ( (box->pSecondColumnString[uiCount]->fHighLightFlag == TRUE) ) + { + // highlight + SetFontForeground( box->pSecondColumnString[uiCount]->ubHighLight ); + } + else + { + //shading + SetFontForeground( box->pSecondColumnString[uiCount]->ubShade ); + } + + // set background + SetFontBackground( box->pSecondColumnString[uiCount]->ubBackgroundColor ); + + // copy string + wcsncpy( sString, box->pSecondColumnString[uiCount]->pString, wcslen( box->pSecondColumnString[uiCount]->pString ) + 1 ); + + // centering? + if ( box->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT ) + { + FindFontCenterCoordinates( ((INT16)(box->Position.iX + box->uiLeftMargin)), ((INT16)(box->Position.iY + uiCount * GetFontHeight( box->pSecondColumnString[uiCount]->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)), ((INT16)(box->Dimensions.iRight - (box->uiRightMargin + box->uiLeftMargin + 2))), ((INT16)GetFontHeight( box->pSecondColumnString[uiCount]->uiFont )), (sString), ((INT32)box->pSecondColumnString[uiCount]->uiFont), &uX, &uY ); + } + else + { + uX = ((INT16)(box->Position.iX + box->uiLeftMargin + box->uiSecondColumnCurrentOffset + box->usSecondColumnOffsetAdjustment)); + uY = ((INT16)(box->Position.iY + uiCount * GetFontHeight( box->pSecondColumnString[uiCount]->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)); + } + + // print + mprintf( uX, uY, box->pSecondColumnString[uiCount]->pString ); + } } - // there is secondary text in this line? - if(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]) + if ( box->uiBuffer != guiSAVEBUFFER ) { - // set font - SetFont(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont); - - // are we highlighting?...shading?..or neither - if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == FALSE )&&( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fShadeFlag == FALSE) ) - { - // neither - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubForegroundColor); - } - else if( ( PopUpBoxList[ uiCounter ]->pSecondColumnString[ uiCount ]->fHighLightFlag == TRUE ) ) - { - // highlight - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubHighLight); - } - else - { - //shading - SetFontForeground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubShade); - } - - // set background - SetFontBackground(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->ubBackgroundColor); - - // copy string - wcsncpy(sString, PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString, wcslen(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString)+1); - - // centering? - if(PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT) - { - FindFontCenterCoordinates(((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin)),((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)),((INT16)(PopUpBoxList[uiCounter]->Dimensions.iRight-(PopUpBoxList[uiCounter]->uiRightMargin+PopUpBoxList[uiCounter]->uiLeftMargin+2))),((INT16)GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)),(sString),((INT32)PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont) ,&uX, &uY); - } - else - { - uX=((INT16)(PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin + PopUpBoxList[uiCounter]->uiSecondColumnCurrentOffset + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); - uY=((INT16)(PopUpBoxList[uiCounter]->Position.iY+uiCount*GetFontHeight(PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->uiFont)+PopUpBoxList[uiCounter]->uiTopMargin+uiCount*PopUpBoxList[uiCounter]->uiLineSpace)); - } - - // print - mprintf(uX,uY,PopUpBoxList[uiCounter]->pSecondColumnString[uiCount]->pString); - } - } - - - if( PopUpBoxList[uiCounter]->uiBuffer != guiSAVEBUFFER ) - { - InvalidateRegion( PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->uiLeftMargin-1, PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->uiTopMargin, PopUpBoxList[uiCounter]->Position.iX+PopUpBoxList[uiCounter]->Dimensions.iRight-PopUpBoxList[uiCounter]->uiRightMargin,PopUpBoxList[uiCounter]->Position.iY+PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->uiBottomMargin ); + InvalidateRegion( box->Position.iX + box->uiLeftMargin - 1, box->Position.iY + box->uiTopMargin, box->Position.iX + box->Dimensions.iRight - box->uiRightMargin, box->Position.iY + box->Dimensions.iBottom - box->uiBottomMargin ); } - SetFontDestBuffer(FRAME_BUFFER, 0,0,SCREEN_WIDTH, SCREEN_HEIGHT,FALSE); + SetFontDestBuffer( FRAME_BUFFER, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); - return TRUE; + return TRUE; } -void ResizeBoxToText(INT32 hBoxHandle) +void ResizeBoxToText( INT32 hBoxHandle ) { // run through lines of text in box and size box width to longest line plus margins // height is sum of getfontheight of each line+ spacing - INT32 iWidth=0; - INT32 iHeight=0; - INT32 iCurrString=0; + INT32 iWidth = 0; + INT32 iHeight = 0; + INT32 iCurrString = 0; INT32 iSecondColumnLength = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - if(!PopUpBoxList[hBoxHandle]) + if ( !PopUpBoxList[hBoxHandle] ) return; - ResizeBoxForSecondStrings( hBoxHandle ); + if ( hBoxHandle == ghMoveBox ) + { + ResizeStrategicMvtBoxForSecondStrings( hBoxHandle ); + } + else + { + ResizeBoxForSecondStrings( hBoxHandle ); + } - iHeight=PopUpBoxList[hBoxHandle]->uiTopMargin+PopUpBoxList[hBoxHandle]->uiBottomMargin; + auto box = PopUpBoxList[hBoxHandle]; + const UINT32 margins = box->uiLeftMargin + box->uiRightMargin; + + iHeight = box->uiTopMargin + box->uiBottomMargin; for ( iCurrString = 0; iCurrString < MAX_POPUP_BOX_STRING_COUNT; iCurrString++ ) { - if ( PopUpBoxList[hBoxHandle]->Text[iCurrString] != NULL) + if ( box->Text[0][iCurrString] != NULL ) { - if( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCurrString] != NULL ) + + if ( box->Text[3][iCurrString] != NULL && wcscmp( box->Text[3][iCurrString]->pString, L"") != 0) { - iSecondColumnLength = StringPixLength( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCurrString]->pString,PopUpBoxList[ hBoxHandle]->pSecondColumnString[ iCurrString ]->uiFont ); - if( PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin > ( ( UINT32 ) iWidth ) ) + iSecondColumnLength = StringPixLength( box->Text[3][iCurrString]->pString, box->Text[3][iCurrString]->uiFont ); + if ( 3*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) { - iWidth = PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset + iSecondColumnLength + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; + iWidth = 3*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + } + } + else if ( box->Text[2][iCurrString] != NULL && wcscmp( box->Text[2][iCurrString]->pString, L"" ) != 0 ) + { + iSecondColumnLength = StringPixLength( box->Text[2][iCurrString]->pString, box->Text[2][iCurrString]->uiFont ); + if ( 2*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + { + iWidth = 2*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + } + } + else if ( box->Text[1][iCurrString] != NULL && wcscmp( box->Text[1][iCurrString]->pString, L"" ) != 0 ) + { + iSecondColumnLength = StringPixLength( box->Text[1][iCurrString]->pString, box->Text[1][iCurrString]->uiFont ); + if ( box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + { + iWidth = box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; } } - if( ( StringPixLength(PopUpBoxList[hBoxHandle]->Text[iCurrString]->pString,PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont ) + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin ) > ( (UINT32) iWidth ) ) - iWidth=StringPixLength(PopUpBoxList[hBoxHandle]->Text[iCurrString]->pString,PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont ) + PopUpBoxList[hBoxHandle]->uiLeftMargin+PopUpBoxList[hBoxHandle]->uiRightMargin; + + if ( box->pSecondColumnString[iCurrString] != NULL ) + { + iSecondColumnLength = StringPixLength( box->pSecondColumnString[iCurrString]->pString, box->pSecondColumnString[iCurrString]->uiFont ); + if ( box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + { + iWidth = box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + } + } + + INT32 iFirstColumnLength = StringPixLength( box->Text[0][iCurrString]->pString, box->Text[0][iCurrString]->uiFont ) + margins; + if ( iFirstColumnLength > iWidth ) + iWidth = iFirstColumnLength; //vertical - iHeight+=GetFontHeight(PopUpBoxList[hBoxHandle]->Text[iCurrString]->uiFont)+PopUpBoxList[hBoxHandle]->uiLineSpace; + iHeight += GetFontHeight( box->Text[0][iCurrString]->uiFont ) + box->uiLineSpace; } else { @@ -1614,14 +1970,14 @@ void ResizeBoxToText(INT32 hBoxHandle) } // Flugente we shouldn't have added more popup options than we can display anyway, but I have no idea where to stop that, so at least we can fix this - PopUpBoxList[hBoxHandle]->Dimensions.iBottom = min( iHeight, SCREEN_HEIGHT - PopUpBoxList[hBoxHandle]->Position.iY); - PopUpBoxList[hBoxHandle]->Dimensions.iRight = min( iWidth, SCREEN_WIDTH - PopUpBoxList[hBoxHandle]->Position.iX ); + box->Dimensions.iBottom = min( iHeight, SCREEN_HEIGHT - box->Position.iY ); + box->Dimensions.iRight = min( iWidth, SCREEN_WIDTH - box->Position.iX ); // Constrain popup box height to background graphics max height. Otherwise we get blue graphics glitches - const auto popupBoxHeight = PopUpBoxList[hBoxHandle]->Dimensions.iBottom - PopUpBoxList[hBoxHandle]->Dimensions.iTop; - if (popupBoxHeight > 480) + const auto popupBoxHeight = box->Dimensions.iBottom - box->Dimensions.iTop; + if ( popupBoxHeight > 480 ) { - PopUpBoxList[hBoxHandle]->Dimensions.iBottom = PopUpBoxList[hBoxHandle]->Dimensions.iTop + 480; + box->Dimensions.iBottom = box->Dimensions.iTop + 480; } } @@ -1666,7 +2022,6 @@ void HideAllBoxes( void ) } - void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ) { if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) @@ -1676,15 +2031,15 @@ void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ) Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); // remove & release primary text - if(PopUpBoxList[guiCurrentBox]->Text[hStringHandle] != NULL) + if(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] != NULL) { - if ( PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->pString ) + if ( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->pString ) { - MemFree(PopUpBoxList[guiCurrentBox]->Text[hStringHandle]->pString); + MemFree(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->pString); } - MemFree(PopUpBoxList[guiCurrentBox]->Text[hStringHandle]); - PopUpBoxList[guiCurrentBox]->Text[hStringHandle]=NULL; + MemFree(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]); + PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]=NULL; } } @@ -1708,3 +2063,34 @@ void RemoveCurrentBoxSecondaryText( INT32 hStringHandle ) PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]=NULL; } } + +void RemoveCurrentBoxText( INT32 hStringHandle, UINT8 column ) +{ + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column >= MAX_POPUP_BOX_COLUMNS ) + return; + + Assert( PopUpBoxList[guiCurrentBox] != NULL ); + Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); + + // remove & release text + auto textColumn = PopUpBoxList[guiCurrentBox]->Text[column]; + + if ( textColumn[hStringHandle] != NULL ) + { + if ( textColumn[hStringHandle]->pString ) + { + MemFree( textColumn[hStringHandle]->pString ); + } + + MemFree( textColumn[hStringHandle] ); + textColumn[hStringHandle] = NULL; + } +} + +UINT32 GetBoxSecondColumnCurrentOffset( INT32 hBoxHandle ) +{ + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return 0; + + return PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset; +} diff --git a/Utils/PopUpBox.h b/Utils/PopUpBox.h index 4f3b6dd7..a140b179 100644 --- a/Utils/PopUpBox.h +++ b/Utils/PopUpBox.h @@ -9,6 +9,7 @@ #define MAX_POPUP_BOX_COUNT 32 #define MAX_POPUP_BOX_STRING_COUNT 128 // worst case = 45: move menu with 20 soldiers, each on different squad + overhead +#define MAX_POPUP_BOX_COLUMNS 4 // PopUpBox Flags #define POPUP_BOX_FLAG_CLIP_TEXT 1 @@ -51,7 +52,8 @@ struct popupbox{ BOOLEAN fUpdated; BOOLEAN fShowBox; - POPUPSTRINGPTR Text[ MAX_POPUP_BOX_STRING_COUNT ]; + POPUPSTRINGPTR Text[MAX_POPUP_BOX_COLUMNS][ MAX_POPUP_BOX_STRING_COUNT ]; + // TODO Remove pSecondColumnString POPUPSTRINGPTR pSecondColumnString[ MAX_POPUP_BOX_STRING_COUNT ]; }; @@ -76,6 +78,8 @@ void SetBoxPosition(INT32 hBoxHandle,SGPPoint Position); void GetBoxPosition( INT32 hBoxHandle, SGPPoint *Position ); UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ); UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle); +UINT32 GetTotalNumberOfLinesOfTextInBox( INT32 hBoxHandle ); +UINT32 GetBoxSecondColumnCurrentOffset( INT32 hBoxHandle ); void SetBoxSize( INT32 hBoxHandle, SGPRect Dimensions ); void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ); void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags); @@ -96,8 +100,10 @@ void SetBoxHighLight(INT32 hBoxHandle, UINT8 ubColor); void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor); void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); -void HighLightLine(INT32 hStringHandle); -void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber ); +void HighLightLine( INT32 hStringHandle, UINT8 column ); +void HighLight2ndLine( INT32 hStringHandle ); +void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column = 0 ); +void HighLight2ndBoxLine( INT32 hBoxHandle, INT32 iLineNumber ); void UnHighLightLine(INT32 hStringHandle); void UnHighLightBox(INT32 hBoxHandle); void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps); @@ -110,6 +116,9 @@ void DisplayOnePopupBox( UINT32 uiIndex, UINT32 uiBuffer ); void SetCurrentBox(INT32 hBoxHandle); void GetCurrentBox(INT32 *hBoxHandle); +void AddStringToBoxColumn( UINT32 *hStringHandle, STR16 pString, UINT8 column ); +void AddColumnMonoString( UINT32 *hStringHandle, STR16 pString, UINT8 column ); + // resize this box to the text it contains void ResizeBoxToText(INT32 hBoxHandle); @@ -162,6 +171,13 @@ void SetBoxSecondColumnShade(INT32 hBoxHandle, UINT8 ubColor); // Manual adjustment for 2nd column offset, eg. when 1st column has a title text that's wider than the rest and you want to move 2nd column texts towards the 1st column some. void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x); +// Set attributes by column +void SetBoxColumnForeground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnBackground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnHighLight( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnShade( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); +void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column ); + // secondary shades for boxes void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); @@ -172,4 +188,4 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ); // min width for box void SpecifyBoxMinWidth( INT32 hBoxHandle, INT32 iMinWidth ); -#endif \ No newline at end of file +#endif From 36a84ffe5937f0e1b474953f9ff6d26388cbe7e4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 13 Apr 2025 21:37:14 +0300 Subject: [PATCH 291/571] Remove pSecondColumnString * Use the new columns added to Text instead * Changed most functions to allow choosing a column * Removed unneeded SecondColumn specific functions to lessen code duplication * Lots of formatting changes to Popupbox.cpp, indentation was messed up in majority of the functions --- .../Map Screen Interface TownMine Info.cpp | 11 +- Strategic/Map Screen Interface.cpp | 42 +- Utils/PopUpBox.cpp | 1262 ++++++----------- Utils/PopUpBox.h | 48 +- 4 files changed, 508 insertions(+), 855 deletions(-) diff --git a/Strategic/Map Screen Interface TownMine Info.cpp b/Strategic/Map Screen Interface TownMine Info.cpp index 17294d0a..6fd9748c 100644 --- a/Strategic/Map Screen Interface TownMine Info.cpp +++ b/Strategic/Map Screen Interface TownMine Info.cpp @@ -180,11 +180,12 @@ void CreateDestroyTownInfoBox( void ) // set highlight color SetBoxHighLight(ghTownMineBox, FONT_WHITE); - SetBoxSecondColumnForeground( ghTownMineBox, FONT_WHITE ); - SetBoxSecondColumnBackground( ghTownMineBox, FONT_BLACK ); - SetBoxSecondColumnHighLight( ghTownMineBox, FONT_WHITE ); - SetBoxSecondColumnShade( ghTownMineBox, FONT_BLACK ); - SetBoxSecondColumnFont( ghTownMineBox, BLOCKFONT2 ); + const auto column = 1; + SetBoxColumnForeground( ghTownMineBox, FONT_WHITE, column ); + SetBoxColumnBackground( ghTownMineBox, FONT_BLACK, column ); + SetBoxColumnHighLight( ghTownMineBox, FONT_WHITE, column ); + SetBoxColumnShade( ghTownMineBox, FONT_BLACK, column ); + SetBoxColumnFont( ghTownMineBox, BLOCKFONT2, column ); SetBoxSecondColumnMinimumOffset( ghTownMineBox, 20 ); // unhighlighted color diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index ecca6342..4812b167 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -3796,27 +3796,27 @@ void AddStringsToMoveBox( void ) // add title GetShortSectorString( sSelMapX, sSelMapY, sStringB ); swprintf( sString, L"%s %s", pMovementMenuStrings[ 0 ], sStringB ); - AddStringToBoxColumn(&hStringHandle, sString, 0 ); + AddMonoString(&hStringHandle, sString, 0 ); // Add empty lines to other columns for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) { - AddStringToBoxColumn( &hStringHandle, L"", i); + AddMonoString( &hStringHandle, L"", i); } // blank line for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) { - AddStringToBoxColumn( &hStringHandle, L"", i ); + AddMonoString( &hStringHandle, L"", i ); } // add Select all line if (giNumberOfSquadsInSectorMoving > 1) { swprintf(sString, L"%s", pMovementMenuStrings[4]); - AddStringToBoxColumn( &hStringHandle, sString, 0 ); + AddMonoString( &hStringHandle, sString, 0 ); for ( size_t i = 1; i < MAX_POPUP_BOX_COLUMNS; i++ ) { - AddStringToBoxColumn( &hStringHandle, L"", i ); + AddMonoString( &hStringHandle, L"", i ); } } @@ -3842,21 +3842,21 @@ void AddStringsToMoveBox( void ) // Determine which column to add if (!isFirstColumnFull) { - AddStringToBoxColumn( &hStringHandle, sString, 0 ); + AddMonoString( &hStringHandle, sString, 0 ); } else if ( !secondColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 1 ); + AddMonoString( &hStringHandle, sString, 1 ); gColumnEntries[1] += 1; } else if ( !thirdColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 2 ); + AddMonoString( &hStringHandle, sString, 2 ); gColumnEntries[2] += 1; } else { - AddStringToBoxColumn( &hStringHandle, sString, 3 ); + AddMonoString( &hStringHandle, sString, 3 ); gColumnEntries[3] += 1; } entries += 1; @@ -3878,21 +3878,21 @@ void AddStringsToMoveBox( void ) if ( !isFirstColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 0 ); + AddMonoString( &hStringHandle, sString, 0 ); } else if ( !secondColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 1 ); + AddMonoString( &hStringHandle, sString, 1 ); gColumnEntries[1] += 1; } else if ( !thirdColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 2 ); + AddMonoString( &hStringHandle, sString, 2 ); gColumnEntries[2] += 1; } else { - AddStringToBoxColumn( &hStringHandle, sString, 3 ); + AddMonoString( &hStringHandle, sString, 3 ); gColumnEntries[3] += 1; } entries += 1; @@ -3930,21 +3930,21 @@ void AddStringsToMoveBox( void ) if ( !isFirstColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 0 ); + AddMonoString( &hStringHandle, sString, 0 ); } else if ( !secondColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 1 ); + AddMonoString( &hStringHandle, sString, 1 ); gColumnEntries[1] += 1; } else if ( !thirdColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 2 ); + AddMonoString( &hStringHandle, sString, 2 ); gColumnEntries[2] += 1; } else { - AddStringToBoxColumn( &hStringHandle, sString, 3 ); + AddMonoString( &hStringHandle, sString, 3 ); gColumnEntries[3] += 1; } entries += 1; @@ -3966,21 +3966,21 @@ void AddStringsToMoveBox( void ) if ( !isFirstColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 0 ); + AddMonoString( &hStringHandle, sString, 0 ); } else if ( !secondColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 1 ); + AddMonoString( &hStringHandle, sString, 1 ); gColumnEntries[1] += 1; } else if ( !thirdColumnFull ) { - AddStringToBoxColumn( &hStringHandle, sString, 2 ); + AddMonoString( &hStringHandle, sString, 2 ); gColumnEntries[2] += 1; } else { - AddStringToBoxColumn( &hStringHandle, sString, 3 ); + AddMonoString( &hStringHandle, sString, 3 ); gColumnEntries[3] += 1; } entries += 1; diff --git a/Utils/PopUpBox.cpp b/Utils/PopUpBox.cpp index 168cad0a..b0bd06a4 100644 --- a/Utils/PopUpBox.cpp +++ b/Utils/PopUpBox.cpp @@ -1,5 +1,5 @@ #include "PopUpBox.h" - #include "sysutil.h" +#include "sysutil.h" #define BORDER_WIDTH 16 @@ -13,8 +13,8 @@ #define BOTTOM_RIGHT_CORNER 3 -BOOLEAN DrawBox(UINT32 uiCounter); -BOOLEAN DrawBoxText(UINT32 uiCounter); +BOOLEAN DrawBox( UINT32 uiCounter ); +BOOLEAN DrawBoxText( UINT32 uiCounter ); void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ); void RemoveCurrentBoxSecondaryText( INT32 hStringHandle ); @@ -29,105 +29,101 @@ void InitPopUpBoxList() } -void InitPopUpBox(INT32 hBoxHandle) +void InitPopUpBox( INT32 hBoxHandle ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); - memset(PopUpBoxList[hBoxHandle], 0, sizeof(PopUpBo)); + Assert( PopUpBoxList[hBoxHandle] ); + memset( PopUpBoxList[hBoxHandle], 0, sizeof( PopUpBo ) ); } -void SetLineSpace(INT32 hBoxHandle, UINT32 uiLineSpace) +void SetLineSpace( INT32 hBoxHandle, UINT32 uiLineSpace ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); - PopUpBoxList[hBoxHandle]->uiLineSpace=uiLineSpace; - return; + Assert( PopUpBoxList[hBoxHandle] ); + PopUpBoxList[hBoxHandle]->uiLineSpace = uiLineSpace; + return; } UINT32 GetLineSpace( INT32 hBoxHandle ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return( 0 ); + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return(0); - Assert( PopUpBoxList[ hBoxHandle ] ); + Assert( PopUpBoxList[hBoxHandle] ); // return number of pixels between lines for this box - return( PopUpBoxList[hBoxHandle]->uiLineSpace ); + return(PopUpBoxList[hBoxHandle]->uiLineSpace); } void SpecifyBoxMinWidth( INT32 hBoxHandle, INT32 iMinWidth ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - PopUpBoxList[hBoxHandle]->uiBoxMinWidth = iMinWidth; + box->uiBoxMinWidth = iMinWidth; // check if the box is currently too small - if( PopUpBoxList[hBoxHandle]->Dimensions.iRight < iMinWidth ) + if ( box->Dimensions.iRight < iMinWidth ) { - PopUpBoxList[hBoxHandle]->Dimensions.iRight = iMinWidth; + box->Dimensions.iRight = iMinWidth; } return; } -BOOLEAN CreatePopUpBox(INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position, UINT32 uiFlags) +BOOLEAN CreatePopUpBox( INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position, UINT32 uiFlags ) { - INT32 iCounter=0; - INT32 iCount=0; - PopUpBoxPt pBox=NULL; + INT32 iCounter = 0; + INT32 iCount = 0; + PopUpBoxPt pBox = NULL; // find first free box - for(iCounter=0; ( iCounter < MAX_POPUP_BOX_COUNT ) && ( PopUpBoxList[iCounter] != NULL ); iCounter++); + for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_COUNT) && (PopUpBoxList[iCounter] != NULL); iCounter++ ); - if( iCounter >= MAX_POPUP_BOX_COUNT ) + if ( iCounter >= MAX_POPUP_BOX_COUNT ) { // ran out of available popup boxes - probably not freeing them up right! - Assert(0); + Assert( 0 ); return FALSE; } - iCount=iCounter; - *phBoxHandle=iCount; + iCount = iCounter; + *phBoxHandle = iCount; - pBox= (PopUpBoxPt) MemAlloc(sizeof(PopUpBo)); - if (pBox == NULL) + pBox = (PopUpBoxPt)MemAlloc( sizeof( PopUpBo ) ); + if ( pBox == NULL ) { return FALSE; } - PopUpBoxList[iCount]=pBox; + PopUpBoxList[iCount] = pBox; - InitPopUpBox(iCount); - SetBoxPosition(iCount, Position); - SetBoxSize(iCount, Dimensions); - SetBoxFlags(iCount, uiFlags); + InitPopUpBox( iCount ); + SetBoxPosition( iCount, Position ); + SetBoxSize( iCount, Dimensions ); + SetBoxFlags( iCount, uiFlags ); for ( UINT8 col = 0; col < MAX_POPUP_BOX_COLUMNS; ++col ) { - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; ++iCounter) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; ++iCounter ) { PopUpBoxList[iCount]->Text[col][iCounter] = NULL; } } - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - PopUpBoxList[iCount]->pSecondColumnString[iCounter] = NULL; - } - - SetCurrentBox(iCount); + SetCurrentBox( iCount ); SpecifyBoxMinWidth( iCount, 0 ); SetBoxSecondColumnMinimumOffset( iCount, 0 ); SetBoxSecondColumnCurrentOffset( iCount, 0 ); @@ -138,35 +134,37 @@ BOOLEAN CreatePopUpBox(INT32 *phBoxHandle, SGPRect Dimensions, SGPPoint Position } -void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags) +void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - PopUpBoxList[hBoxHandle]->uiFlags=uiFlags; - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + box->uiFlags = uiFlags; + box->fUpdated = FALSE; - return; + return; } -void SetMargins(INT32 hBoxHandle, UINT32 uiLeft, UINT32 uiTop, UINT32 uiBottom, UINT32 uiRight) +void SetMargins( INT32 hBoxHandle, UINT32 uiLeft, UINT32 uiTop, UINT32 uiBottom, UINT32 uiRight ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - PopUpBoxList[hBoxHandle]->uiLeftMargin=uiLeft; - PopUpBoxList[hBoxHandle]->uiRightMargin=uiRight; - PopUpBoxList[hBoxHandle]->uiTopMargin=uiTop; - PopUpBoxList[hBoxHandle]->uiBottomMargin=uiBottom; + box->uiLeftMargin = uiLeft; + box->uiRightMargin = uiRight; + box->uiTopMargin = uiTop; + box->uiBottomMargin = uiBottom; - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + box->fUpdated = FALSE; - return; + return; } @@ -174,183 +172,192 @@ UINT32 GetTopMarginSize( INT32 hBoxHandle ) { // return size of top margin, for mouse region offsets - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return( 0 ); + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return(0); - Assert( PopUpBoxList[ hBoxHandle ] ); + Assert( PopUpBoxList[hBoxHandle] ); - return( PopUpBoxList[hBoxHandle]->uiTopMargin ); + return(PopUpBoxList[hBoxHandle]->uiTopMargin); } -void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) +void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) { // shade iLineNumber Line in box indexed by hBoxHandle if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[hBoxHandle] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - if ( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber] != NULL ) + if ( box->Text[column][iLineNumber] != NULL ) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag = TRUE; + box->Text[column][iLineNumber]->fShadeFlag = TRUE; } } -void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) +void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) { // unshade iLineNumber in box indexed by hBoxHandle - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) + if ( box->Text[column][iLineNumber] != NULL ) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag = FALSE; + box->Text[column][iLineNumber]->fShadeFlag = FALSE; } } -void SecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) +void SecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) { // shade iLineNumber Line in box indexed by hBoxHandle - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) + if ( box->Text[column][iLineNumber] != NULL ) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag = TRUE; + box->Text[column][iLineNumber]->fSecondaryShadeFlag = TRUE; } } -void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ) +void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) { // unshade iLineNumber in box indexed by hBoxHandle - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) + if ( box->Text[column][iLineNumber] != NULL ) { // set current box SetCurrentBox( hBoxHandle ); // shade line - PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag = FALSE; + box->Text[column][iLineNumber]->fSecondaryShadeFlag = FALSE; } } -void SetBoxBuffer(INT32 hBoxHandle, UINT32 uiBuffer) +void SetBoxBuffer( INT32 hBoxHandle, UINT32 uiBuffer ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - PopUpBoxList[hBoxHandle]->uiBuffer=uiBuffer; + box->uiBuffer = uiBuffer; - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + box->fUpdated = FALSE; } -void SetBoxPosition( INT32 hBoxHandle,SGPPoint Position ) +void SetBoxPosition( INT32 hBoxHandle, SGPPoint Position ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - PopUpBoxList[hBoxHandle]->Position.iX=Position.iX; - PopUpBoxList[hBoxHandle]->Position.iY=Position.iY; + box->Position.iX = Position.iX; + box->Position.iY = Position.iY; - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + box->fUpdated = FALSE; } void GetBoxPosition( INT32 hBoxHandle, SGPPoint *Position ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - Position->iX = PopUpBoxList[hBoxHandle]->Position.iX; - Position->iY = PopUpBoxList[hBoxHandle]->Position.iY; + Position->iX = box->Position.iX; + Position->iY = box->Position.iY; } -void SetBoxSize(INT32 hBoxHandle,SGPRect Dimensions) +void SetBoxSize( INT32 hBoxHandle, SGPRect Dimensions ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - PopUpBoxList[hBoxHandle]->Dimensions.iLeft=Dimensions.iLeft; - PopUpBoxList[hBoxHandle]->Dimensions.iBottom=Dimensions.iBottom; - PopUpBoxList[hBoxHandle]->Dimensions.iRight=Dimensions.iRight; - PopUpBoxList[hBoxHandle]->Dimensions.iTop=Dimensions.iTop; + box->Dimensions.iLeft = Dimensions.iLeft; + box->Dimensions.iBottom = Dimensions.iBottom; + box->Dimensions.iRight = Dimensions.iRight; + box->Dimensions.iTop = Dimensions.iTop; - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; + box->fUpdated = FALSE; } void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); + auto box = PopUpBoxList[hBoxHandle]; + Assert( box ); - Dimensions->iLeft = PopUpBoxList[hBoxHandle]->Dimensions.iLeft; - Dimensions->iBottom = PopUpBoxList[hBoxHandle]->Dimensions.iBottom; - Dimensions->iRight = PopUpBoxList[hBoxHandle]->Dimensions.iRight; - Dimensions->iTop = PopUpBoxList[hBoxHandle]->Dimensions.iTop; + Dimensions->iLeft = box->Dimensions.iLeft; + Dimensions->iBottom = box->Dimensions.iBottom; + Dimensions->iRight = box->Dimensions.iRight; + Dimensions->iTop = box->Dimensions.iTop; } -void SetBorderType(INT32 hBoxHandle, INT32 iBorderObjectIndex) +void SetBorderType( INT32 hBoxHandle, INT32 iBorderObjectIndex ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); - PopUpBoxList[hBoxHandle]->iBorderObjectIndex=iBorderObjectIndex; + Assert( PopUpBoxList[hBoxHandle] ); + PopUpBoxList[hBoxHandle]->iBorderObjectIndex = iBorderObjectIndex; } -void SetBackGroundSurface(INT32 hBoxHandle, INT32 iBackGroundSurfaceIndex) +void SetBackGroundSurface( INT32 hBoxHandle, INT32 iBackGroundSurfaceIndex ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ hBoxHandle ] ); - PopUpBoxList[hBoxHandle]->iBackGroundSurface=iBackGroundSurfaceIndex; + Assert( PopUpBoxList[hBoxHandle] ); + PopUpBoxList[hBoxHandle]->iBackGroundSurface = iBackGroundSurfaceIndex; } -// adds a FIRST column string to the CURRENT popup box -void AddMonoString( UINT32 *hStringHandle, STR16 pString ) +// Adds a string to the first available slot in the column +void AddMonoString( UINT32 *hStringHandle, STR16 pString, UINT8 column ) { STR16 pLocalString = NULL; POPUPSTRINGPTR pStringSt = NULL; @@ -360,10 +367,11 @@ void AddMonoString( UINT32 *hStringHandle, STR16 pString ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); // find first free slot in list - for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[0][iCounter] != NULL); iCounter++ ); + for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (box->Text[column][iCounter] != NULL); iCounter++ ); if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) { @@ -382,17 +390,17 @@ void AddMonoString( UINT32 *hStringHandle, STR16 pString ) wcscpy( pLocalString, pString ); - RemoveCurrentBoxPrimaryText( iCounter ); + RemoveCurrentBoxText( iCounter, column ); - PopUpBoxList[guiCurrentBox]->Text[0][iCounter] = pStringSt; - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fColorFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->pString = pLocalString; - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fHighLightFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fSecondaryShadeFlag = FALSE; + box->Text[column][iCounter] = pStringSt; + box->Text[column][iCounter]->fColorFlag = FALSE; + box->Text[column][iCounter]->pString = pLocalString; + box->Text[column][iCounter]->fShadeFlag = FALSE; + box->Text[column][iCounter]->fHighLightFlag = FALSE; + box->Text[column][iCounter]->fSecondaryShadeFlag = FALSE; *hStringHandle = iCounter; - PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; + box->fUpdated = FALSE; return; } @@ -400,232 +408,97 @@ void AddMonoString( UINT32 *hStringHandle, STR16 pString ) // Adds string to the current popup box 2nd column. !!! String's position is the LAST used position in the 1st column !!! void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ) { - STR16 pLocalString=NULL; - POPUPSTRINGPTR pStringSt=NULL; - INT32 iCounter=0; + STR16 pLocalString = NULL; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); // find the LAST USED text string index - for( iCounter = 0; ( iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[0][ iCounter + 1 ] != NULL ); iCounter++ ); + for ( iCounter = 0; (iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT) && (box->Text[0][iCounter + 1] != NULL); iCounter++ ); if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) { // using too many text lines, or not freeing them up properly - Assert(0); + Assert( 0 ); return; } - pStringSt=(POPUPSTRING *)(MemAlloc(sizeof(POPUPSTRING))); - if (pStringSt == NULL) + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) return; - pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); - if (pLocalString == NULL) + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) return; - wcscpy(pLocalString, pString); + wcscpy( pLocalString, pString ); RemoveCurrentBoxSecondaryText( iCounter ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]=pStringSt; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fColorFlag=FALSE; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->pString=pLocalString; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; - - *hStringHandle=iCounter; - - return; -} - -// Adds a string to the first available slot in the second column -void AddMonoStringToSecondColumn(UINT32* hStringHandle, STR16 pString) -{ - STR16 pLocalString = NULL; - POPUPSTRINGPTR pStringSt = NULL; - INT32 iCounter = 0; - - - if ((guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT)) - return; - - Assert(PopUpBoxList[guiCurrentBox] != NULL); - - // find the free text string index in 2nd column - for (iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter] != NULL); iCounter++); - - if (iCounter >= MAX_POPUP_BOX_STRING_COUNT) - { - // using too many text lines, or not freeing them up properly - Assert(0); - return; - } - - pStringSt = (POPUPSTRING*)(MemAlloc(sizeof(POPUPSTRING))); - if (pStringSt == NULL) - return; - - pLocalString = (STR16)MemAlloc((wcslen(pString) + 1) * sizeof(CHAR16)); - if (pLocalString == NULL) - return; - - wcscpy(pLocalString, pString); - - RemoveCurrentBoxSecondaryText(iCounter); - - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter] = pStringSt; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fColorFlag = FALSE; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->pString = pLocalString; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; + box->Text[1][iCounter] = pStringSt; + box->Text[1][iCounter]->fColorFlag = FALSE; + box->Text[1][iCounter]->pString = pLocalString; + box->Text[1][iCounter]->fShadeFlag = FALSE; + box->Text[1][iCounter]->fHighLightFlag = FALSE; + box->Text[1][iCounter]->fSecondaryShadeFlag = FALSE; *hStringHandle = iCounter; return; } -// Adds a string to the first available slot in the column -void AddStringToBoxColumn( UINT32 *hStringHandle, STR16 pString, UINT8 column ) -{ - STR16 pLocalString = NULL; - POPUPSTRINGPTR pStringSt = NULL; - INT32 iCounter = 0; - - - if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column >= MAX_POPUP_BOX_COLUMNS ) - return; - - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - - // find first free slot in list - for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[column][iCounter] != NULL); iCounter++ ); - - if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) - { - // using too many text lines, or not freeing them up properly - Assert( 0 ); - return; - } - - pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); - if ( pStringSt == NULL ) - return; - - pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); - if ( pLocalString == NULL ) - return; - - wcscpy( pLocalString, pString ); - - RemoveCurrentBoxText( iCounter, column ); - - PopUpBoxList[guiCurrentBox]->Text[column][iCounter] = pStringSt; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fColorFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->pString = pLocalString; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fHighLightFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fSecondaryShadeFlag = FALSE; - - *hStringHandle = iCounter; - PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; - return; -} - -// Adds string to the current popup box column besides first. !!! String's position is the LAST used position in the 1st column !!! -void AddColumnMonoString( UINT32 *hStringHandle, STR16 pString, UINT8 column ) -{ - STR16 pLocalString = NULL; - POPUPSTRINGPTR pStringSt = NULL; - INT32 iCounter = 0; - - - if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column < 1 || column >= MAX_POPUP_BOX_COLUMNS) - return; - - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - - // find the LAST USED text string index - for ( iCounter = 0; (iCounter + 1 < MAX_POPUP_BOX_STRING_COUNT) && (PopUpBoxList[guiCurrentBox]->Text[0][iCounter + 1] != NULL); iCounter++ ); - - if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) - { - // using too many text lines, or not freeing them up properly - Assert( 0 ); - return; - } - - pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); - if ( pStringSt == NULL ) - return; - - pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); - if ( pLocalString == NULL ) - return; - - wcscpy( pLocalString, pString ); - - RemoveCurrentBoxText( iCounter, column ); - - PopUpBoxList[guiCurrentBox]->Text[column][iCounter] = pStringSt; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fColorFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->pString = pLocalString; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fShadeFlag = FALSE; - PopUpBoxList[guiCurrentBox]->Text[column][iCounter]->fHighLightFlag = FALSE; - - *hStringHandle = iCounter; - return; -} - // Adds a COLORED first column string to the CURRENT box -void AddColorString(INT32 *hStringHandle, STR16 pString) +void AddColorString( INT32 *hStringHandle, STR16 pString, UINT8 column ) { - STR16 pLocalString; - POPUPSTRINGPTR pStringSt=NULL; - INT32 iCounter=0; + STR16 pLocalString; + POPUPSTRINGPTR pStringSt = NULL; + INT32 iCounter = 0; - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); - // find first free slot in list - for( iCounter = 0; ( iCounter < MAX_POPUP_BOX_STRING_COUNT ) && ( PopUpBoxList[guiCurrentBox]->Text[0][iCounter] != NULL ); iCounter++ ); + // find first free slot in list + for ( iCounter = 0; (iCounter < MAX_POPUP_BOX_STRING_COUNT) && (box->Text[column][iCounter] != NULL); iCounter++ ); + + if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) + { + // using too many text lines, or not freeing them up properly + Assert( 0 ); + return; + } + + pStringSt = (POPUPSTRING *)(MemAlloc( sizeof( POPUPSTRING ) )); + if ( pStringSt == NULL ) + return; + + pLocalString = (STR16)MemAlloc( (wcslen( pString ) + 1) * sizeof( CHAR16 ) ); + if ( pLocalString == NULL ) + return; + + wcscpy( pLocalString, pString ); + + RemoveCurrentBoxText( iCounter, column ); + + box->Text[column][iCounter] = pStringSt; + box->Text[column][iCounter]->fColorFlag = TRUE; + box->Text[column][iCounter]->pString = pLocalString; + + *hStringHandle = iCounter; + + box->fUpdated = FALSE; - if ( iCounter >= MAX_POPUP_BOX_STRING_COUNT ) - { - // using too many text lines, or not freeing them up properly - Assert(0); return; - } - - pStringSt=(POPUPSTRING *)(MemAlloc(sizeof(POPUPSTRING))); - if (pStringSt == NULL) - return; - - pLocalString=(STR16)MemAlloc((wcslen(pString)+1)*sizeof(CHAR16)); - if (pLocalString == NULL) - return; - - wcscpy(pLocalString, pString); - - RemoveCurrentBoxPrimaryText( iCounter ); - - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]=pStringSt; - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->fColorFlag=TRUE; - PopUpBoxList[guiCurrentBox]->Text[0][iCounter]->pString=pLocalString; - - *hStringHandle=iCounter; - - PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; - - return; } @@ -637,22 +510,22 @@ void ResizeBoxForSecondStrings( INT32 hBoxHandle ) UINT32 uiBaseWidth, uiThisWidth; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - pBox = ( PopUpBoxList[ hBoxHandle ] ); + pBox = (PopUpBoxList[hBoxHandle]); Assert( pBox ); uiBaseWidth = pBox->uiLeftMargin + pBox->uiSecondColumnMinimunOffset; // check string sizes - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if( pBox->Text[0][ iCounter ] ) + if ( pBox->Text[0][iCounter] ) { - uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[0][ iCounter ]->pString, pBox->Text[0][ iCounter ]->uiFont ); + uiThisWidth = uiBaseWidth + StringPixLength( pBox->Text[0][iCounter]->pString, pBox->Text[0][iCounter]->uiFont ); - if( uiThisWidth > pBox->uiSecondColumnCurrentOffset ) + if ( uiThisWidth > pBox->uiSecondColumnCurrentOffset ) { pBox->uiSecondColumnCurrentOffset = uiThisWidth; } @@ -708,39 +581,18 @@ static void ResizeStrategicMvtBoxForSecondStrings( INT32 hBoxHandle ) } -UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ) +UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle, UINT8 column ) { INT32 iCounter = 0; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return( 0 ); - - // count number of lines - // check string size - for( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if( PopUpBoxList[ hBoxHandle ]->Text[0][ iCounter ] == NULL ) - { - break; - } - } - - return( iCounter ); -} - - -UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle) -{ - INT32 iCounter = 0; - - if ((hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT)) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return(0); // count number of lines // check string size - for (iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if (PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] == NULL) + if ( PopUpBoxList[hBoxHandle]->Text[column][iCounter] == NULL ) { break; } @@ -749,6 +601,7 @@ UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle) return(iCounter); } + UINT32 GetTotalNumberOfLinesOfTextInBox( INT32 hBoxHandle ) { UINT32 lines = 0; @@ -780,17 +633,17 @@ void SetBoxFont( INT32 hBoxHandle, UINT32 uiFont ) if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) { - if ( PopUpBoxList[hBoxHandle]->Text[0][uiCounter] != NULL ) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->uiFont = uiFont; + if ( PopUpBoxList[hBoxHandle]->Text[i][uiCounter] != NULL ) + { + PopUpBoxList[hBoxHandle]->Text[i][uiCounter]->uiFont = uiFont; + } } } - // set up the 2nd column font - SetBoxSecondColumnFont( hBoxHandle, uiFont ); - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; return; @@ -798,7 +651,7 @@ void SetBoxFont( INT32 hBoxHandle, UINT32 uiFont ) void SetBoxSecondColumnMinimumOffset( INT32 hBoxHandle, UINT32 uiWidth ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; PopUpBoxList[hBoxHandle]->uiSecondColumnMinimunOffset = uiWidth; @@ -807,41 +660,13 @@ void SetBoxSecondColumnMinimumOffset( INT32 hBoxHandle, UINT32 uiWidth ) void SetBoxSecondColumnCurrentOffset( INT32 hBoxHandle, UINT32 uiCurrentOffset ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; PopUpBoxList[hBoxHandle]->uiSecondColumnCurrentOffset = uiCurrentOffset; return; } -void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x) -{ - if ((hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT)) - return; - - PopUpBoxList[hBoxHandle]->usSecondColumnOffsetAdjustment = x; - return; -} - -void SetBoxSecondColumnFont( INT32 hBoxHandle, UINT32 uiFont ) -{ - UINT32 iCounter = 0; - - if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) - return; - - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) - { - if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) - { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->uiFont = uiFont; - } - } - - PopUpBoxList[hBoxHandle]->fUpdated = FALSE; - - return; -} void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column ) { @@ -864,27 +689,27 @@ void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column ) UINT32 GetBoxFont( INT32 hBoxHandle ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return( 0 ); + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return(0); - Assert( PopUpBoxList[ hBoxHandle ] ); - Assert( PopUpBoxList[ hBoxHandle ]->Text[0][ 0 ] ); + Assert( PopUpBoxList[hBoxHandle] ); + Assert( PopUpBoxList[hBoxHandle]->Text[0][0] ); // return font id of first line of text of box - return( PopUpBoxList[hBoxHandle]->Text[0][ 0 ]->uiFont ); + return(PopUpBoxList[hBoxHandle]->Text[0][0]->uiFont); } // set the foreground color of this string in this pop up box void SetBoxLineForeground( INT32 iBox, INT32 iStringValue, UINT8 ubColor ) { - if ( ( iBox < 0 ) || ( iBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (iBox < 0) || (iBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ iBox ] ); - Assert( PopUpBoxList[ iBox ]->Text[0][iStringValue] ); + Assert( PopUpBoxList[iBox] ); + Assert( PopUpBoxList[iBox]->Text[0][iStringValue] ); - PopUpBoxList[iBox]->Text[0][iStringValue]->ubForegroundColor=ubColor; + PopUpBoxList[iBox]->Text[0][iStringValue]->ubForegroundColor = ubColor; return; } @@ -892,16 +717,16 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ) { UINT32 uiCounter; - if ( ( iBox < 0 ) || ( iBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (iBox < 0) || (iBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[ iBox ] ); + Assert( PopUpBoxList[iBox] ); for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if (PopUpBoxList[iBox]->Text[0][uiCounter]!=NULL) + if ( PopUpBoxList[iBox]->Text[0][uiCounter] != NULL ) { - PopUpBoxList[iBox]->Text[0][uiCounter]->ubSecondaryShade=ubColor; + PopUpBoxList[iBox]->Text[0][uiCounter]->ubSecondaryShade = ubColor; } } return; @@ -909,30 +734,31 @@ void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ) // The following functions operate on the CURRENT box - -void SetPopUpStringFont(INT32 hStringHandle, UINT32 uiFont) +void SetPopUpStringFont( INT32 hStringHandle, UINT32 uiFont ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->uiFont=uiFont; - return; + box->Text[0][hStringHandle]->uiFont = uiFont; + return; } -void SetPopUpSecondColumnStringFont(INT32 hStringHandle, UINT32 uiFont) +void SetPopUpSecondColumnStringFont( INT32 hStringHandle, UINT32 uiFont ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[1][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->uiFont=uiFont; - return; + box->Text[1][hStringHandle]->uiFont = uiFont; + return; } @@ -942,10 +768,11 @@ void SetStringSecondaryShade( INT32 hStringHandle, UINT8 ubColor ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubSecondaryShade = ubColor; + box->Text[0][hStringHandle]->ubSecondaryShade = ubColor; return; } @@ -954,10 +781,11 @@ void SetStringForeground( INT32 hStringHandle, UINT8 ubColor ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubForegroundColor = ubColor; + box->Text[0][hStringHandle]->ubForegroundColor = ubColor; return; } @@ -966,10 +794,11 @@ void SetStringBackground( INT32 hStringHandle, UINT8 ubColor ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubBackgroundColor = ubColor; + box->Text[0][hStringHandle]->ubBackgroundColor = ubColor; return; } @@ -978,10 +807,11 @@ void SetStringHighLight( INT32 hStringHandle, UINT8 ubColor ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubHighLight = ubColor; + box->Text[0][hStringHandle]->ubHighLight = ubColor; return; } @@ -991,10 +821,11 @@ void SetStringShade( INT32 hStringHandle, UINT8 ubShade ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[0][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->ubShade = ubShade; + box->Text[0][hStringHandle]->ubShade = ubShade; return; } @@ -1003,10 +834,11 @@ void SetStringSecondColumnForeground( INT32 hStringHandle, UINT8 ubColor ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[1][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubForegroundColor = ubColor; + box->Text[1][hStringHandle]->ubForegroundColor = ubColor; return; } @@ -1015,10 +847,11 @@ void SetStringSecondColumnBackground( INT32 hStringHandle, UINT8 ubColor ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[1][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubBackgroundColor = ubColor; + box->Text[1][hStringHandle]->ubBackgroundColor = ubColor; return; } @@ -1027,10 +860,11 @@ void SetStringSecondColumnHighLight( INT32 hStringHandle, UINT8 ubColor ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[1][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubHighLight = ubColor; + box->Text[1][hStringHandle]->ubHighLight = ubColor; return; } @@ -1040,171 +874,95 @@ void SetStringSecondColumnShade( INT32 hStringHandle, UINT8 ubShade ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - Assert( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + Assert( box->Text[1][hStringHandle] ); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->ubShade = ubShade; + box->Text[1][hStringHandle]->ubShade = ubShade; return; } -void SetBoxForeground(INT32 hBoxHandle, UINT8 ubColor) +void SetBoxForeground( INT32 hBoxHandle, UINT8 ubColor ) { UINT32 uiCounter; - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) - { - if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) - { - PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubForegroundColor=ubColor; - } - } - return; -} - -void SetBoxBackground(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 uiCounter; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) - { - if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) - { - PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubBackgroundColor=ubColor; - } - } - return; -} - -void SetBoxHighLight(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 uiCounter; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) - { - if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) - { - PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubHighLight=ubColor; - } - } - return; -} - -void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor) -{ - UINT32 uiCounter; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[hBoxHandle] != NULL ); - - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) - { - if (PopUpBoxList[hBoxHandle]->Text[0][uiCounter]!=NULL) - { - PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubShade=ubColor; - } - } - return; -} - -void SetBoxSecondColumnForeground( INT32 hBoxHandle, UINT8 ubColor ) -{ - UINT32 iCounter = 0; - if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; Assert( PopUpBoxList[hBoxHandle] != NULL ); - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + if ( PopUpBoxList[hBoxHandle]->Text[0][uiCounter] != NULL ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubForegroundColor = ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubForegroundColor = ubColor; } } - return; } -void SetBoxSecondColumnBackground( INT32 hBoxHandle, UINT8 ubColor ) +void SetBoxBackground( INT32 hBoxHandle, UINT8 ubColor ) { - UINT32 iCounter = 0; + UINT32 uiCounter; if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; Assert( PopUpBoxList[hBoxHandle] != NULL ); - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + if ( PopUpBoxList[hBoxHandle]->Text[0][uiCounter] != NULL ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubBackgroundColor = ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubBackgroundColor = ubColor; } } - return; } -void SetBoxSecondColumnHighLight( INT32 hBoxHandle, UINT8 ubColor ) +void SetBoxHighLight( INT32 hBoxHandle, UINT8 ubColor ) { - UINT32 iCounter = 0; + UINT32 uiCounter; if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; Assert( PopUpBoxList[hBoxHandle] != NULL ); - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + if ( PopUpBoxList[hBoxHandle]->Text[0][uiCounter] != NULL ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubHighLight = ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubHighLight = ubColor; } } - return; } -void SetBoxSecondColumnShade( INT32 hBoxHandle, UINT8 ubColor ) +void SetBoxShade( INT32 hBoxHandle, UINT8 ubColor ) { - UINT32 iCounter = 0; + UINT32 uiCounter; if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; Assert( PopUpBoxList[hBoxHandle] != NULL ); - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { - if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter] ) + if ( PopUpBoxList[hBoxHandle]->Text[0][uiCounter] != NULL ) { - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->ubShade = ubColor; + PopUpBoxList[hBoxHandle]->Text[0][uiCounter]->ubShade = ubColor; } } return; } + + void SetBoxColumnForeground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ) { if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) @@ -1293,55 +1051,44 @@ void HighLightLine( INT32 hStringHandle, UINT8 column ) return; } -void HighLight2ndLine( INT32 hStringHandle ) + +BOOLEAN GetShadeFlag( INT32 hStringHandle ) { if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) - return; + return(FALSE); auto box = PopUpBoxList[guiCurrentBox]; Assert( box != NULL ); - if ( !box->pSecondColumnString[hStringHandle] ) - return; - box->pSecondColumnString[hStringHandle]->fHighLightFlag = TRUE; - return; -} - -BOOLEAN GetShadeFlag( INT32 hStringHandle ) -{ - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( !box->Text[0][hStringHandle] ) return(FALSE); - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - - if(!PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]) - return( FALSE ); - - return( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fShadeFlag); + return(box->Text[0][hStringHandle]->fShadeFlag); } BOOLEAN GetSecondaryShadeFlag( INT32 hStringHandle ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return(FALSE); - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); - if(!PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]) - return( FALSE ); + if ( !box->Text[0][hStringHandle] ) + return(FALSE); - return( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fSecondaryShadeFlag ); + return(box->Text[0][hStringHandle]->fSecondaryShadeFlag); } void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; // highlight iLineNumber Line in box indexed by hBoxHandle - if( PopUpBoxList[hBoxHandle]->Text[column][iLineNumber]!=NULL) + if ( PopUpBoxList[hBoxHandle]->Text[column][iLineNumber] != NULL ) { // set current box SetCurrentBox( hBoxHandle ); @@ -1353,122 +1100,103 @@ void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column ) return; } -void HighLight2ndBoxLine( INT32 hBoxHandle, INT32 iLineNumber ) -{ - if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) - return; - - // highlight iLineNumber Line in box indexed by hBoxHandle - if ( PopUpBoxList[hBoxHandle]->pSecondColumnString[iLineNumber] != NULL ) - { - SetCurrentBox( hBoxHandle ); - HighLight2ndLine( iLineNumber ); - } - - return; -} BOOLEAN GetBoxShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return(FALSE); - if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) + if ( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber] != NULL ) { - return( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag ); + return(PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fShadeFlag); } - return( FALSE ); + return(FALSE); } BOOLEAN GetBoxSecondaryShadeFlag( INT32 hBoxHandle, INT32 iLineNumber ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return(FALSE); - if( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]!=NULL) + if ( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber] != NULL ) { - return( PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag ); + return(PopUpBoxList[hBoxHandle]->Text[0][iLineNumber]->fSecondaryShadeFlag); } - return( FALSE ); + return(FALSE); } -void UnHighLightLine( INT32 hStringHandle ) +void UnHighLightLine( INT32 hStringHandle, UINT8 column ) { if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); - if ( !PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] ) + if ( !box->Text[column][hStringHandle] ) return; - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->fHighLightFlag = FALSE; + box->Text[column][hStringHandle]->fHighLightFlag = FALSE; return; } void UnHighLightBox( INT32 hBoxHandle ) { - INT32 iCounter = 0; - if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; auto box = PopUpBoxList[hBoxHandle]; for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) { - for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) + for ( INT32 iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { if ( box->Text[i][iCounter] ) box->Text[i][iCounter]->fHighLightFlag = FALSE; } } +} + +void UnHighLightSecondColumnLine( INT32 hStringHandle ) +{ + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) + return; + + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); + + if ( !box->Text[1][hStringHandle] ) + return; + + box->Text[1][hStringHandle]->fHighLightFlag = FALSE; + return; +} + +void UnHighLightSecondColumnBox( INT32 hBoxHandle ) +{ + INT32 iCounter = 0; + + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) + return; for ( iCounter = 0; iCounter < MAX_POPUP_BOX_STRING_COUNT; iCounter++ ) { - if ( box->pSecondColumnString[iCounter] ) - box->pSecondColumnString[iCounter]->fHighLightFlag = FALSE; + if ( PopUpBoxList[hBoxHandle]->Text[1][iCounter] ) + PopUpBoxList[hBoxHandle]->Text[1][iCounter]->fHighLightFlag = FALSE; } } -void UnHighLightSecondColumnLine(INT32 hStringHandle) +void RemoveOneCurrentBoxString( INT32 hStringHandle, BOOLEAN fFillGaps ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + UINT32 uiCounter = 0; + + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); - - if(!PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]) - return; - - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->fHighLightFlag=FALSE; - return; -} - -void UnHighLightSecondColumnBox(INT32 hBoxHandle) -{ - INT32 iCounter=0; - - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) - return; - - for(iCounter=0; iCounter pSecondColumnString[iCounter]) - PopUpBoxList[hBoxHandle]->pSecondColumnString[iCounter]->fHighLightFlag=FALSE; - } -} - -void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps) -{ - UINT32 uiCounter=0; - - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) - return; - - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); RemoveCurrentBoxPrimaryText( hStringHandle ); @@ -1477,27 +1205,25 @@ void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps) if ( fFillGaps ) { // shuffle all strings down a slot to fill in the gap - for ( uiCounter = hStringHandle; uiCounter < ( MAX_POPUP_BOX_STRING_COUNT - 1 ); uiCounter++ ) + for ( uiCounter = hStringHandle; uiCounter < (MAX_POPUP_BOX_STRING_COUNT - 1); uiCounter++ ) { - PopUpBoxList[guiCurrentBox]->Text[0][uiCounter]=PopUpBoxList[guiCurrentBox]->Text[0][uiCounter+1]; - PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter]=PopUpBoxList[guiCurrentBox]->pSecondColumnString[uiCounter+1]; + box->Text[0][uiCounter] = box->Text[0][uiCounter + 1]; + box->Text[1][uiCounter] = box->Text[1][uiCounter + 1]; } } - PopUpBoxList[guiCurrentBox]->fUpdated = FALSE; + box->fUpdated = FALSE; } void RemoveAllCurrentBoxStrings( void ) { - UINT32 uiCounter; - if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || !PopUpBoxList[guiCurrentBox] ) return; for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) { - for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) + for ( UINT32 uiCounter = 0; uiCounter < MAX_POPUP_BOX_STRING_COUNT; uiCounter++ ) { RemoveCurrentBoxText( uiCounter, i ); } @@ -1529,14 +1255,14 @@ void RemoveBox( INT32 hBoxHandle ) -void ShowBox(INT32 hBoxHandle) +void ShowBox( INT32 hBoxHandle ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - if( PopUpBoxList[hBoxHandle] != NULL ) + if ( PopUpBoxList[hBoxHandle] != NULL ) { - if( PopUpBoxList[hBoxHandle]->fShowBox == FALSE ) + if ( PopUpBoxList[hBoxHandle]->fShowBox == FALSE ) { PopUpBoxList[hBoxHandle]->fShowBox = TRUE; PopUpBoxList[hBoxHandle]->fUpdated = FALSE; @@ -1544,14 +1270,14 @@ void ShowBox(INT32 hBoxHandle) } } -void HideBox(INT32 hBoxHandle) +void HideBox( INT32 hBoxHandle ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; - if( PopUpBoxList[hBoxHandle] != NULL ) + if ( PopUpBoxList[hBoxHandle] != NULL ) { - if( PopUpBoxList[hBoxHandle]->fShowBox == TRUE ) + if ( PopUpBoxList[hBoxHandle]->fShowBox == TRUE ) { PopUpBoxList[hBoxHandle]->fShowBox = FALSE; PopUpBoxList[hBoxHandle]->fUpdated = FALSE; @@ -1561,27 +1287,27 @@ void HideBox(INT32 hBoxHandle) -void SetCurrentBox(INT32 hBoxHandle) +void SetCurrentBox( INT32 hBoxHandle ) { - if ( ( hBoxHandle < 0 ) || ( hBoxHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) return; guiCurrentBox = hBoxHandle; } -void GetCurrentBox(INT32 *hBoxHandle) +void GetCurrentBox( INT32 *hBoxHandle ) { *hBoxHandle = guiCurrentBox; } -void DisplayBoxes(UINT32 uiBuffer) +void DisplayBoxes( UINT32 uiBuffer ) { UINT32 uiCounter; - for( uiCounter=0; uiCounter < MAX_POPUP_BOX_COUNT; uiCounter++ ) + for ( uiCounter = 0; uiCounter < MAX_POPUP_BOX_COUNT; uiCounter++ ) { DisplayOnePopupBox( uiCounter, uiBuffer ); } @@ -1609,75 +1335,75 @@ void DisplayOnePopupBox( UINT32 uiIndex, UINT32 uiBuffer ) // force an update of this box void ForceUpDateOfBox( UINT32 uiIndex ) { - if ( ( uiIndex < 0 ) || ( uiIndex >= MAX_POPUP_BOX_COUNT ) ) + if ( (uiIndex < 0) || (uiIndex >= MAX_POPUP_BOX_COUNT) ) return; - if( PopUpBoxList[ uiIndex ] != NULL ) + if ( PopUpBoxList[uiIndex] != NULL ) { - PopUpBoxList[ uiIndex ]->fUpdated = FALSE; + PopUpBoxList[uiIndex]->fUpdated = FALSE; } } -BOOLEAN DrawBox(UINT32 uiCounter) +BOOLEAN DrawBox( UINT32 uiCounter ) { // will build pop up box in usTopX, usTopY with dimensions usWidth and usHeight UINT32 uiNumTilesWide; UINT32 uiNumTilesHigh; - UINT32 uiCount=0; + UINT32 uiCount = 0; HVOBJECT hBoxHandle; HVSURFACE hSrcVSurface; UINT32 uiDestPitchBYTES; UINT32 uiSrcPitchBYTES; - UINT16 *pDestBuf; - UINT8 *pSrcBuf; + UINT16 *pDestBuf; + UINT8 *pSrcBuf; SGPRect clip; UINT16 usTopX, usTopY; UINT16 usWidth, usHeight; - if ( ( uiCounter < 0 ) || ( uiCounter >= MAX_POPUP_BOX_COUNT ) ) + if ( (uiCounter < 0) || (uiCounter >= MAX_POPUP_BOX_COUNT) ) return(FALSE); - - Assert( PopUpBoxList[uiCounter] != NULL ); + auto box = PopUpBoxList[uiCounter]; + Assert( box != NULL ); // only update if we need to - if( PopUpBoxList[uiCounter]->fUpdated == TRUE ) + if ( box->fUpdated == TRUE ) { - return( FALSE ); + return(FALSE); } - PopUpBoxList[uiCounter]->fUpdated = TRUE; + box->fUpdated = TRUE; - if( PopUpBoxList[uiCounter]->uiFlags & POPUP_BOX_FLAG_RESIZE ) + if ( box->uiFlags & POPUP_BOX_FLAG_RESIZE ) { - ResizeBoxToText(uiCounter); + ResizeBoxToText( uiCounter ); } - usTopX=(UINT16)PopUpBoxList[uiCounter]->Position.iX; - usTopY=(UINT16)PopUpBoxList[uiCounter]->Position.iY; - usWidth = ((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iRight - PopUpBoxList[uiCounter]->Dimensions.iLeft + PopUpBoxList[uiCounter]->usSecondColumnOffsetAdjustment)); - usHeight=((UINT16)(PopUpBoxList[uiCounter]->Dimensions.iBottom-PopUpBoxList[uiCounter]->Dimensions.iTop)); + usTopX = (UINT16)box->Position.iX; + usTopY = (UINT16)box->Position.iY; + usWidth = ((UINT16)(box->Dimensions.iRight - box->Dimensions.iLeft)); + usHeight = ((UINT16)(box->Dimensions.iBottom - box->Dimensions.iTop)); //CHRISL: Adjust position for screen limits - if((usTopX + usWidth) > SCREEN_WIDTH && usTopX > ((usTopX + usWidth) - SCREEN_WIDTH)) + if ( (usTopX + usWidth) > SCREEN_WIDTH && usTopX > ((usTopX + usWidth) - SCREEN_WIDTH) ) { usTopX -= ((usTopX + usWidth) - SCREEN_WIDTH); - PopUpBoxList[uiCounter]->Position.iX -= (PopUpBoxList[uiCounter]->Position.iX - usTopX); + box->Position.iX -= (box->Position.iX - usTopX); } - if((usTopY + usHeight) > SCREEN_HEIGHT && usTopY > ((usTopY + usHeight) - SCREEN_HEIGHT)) + if ( (usTopY + usHeight) > SCREEN_HEIGHT && usTopY > ((usTopY + usHeight) - SCREEN_HEIGHT) ) { usTopY -= ((usTopY + usHeight) - SCREEN_HEIGHT); - PopUpBoxList[uiCounter]->Position.iY -= (PopUpBoxList[uiCounter]->Position.iY - usTopY); + box->Position.iY -= (box->Position.iY - usTopY); } // check if we have a min width, if so then update box for such - if( ( PopUpBoxList[uiCounter]->uiBoxMinWidth ) && ( usWidth < PopUpBoxList[uiCounter]->uiBoxMinWidth ) ) + if ( (box->uiBoxMinWidth) && (usWidth < box->uiBoxMinWidth) ) { - usWidth = ( INT16 )( PopUpBoxList[uiCounter]->uiBoxMinWidth ); + usWidth = (INT16)(box->uiBoxMinWidth); } // make sure it will fit on screen! @@ -1685,56 +1411,56 @@ BOOLEAN DrawBox(UINT32 uiCounter) Assert( usTopY + usHeight <= SCREEN_HEIGHT ); // subtract 4 because the 2 2-pixel corners are handled separately - uiNumTilesWide=((usWidth-4)/BORDER_WIDTH); - uiNumTilesHigh=((usHeight-4)/BORDER_HEIGHT); + uiNumTilesWide = ((usWidth - 4) / BORDER_WIDTH); + uiNumTilesHigh = ((usHeight - 4) / BORDER_HEIGHT); - clip.iLeft=0; - clip.iRight=clip.iLeft+usWidth; - clip.iTop=0; - clip.iBottom=clip.iTop+usHeight; + clip.iLeft = 0; + clip.iRight = clip.iLeft + usWidth; + clip.iTop = 0; + clip.iBottom = clip.iTop + usHeight; // blit in texture first, then borders // blit in surface - pDestBuf = (UINT16*)LockVideoSurface(PopUpBoxList[uiCounter]->uiBuffer, &uiDestPitchBYTES); - CHECKF( GetVideoSurface( &hSrcVSurface, PopUpBoxList[uiCounter]->iBackGroundSurface) ); - pSrcBuf = LockVideoSurface( PopUpBoxList[uiCounter]->iBackGroundSurface, &uiSrcPitchBYTES); - Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf,uiSrcPitchBYTES,usTopX,usTopY, &clip); - UnLockVideoSurface( PopUpBoxList[uiCounter]->iBackGroundSurface); - UnLockVideoSurface(PopUpBoxList[uiCounter]->uiBuffer); - GetVideoObject(&hBoxHandle, PopUpBoxList[uiCounter]->iBorderObjectIndex); + pDestBuf = (UINT16 *)LockVideoSurface( box->uiBuffer, &uiDestPitchBYTES ); + CHECKF( GetVideoSurface( &hSrcVSurface, box->iBackGroundSurface ) ); + pSrcBuf = LockVideoSurface( box->iBackGroundSurface, &uiSrcPitchBYTES ); + Blt8BPPDataSubTo16BPPBuffer( pDestBuf, uiDestPitchBYTES, hSrcVSurface, pSrcBuf, uiSrcPitchBYTES, usTopX, usTopY, &clip ); + UnLockVideoSurface( box->iBackGroundSurface ); + UnLockVideoSurface( box->uiBuffer ); + GetVideoObject( &hBoxHandle, box->iBorderObjectIndex ); // blit in 4 corners (they're 2x2 pixels) - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_LEFT_CORNER,usTopX,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_RIGHT_CORNER,usTopX+usWidth-2,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_RIGHT_CORNER,usTopX+usWidth-2,usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_LEFT_CORNER,usTopX,usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, TOP_LEFT_CORNER, usTopX, usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, TOP_RIGHT_CORNER, usTopX + usWidth - 2, usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, BOTTOM_RIGHT_CORNER, usTopX + usWidth - 2, usTopY + usHeight - 2, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, BOTTOM_LEFT_CORNER, usTopX, usTopY + usHeight - 2, VO_BLT_SRCTRANSPARENCY, NULL ); // blit in edges - if (uiNumTilesWide > 0) + if ( uiNumTilesWide > 0 ) { // full pieces - for (uiCount=0; uiCount uiBuffer, hBoxHandle, TOP_EDGE, usTopX+2+(uiCount*BORDER_WIDTH),usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_EDGE,usTopX+2+(uiCount*BORDER_WIDTH),usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, TOP_EDGE, usTopX + 2 + (uiCount * BORDER_WIDTH), usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, BOTTOM_EDGE, usTopX + 2 + (uiCount * BORDER_WIDTH), usTopY + usHeight - 2, VO_BLT_SRCTRANSPARENCY, NULL ); } // partial pieces - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, TOP_EDGE, usTopX+usWidth-2-BORDER_WIDTH,usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, BOTTOM_EDGE,usTopX+usWidth-2-BORDER_WIDTH,usTopY+usHeight-2, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, TOP_EDGE, usTopX + usWidth - 2 - BORDER_WIDTH, usTopY, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, BOTTOM_EDGE, usTopX + usWidth - 2 - BORDER_WIDTH, usTopY + usHeight - 2, VO_BLT_SRCTRANSPARENCY, NULL ); } - if (uiNumTilesHigh > 0) + if ( uiNumTilesHigh > 0 ) { // full pieces - for (uiCount=0; uiCount uiBuffer, hBoxHandle, SIDE_EDGE,usTopX, usTopY+2+(uiCount*BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX+usWidth-2,usTopY+2+(uiCount*BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, SIDE_EDGE, usTopX, usTopY + 2 + (uiCount * BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, SIDE_EDGE, usTopX + usWidth - 2, usTopY + 2 + (uiCount * BORDER_HEIGHT), VO_BLT_SRCTRANSPARENCY, NULL ); } // partial pieces - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX, usTopY+usHeight-2-BORDER_HEIGHT, VO_BLT_SRCTRANSPARENCY, NULL ); - BltVideoObject(PopUpBoxList[uiCounter]->uiBuffer, hBoxHandle, SIDE_EDGE,usTopX+usWidth-2,usTopY+usHeight-2-BORDER_HEIGHT, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, SIDE_EDGE, usTopX, usTopY + usHeight - 2 - BORDER_HEIGHT, VO_BLT_SRCTRANSPARENCY, NULL ); + BltVideoObject( box->uiBuffer, hBoxHandle, SIDE_EDGE, usTopX + usWidth - 2, usTopY + usHeight - 2 - BORDER_HEIGHT, VO_BLT_SRCTRANSPARENCY, NULL ); } InvalidateRegion( usTopX, usTopY, usTopX + usWidth, usTopY + usHeight ); @@ -1753,9 +1479,9 @@ BOOLEAN DrawBoxText( UINT32 uiCounter ) if ( (uiCounter < 0) || (uiCounter >= MAX_POPUP_BOX_COUNT) ) return(FALSE); - Assert( PopUpBoxList[uiCounter] != NULL ); - auto box = PopUpBoxList[uiCounter]; + Assert( box != NULL ); + //clip text? if ( box->uiFlags & POPUP_BOX_FLAG_CLIP_TEXT ) { @@ -1768,7 +1494,6 @@ BOOLEAN DrawBoxText( UINT32 uiCounter ) for ( size_t i = 0; i < MAX_POPUP_BOX_COLUMNS; i++ ) { - for ( uiCount = 0; uiCount < MAX_POPUP_BOX_STRING_COUNT; uiCount++ ) { auto entry = box->Text[i][uiCount]; @@ -1816,7 +1541,7 @@ BOOLEAN DrawBoxText( UINT32 uiCounter ) } else { - uX = box->Position.iX + box->uiLeftMargin + box->uiSecondColumnCurrentOffset*i; + uX = box->Position.iX + box->uiLeftMargin + box->uiSecondColumnCurrentOffset * i; uY = ((INT16)(box->Position.iY + uiCount * GetFontHeight( entry->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)); } @@ -1826,53 +1551,6 @@ BOOLEAN DrawBoxText( UINT32 uiCounter ) } } - for ( uiCount = 0; uiCount < MAX_POPUP_BOX_STRING_COUNT; uiCount++ ) - { - // there is secondary text in this line? - if ( box->pSecondColumnString[uiCount] ) - { - // set font - SetFont( box->pSecondColumnString[uiCount]->uiFont ); - - // are we highlighting?...shading?..or neither - if ( (box->pSecondColumnString[uiCount]->fHighLightFlag == FALSE) && (box->pSecondColumnString[uiCount]->fShadeFlag == FALSE) ) - { - // neither - SetFontForeground( box->pSecondColumnString[uiCount]->ubForegroundColor ); - } - else if ( (box->pSecondColumnString[uiCount]->fHighLightFlag == TRUE) ) - { - // highlight - SetFontForeground( box->pSecondColumnString[uiCount]->ubHighLight ); - } - else - { - //shading - SetFontForeground( box->pSecondColumnString[uiCount]->ubShade ); - } - - // set background - SetFontBackground( box->pSecondColumnString[uiCount]->ubBackgroundColor ); - - // copy string - wcsncpy( sString, box->pSecondColumnString[uiCount]->pString, wcslen( box->pSecondColumnString[uiCount]->pString ) + 1 ); - - // centering? - if ( box->uiFlags & POPUP_BOX_FLAG_CENTER_TEXT ) - { - FindFontCenterCoordinates( ((INT16)(box->Position.iX + box->uiLeftMargin)), ((INT16)(box->Position.iY + uiCount * GetFontHeight( box->pSecondColumnString[uiCount]->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)), ((INT16)(box->Dimensions.iRight - (box->uiRightMargin + box->uiLeftMargin + 2))), ((INT16)GetFontHeight( box->pSecondColumnString[uiCount]->uiFont )), (sString), ((INT32)box->pSecondColumnString[uiCount]->uiFont), &uX, &uY ); - } - else - { - uX = ((INT16)(box->Position.iX + box->uiLeftMargin + box->uiSecondColumnCurrentOffset + box->usSecondColumnOffsetAdjustment)); - uY = ((INT16)(box->Position.iY + uiCount * GetFontHeight( box->pSecondColumnString[uiCount]->uiFont ) + box->uiTopMargin + uiCount * box->uiLineSpace)); - } - - // print - mprintf( uX, uY, box->pSecondColumnString[uiCount]->pString ); - } - } - if ( box->uiBuffer != guiSAVEBUFFER ) { @@ -1892,7 +1570,7 @@ void ResizeBoxToText( INT32 hBoxHandle ) INT32 iWidth = 0; INT32 iHeight = 0; INT32 iCurrString = 0; - INT32 iSecondColumnLength = 0; + INT32 iColumnLength = 0; if ( (hBoxHandle < 0) || (hBoxHandle >= MAX_POPUP_BOX_COUNT) ) @@ -1912,49 +1590,40 @@ void ResizeBoxToText( INT32 hBoxHandle ) auto box = PopUpBoxList[hBoxHandle]; const UINT32 margins = box->uiLeftMargin + box->uiRightMargin; - iHeight = box->uiTopMargin + box->uiBottomMargin; + const auto columnOffset = box->uiSecondColumnCurrentOffset; for ( iCurrString = 0; iCurrString < MAX_POPUP_BOX_STRING_COUNT; iCurrString++ ) { if ( box->Text[0][iCurrString] != NULL ) { - if ( box->Text[3][iCurrString] != NULL && wcscmp( box->Text[3][iCurrString]->pString, L"") != 0) + if ( box->Text[3][iCurrString] != NULL && wcscmp( box->Text[3][iCurrString]->pString, L"" ) != 0 ) { - iSecondColumnLength = StringPixLength( box->Text[3][iCurrString]->pString, box->Text[3][iCurrString]->uiFont ); - if ( 3*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + iColumnLength = StringPixLength( box->Text[3][iCurrString]->pString, box->Text[3][iCurrString]->uiFont ); + if ( 3 * columnOffset + iColumnLength + margins > iWidth ) { - iWidth = 3*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + iWidth = 3 * columnOffset + iColumnLength + margins; } } else if ( box->Text[2][iCurrString] != NULL && wcscmp( box->Text[2][iCurrString]->pString, L"" ) != 0 ) { - iSecondColumnLength = StringPixLength( box->Text[2][iCurrString]->pString, box->Text[2][iCurrString]->uiFont ); - if ( 2*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + iColumnLength = StringPixLength( box->Text[2][iCurrString]->pString, box->Text[2][iCurrString]->uiFont ); + if ( 2 * columnOffset + iColumnLength + margins > iWidth ) { - iWidth = 2*box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + iWidth = 2 * columnOffset + iColumnLength + margins; } } else if ( box->Text[1][iCurrString] != NULL && wcscmp( box->Text[1][iCurrString]->pString, L"" ) != 0 ) { - iSecondColumnLength = StringPixLength( box->Text[1][iCurrString]->pString, box->Text[1][iCurrString]->uiFont ); - if ( box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) + iColumnLength = StringPixLength( box->Text[1][iCurrString]->pString, box->Text[1][iCurrString]->uiFont ); + if ( columnOffset + iColumnLength + margins > iWidth ) { - iWidth = box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; + iWidth = columnOffset + iColumnLength + margins; } } - if ( box->pSecondColumnString[iCurrString] != NULL ) - { - iSecondColumnLength = StringPixLength( box->pSecondColumnString[iCurrString]->pString, box->pSecondColumnString[iCurrString]->uiFont ); - if ( box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins > iWidth ) - { - iWidth = box->uiSecondColumnCurrentOffset + iSecondColumnLength + margins; - } - } - INT32 iFirstColumnLength = StringPixLength( box->Text[0][iCurrString]->pString, box->Text[0][iCurrString]->uiFont ) + margins; if ( iFirstColumnLength > iWidth ) iWidth = iFirstColumnLength; @@ -1984,15 +1653,15 @@ void ResizeBoxToText( INT32 hBoxHandle ) BOOLEAN IsBoxShown( UINT32 uiHandle ) { - if ( ( uiHandle < 0 ) || ( uiHandle >= MAX_POPUP_BOX_COUNT ) ) + if ( (uiHandle < 0) || (uiHandle >= MAX_POPUP_BOX_COUNT) ) return(FALSE); - if( PopUpBoxList[ uiHandle ] == NULL ) + if ( PopUpBoxList[uiHandle] == NULL ) { - return ( FALSE ); + return (FALSE); } - return( PopUpBoxList[ uiHandle ]->fShowBox ); + return(PopUpBoxList[uiHandle]->fShowBox); } @@ -2001,7 +1670,7 @@ void MarkAllBoxesAsAltered( void ) INT32 iCounter = 0; // mark all boxes as altered - for( iCounter = 0; iCounter < MAX_POPUP_BOX_COUNT; iCounter++ ) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_COUNT; iCounter++ ) { ForceUpDateOfBox( iCounter ); } @@ -2015,7 +1684,7 @@ void HideAllBoxes( void ) INT32 iCounter = 0; // hide all the boxes that are shown - for(iCounter=0; iCounter < MAX_POPUP_BOX_COUNT; iCounter++) + for ( iCounter = 0; iCounter < MAX_POPUP_BOX_COUNT; iCounter++ ) { HideBox( iCounter ); } @@ -2024,43 +1693,45 @@ void HideAllBoxes( void ) void RemoveCurrentBoxPrimaryText( INT32 hStringHandle ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); // remove & release primary text - if(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle] != NULL) + if ( box->Text[0][hStringHandle] != NULL ) { - if ( PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->pString ) + if ( box->Text[0][hStringHandle]->pString ) { - MemFree(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]->pString); + MemFree( box->Text[0][hStringHandle]->pString ); } - MemFree(PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]); - PopUpBoxList[guiCurrentBox]->Text[0][hStringHandle]=NULL; + MemFree( box->Text[0][hStringHandle] ); + box->Text[0][hStringHandle] = NULL; } } void RemoveCurrentBoxSecondaryText( INT32 hStringHandle ) { - if ( ( guiCurrentBox < 0 ) || ( guiCurrentBox >= MAX_POPUP_BOX_COUNT ) ) + if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); // remove & release secondary strings - if(PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle] != NULL) + if ( box->Text[1][hStringHandle] != NULL ) { - if ( PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->pString ) + if ( box->Text[1][hStringHandle]->pString ) { - MemFree(PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]->pString); + MemFree( box->Text[1][hStringHandle]->pString ); } - MemFree(PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]); - PopUpBoxList[guiCurrentBox]->pSecondColumnString[hStringHandle]=NULL; + MemFree( box->Text[1][hStringHandle] ); + box->Text[1][hStringHandle] = NULL; } } @@ -2069,11 +1740,12 @@ void RemoveCurrentBoxText( INT32 hStringHandle, UINT8 column ) if ( (guiCurrentBox < 0) || (guiCurrentBox >= MAX_POPUP_BOX_COUNT) || column >= MAX_POPUP_BOX_COLUMNS ) return; - Assert( PopUpBoxList[guiCurrentBox] != NULL ); + auto box = PopUpBoxList[guiCurrentBox]; + Assert( box != NULL ); Assert( hStringHandle < MAX_POPUP_BOX_STRING_COUNT ); // remove & release text - auto textColumn = PopUpBoxList[guiCurrentBox]->Text[column]; + auto textColumn = box->Text[column]; if ( textColumn[hStringHandle] != NULL ) { diff --git a/Utils/PopUpBox.h b/Utils/PopUpBox.h index a140b179..f1b4ded7 100644 --- a/Utils/PopUpBox.h +++ b/Utils/PopUpBox.h @@ -47,14 +47,11 @@ struct popupbox{ UINT32 uiBuffer; UINT32 uiSecondColumnMinimunOffset; UINT32 uiSecondColumnCurrentOffset; - INT16 usSecondColumnOffsetAdjustment; UINT32 uiBoxMinWidth; BOOLEAN fUpdated; BOOLEAN fShowBox; POPUPSTRINGPTR Text[MAX_POPUP_BOX_COLUMNS][ MAX_POPUP_BOX_STRING_COUNT ]; - // TODO Remove pSecondColumnString - POPUPSTRINGPTR pSecondColumnString[ MAX_POPUP_BOX_STRING_COUNT ]; }; typedef struct popupbox PopUpBo; @@ -76,8 +73,7 @@ UINT32 GetLineSpace( INT32 hBoxHandle ); void SetBoxBuffer(INT32 hBoxHandle, UINT32 uiBuffer); void SetBoxPosition(INT32 hBoxHandle,SGPPoint Position); void GetBoxPosition( INT32 hBoxHandle, SGPPoint *Position ); -UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle ); -UINT32 GetNumberOfSecondaryLinesOfTextInBox(INT32 hBoxHandle); +UINT32 GetNumberOfLinesOfTextInBox( INT32 hBoxHandle, UINT8 column = 0 ); UINT32 GetTotalNumberOfLinesOfTextInBox( INT32 hBoxHandle ); UINT32 GetBoxSecondColumnCurrentOffset( INT32 hBoxHandle ); void SetBoxSize( INT32 hBoxHandle, SGPRect Dimensions ); @@ -85,8 +81,8 @@ void GetBoxSize( INT32 hBoxHandle, SGPRect *Dimensions ); void SetBoxFlags( INT32 hBoxHandle, UINT32 uiFlags); void SetBorderType(INT32 hBoxHandle,INT32 BorderObjectIndex); void SetBackGroundSurface(INT32 hBoxHandle, INT32 BackGroundSurfaceIndex); -void AddMonoString(UINT32 *hStringHandle, STR16 pString); -void AddColorString(INT32 *hStringHandle, STR16 pString); +void AddMonoString(UINT32 *hStringHandle, STR16 pString, UINT8 column = 0); +void AddColorString(INT32 *hStringHandle, STR16 pString, UINT8 column = 0); void SetPopUpStringFont(INT32 hStringHandle, UINT32 uiFont); void SetBoxFont(INT32 hBoxHandle, UINT32 uiFont); UINT32 GetBoxFont( INT32 hBoxHandle ); @@ -98,13 +94,11 @@ void SetBoxForeground(INT32 hBoxHandle, UINT8 ubColor); void SetBoxBackground(INT32 hBoxHandle, UINT8 ubColor); void SetBoxHighLight(INT32 hBoxHandle, UINT8 ubColor); void SetBoxShade(INT32 hBoxHandle, UINT8 ubColor); -void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); -void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); -void HighLightLine( INT32 hStringHandle, UINT8 column ); -void HighLight2ndLine( INT32 hStringHandle ); +void ShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column = 0 ); +void UnShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column = 0 ); +void HighLightLine( INT32 hStringHandle, UINT8 column = 0 ); void HighLightBoxLine( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column = 0 ); -void HighLight2ndBoxLine( INT32 hBoxHandle, INT32 iLineNumber ); -void UnHighLightLine(INT32 hStringHandle); +void UnHighLightLine(INT32 hStringHandle, UINT8 column = 0); void UnHighLightBox(INT32 hBoxHandle); void RemoveOneCurrentBoxString(INT32 hStringHandle, BOOLEAN fFillGaps); void RemoveAllCurrentBoxStrings( void ); @@ -116,9 +110,6 @@ void DisplayOnePopupBox( UINT32 uiIndex, UINT32 uiBuffer ); void SetCurrentBox(INT32 hBoxHandle); void GetCurrentBox(INT32 *hBoxHandle); -void AddStringToBoxColumn( UINT32 *hStringHandle, STR16 pString, UINT8 column ); -void AddColumnMonoString( UINT32 *hStringHandle, STR16 pString, UINT8 column ); - // resize this box to the text it contains void ResizeBoxToText(INT32 hBoxHandle); @@ -147,10 +138,6 @@ void HideAllBoxes( void ); // add the second column monocrome string void AddSecondColumnMonoString( UINT32 *hStringHandle, STR16 pString ); -void AddMonoStringToSecondColumn(UINT32* hStringHandle, STR16 pString); - -// set the 2nd column font for this box -void SetBoxSecondColumnFont(INT32 hBoxHandle, UINT32 uiFont); // set the minimum offset void SetBoxSecondColumnMinimumOffset( INT32 hBoxHandle, UINT32 uiWidth ); @@ -164,24 +151,17 @@ void SetStringSecondColumnHighLight(INT32 hStringHandle, UINT8 ubColor); void SetStringSecondColumnShade(INT32 hStringHandle, UINT8 ubShade); // now on a box wide basis, one if recomened to use this function after adding all the strings..rather than on an individual basis -void SetBoxSecondColumnForeground(INT32 hBoxHandle, UINT8 ubColor); -void SetBoxSecondColumnBackground(INT32 hBoxHandle, UINT8 ubColor); -void SetBoxSecondColumnHighLight(INT32 hBoxHandle, UINT8 ubColor); -void SetBoxSecondColumnShade(INT32 hBoxHandle, UINT8 ubColor); -// Manual adjustment for 2nd column offset, eg. when 1st column has a title text that's wider than the rest and you want to move 2nd column texts towards the 1st column some. -void SetBoxSecondColumnOffsetAdjustment(INT32 hBoxHandle, INT16 x); - // Set attributes by column -void SetBoxColumnForeground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); -void SetBoxColumnBackground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); -void SetBoxColumnHighLight( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); -void SetBoxColumnShade( INT32 hBoxHandle, UINT8 ubColor, UINT8 column ); -void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column ); +void SetBoxColumnForeground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column = 0 ); +void SetBoxColumnBackground( INT32 hBoxHandle, UINT8 ubColor, UINT8 column = 0 ); +void SetBoxColumnHighLight( INT32 hBoxHandle, UINT8 ubColor, UINT8 column = 0 ); +void SetBoxColumnShade( INT32 hBoxHandle, UINT8 ubColor, UINT8 column = 0 ); +void SetBoxColumnFont( INT32 hBoxHandle, UINT32 uiFont, UINT8 column = 0 ); // secondary shades for boxes -void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); -void SecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber ); +void UnSecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column = 0 ); +void SecondaryShadeStringInBox( INT32 hBoxHandle, INT32 iLineNumber, UINT8 column = 0 ); void SetBoxSecondaryShade( INT32 iBox, UINT8 ubColor ); From c2e78d04616fa2897b065dec20cb03fcc1e976c4 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 01:10:33 +0300 Subject: [PATCH 292/571] Use correct macro to index StrategicMap --- Tactical/Merc Hiring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index 24e98b63..a86aca68 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -1043,7 +1043,7 @@ void UpdateJerryMiloInInitialSector() //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; - StrategicMap[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; + StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; if ( gGameUBOptions.InGameHeli == TRUE ) return; //AA @@ -1071,7 +1071,7 @@ if ( gGameUBOptions.InGameHeliCrash == TRUE ) //Record the initial sector as ours //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; - StrategicMap[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; + StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; if ( gGameUBOptions.InJerry == TRUE ) { From 8f98a9b9850f1eb8e438de2e069f6590a6fd465f Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 01:11:37 +0300 Subject: [PATCH 293/571] Move UpdateAirspaceControl() out of #ifdef Fixes UB not updating samsite airspace correctly after battle --- Strategic/Player Command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index efa91292..51fd7d7d 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -342,8 +342,8 @@ BOOLEAN SetThisSectorAsPlayerControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, B // Ja25: no loyalty #else HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_GAIN_SAM, sMapX, sMapY, bMapZ ); - UpdateAirspaceControl( ); #endif + UpdateAirspaceControl( ); // if Skyrider has been delivered to chopper, and already mentioned Drassen SAM site, but not used this quote yet if ( IsHelicopterPilotAvailable( ) && ( guiHelicopterSkyriderTalkState >= 1 ) && ( !gfSkyriderSaidCongratsOnTakingSAM ) ) { From 92103e36a6bb9b7b2313ab1f0ebe8e602b3c186a Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 01:12:56 +0300 Subject: [PATCH 294/571] Fix formatting --- Tactical/Merc Hiring.cpp | 124 +++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index a86aca68..b193f2e6 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -1036,78 +1036,78 @@ if ( gGameUBOptions.InGameHeliCrash == TRUE ) void UpdateJerryMiloInInitialSector() { - SOLDIERTYPE *pSoldier = NULL; - SOLDIERTYPE *pJerrySoldier=NULL; + SOLDIERTYPE *pSoldier = NULL; + SOLDIERTYPE *pJerrySoldier = NULL; - - //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; - SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; - //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; - StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; - -if ( gGameUBOptions.InGameHeli == TRUE ) - return; //AA -if ( gGameUBOptions.InGameHeliCrash == TRUE ) - { - //if it is the first sector we are loading up, place Jerry in the map - if( !gfFirstTimeInGameHeliCrash ) - return; - - if ( gGameUBOptions.InJerry == TRUE ) - { - pSoldier = FindSoldierByProfileID( JERRY_MILO_UB, FALSE ); //JERRY - if( pSoldier == NULL ) - { - Assert( 0 ); - } - - } - - //the internet part of the laptop isnt working. It gets broken in the heli crash. - if ( gGameUBOptions.LaptopQuestEnabled == TRUE ) - StartQuest( QUEST_FIX_LAPTOP, -1, -1 ); - - //Record the initial sector as ours //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; - SectorInfo[ (UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fSurfaceWasEverPlayerControlled = TRUE; - StrategicMap[ (UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY ) ].fEnemyControlled = FALSE; - - if ( gGameUBOptions.InJerry == TRUE ) + SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; + //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; + StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; + + if ( gGameUBOptions.InGameHeli == TRUE ) + return; //AA + + if ( gGameUBOptions.InGameHeliCrash == TRUE ) { - //Set some variable so Jerry will be on the ground - pSoldier->fWaitingToGetupFromJA25Start = TRUE; - pSoldier->fIgnoreGetupFromCollapseCheck = TRUE; + //if it is the first sector we are loading up, place Jerry in the map + if ( !gfFirstTimeInGameHeliCrash ) + return; - //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; //to by³o wy³¹czone - //pSoldier->usStrategicInsertionData = GetInitialHeliGridNo( ); //to by³o wy³¹czone + if ( gGameUBOptions.InJerry == TRUE ) + { + pSoldier = FindSoldierByProfileID( JERRY_MILO_UB, FALSE ); //JERRY + if ( pSoldier == NULL ) + { + Assert( 0 ); + } - RESETTIMECOUNTER( pSoldier->GetupFromJA25StartCounter, gsInitialHeliRandomTimes[ 6 ] + 800 + Random( 400 ) ); + } - //should we be on our back or tummy - if( Random( 100 ) < 50 ) - pSoldier->EVENT_InitNewSoldierAnim( STAND_FALLFORWARD_STOP, 1, TRUE ); - else - pSoldier->EVENT_InitNewSoldierAnim( FALLBACKHIT_STOP, 1, TRUE ); - } + //the internet part of the laptop isnt working. It gets broken in the heli crash. + if ( gGameUBOptions.LaptopQuestEnabled == TRUE ) + StartQuest( QUEST_FIX_LAPTOP, -1, -1 ); -//Wont work cause it gets reset every frame - //make sure we can see Jerry - - if ( gGameUBOptions.InJerry == TRUE ) - { - pJerrySoldier = FindSoldierByProfileID(JERRY_MILO_UB, FALSE );//JERRY - if( pJerrySoldier != NULL ) - { - //Make sure we can see the pilot - gbPublicOpplist[OUR_TEAM][ pJerrySoldier->ubID ] = SEEN_CURRENTLY; - pJerrySoldier->bVisible = TRUE; - } + //Record the initial sector as ours + //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; + SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; + StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; - } + if ( gGameUBOptions.InJerry == TRUE ) + { + //Set some variable so Jerry will be on the ground + pSoldier->fWaitingToGetupFromJA25Start = TRUE; + pSoldier->fIgnoreGetupFromCollapseCheck = TRUE; - //Lock the interface - guiPendingOverrideEvent = LU_BEGINUILOCK; + //pSoldier->ubStrategicInsertionCode = INSERTION_CODE_GRIDNO; //to by³o wy³¹czone + //pSoldier->usStrategicInsertionData = GetInitialHeliGridNo( ); //to by³o wy³¹czone + + RESETTIMECOUNTER( pSoldier->GetupFromJA25StartCounter, gsInitialHeliRandomTimes[6] + 800 + Random( 400 ) ); + + //should we be on our back or tummy + if ( Random( 100 ) < 50 ) + pSoldier->EVENT_InitNewSoldierAnim( STAND_FALLFORWARD_STOP, 1, TRUE ); + else + pSoldier->EVENT_InitNewSoldierAnim( FALLBACKHIT_STOP, 1, TRUE ); + } + + //Wont work cause it gets reset every frame + //make sure we can see Jerry + + if ( gGameUBOptions.InJerry == TRUE ) + { + pJerrySoldier = FindSoldierByProfileID( JERRY_MILO_UB, FALSE );//JERRY + if ( pJerrySoldier != NULL ) + { + //Make sure we can see the pilot + gbPublicOpplist[OUR_TEAM][pJerrySoldier->ubID] = SEEN_CURRENTLY; + pJerrySoldier->bVisible = TRUE; + } + + } + + //Lock the interface + guiPendingOverrideEvent = LU_BEGINUILOCK; } } From 5f45d068526334e4b4f6e76da77db5df913e10da Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 16 Apr 2025 20:07:42 +0300 Subject: [PATCH 295/571] Fix possible integer overflow --- Tactical/Merc Hiring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index b193f2e6..faa73287 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -1043,7 +1043,7 @@ void UpdateJerryMiloInInitialSector() //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; //SectorInfo[ SEC_H7 ].ubNumAdmins = 2; - StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; + StrategicMap[CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; if ( gGameUBOptions.InGameHeli == TRUE ) return; //AA @@ -1071,7 +1071,7 @@ void UpdateJerryMiloInInitialSector() //Record the initial sector as ours //SectorInfo[ SEC_H7 ].fSurfaceWasEverPlayerControlled = TRUE; SectorInfo[(UINT8)SECTOR( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fSurfaceWasEverPlayerControlled = TRUE; - StrategicMap[(UINT8)CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; + StrategicMap[CALCULATE_STRATEGIC_INDEX( gGameExternalOptions.ubDefaultArrivalSectorX, gGameExternalOptions.ubDefaultArrivalSectorY )].fEnemyControlled = FALSE; if ( gGameUBOptions.InJerry == TRUE ) { From 8dcb431ef2d9ff9c042eb23e6b258d05a68778de Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 17 Apr 2025 23:46:42 +0300 Subject: [PATCH 296/571] Use (0,0) sector coordinates as unused cache Makes the comment in Mod_Settings.ini valid advice --- Strategic/Strategic AI.cpp | 66 +++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index bf1d52b5..378a3584 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -1610,6 +1610,11 @@ void InitStrategicAI() case 1: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + // (0,0) coordinates signify a not used cache sector + if ( gModSettings.ubWeaponCache1X == 0 || gModSettings.ubWeaponCache1Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); @@ -1628,6 +1633,10 @@ void InitStrategicAI() case 2: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache2X == 0 || gModSettings.ubWeaponCache2Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y ) ]; //SEC_H5 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2); @@ -1646,6 +1655,10 @@ void InitStrategicAI() case 3: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache3X == 0 || gModSettings.ubWeaponCache3Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y ) ]; //SEC_H10 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2); @@ -1664,6 +1677,10 @@ void InitStrategicAI() case 4: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache4X == 0 || gModSettings.ubWeaponCache4Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y ) ]; //SEC_J12 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2); @@ -1682,6 +1699,10 @@ void InitStrategicAI() case 5: if( ubPicked[0] != ubSector && ubPicked[1] != ubSector ) { + if ( gModSettings.ubWeaponCache5X == 0 || gModSettings.ubWeaponCache5Y == 0 ) + { + break; + } pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9 pSector->uiFlags |= SF_USE_ALTERNATE_MAP; pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2); @@ -1706,25 +1727,40 @@ void InitStrategicAI() } else { - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); + if ( gModSettings.ubWeaponCache1X != 0 && gModSettings.ubWeaponCache1Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y )]; //SEC_E11 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops1 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y ) ]; //SEC_H5 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2); + if ( gModSettings.ubWeaponCache2X != 0 && gModSettings.ubWeaponCache2Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache2X, gModSettings.ubWeaponCache2Y )]; //SEC_H5 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops2 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y ) ]; //SEC_H10 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2); + if ( gModSettings.ubWeaponCache3X != 0 && gModSettings.ubWeaponCache3Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache3X, gModSettings.ubWeaponCache3Y )]; //SEC_H10 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops3 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y ) ]; //SEC_J12 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2); + if ( gModSettings.ubWeaponCache4X != 0 && gModSettings.ubWeaponCache4Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache4X, gModSettings.ubWeaponCache4Y )]; //SEC_J12 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops4 * 2); + } - pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y ) ]; //SEC_M9 - pSector->uiFlags |= SF_USE_ALTERNATE_MAP; - pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2); + if ( gModSettings.ubWeaponCache5X != 0 && gModSettings.ubWeaponCache5Y != 0 ) + { + pSector = &SectorInfo[SECTOR( gModSettings.ubWeaponCache5X, gModSettings.ubWeaponCache5Y )]; //SEC_M9 + pSector->uiFlags |= SF_USE_ALTERNATE_MAP; + pSector->ubNumTroops = (UINT8)(6 + zDiffSetting[gGameOptions.ubDifficultyLevel].iWeaponCacheTroops5 * 2); + } /* pSector = &SectorInfo[ SECTOR( gModSettings.ubWeaponCache1X, gModSettings.ubWeaponCache1Y ) ]; //SEC_E11 From dd58f904f4ac4cbfee0ae5f87e95c06c5aab37ff Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 24 Apr 2025 21:51:02 +0300 Subject: [PATCH 297/571] Do not offer surrender for multiplayer --- TacticalAI/DecideAction.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index c30aaa68..624ccb40 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -5164,13 +5164,16 @@ INT16 ubMinAPCost; // offer surrender? #ifndef JA2UB - if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) + if ( !is_networked ) // No surrender in multiplayer { - if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 && gTacticalStatus.Team[ CREATURE_TEAM ].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector >= NumPCsInSector() * 3 ) + if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) { - if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) + if ( gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 && gTacticalStatus.Team[ CREATURE_TEAM ].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector >= NumPCsInSector() * 3 ) { - return( AI_ACTION_OFFER_SURRENDER ); + if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) + { + return( AI_ACTION_OFFER_SURRENDER ); + } } } } @@ -9584,13 +9587,16 @@ INT8 ArmedVehicleDecideActionBlack( SOLDIERTYPE *pSoldier ) // offer surrender? #ifndef JA2UB - if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) + if ( !is_networked ) // No surrender in multiplayer { - if ( gTacticalStatus.Team[MILITIA_TEAM].bMenInSector == 0 && gTacticalStatus.Team[CREATURE_TEAM].bMenInSector == 0 && NumPCsInSector( ) < 4 && gTacticalStatus.Team[ENEMY_TEAM].bMenInSector >= NumPCsInSector( ) * 3 ) + if ( pSoldier->bTeam == ENEMY_TEAM && pSoldier->bVisible == TRUE && !(gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER) && pSoldier->stats.bLife >= pSoldier->stats.bLifeMax / 2 && !ARMED_VEHICLE( pSoldier ) && !ENEMYROBOT( pSoldier ) ) { - if (gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED) + if ( gTacticalStatus.Team[MILITIA_TEAM].bMenInSector == 0 && gTacticalStatus.Team[CREATURE_TEAM].bMenInSector == 0 && NumPCsInSector() < 4 && gTacticalStatus.Team[ENEMY_TEAM].bMenInSector >= NumPCsInSector() * 3 ) { - return(AI_ACTION_OFFER_SURRENDER); + if ( gubQuest[QUEST_HELD_IN_ALMA] == QUESTNOTSTARTED || gubQuest[QUEST_HELD_IN_TIXA] == QUESTNOTSTARTED || gubQuest[QUEST_INTERROGATION] == QUESTNOTSTARTED ) + { + return(AI_ACTION_OFFER_SURRENDER); + } } } } From 5062ae74f2088da1e6bbdef1cd17d8be00c22a76 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 25 Apr 2025 23:09:19 +0300 Subject: [PATCH 298/571] Display correct salary info for MERCs in UB campaign --- Laptop/mercs Files.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index e1372176..8bbda718 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1040,14 +1040,25 @@ void DisplayMercsStats( UINT8 ubMercID ) DrawNumeralsToScreen(gMercProfiles[ ubMercID ].bMedical, 3, MERC_STATS_SECOND_NUM_COL_X, usPosY, MERC_STATS_FONT, ubColor); usPosY += MERC_SPACE_BN_LINES; - //Daily Salary - DrawTextToScreen( MercInfo[MERC_FILES_SALARY], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); + //Merc Salary +#ifdef JA2UB + // One time "Fee" instead of "Salary" per day + DrawTextToScreen( CharacterInfo[AIM_MEMBER_FEE], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_TITLE_FONT, MERC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); - usPosX = MERC_STATS_SECOND_COL_X + StringPixLength(MercInfo[MERC_FILES_SALARY], MERC_NAME_FONT); - swprintf(sString, L"%d", gMercProfiles[ ubMercID ].sSalary); + usPosX = MERC_STATS_SECOND_COL_X + StringPixLength( CharacterInfo[AIM_MEMBER_FEE], MERC_NAME_FONT ); + swprintf( sString, L"%d", gMercProfiles[ubMercID].uiWeeklySalary ); InsertCommasForDollarFigure( sString ); InsertDollarSignInToString( sString ); - swprintf(sTemp, L" %s", MercInfo[MERC_FILES_PER_DAY]); +#else + DrawTextToScreen( MercInfo[MERC_FILES_SALARY], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); + + usPosX = MERC_STATS_SECOND_COL_X + StringPixLength( MercInfo[MERC_FILES_SALARY], MERC_NAME_FONT ); + swprintf( sString, L"%d", gMercProfiles[ubMercID].sSalary ); + InsertCommasForDollarFigure( sString ); + InsertDollarSignInToString( sString ); + swprintf( sTemp, L" %s", MercInfo[MERC_FILES_PER_DAY] ); +#endif // JA2UB + wcscat( sString, sTemp ); DrawTextToScreen( sString, usPosX, usPosY, 95, MERC_NAME_FONT, MERC_DYNAMIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED); From a3e7ce57945747474cb8c3e987fabf1624d2b5d5 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:21:43 +0300 Subject: [PATCH 299/571] Display special offer for 1st M.E.R.C. inv kit in UB * Use weekly instead of daily salary for total cost calculation --- Laptop/mercs Files.cpp | 40 +++++++++++++++++++++++++++++++++------- i18n/_ChineseText.cpp | 1 + i18n/_DutchText.cpp | 1 + i18n/_EnglishText.cpp | 1 + i18n/_FrenchText.cpp | 1 + i18n/_GermanText.cpp | 1 + i18n/_ItalianText.cpp | 1 + i18n/_PolishText.cpp | 1 + i18n/_RussianText.cpp | 1 + i18n/include/Text.h | 1 + 10 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 8bbda718..3e41ad50 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1070,14 +1070,27 @@ void DisplayMercsStats( UINT8 ubMercID ) if (gubCurMercFilesTogglePage == MERC_FILES_INV_PAGE) { //Gear Cost - usPosY = usPosY + 145; + usPosY = usPosY + 148; DrawTextToScreen( MercInfo[MERC_FILES_GEAR], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_STATS_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); - if ( (gMercProfiles[ ubMercID ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS ) - && ( !(gMercProfiles[ ubMercID ].ubMiscFlags2 & PROFILE_MISC_FLAG2_MERC_GEARKIT_UNPAID) || gGameExternalOptions.fGearKitsAlwaysAvailable ) ) + if ( (gMercProfiles[ubMercID].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) + && (!(gMercProfiles[ubMercID].ubMiscFlags2 & PROFILE_MISC_FLAG2_MERC_GEARKIT_UNPAID) || gGameExternalOptions.fGearKitsAlwaysAvailable) ) + { gMercProfiles[ ubMercID ].usOptionalGearCost = 0; + } +#ifdef JA2UB + if ( gSelectedMercKit == 0 ) // First kit is free, due to M.E.R.C special offer + { + gMercProfiles[ubMercID].usOptionalGearCost = 0; - swprintf(NsString, L"+ "); + // Special offer text above the gear cost + const auto y = usPosY - MERC_SPACE_BN_LINES + 2; + swprintf( NsString, MercInfo[MERC_FILES_SPECIAL_OFFER] ); + DrawTextToScreen( NsString, usPosX, y, 95, MERC_TITLE_FONT, MERC_TITLE_COLOR, FONT_MCOLOR_BLACK, FALSE, RIGHT_JUSTIFIED ); + } +#endif // JA2UB + + swprintf( NsString, L"+ " ); swprintf(sTemp, L"%d",gMercProfiles[ ubMercID ].usOptionalGearCost); InsertCommasForDollarFigure( sTemp ); InsertDollarSignInToString( sTemp ); @@ -1089,7 +1102,11 @@ void DisplayMercsStats( UINT8 ubMercID ) DrawTextToScreen( MercInfo[MERC_FILES_TOTAL], MERC_STATS_SECOND_COL_X, usPosY, 0, MERC_NAME_FONT, MERC_STATIC_STATS_COLOR, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED); swprintf(N2sString, L"= "); +#ifdef JA2UB + swprintf( sTemp, L"%d", gMercProfiles[ubMercID].usOptionalGearCost + gMercProfiles[ubMercID].uiWeeklySalary ); +#else swprintf(sTemp, L"%d",gMercProfiles[ ubMercID ].usOptionalGearCost+gMercProfiles[ ubMercID ].sSalary); +#endif InsertCommasForDollarFigure( sTemp ); InsertDollarSignInToString( sTemp ); wcscat( N2sString, sTemp ); @@ -1207,16 +1224,25 @@ BOOLEAN MercFilesHireMerc(UINT8 ubMercID) AddTransactionToPlayersBook( HIRED_MERC, ubMercID, GetWorldTotalMin(), Namount ); } - #ifdef JA2UB +#ifdef JA2UB //add an entry in the finacial page for the hiring of the merc - AddTransactionToPlayersBook(PAY_SPECK_FOR_MERC, ubMercID, GetWorldTotalMin(), -(INT32)( gMercProfiles[ubMercID].uiWeeklySalary ) ); - #endif + INT32 totalCost = gMercProfiles[ubMercID].uiWeeklySalary; + if ( gSelectedMercKit > 0 ) // First kit is included in the initial fee + { + totalCost += gMercProfiles[ubMercID].usOptionalGearCost; + } + AddTransactionToPlayersBook(PAY_SPECK_FOR_MERC, ubMercID, GetWorldTotalMin(), -totalCost ); +#endif //JMich_MMG: Setting the flag that we bought the gear and still haven't paid for it if we succesfully hired the merc if ( fMercBuyEquipment ) { gMercProfiles[ ubMercID ].ubMiscFlags |= PROFILE_MISC_FLAG_ALREADY_USED_ITEMS; +#ifdef JA2UB + // Gear cost gets added to initial hiring fee in UB +#else gMercProfiles[ ubMercID ].ubMiscFlags2 |= PROFILE_MISC_FLAG2_MERC_GEARKIT_UNPAID; +#endif // JA2UB } return(TRUE); diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index 3b7f881c..56deb055 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -5478,6 +5478,7 @@ STR16 MercInfo[] = L"未结账å•", //L"Unsettled Bills", L"生平", //L"Bio", L"物å“", //L"Inv", + L"Special Offer!", }; diff --git a/i18n/_DutchText.cpp b/i18n/_DutchText.cpp index 976ea802..580bb33c 100644 --- a/i18n/_DutchText.cpp +++ b/i18n/_DutchText.cpp @@ -5481,6 +5481,7 @@ STR16 MercInfo[] = L"Unsettled Bills", // TODO.Translate L"Bio", // TODO.Translate L"Inv", + L"Special Offer!", }; diff --git a/i18n/_EnglishText.cpp b/i18n/_EnglishText.cpp index 0f5f947e..377ad755 100644 --- a/i18n/_EnglishText.cpp +++ b/i18n/_EnglishText.cpp @@ -5478,6 +5478,7 @@ STR16 MercInfo[] = L"Unsettled Bills", L"Bio", L"Inv", + L"Special Offer!", }; diff --git a/i18n/_FrenchText.cpp b/i18n/_FrenchText.cpp index 6a259577..fbd776a8 100644 --- a/i18n/_FrenchText.cpp +++ b/i18n/_FrenchText.cpp @@ -5485,6 +5485,7 @@ STR16 MercInfo[] = L"Payez sa solde", L"Biographie", L"Inventaire", + L"Special Offer!", }; diff --git a/i18n/_GermanText.cpp b/i18n/_GermanText.cpp index 53bb2601..4b66db3f 100644 --- a/i18n/_GermanText.cpp +++ b/i18n/_GermanText.cpp @@ -5429,6 +5429,7 @@ STR16 MercInfo[] = L"Offene Beträge", L"Bio", L"Inv", + L"Special Offer!", }; // For use at the M.E.R.C. web site. Text relating to opening an account with MERC diff --git a/i18n/_ItalianText.cpp b/i18n/_ItalianText.cpp index 6f9cbb10..0601468b 100644 --- a/i18n/_ItalianText.cpp +++ b/i18n/_ItalianText.cpp @@ -5468,6 +5468,7 @@ STR16 MercInfo[] = L"Unsettled Bills", // TODO.Translate L"Bio", // TODO.Translate L"Inv", + L"Special Offer!", }; diff --git a/i18n/_PolishText.cpp b/i18n/_PolishText.cpp index 8445de0d..f49fe637 100644 --- a/i18n/_PolishText.cpp +++ b/i18n/_PolishText.cpp @@ -5481,6 +5481,7 @@ STR16 MercInfo[] = L"Unsettled Bills", // TODO.Translate L"Bio", // TODO.Translate L"Inv", + L"Special Offer!", }; diff --git a/i18n/_RussianText.cpp b/i18n/_RussianText.cpp index 110c38e7..5b1a777e 100644 --- a/i18n/_RussianText.cpp +++ b/i18n/_RussianText.cpp @@ -5474,6 +5474,7 @@ STR16 MercInfo[] = L"Ðеоплаченные Ñчета", L"ИнформациÑ", L"СнарÑжение", + L"Special Offer!", }; diff --git a/i18n/include/Text.h b/i18n/include/Text.h index 6d97672a..12584904 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -1262,6 +1262,7 @@ enum MERC_FILES_MERC_OUTSTANDING, MERC_FILES_BIO, //JMich_MMG: Adding two new texts for the small button, assuming we manage to add a silhouette with the gear, add it after this. MERC_FILES_INVENTORY, + MERC_FILES_SPECIAL_OFFER, TEXT_NUM_MERC_FILES, }; extern STR16 MercInfo[]; From db6da100e18a0353041db6f8063aaf58e1519a14 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:22:24 +0300 Subject: [PATCH 300/571] Reset selected gear kit when browsing mercs --- Laptop/mercs Files.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 3e41ad50..4ef50fd5 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1847,6 +1847,10 @@ void MercProcessHireAfterGear() void NextMercMember() { + // Reset selected kit, cannot assume next merc has more than 1 kit + gSelectedMercKit = 0; + MercWeaponKitSelectionUpdate( gSelectedMercKit ); + if (gfKeyState [ CTRL ]) gubCurMercIndex = LaptopSaveInfo.gubLastMercIndex; else if (gfKeyState [ SHIFT ]) @@ -1877,6 +1881,10 @@ void NextMercMember() void PrevMercMember() { + // Reset selected kit, cannot assume next merc has more than 1 kit + gSelectedMercKit = 0; + MercWeaponKitSelectionUpdate( gSelectedMercKit ); + if (gfKeyState [ CTRL ]) gubCurMercIndex = 0; else if (gfKeyState [ SHIFT ]) From fa0c5a2862ddde9c31a3b045a7b4dc62ca979a02 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:23:02 +0300 Subject: [PATCH 301/571] Prevent hiring MERC in UB if not enough funds --- Laptop/mercs Files.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 4ef50fd5..159161d7 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1203,6 +1203,22 @@ BOOLEAN MercFilesHireMerc(UINT8 ubMercID) return(FALSE);//not enough big ones $$$sATMText } +#ifdef JA2UB + Namount = 0; + Namount += gMercProfiles[ubMercID].uiWeeklySalary; + if ( gSelectedMercKit > 0 ) + { + Namount += gMercProfiles[ubMercID].usOptionalGearCost; + } + + if ( Namount > LaptopSaveInfo.iCurrentBalance ) + { + DoLapTopMessageBox( MSG_BOX_LAPTOP_DEFAULT, sATMText[4], LAPTOP_SCREEN, MSG_BOX_FLAG_OK, NULL ); + return(FALSE);//not enough big ones $$$sATMText + } +#endif // JA2UB + + bReturnCode = HireMerc( &HireMercStruct ); //already have limit of mercs on the team From b23c9ac8b105a2b675a48fe5e035eeb6ac0f0e87 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:30:45 +0300 Subject: [PATCH 302/571] Do not prompt for buying inventory for 1st kit in UB --- Laptop/mercs Files.cpp | 58 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index 159161d7..e95782c1 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -418,6 +418,34 @@ BOOLEAN EnterMercsFiles() return( TRUE ); } +static void TryToHireMERC() +{ + if ( (gMercProfiles[GetAvailableMercIDFromMERCArray( gubCurMercIndex )].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) + { + //bought gear before + fMercBuyEquipment = 0; + MercProcessHireAfterGear(); + } + else + { +#ifdef JA2UB + if ( gSelectedMercKit == 0 ) // First kit is free, due to M.E.R.C special offer + { + fMercBuyEquipment = 1; + MercProcessHireAfterGear(); + } + else + { + //prompt to buy gear + DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[MERC_FILES_BUY_GEAR], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + } +#else + //prompt to buy gear + DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[MERC_FILES_BUY_GEAR], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); +#endif // JA2UB + } +} + void SelectMercsFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) { if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP) @@ -442,15 +470,7 @@ void SelectMercsFaceRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ) //else try to hire the merc else { - if ( (gMercProfiles[ GetAvailableMercIDFromMERCArray( gubCurMercIndex ) ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) - { - //bought gear before - fMercBuyEquipment = 0; - MercProcessHireAfterGear(); - } - else - //prompt to buy gear - DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[ MERC_FILES_BUY_GEAR ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + TryToHireMERC(); } } } @@ -701,15 +721,7 @@ void BtnMercHireButtonCallback(GUI_BUTTON *btn,INT32 reason) //else try to hire the merc else { - if ( (gMercProfiles[ GetAvailableMercIDFromMERCArray( gubCurMercIndex ) ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) - { - //bought gear before - fMercBuyEquipment = 0; - MercProcessHireAfterGear(); - } - else - //prompt to buy gear - DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[ MERC_FILES_BUY_GEAR ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + TryToHireMERC(); } InvalidateRegion(btn->Area.RegionTopLeftX, btn->Area.RegionTopLeftY, btn->Area.RegionBottomRightX, btn->Area.RegionBottomRightY); @@ -1358,15 +1370,7 @@ void HandleMercsFilesKeyBoardInput( ) //else try to hire the merc else { - //bought gear before - if ( (gMercProfiles[ GetAvailableMercIDFromMERCArray( gubCurMercIndex ) ].ubMiscFlags & PROFILE_MISC_FLAG_ALREADY_USED_ITEMS) && !gGameExternalOptions.fGearKitsAlwaysAvailable ) - { - fMercBuyEquipment = 0; - MercProcessHireAfterGear(); - } - //prompt to buy gear - else - DoLapTopMessageBox( MSG_BOX_BLUE_ON_GREY, MercInfo[ MERC_FILES_BUY_GEAR ], LAPTOP_SCREEN, MSG_BOX_FLAG_YESNO, MercHireButtonGearYesNoCallback ); + TryToHireMERC(); } } break; From ee2807ae64f6230d35d8555cd5a3b344af1472d9 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 26 Apr 2025 00:31:32 +0300 Subject: [PATCH 303/571] Default to 1st kit if deciding not to buy gear in UB 1st one is included in the hiring fee --- Laptop/mercs Files.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index e95782c1..a32a7a7c 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -1840,11 +1840,22 @@ void MercWeaponKitSelectionUpdate(UINT8 selectedInventory) void MercHireButtonGearYesNoCallback (UINT8 bExitValue) { //yes, buy gear - if( bExitValue == MSG_BOX_RETURN_YES ) + if ( bExitValue == MSG_BOX_RETURN_YES ) + { fMercBuyEquipment = 1; + } //no, no gear else + { +#ifdef JA2UB + // Switch to the free, first kit + gSelectedMercKit = 0; + MercWeaponKitSelectionUpdate( gSelectedMercKit ); + fMercBuyEquipment = 1; +#else fMercBuyEquipment = 0; +#endif // JA2UB + } MercProcessHireAfterGear(); } From e2f296c42c4c1d40a63aedff344c28cc72449c65 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 1 May 2025 10:38:39 +0300 Subject: [PATCH 304/571] Remove #pragma optimize("", off) Managed to slip in in commit f21cb38. Bad Asdow, bad! --- TileEngine/lighting.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index b1bcdd67..f7652598 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -1,4 +1,3 @@ -#pragma optimize("", off) #include "builddefines.h" /**************************************************************************************** From 11caa6529cd9652ac71b4e69d508e2accb166500 Mon Sep 17 00:00:00 2001 From: zwwooooo Date: Sun, 11 May 2025 00:33:08 +0800 Subject: [PATCH 305/571] Fix the issue of garbled UTF-8 text in the szTileSetDisplayName field of the StructureMove.xml file in the game's "Drag" menu.(Method provided by @Learner) --- Tactical/SkillMenu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tactical/SkillMenu.cpp b/Tactical/SkillMenu.cpp index 3ecd4aec..bb11f167 100644 --- a/Tactical/SkillMenu.cpp +++ b/Tactical/SkillMenu.cpp @@ -909,7 +909,9 @@ DragSelection::Setup( UINT32 aVal ) if ( xmlentry >= 0 ) { - swprintf( pStr, L"%hs (%s)", gStructureMovePossible[xmlentry].szTileSetDisplayName, FaceDirs[gOneCDirection[ubDirection]] ); + WCHAR buf[256]; + MultiByteToWideChar(CP_UTF8, 0, gStructureMovePossible[xmlentry].szTileSetDisplayName, -1, buf, 256); + swprintf(pStr, L"%s (%s)", buf, FaceDirs[gOneCDirection[ubDirection]]); // we have to use an offset of NOBODY in order to differentiate between person and corpse pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction( &Wrapper_Function_DragSelection_GridNo, sTempGridNo ) ); From efb54202ea16841491d13c42f4a056168e147fef Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 15 Jun 2025 10:58:12 +0300 Subject: [PATCH 306/571] Fix Mercprofile usStrategicInsertionData for bigmaps NPCs would not appear in the map if their gridno was over 65535 in large maps --- Ja2/GameVersion.h | 4 ++-- Ja2/SaveLoadGame.cpp | 11 ++++++++++- Tactical/soldier profile type.h | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Ja2/GameVersion.h b/Ja2/GameVersion.h index b516b225..f85ee016 100644 --- a/Ja2/GameVersion.h +++ b/Ja2/GameVersion.h @@ -22,7 +22,7 @@ extern CHAR16 zBuildInformation[256]; // // Keeps track of the saved game version. Increment the saved game version whenever // you will invalidate the saved game file - +#define MERC_PROFILE_INSERTION_DATA 185 // Bigmap support for AddProfileToMap function #define GROWTH_MODIFIERS 184 #define REBELCOMMAND 183 #define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us @@ -105,7 +105,7 @@ extern CHAR16 zBuildInformation[256]; #define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes #define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system -#define SAVE_GAME_VERSION GROWTH_MODIFIERS +#define SAVE_GAME_VERSION MERC_PROFILE_INSERTION_DATA //#define RUSSIANGOLD #ifdef __cplusplus diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index a0dd2cb5..4208cb56 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -1467,7 +1467,16 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for numBytesRead = ReadFieldByField( hFile, &this->ubLastDateSpokenTo, sizeof(this->ubLastDateSpokenTo), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bLastQuoteSaidWasSpecial, sizeof(this->bLastQuoteSaidWasSpecial), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSectorZ, sizeof(this->bSectorZ), sizeof(INT8), numBytesRead); - numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + + if ( guiCurrentSaveGameVersion >= MERC_PROFILE_INSERTION_DATA ) + { + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof( this->usStrategicInsertionData ), sizeof( UINT32 ), numBytesRead ); + } + else + { + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + } + numBytesRead = ReadFieldByField( hFile, &this->bFriendlyOrDirectDefaultResponseUsedRecently, sizeof(this->bFriendlyOrDirectDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bRecruitDefaultResponseUsedRecently, sizeof(this->bRecruitDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bThreatenDefaultResponseUsedRecently, sizeof(this->bThreatenDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 8d427a5b..222d5401 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -934,7 +934,7 @@ public: UINT8 ubLastDateSpokenTo; UINT8 bLastQuoteSaidWasSpecial; INT8 bSectorZ; - UINT16 usStrategicInsertionData; + UINT32 usStrategicInsertionData; INT8 bFriendlyOrDirectDefaultResponseUsedRecently; INT8 bRecruitDefaultResponseUsedRecently; INT8 bThreatenDefaultResponseUsedRecently; From c02bbc90cbe374441930fd537d3e2f106b84bdc6 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 18 Jun 2025 22:57:50 +0300 Subject: [PATCH 307/571] Fix helicopter for UB No need to force an assert error here. We can simply ignore the meanwhile scene just like all the others. --- Strategic/Map Screen Helicopter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Strategic/Map Screen Helicopter.cpp b/Strategic/Map Screen Helicopter.cpp index 47fcfd44..8ba308f9 100644 --- a/Strategic/Map Screen Helicopter.cpp +++ b/Strategic/Map Screen Helicopter.cpp @@ -1278,8 +1278,7 @@ void LandHelicopter( void ) else { #ifdef JA2UB - Assert( 0 ); -//No meanwhiles + //No meanwhiles in UB #else // play meanwhile scene if it hasn't been used yet HandleKillChopperMeanwhileScene(); From d9391de58a89b9941a8ab19ac660baeb3d898a90 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 22 Jun 2025 12:41:24 +0300 Subject: [PATCH 308/571] Fix laptop crush popup text Due to additional dialogue flag having the value 8, and UB not having a specific flag for mercs standing up after heli crash, the FindSoldierByProfileID would always find Steroid if he was on the team, and then display the crunched laptop popup text. Adding a new flag that is checked before we go into that branch in HandleDialogue fixes the issue. --- Tactical/Dialogue Control.cpp | 4 ++-- Tactical/Dialogue Control.h | 1 + Tactical/Overhead.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 00b32f72..10fa1d9c 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -1345,10 +1345,10 @@ void HandleDialogue( ) { HandleEveryoneDoneTheirEndGameQuotes(); } - else + else if ( QItem.uiSpecialEventData & MULTIPURPOSE_SPECIAL_EVENT_GETUP_AFTER_HELI_CRASH ) { // grab soldier ptr from profile ID - pSoldier = FindSoldierByProfileID( (UINT8)QItem.uiSpecialEventData, FALSE ); + pSoldier = FindSoldierByProfileID( (UINT8)QItem.uiSpecialEventData2, FALSE ); // FindSoldier was returning a lot of nullptrs which would crash the game very quickly after Jerry gets up. This check is here to circumvent that. if (pSoldier != nullptr) diff --git a/Tactical/Dialogue Control.h b/Tactical/Dialogue Control.h index f2aca38e..5c422c2e 100644 --- a/Tactical/Dialogue Control.h +++ b/Tactical/Dialogue Control.h @@ -262,6 +262,7 @@ enum DialogQuoteIDs #ifdef JA2UB #define MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING 0x20000000 #define MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA 0x10000000 +#define MULTIPURPOSE_SPECIAL_EVENT_GETUP_AFTER_HELI_CRASH 0x08000000 #else #define MULTIPURPOSE_SPECIAL_EVENT_DONE_KILLING_DEIDRANNA 0x00000001 #define MULTIPURPOSE_SPECIAL_EVENT_TEAM_MEMBERS_DONE_TALKING 0x00000002 diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index ddc86eaa..14cdf1ac 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -1077,7 +1077,7 @@ BOOLEAN ExecuteOverhead( ) pSoldier->DoMercBattleSound( BATTLE_SOUND_CURSE1 ); } - SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, pSoldier->ubProfile, 0, 0, pSoldier->iFaceIndex, 0 ); + SpecialCharacterDialogueEvent( DIALOGUE_SPECIAL_EVENT_MULTIPURPOSE, MULTIPURPOSE_SPECIAL_EVENT_GETUP_AFTER_HELI_CRASH, pSoldier->ubProfile, 0, pSoldier->iFaceIndex, 0 ); } } else From a1bb85ca95fad6137a64a3c5c26ab8162a25f5ea Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sun, 27 Apr 2025 12:24:31 +0300 Subject: [PATCH 309/571] Externalize fan exitgrid location in the source sector --- Ja2/ub_config.cpp | 3 ++- Ja2/ub_config.h | 1 + Strategic/strategicmap.cpp | 3 ++- Tactical/Ja25_Tactical.cpp | 16 ++++++++++------ Tactical/Ja25_Tactical.h | 1 - 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Ja2/ub_config.cpp b/Ja2/ub_config.cpp index edf55ca0..0479cc89 100644 --- a/Ja2/ub_config.cpp +++ b/Ja2/ub_config.cpp @@ -238,7 +238,8 @@ void LoadGameUBOptions() gGameUBOptions.PowergenSectorGridNo3 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_3", 14155); gGameUBOptions.PowergenSectorGridNo4 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_GRIDNO_4", 13980); - gGameUBOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749); + gGameUBOptions.PowergenSectorExitgridGridNo = iniReader.ReadInteger( "Unfinished Business Settings", "POWERGEN_SECTOR_EXITGRID_GRIDNO", 19749 ); + gGameUBOptions.PowergenSectorExitgridSrcGridNo = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_SECTOR_EXITGRID_SRC_GRIDNO", 10979 ); gGameUBOptions.PowergenFanSoundGridNo1 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_1", 10979); gGameUBOptions.PowergenFanSoundGridNo2 = iniReader.ReadInteger("Unfinished Business Settings","POWERGEN_FAN_SOUND_GRIDNO_2", 19749); gGameUBOptions.StartFanbackupAgainGridNo = iniReader.ReadInteger("Unfinished Business Settings","START_FANBACKUP_AGAIN_GRIDNO", 10980); diff --git a/Ja2/ub_config.h b/Ja2/ub_config.h index dc43d6e7..c8e2780d 100644 --- a/Ja2/ub_config.h +++ b/Ja2/ub_config.h @@ -67,6 +67,7 @@ typedef struct UINT32 PowergenSectorGridNo3; UINT32 PowergenSectorGridNo4; UINT32 PowergenSectorExitgridGridNo; + UINT32 PowergenSectorExitgridSrcGridNo; UINT32 PowergenFanSoundGridNo1; UINT32 PowergenFanSoundGridNo2; UINT32 StartFanbackupAgainGridNo; diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 801bda22..010e944e 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -7778,6 +7778,7 @@ void HandleMovingEnemiesCloseToEntranceInSecondTunnelMap( ) void HandlePowerGenFanSoundModification( ) { + extern UINT32 POWERGENSECTOREXITGRID_SRC_GRIDNO; SetTileAnimCounter( TILE_ANIM__FAST_SPEED ); switch ( gJa25SaveStruct.ubStateOfFanInPowerGenSector ) @@ -7786,7 +7787,7 @@ void HandlePowerGenFanSoundModification( ) HandleAddingPowerGenFanSound( ); //MAKE SURE the fan does not have an exit grid - RemoveExitGridFromWorld( PGF__FAN_EXIT_GRID_GRIDNO ); + RemoveExitGridFromWorld( POWERGENSECTOREXITGRID_SRC_GRIDNO ); break; case PGF__STOPPED: diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 4893ce49..0767119d 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -293,7 +293,8 @@ UINT32 POWERGENSECTOR_GRIDNO1 = 15100; UINT32 POWERGENSECTOR_GRIDNO2 = 12220; UINT32 POWERGENSECTOR_GRIDNO3 = 14155; UINT32 POWERGENSECTOR_GRIDNO4 = 13980; -UINT32 POWERGENSECTOREXITGRID_GRIDNO1 = 19749; +UINT32 POWERGENSECTOREXITGRID_SRC_GRIDNO = 10979; +UINT32 POWERGENSECTOREXITGRID_DST_GRIDNO = 19749; UINT32 POWERGENFANSOUND_GRIDNO1 = 10979; UINT32 POWERGENFANSOUND_GRIDNO2 = 19749; UINT32 STARTFANBACKUPAGAIN_GRIDNO = 10980; @@ -310,11 +311,13 @@ UINT32 SECTOR_FAN_Y = 0; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_X = 14; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_Y = 11; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_Z = 1; -//J14-1 +// Destination sector for fan exitgrid +//J14-1 UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X = 14; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y = 10; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z = 1; + void InitGridNoUB() { SWITCHINMORRISAREA_GRIDNO = gGameUBOptions.SwitchInMorrisAreaGridNo; //= 15231; @@ -326,7 +329,8 @@ void InitGridNoUB() POWERGENSECTOR_GRIDNO2 = gGameUBOptions.PowergenSectorGridNo2; //= 12220; POWERGENSECTOR_GRIDNO3 = gGameUBOptions.PowergenSectorGridNo3; //= 14155; POWERGENSECTOR_GRIDNO4 = gGameUBOptions.PowergenSectorGridNo4; //= 13980; - POWERGENSECTOREXITGRID_GRIDNO1 = gGameUBOptions.PowergenSectorExitgridGridNo; // = 19749; + POWERGENSECTOREXITGRID_SRC_GRIDNO = gGameUBOptions.PowergenSectorExitgridSrcGridNo; //= 10979; // Exitgrid location in the sector it is created in + POWERGENSECTOREXITGRID_DST_GRIDNO = gGameUBOptions.PowergenSectorExitgridGridNo; // = 19749; // Exitgrid location in the destination sector POWERGENFANSOUND_GRIDNO1 = gGameUBOptions.PowergenFanSoundGridNo1; //= 10979; POWERGENFANSOUND_GRIDNO2 = gGameUBOptions.PowergenFanSoundGridNo2; //= 19749; STARTFANBACKUPAGAIN_GRIDNO = gGameUBOptions.StartFanbackupAgainGridNo; //= 10980; @@ -821,7 +825,7 @@ void StartFanBackUpAgain() gTacticalStatus.uiFlags |= NOHIDE_REDUNDENCY; //Remove the exit grid - RemoveExitGridFromWorld( PGF__FAN_EXIT_GRID_GRIDNO ); + RemoveExitGridFromWorld( POWERGENSECTOREXITGRID_SRC_GRIDNO ); // FOR THE NEXT RENDER LOOP, RE-EVALUATE REDUNDENT TILES SetRenderFlags(RENDER_FLAG_FULL); @@ -942,10 +946,10 @@ void AddExitGridForFanToPowerGenSector() ExitGrid.ubGotoSectorX = EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X; //14; ExitGrid.ubGotoSectorY = EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y; //MAP_ROW_J; ExitGrid.ubGotoSectorZ = EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z; //1; - ExitGrid.usGridNo = POWERGENSECTOREXITGRID_GRIDNO1; + ExitGrid.usGridNo = POWERGENSECTOREXITGRID_DST_GRIDNO; //Add the exit grid when the fan is either stopped or blown up - AddExitGridToWorld( PGF__FAN_EXIT_GRID_GRIDNO, &ExitGrid ); + AddExitGridToWorld( POWERGENSECTOREXITGRID_SRC_GRIDNO, &ExitGrid ); } BOOLEAN HandlePlayerSayingQuoteWhenFailingToOpenGateInTunnel( SOLDIERTYPE *pSoldierAtDoor, BOOLEAN fSayQuoteOnlyOnce ) diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 2c5f2156..155e6e37 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -5,7 +5,6 @@ #include "MapScreen Quotes.h" -#define PGF__FAN_EXIT_GRID_GRIDNO 10979 #define NUM_MERCS_WITH_NEW_QUOTES 20//7 From d95bae2bf6fcca2bf50395178d8b259bc5d1d024 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:13:10 +0300 Subject: [PATCH 310/571] Re-enable power generator fan sound effect for UB --- Tactical/Ja25_Tactical.cpp | 2 +- Tactical/Soldier Control.cpp | 2 +- Utils/Sound Control.cpp | 33 +++++++++++++++++++++------------ Utils/Sound Control.h | 6 ++++-- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 0767119d..2a4fc5b3 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -918,7 +918,7 @@ void HandleAddingPowerGenFanSound() sGridNo = POWERGENFANSOUND_GRIDNO2; //Create the new ambient fan sound - //gJa25SaveStruct.iPowerGenFanPositionSndID = NewPositionSnd( sGridNo, POSITION_SOUND_STATIONATY_OBJECT, 0, POWER_GEN_FAN_SOUND ); + gJa25SaveStruct.iPowerGenFanPositionSndID = NewPositionSnd( sGridNo, POSITION_SOUND_STATIONATY_OBJECT, 0, POWER_GEN_FAN_SOUND, 30 ); SetPositionSndsInActive( ); SetPositionSndsActive( ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index b80c9585..f9bdabce 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2445,7 +2445,7 @@ BOOLEAN SOLDIERTYPE::CreateSoldierCommon( UINT8 ubBodyType, UINT16 usSoldierID, if ( this->ubBodyType == QUEENMONSTER ) { - this->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)this, QUEEN_AMBIENT_NOISE ); + this->iPositionSndID = NewPositionSnd( NOWHERE, POSITION_SOUND_FROM_SOLDIER, (UINT32)this, QUEEN_AMBIENT_NOISE, 15 ); } diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index 2598dc28..af8946bf 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -774,6 +774,7 @@ typedef struct UINT32 uiData; BOOLEAN fAllocated; BOOLEAN fInActive; + UINT8 volume; } POSITIONSND; @@ -820,7 +821,7 @@ void RecountPositionSnds( void ) } -INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay ) +INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay, UINT8 volume ) { POSITIONSND *pPositionSnd; INT32 iPositionSndIndex; @@ -849,6 +850,7 @@ INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoun pPositionSnd->uiFlags = uiFlags; pPositionSnd->fAllocated = TRUE; pPositionSnd->iSoundToPlay = iSoundToPlay; + pPositionSnd->volume = volume; pPositionSnd->iSoundSampleID = NO_SAMPLE; @@ -892,7 +894,7 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ) } } -void SetPositionSndsActive( ) +void SetPositionSndsActive() { UINT32 cnt; POSITIONSND *pPositionSnd; @@ -901,20 +903,27 @@ void SetPositionSndsActive( ) for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) { - pPositionSnd = &gPositionSndData[ cnt ]; + pPositionSnd = &gPositionSndData[cnt]; - if ( pPositionSnd->fAllocated ) - { - if ( pPositionSnd->fInActive ) + if ( pPositionSnd->fAllocated ) { - pPositionSnd->fInActive = FALSE; + if ( pPositionSnd->fInActive ) + { + pPositionSnd->fInActive = FALSE; - // Begin sound effect - // Volume 0 - pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); + // Begin sound effect + // Volume 0 + if ( pPositionSnd->iSoundToPlay == POWER_GEN_FAN_SOUND ) + { + pPositionSnd->iSoundSampleID = PlayJA2SampleFromFile( "Sounds\\POWERGENFAN.WAV", RATE_11025, 0, 0, MIDDLEPAN); + } + else + { + pPositionSnd->iSoundSampleID = PlayJA2Sample( pPositionSnd->iSoundToPlay, RATE_11025, 0, 0, MIDDLEPAN ); + } + } } } - } } @@ -1068,7 +1077,7 @@ void SetPositionSndsVolumeAndPanning( ) { if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) { - bVolume = PositionSoundVolume( 15, pPositionSnd->sGridNo ); + bVolume = PositionSoundVolume( pPositionSnd->volume, pPositionSnd->sGridNo ); if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) { diff --git a/Utils/Sound Control.h b/Utils/Sound Control.h index 656be5ce..e351c783 100644 --- a/Utils/Sound Control.h +++ b/Utils/Sound Control.h @@ -379,7 +379,9 @@ enum SoundDefines S_VAL, //BREAK_LIGHT_IGNITING, - NUM_SAMPLES + NUM_SAMPLES, + POWER_GEN_FAN_SOUND = 5001 // This is a workaround to get the generator fan positional sound working in UB campaign. + // Had to special case it because sound effects have been externalized. }; enum AmbientDefines @@ -453,7 +455,7 @@ void PlayDelayedJA2Sample( UINT32 uiDelay, UINT32 usNum, UINT32 usRate, UINT32 u #define POSITION_SOUND_FROM_SOLDIER 0x00000001 #define POSITION_SOUND_STATIONATY_OBJECT 0x00000002 -INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay ); +INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoundToPlay, UINT8 volume ); void DeletePositionSnd( INT32 iPositionSndIndex ); void SetPositionSndsActive( ); void SetPositionSndsInActive( ); From 9a78e7dfa0cbcee2424f33d19aa2f93eb14ce184 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:30:14 +0300 Subject: [PATCH 311/571] Formatting changes --- Utils/Sound Control.cpp | 222 ++++++++++++++++++++-------------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index af8946bf..3c8472f8 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -768,9 +768,9 @@ void DelayedSoundTimerCallback( void ) typedef struct { UINT32 uiFlags; - INT32 sGridNo; - INT32 iSoundSampleID; - INT32 iSoundToPlay; + INT32 sGridNo; + INT32 iSoundSampleID; + INT32 iSoundToPlay; UINT32 uiData; BOOLEAN fAllocated; BOOLEAN fInActive; @@ -794,27 +794,27 @@ INT32 GetFreePositionSnd( void ) { UINT32 uiCount; - for(uiCount=0; uiCount < guiNumPositionSnds; uiCount++) + for ( uiCount = 0; uiCount < guiNumPositionSnds; uiCount++ ) { - if(( gPositionSndData[uiCount].fAllocated==FALSE ) ) - return( (INT32)uiCount ); + if ( (gPositionSndData[uiCount].fAllocated == FALSE) ) + return((INT32)uiCount); } - if( guiNumPositionSnds < NUM_POSITION_SOUND_EFFECT_SLOTS ) - return( (INT32) guiNumPositionSnds++ ); + if ( guiNumPositionSnds < NUM_POSITION_SOUND_EFFECT_SLOTS ) + return((INT32)guiNumPositionSnds++); - return( -1 ); + return(-1); } void RecountPositionSnds( void ) { INT32 uiCount; - for(uiCount=guiNumPositionSnds-1; (uiCount >=0) ; uiCount--) + for ( uiCount = guiNumPositionSnds - 1; (uiCount >= 0); uiCount-- ) { - if( ( gPositionSndData[uiCount].fAllocated ) ) + if ( (gPositionSndData[uiCount].fAllocated) ) { - guiNumPositionSnds=(UINT32)(uiCount+1); + guiNumPositionSnds = (UINT32)(uiCount + 1); break; } } @@ -826,57 +826,57 @@ INT32 NewPositionSnd( INT32 sGridNo, UINT32 uiFlags, UINT32 uiData, UINT32 iSoun POSITIONSND *pPositionSnd; INT32 iPositionSndIndex; - if( ( iPositionSndIndex = GetFreePositionSnd() )==(-1) ) + if ( (iPositionSndIndex = GetFreePositionSnd()) == (-1) ) return(-1); - memset( &gPositionSndData[ iPositionSndIndex ], 0, sizeof( POSITIONSND ) ); + memset( &gPositionSndData[iPositionSndIndex], 0, sizeof( POSITIONSND ) ); - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[iPositionSndIndex]; // Default to inactive if ( gfPositionSoundsActive ) { - pPositionSnd->fInActive = FALSE; + pPositionSnd->fInActive = FALSE; } else { - pPositionSnd->fInActive = TRUE; + pPositionSnd->fInActive = TRUE; } - pPositionSnd->sGridNo = sGridNo; - pPositionSnd->uiData = uiData; - pPositionSnd->uiFlags = uiFlags; - pPositionSnd->fAllocated = TRUE; + pPositionSnd->sGridNo = sGridNo; + pPositionSnd->uiData = uiData; + pPositionSnd->uiFlags = uiFlags; + pPositionSnd->fAllocated = TRUE; pPositionSnd->iSoundToPlay = iSoundToPlay; pPositionSnd->volume = volume; pPositionSnd->iSoundSampleID = NO_SAMPLE; - return( iPositionSndIndex ); + return(iPositionSndIndex); } void DeletePositionSnd( INT32 iPositionSndIndex ) { POSITIONSND *pPositionSnd; - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[iPositionSndIndex]; if ( pPositionSnd->fAllocated ) { - // Turn inactive first... - pPositionSnd->fInActive = TRUE; + // Turn inactive first... + pPositionSnd->fInActive = TRUE; - // End sound... - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) - { - SoundStop( pPositionSnd->iSoundSampleID ); - } + // End sound... + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + { + SoundStop( pPositionSnd->iSoundSampleID ); + } - pPositionSnd->fAllocated = FALSE; + pPositionSnd->fAllocated = FALSE; - RecountPositionSnds( ); + RecountPositionSnds(); } } @@ -884,13 +884,13 @@ void SetPositionSndGridNo( INT32 iPositionSndIndex, INT32 sGridNo ) { POSITIONSND *pPositionSnd; - pPositionSnd = &gPositionSndData[ iPositionSndIndex ]; + pPositionSnd = &gPositionSndData[iPositionSndIndex]; if ( pPositionSnd->fAllocated ) { - pPositionSnd->sGridNo = sGridNo; + pPositionSnd->sGridNo = sGridNo; - SetPositionSndsVolumeAndPanning( ); + SetPositionSndsVolumeAndPanning(); } } @@ -915,7 +915,7 @@ void SetPositionSndsActive() // Volume 0 if ( pPositionSnd->iSoundToPlay == POWER_GEN_FAN_SOUND ) { - pPositionSnd->iSoundSampleID = PlayJA2SampleFromFile( "Sounds\\POWERGENFAN.WAV", RATE_11025, 0, 0, MIDDLEPAN); + pPositionSnd->iSoundSampleID = PlayJA2SampleFromFile( "Sounds\\POWERGENFAN.WAV", RATE_11025, 0, 0, MIDDLEPAN ); } else { @@ -927,7 +927,7 @@ void SetPositionSndsActive() } -void SetPositionSndsInActive( ) +void SetPositionSndsInActive() { UINT32 cnt; POSITIONSND *pPositionSnd; @@ -936,20 +936,20 @@ void SetPositionSndsInActive( ) for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) { - pPositionSnd = &gPositionSndData[ cnt ]; + pPositionSnd = &gPositionSndData[cnt]; - if ( pPositionSnd->fAllocated ) - { - pPositionSnd->fInActive = TRUE; - - // End sound... - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + if ( pPositionSnd->fAllocated ) { - SoundStop( pPositionSnd->iSoundSampleID ); - pPositionSnd->iSoundSampleID = NO_SAMPLE; + pPositionSnd->fInActive = TRUE; + + // End sound... + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) + { + SoundStop( pPositionSnd->iSoundSampleID ); + pPositionSnd->iSoundSampleID = NO_SAMPLE; + } } } - } } // == Lesh slightly changed this function ============ @@ -959,51 +959,51 @@ UINT8 PositionSoundDir( INT32 sGridNo ) INT16 sScreenX, sScreenY; INT16 sMiddleX; INT16 sDif, sAbsDif; - - if (TileIsOutOfBounds(sGridNo)) + + if ( TileIsOutOfBounds( sGridNo ) ) { - return( MIDDLEPAN ); + return(MIDDLEPAN); } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); // Get screen coordinates for current position of soldier - GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY); + GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY ); // Get middle of where we are now.... - sMiddleX = gsTopLeftWorldX + ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2; + sMiddleX = gsTopLeftWorldX + (gsBottomRightWorldX - gsTopLeftWorldX) / 2; sDif = sMiddleX - sScreenX; - if ( ( sAbsDif = abs( sDif ) ) > 64 ) + if ( (sAbsDif = abs( sDif )) > 64 ) { // OK, NOT the middle. // Is it outside the screen? - if ( sAbsDif > ( ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2 ) ) - { + if ( sAbsDif > ((gsBottomRightWorldX - gsTopLeftWorldX) / 2) ) + { // yes, outside... if ( sDif > 0 ) { - return( FARLEFT ); + return(FARLEFT); //return( 1 ); } - else - return( FARRIGHT ); - //return( 126 ); + else + return(FARRIGHT); + //return( 126 ); - } + } else // inside screen { - if ( sDif > 0) - return( LEFTSIDE ); + if ( sDif > 0 ) + return(LEFTSIDE); else - return( RIGHTSIDE ); + return(RIGHTSIDE); } } else // hardly any difference, so sound should be played from middle - return(MIDDLE); + return(MIDDLE); } @@ -1016,21 +1016,21 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT32 sGridNo ) INT16 sDifY, sAbsDifY; INT16 sMaxDistX, sMaxDistY; double sMaxSoundDist, sSoundDist; - - if (TileIsOutOfBounds(sGridNo)) + + if ( TileIsOutOfBounds( sGridNo ) ) { - return( bInitialVolume ); + return(bInitialVolume); } // OK, get screen position of gridno..... ConvertGridNoToXY( sGridNo, &sWorldX, &sWorldY ); // Get screen coordinates for current position of soldier - GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY); + GetWorldXYAbsoluteScreenXY( (INT16)(sWorldX), (INT16)(sWorldY), &sScreenX, &sScreenY ); // Get middle of where we are now.... - sMiddleX = gsTopLeftWorldX + ( gsBottomRightWorldX - gsTopLeftWorldX ) / 2; - sMiddleY = gsTopLeftWorldY + ( gsBottomRightWorldY - gsTopLeftWorldY ) / 2; + sMiddleX = gsTopLeftWorldX + (gsBottomRightWorldX - gsTopLeftWorldX) / 2; + sMiddleY = gsTopLeftWorldY + (gsBottomRightWorldY - gsTopLeftWorldY) / 2; sDifX = sMiddleX - sScreenX; sDifY = sMiddleY - sScreenY; @@ -1038,28 +1038,28 @@ INT8 PositionSoundVolume( INT8 bInitialVolume, INT32 sGridNo ) sAbsDifX = abs( sDifX ); sAbsDifY = abs( sDifY ); - sMaxDistX = (INT16)( ( gsBottomRightWorldX - gsTopLeftWorldX ) * 1.5 ); - sMaxDistY = (INT16)( ( gsBottomRightWorldY - gsTopLeftWorldY ) * 1.5 ); + sMaxDistX = (INT16)((gsBottomRightWorldX - gsTopLeftWorldX) * 1.5); + sMaxDistY = (INT16)((gsBottomRightWorldY - gsTopLeftWorldY) * 1.5); - sMaxSoundDist = sqrt( (double) ( sMaxDistX * sMaxDistX ) + ( sMaxDistY * sMaxDistY ) ); - sSoundDist = sqrt( (double)( sAbsDifX * sAbsDifX ) + ( sAbsDifY * sAbsDifY ) ); + sMaxSoundDist = sqrt( (double)(sMaxDistX * sMaxDistX) + (sMaxDistY * sMaxDistY) ); + sSoundDist = sqrt( (double)(sAbsDifX * sAbsDifX) + (sAbsDifY * sAbsDifY) ); if ( sSoundDist == 0 ) { - return( bInitialVolume ); + return(bInitialVolume); } if ( sSoundDist > sMaxSoundDist ) { - sSoundDist = sMaxSoundDist; + sSoundDist = sMaxSoundDist; } // Scale - return( (INT8)( bInitialVolume * ( ( sMaxSoundDist - sSoundDist ) / sMaxSoundDist ) ) ); + return((INT8)(bInitialVolume * ((sMaxSoundDist - sSoundDist) / sMaxSoundDist))); } -void SetPositionSndsVolumeAndPanning( ) +void SetPositionSndsVolumeAndPanning() { UINT32 cnt; POSITIONSND *pPositionSnd; @@ -1069,49 +1069,49 @@ void SetPositionSndsVolumeAndPanning( ) for ( cnt = 0; cnt < guiNumPositionSnds; cnt++ ) { - pPositionSnd = &gPositionSndData[ cnt ]; + pPositionSnd = &gPositionSndData[cnt]; - if ( pPositionSnd->fAllocated ) - { - if ( !pPositionSnd->fInActive ) + if ( pPositionSnd->fAllocated ) { - if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) - { - bVolume = PositionSoundVolume( pPositionSnd->volume, pPositionSnd->sGridNo ); - - if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) + if ( !pPositionSnd->fInActive ) { - pSoldier = (SOLDIERTYPE*)pPositionSnd->uiData; - - if ( pSoldier->bVisible == -1 ) + if ( pPositionSnd->iSoundSampleID != NO_SAMPLE ) { - // Limit volume,,, - if ( bVolume > 10 ) + bVolume = PositionSoundVolume( pPositionSnd->volume, pPositionSnd->sGridNo ); + + if ( pPositionSnd->uiFlags & POSITION_SOUND_FROM_SOLDIER ) { - bVolume = 10; + pSoldier = (SOLDIERTYPE *)pPositionSnd->uiData; + + if ( pSoldier->bVisible == -1 ) + { + // Limit volume,,, + if ( bVolume > 10 ) + { + bVolume = 10; + } + } } + + //if the sound is from a stationary object + if ( pPositionSnd->uiFlags & POSITION_SOUND_STATIONATY_OBJECT ) + { + // make sure you can always hear it + if ( bVolume < 5 ) + { + bVolume = 5; + } + } + + SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume ); + + ubPan = PositionSoundDir( pPositionSnd->sGridNo ); + + SoundSetPan( pPositionSnd->iSoundSampleID, ubPan ); } } - - //if the sound is from a stationay object - if( pPositionSnd->uiFlags & POSITION_SOUND_STATIONATY_OBJECT ) - { - // make sure you can always hear it - if ( bVolume < 5 ) - { - bVolume = 5; - } - } - - SoundSetVolume( pPositionSnd->iSoundSampleID, bVolume ); - - ubPan = PositionSoundDir( pPositionSnd->sGridNo ); - - SoundSetPan( pPositionSnd->iSoundSampleID, ubPan ); - } } } - } } From 2ae110971bf5132bce2fc49f9dc1177256f6d6cb Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 21:31:42 +0300 Subject: [PATCH 312/571] spelling fixes --- Tactical/Ja25_Tactical.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 2a4fc5b3..38313a09 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -650,7 +650,7 @@ void HandleWhenCertainPercentageOfEnemiesDie() UINT32 uiPercentEnemiesKilled; UINT8 ubSectorID; - //if there isnt enemies in the sector + //if there isn't enemies in the sector if( ( gTacticalStatus.Team[ ENEMY_TEAM ].bMenInSector + gTacticalStatus.ubArmyGuysKilled ) == 0 ) { //get out @@ -667,7 +667,7 @@ void HandleWhenCertainPercentageOfEnemiesDie() switch( ubSectorID ) { case SEC_K15: - //all enemies are dead and if the quote hasnt been said yet + //all enemies are dead and if the quote hasn't been said yet if( uiPercentEnemiesKilled >= 100 && !( gJa25SaveStruct.uiJa25GeneralFlags & JA_GF__ALL_DEAD_TOP_LEVEL_OF_COMPLEX ) ) { INT16 bProfile = RandomProfileIdFromNewMercsOnPlayerTeam(); @@ -707,7 +707,7 @@ void StopPowerGenFan() return; } - //Remeber how the player got through + //Remember how the player got through SetJa25GeneralFlag( JA_GF__POWER_GEN_FAN_HAS_BEEN_STOPPED ); gJa25SaveStruct.ubStateOfFanInPowerGenSector = PGF__STOPPED; @@ -725,7 +725,7 @@ void StopPowerGenFan() //Turn off the power gen fan sound HandleRemovingPowerGenFanSound(); - //remeber which turn the fan stopped on + //remember which turn the fan stopped on gJa25SaveStruct.uiTurnPowerGenFanWentDown = gJa25SaveStruct.uiTacticalTurnCounter; @@ -733,7 +733,7 @@ void StopPowerGenFan() // Replace the Fan graphic // - // Turn on permenant changes.... + // Turn on permanent changes.... ApplyMapChangesToMapTempFile( TRUE ); //Add the exit grid to the power gen fan @@ -788,7 +788,7 @@ void StartFanBackUpAgain() return; } - //Remeber how the player got through + //Remember how the player got through gJa25SaveStruct.ubStateOfFanInPowerGenSector = PGF__RUNNING_NORMALLY; @@ -800,7 +800,7 @@ void StartFanBackUpAgain() // Replace the Fan graphic // - // Turn on permenant changes.... + // Turn on permanent changes.... ApplyMapChangesToMapTempFile( TRUE ); // Remove it! From 4d948fda069dbb59fbc27d05d7edff1792f0d720 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 24 Jun 2025 22:50:40 +0300 Subject: [PATCH 313/571] Fix powergen fan stopping in UB Sector Y & Z coordinates were mixed up in code, which would then always fail the check for correct sector. --- Tactical/Ja25_Tactical.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 38313a09..f147dc0d 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -305,8 +305,8 @@ UINT32 SECTOR_LAUNCH_MISSLES_Y = 12; UINT32 SECTOR_LAUNCH_MISSLES_Z = 3; //J13-0 UINT32 SECTOR_FAN_X = 13; -UINT32 SECTOR_FAN_Z = 10; -UINT32 SECTOR_FAN_Y = 0; +UINT32 SECTOR_FAN_Y = 10; +UINT32 SECTOR_FAN_Z = 0; //K14-1 UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_X = 14; UINT32 SECTOR_OPEN_GATE_IN_TUNNEL_Y = 11; @@ -342,8 +342,8 @@ void InitGridNoUB() SECTOR_LAUNCH_MISSLES_Z = gGameUBOptions.SectorLaunchMisslesZ; //3; //J13-0 SECTOR_FAN_X = gGameUBOptions.SectorFanX; //13; - SECTOR_FAN_Z = gGameUBOptions.SectorFanY; //10; - SECTOR_FAN_Y = gGameUBOptions.SectorFanZ; //0; + SECTOR_FAN_Y = gGameUBOptions.SectorFanY; //10; + SECTOR_FAN_Z = gGameUBOptions.SectorFanZ; //0; //K14-1 SECTOR_OPEN_GATE_IN_TUNNEL_X = gGameUBOptions.SectorOpenGateInTunnelX; //14; SECTOR_OPEN_GATE_IN_TUNNEL_Y = gGameUBOptions.SectorOpenGateInTunnelY; //11; From 5e2c61ef123809b253666e01221e80767c847a34 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 25 Jun 2025 22:49:29 +0300 Subject: [PATCH 314/571] Externalized UB bloodcat quest sector --- Ja2/ub_config.cpp | 5 +++++ Ja2/ub_config.h | 5 ++++- Strategic/Queen Command.cpp | 2 +- Tactical/Ja25_Tactical.cpp | 10 +++++++++- Tactical/Ja25_Tactical.h | 4 ++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Ja2/ub_config.cpp b/Ja2/ub_config.cpp index 0479cc89..908f7584 100644 --- a/Ja2/ub_config.cpp +++ b/Ja2/ub_config.cpp @@ -357,6 +357,11 @@ void LoadGameUBOptions() gGameUBOptions.H10SectorPlayerQuoteZ = iniReader.ReadInteger("Unfinished Business Settings","H10_SECTOR_PLAYER_QUOTE_Z", 0); + gGameUBOptions.BettyBloodCatSectorX = iniReader.ReadInteger( "Unfinished Business Settings", "BETTY_BLOODCAT_SECTOR_X", 10 ); + gGameUBOptions.BettyBloodCatSectorY = iniReader.ReadInteger( "Unfinished Business Settings", "BETTY_BLOODCAT_SECTOR_Y", 9 ); + gGameUBOptions.BettyBloodCatSectorZ = iniReader.ReadInteger( "Unfinished Business Settings", "BETTY_BLOODCAT_SECTOR_Z", 0 ); + + if ( gGameUBOptions.InGameHeli == TRUE ) gGameUBOptions.InGameHeliCrash = FALSE; diff --git a/Ja2/ub_config.h b/Ja2/ub_config.h index c8e2780d..d5c98aea 100644 --- a/Ja2/ub_config.h +++ b/Ja2/ub_config.h @@ -220,7 +220,10 @@ typedef struct UINT32 SectorDoorInTunnelGridNo; UINT8 MaxNumberOfMercs; - + + INT16 BettyBloodCatSectorX; + INT16 BettyBloodCatSectorY; + INT8 BettyBloodCatSectorZ; } GAME_UB_OPTIONS; extern GAME_UB_OPTIONS gGameUBOptions; diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 074ef6c3..b5ff2ce4 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -3171,7 +3171,7 @@ BOOLEAN CheckPendingNonPlayerTeam( UINT8 usTeam ) void HandleBloodCatDeaths( SECTORINFO *pSector ) { //if the current sector is the first part of the town - if( gWorldSectorX == 10 && gWorldSectorY == 9 && gbWorldSectorZ == 0 ) + if( gWorldSectorX == BETTY_BLOODCAT_SECTOR_X && gWorldSectorY == BETTY_BLOODCAT_SECTOR_Y && gbWorldSectorZ == BETTY_BLOODCAT_SECTOR_Z ) { //if ALL the bloodcats are killed if( pSector->bBloodCats == 0 ) diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index f147dc0d..28ee41e2 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -317,6 +317,9 @@ UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X = 14; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y = 10; UINT32 EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z = 1; +INT16 BETTY_BLOODCAT_SECTOR_X = 10; +INT16 BETTY_BLOODCAT_SECTOR_Y = 9; +INT8 BETTY_BLOODCAT_SECTOR_Z = 0; void InitGridNoUB() { @@ -352,7 +355,12 @@ void InitGridNoUB() EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_X = gGameUBOptions.ExitForFanToPowerGenSectorX; //14; EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Y = gGameUBOptions.ExitForFanToPowerGenSectorY; //10; EXIT_FOR_FAN_TO_POWER_GEN_SECTOR_Z = gGameUBOptions.ExitForFanToPowerGenSectorZ; //1; - + + BETTY_BLOODCAT_SECTOR_X = gGameUBOptions.BettyBloodCatSectorX; + BETTY_BLOODCAT_SECTOR_Y = gGameUBOptions.BettyBloodCatSectorY; + BETTY_BLOODCAT_SECTOR_Z = gGameUBOptions.BettyBloodCatSectorZ; + + MANUEL_UB = gGameUBOptions.ubMANUEL_UB; BIGGENS_UB = gGameUBOptions.ubBIGGENS_UB; JOHN_K_UB = gGameUBOptions.ubJOHN_K_UB; diff --git a/Tactical/Ja25_Tactical.h b/Tactical/Ja25_Tactical.h index 155e6e37..9e1205f6 100644 --- a/Tactical/Ja25_Tactical.h +++ b/Tactical/Ja25_Tactical.h @@ -143,6 +143,10 @@ extern UINT8 RAUL_UB; extern UINT8 MORRIS_UB; extern UINT8 RUDY_UB; +extern INT16 BETTY_BLOODCAT_SECTOR_X; +extern INT16 BETTY_BLOODCAT_SECTOR_Y; +extern INT8 BETTY_BLOODCAT_SECTOR_Z; + extern void Old_UB_Inventory (); extern void New_UB_Inventory (); From 09ce3327215df22be1e086406d860830558a8b39 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 27 Jun 2025 15:59:45 +0300 Subject: [PATCH 315/571] Allow 10 size squads for 720p resolution in UB --- Ja2/GameInitOptionsScreen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ja2/GameInitOptionsScreen.cpp b/Ja2/GameInitOptionsScreen.cpp index fcad1e9d..b2eb2216 100644 --- a/Ja2/GameInitOptionsScreen.cpp +++ b/Ja2/GameInitOptionsScreen.cpp @@ -1830,7 +1830,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) if( reason & MSYS_CALLBACK_REASON_LBUTTON_REPEAT ) { UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; - if (iResolution >= _800x600 && iResolution < _1024x768) + if (iResolution >= _800x600 && iResolution < _1280x720) maxSquadSize = GIO_SQUAD_SIZE_8; if ( iCurrentSquadSize < maxSquadSize ) @@ -1850,7 +1850,7 @@ void BtnGIOSquadSizeSelectionRightCallback( GUI_BUTTON *btn,INT32 reason ) btn->uiFlags|=(BUTTON_CLICKED_ON); UINT8 maxSquadSize = GIO_SQUAD_SIZE_10; - if (iResolution >= _800x600 && iResolution < _1024x768) + if (iResolution >= _800x600 && iResolution < _1280x720 ) maxSquadSize = GIO_SQUAD_SIZE_8; if ( iCurrentSquadSize < maxSquadSize ) From 1a8db5d15bc88ae81ba60ac9d980bc6ac4728cd3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 27 Jun 2025 19:57:49 +0300 Subject: [PATCH 316/571] More conversions to SoldierID --- .../src/AbstractPlanFactory.cpp | 2 +- Tactical/Overhead.cpp | 174 ++++++++---------- Tactical/Overhead.h | 2 +- Tactical/Soldier Control.cpp | 2 +- Tactical/Soldier Control.h | 2 +- Tactical/TeamTurns.cpp | 4 +- Tactical/opplist.cpp | 16 +- TacticalAI/AIUtils.cpp | 11 +- TacticalAI/NPC.cpp | 8 +- TacticalAI/ai.h | 4 +- TileEngine/SmokeEffects.cpp | 2 +- TileEngine/overhead map.cpp | 9 +- 12 files changed, 111 insertions(+), 125 deletions(-) diff --git a/ModularizedTacticalAI/src/AbstractPlanFactory.cpp b/ModularizedTacticalAI/src/AbstractPlanFactory.cpp index f22c4c8a..accd9113 100644 --- a/ModularizedTacticalAI/src/AbstractPlanFactory.cpp +++ b/ModularizedTacticalAI/src/AbstractPlanFactory.cpp @@ -39,7 +39,7 @@ namespace AI if(i.event_type_ == AIInputData::auditive_event) return os<<"sound: "<ubID<<" was seen at "<ubID.i<<" was seen at "<bTeam = (INT8) cnt; + cnt2->bTeam = (INT8) cnt; } } @@ -3962,7 +3961,7 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) #ifdef JA2UB if ( pSoldierOld->ubProfile == MORRIS_UB ) { - INT16 bSoldierID; + SoldierID bSoldierID; SOLDIERTYPE* pOther = FindSoldierByProfileID( MORRIS_UB, FALSE ); if ( pOther ) { @@ -3975,10 +3974,10 @@ void HandleNPCTeamMemberDeath( SOLDIERTYPE *pSoldierOld ) bSoldierID = RandomSoldierIdFromNewMercsOnPlayerTeam(); //if there is any - if( bSoldierID != -1 ) + if( bSoldierID != NOBODY ) { //say the MORRIS dead quote - TacticalCharacterDialogue( &Menptr[ bSoldierID ], QUOTE_LEARNED_TO_HATE_ON_TEAM_WONT_RENEW ); + TacticalCharacterDialogue( bSoldierID, QUOTE_LEARNED_TO_HATE_ON_TEAM_WONT_RENEW ); } } // Ja25no queen @@ -6860,10 +6859,8 @@ BOOLEAN WeSawSomeoneThisTurn( ) void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) { // WDS - make number of mercenaries, etc. be configurable - // UINT8 ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + SoldierID ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = {}; UINT16 ubNumMercs = 0; - UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; // Loop through all our guys and randomly say one from someone in our sector @@ -6878,7 +6875,7 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { - ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; + ubMercsInSector[ ubNumMercs ] = cnt; ubNumMercs++; } } @@ -6886,9 +6883,9 @@ void SayBattleSoundFromAnyBodyInSector( INT32 iBattleSnd ) // If we are > 0 if ( ubNumMercs > 0 ) { - ubChosenMerc = ubMercsInSector[ (UINT16)Random( ubNumMercs ) ]; + SoldierID ubChosenMerc = ubMercsInSector[ (UINT16)Random( ubNumMercs ) ]; - MercPtrs[ ubChosenMerc ]->DoMercBattleSound( (UINT8)iBattleSnd ); + ubChosenMerc->DoMercBattleSound( (UINT8)iBattleSnd ); } } @@ -7945,10 +7942,9 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) void CycleThroughKnownEnemies( BOOLEAN backward ) { // static to indicate last position we were at: - SOLDIERTYPE *pSoldier; - static BOOLEAN fFirstTime = TRUE; - static UINT16 usStartToLook; - UINT32 cnt; + static BOOLEAN fFirstTime = TRUE; + static SoldierID usStartToLook; + SoldierID enemy; BOOLEAN fEnemyBehindStartLook = FALSE; BOOLEAN fEnemiesFound = FALSE; @@ -7959,30 +7955,31 @@ void CycleThroughKnownEnemies( BOOLEAN backward ) if(backward) usStartToLook = TOTAL_SOLDIERS; else - usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; } - if(backward) - for ( cnt = TOTAL_SOLDIERS-1 , pSoldier = MercPtrs[ cnt ]; cnt >= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt--, pSoldier-- ) + if (backward) + { + for ( enemy = TOTAL_SOLDIERS-1; enemy >= gTacticalStatus.Team[ gbPlayerNum ].bLastID; --enemy ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) + if ( enemy->bActive && enemy->bInSector && !enemy->aiData.bNeutral && (enemy->bSide != gbPlayerNum) && (enemy->stats.bLife > 0) ) { - if ( pSoldier->bVisible != -1 ) + if ( enemy->bVisible != -1 ) { fEnemiesFound = TRUE; // If we are < ok start, this is the one! - if ( cnt < usStartToLook ) + if ( enemy < usStartToLook ) { - usStartToLook = (UINT16)cnt; + usStartToLook = enemy; // Locate to! //LocateSoldier( pSoldier->ubID, 1 ); //ATE: Change to Slide To... - SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( enemy, SETANDREMOVEPREVIOUSLOCATOR ); return; } else @@ -7992,31 +7989,34 @@ void CycleThroughKnownEnemies( BOOLEAN backward ) } } } + } else - for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt < TOTAL_SOLDIERS; cnt++, pSoldier++ ) { - // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) + for ( enemy = gTacticalStatus.Team[gbPlayerNum].bLastID; enemy < TOTAL_SOLDIERS; ++enemy ) { - if ( pSoldier->bVisible != -1 ) + // try to find first active, OK enemy + if ( enemy->bActive && enemy->bInSector && !enemy->aiData.bNeutral && (enemy->bSide != gbPlayerNum) && (enemy->stats.bLife > 0) ) { - fEnemiesFound = TRUE; - - // If we are > ok start, this is the one! - if ( cnt > usStartToLook ) + if (enemy->bVisible != -1) { - usStartToLook = (UINT16)cnt; + fEnemiesFound = TRUE; - // Locate to! - //LocateSoldier( pSoldier->ubID, 1 ); + // If we are > ok start, this is the one! + if (enemy > usStartToLook) + { + usStartToLook = enemy; - //ATE: Change to Slide To... - SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); - return; - } - else - { - fEnemyBehindStartLook = TRUE; + // Locate to! + //LocateSoldier( pSoldier->ubID, 1 ); + + //ATE: Change to Slide To... + SlideTo(enemy, SETANDREMOVEPREVIOUSLOCATOR); + return; + } + else + { + fEnemyBehindStartLook = TRUE; + } } } } @@ -8038,39 +8038,34 @@ void CycleThroughKnownEnemies( BOOLEAN backward ) } else { - usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - - CycleThroughKnownEnemies( ); - } + usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; + CycleThroughKnownEnemies( ); + } } } void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) { - // static to indicate last position we were at: - SOLDIERTYPE *pSoldier; - UINT16 usStartToLook; - UINT32 cnt; + SoldierID enemy; + SoldierID usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - - for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt < TOTAL_SOLDIERS; cnt++, pSoldier++ ) + for ( enemy = gTacticalStatus.Team[ gbPlayerNum ].bLastID; enemy < TOTAL_SOLDIERS; ++enemy ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) + if ( enemy->bActive && enemy->bInSector && !enemy->aiData.bNeutral && (enemy->bSide != gbPlayerNum) && (enemy->stats.bLife > 0) ) { - if ( pSrcSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pSrcSoldier->aiData.bOppList[ enemy ] == SEEN_CURRENTLY ) { // If we are > ok start, this is the one! - if ( cnt > pSrcSoldier->ubLastEnemyCycledID ) + if ( enemy > pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; + pSrcSoldier->ubLastEnemyCycledID = enemy; //ATE: Change to Slide To... - SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( enemy, SETANDREMOVEPREVIOUSLOCATOR ); - ChangeInterfaceLevel( pSoldier->pathing.bLevel ); + ChangeInterfaceLevel( enemy->pathing.bLevel ); return; } } @@ -8082,58 +8077,51 @@ void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier ) usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt < TOTAL_SOLDIERS; cnt++, pSoldier++ ) + for ( enemy = gTacticalStatus.Team[ gbPlayerNum ].bLastID; enemy < TOTAL_SOLDIERS; ++enemy ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) + if (enemy->bActive && enemy->bInSector && !enemy->aiData.bNeutral && (enemy->bSide != gbPlayerNum) && (enemy->stats.bLife > 0) ) { - if ( pSrcSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pSrcSoldier->aiData.bOppList[ enemy ] == SEEN_CURRENTLY ) { // If we are > ok start, this is the one! - if ( cnt > pSrcSoldier->ubLastEnemyCycledID ) + if ( enemy > pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; + pSrcSoldier->ubLastEnemyCycledID = enemy; //ATE: Change to Slide To... - SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo(enemy, SETANDREMOVEPREVIOUSLOCATOR ); - ChangeInterfaceLevel( pSoldier->pathing.bLevel ); + ChangeInterfaceLevel( enemy->pathing.bLevel ); return; } } } } - - } void CycleVisibleEnemiesBackward( SOLDIERTYPE *pSrcSoldier ) { - // static to indicate last position we were at: - SOLDIERTYPE *pSoldier; - UINT16 usStartToLook; - UINT32 cnt; + SoldierID enemy; + SoldierID usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - -// for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt < TOTAL_SOLDIERS; cnt++, pSoldier++ ) - for ( cnt = TOTAL_SOLDIERS-1, pSoldier = MercPtrs[ cnt ]; cnt >= gTacticalStatus.Team[ gbPlayerNum ].bLastID ; cnt--, pSoldier-- ) + for ( enemy = TOTAL_SOLDIERS-1; enemy >= gTacticalStatus.Team[ gbPlayerNum ].bLastID ; --enemy ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) + if ( enemy->bActive && enemy->bInSector && !enemy->aiData.bNeutral && (enemy->bSide != gbPlayerNum) && (enemy->stats.bLife > 0) ) { - if ( pSrcSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pSrcSoldier->aiData.bOppList[ enemy ] == SEEN_CURRENTLY ) { // If we are > ok start, this is the one! - if ( cnt < pSrcSoldier->ubLastEnemyCycledID ) + if ( enemy < pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; + pSrcSoldier->ubLastEnemyCycledID = enemy; //ATE: Change to Slide To... - SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( enemy, SETANDREMOVEPREVIOUSLOCATOR ); - ChangeInterfaceLevel( pSoldier->pathing.bLevel ); + ChangeInterfaceLevel( enemy->pathing.bLevel ); return; } } @@ -8145,24 +8133,23 @@ void CycleVisibleEnemiesBackward( SOLDIERTYPE *pSrcSoldier ) usStartToLook = gTacticalStatus.Team[ gbPlayerNum ].bLastID; - //for ( cnt = gTacticalStatus.Team[ gbPlayerNum ].bLastID, pSoldier = MercPtrs[ cnt ]; cnt >= 0; cnt--, pSoldier-- ) - for ( cnt = TOTAL_SOLDIERS-1, pSoldier = MercPtrs[ cnt ]; cnt >= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt--, pSoldier-- ) + for ( enemy = TOTAL_SOLDIERS-1; enemy >= gTacticalStatus.Team[ gbPlayerNum ].bLastID; --enemy ) { // try to find first active, OK enemy - if ( pSoldier->bActive && pSoldier->bInSector && !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum) && (pSoldier->stats.bLife > 0) ) + if ( enemy->bActive && enemy->bInSector && !enemy->aiData.bNeutral && (enemy->bSide != gbPlayerNum) && (enemy->stats.bLife > 0) ) { - if ( pSrcSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) + if ( pSrcSoldier->aiData.bOppList[ enemy ] == SEEN_CURRENTLY ) { // If we are > ok start, this is the one! - if ( cnt < pSrcSoldier->ubLastEnemyCycledID ) + if ( enemy < pSrcSoldier->ubLastEnemyCycledID ) { - pSrcSoldier->ubLastEnemyCycledID = (UINT16)cnt; + pSrcSoldier->ubLastEnemyCycledID = enemy; //ATE: Change to Slide To... - SlideTo( pSoldier->ubID, SETANDREMOVEPREVIOUSLOCATOR ); + SlideTo( enemy, SETANDREMOVEPREVIOUSLOCATOR ); - ChangeInterfaceLevel( pSoldier->pathing.bLevel ); + ChangeInterfaceLevel( enemy->pathing.bLevel ); return; } } @@ -10492,8 +10479,7 @@ BOOLEAN HostileCreaturesPresent() void HandleCreatureTenseQuote( ) { // WDS - make number of mercenaries, etc. be configurable - // UINT8 ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = { 0 }; - std::vector ubMercsInSector (CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS, 0); + SoldierID ubMercsInSector[ CODE_MAXIMUM_NUMBER_OF_PLAYER_SLOTS ] = {}; UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier; @@ -10523,7 +10509,7 @@ void HandleCreatureTenseQuote( ) // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && !AM_AN_EPC( pTeamSoldier ) && !( pTeamSoldier->flags.uiStatusFlags & SOLDIER_GASSED ) && !(AM_A_ROBOT( pTeamSoldier )) && !pTeamSoldier->flags.fMercAsleep ) { - ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; + ubMercsInSector[ ubNumMercs ] = cnt; ubNumMercs++; } } @@ -10533,7 +10519,7 @@ void HandleCreatureTenseQuote( ) { ubChosenMerc = (UINT16)Random( ubNumMercs ); - DoCreatureTensionQuote ( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ] ); + DoCreatureTensionQuote ( ubMercsInSector[ ubChosenMerc ] ); } // Adjust delay.... diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index fc89d207..114c4053 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -69,7 +69,7 @@ struct TacticalStatusType INT8 fPanicFlags; INT32 sPanicTriggerGridNoUnused; INT16 sHandGrid; - UINT16 ubSpottersCalledForBy; + SoldierID ubSpottersCalledForBy; SoldierID ubTheChosenOne; UINT32 uiTimeOfLastInput; UINT32 uiTimeSinceDemoOn; diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 30547a63..be63bdff 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -992,7 +992,7 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src) this->bRegenBoostersUsedToday = src.bRegenBoostersUsedToday; this->bNumPelletsHitBy = src.bNumPelletsHitBy; this->sSkillCheckGridNo = src.sSkillCheckGridNo; - this->ubLastEnemyCycledID = src.ubLastEnemyCycledID; + this->ubLastEnemyCycledID = static_cast( src.ubLastEnemyCycledID ); this->ubPrevSectorID = src.ubPrevSectorID; this->ubNumTilesMovesSinceLastForget = src.ubNumTilesMovesSinceLastForget; diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 473da2a0..3bba03d3 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1453,7 +1453,7 @@ public: INT8 bRegenBoostersUsedToday; // Flugente: not used anymore! INT8 bNumPelletsHitBy; INT32 sSkillCheckGridNo; - UINT16 ubLastEnemyCycledID; + SoldierID ubLastEnemyCycledID; UINT8 ubPrevSectorID; UINT8 ubNumTilesMovesSinceLastForget; diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index efac8945..48488f6d 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -107,7 +107,7 @@ BOOLEAN InterruptsAllowed = TRUE; BOOLEAN gfHiddenInterrupt = FALSE; SoldierID gubLastInterruptedGuy = NOBODY; -extern UINT16 gsWhoThrewRock; +extern SoldierID gsWhoThrewRock; extern UINT8 gubSightFlags; typedef struct @@ -115,7 +115,7 @@ typedef struct UINT16 ubOutOfTurnPersons; SoldierID InterruptOnlyGuynum; - INT16 sWhoThrewRock; + SoldierID sWhoThrewRock; BOOLEAN InterruptsAllowed; BOOLEAN fHiddenInterrupt; SoldierID ubLastInterruptedGuy; diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index b528e648..3d61980b 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -248,7 +248,7 @@ INT8 gbSmellStrength[3] = }; -UINT16 gsWhoThrewRock = NOBODY; +SoldierID gsWhoThrewRock = NOBODY; // % values of sighting distance at various light levels //DBrot: use gGameExternalOptions.ubBrightnessVisionMod instead @@ -1056,7 +1056,7 @@ void OurTeamRadiosRandomlyAbout(UINT16 ubAbout) -INT16 TeamNoLongerSeesMan( UINT8 ubTeam, SOLDIERTYPE *pOpponent, UINT16 ubExcludeID, INT8 bIteration ) +INT16 TeamNoLongerSeesMan( UINT8 ubTeam, SOLDIERTYPE *pOpponent, SoldierID ubExcludeID, INT8 bIteration ) { SOLDIERTYPE *pMate; SoldierID bLoop = gTacticalStatus.Team[ubTeam].bFirstID; @@ -1833,7 +1833,7 @@ void HandleManNoLongerSeen( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pOpponent, INT { // check if I was the only one who was seeing this guy (exlude ourselves) // THIS MUST HAPPEN EVEN FOR ENEMIES, TO MAKE THEIR PUBLIC opplist DECAY! - if (TeamNoLongerSeesMan(pSoldier->bTeam,pOpponent,pSoldier->ubID, 0 )) + if (TeamNoLongerSeesMan(pSoldier->bTeam, pOpponent, pSoldier->ubID, 0)) { #ifdef TESTOPPLIST DebugMsg( TOPIC_JA2OPPLIST, DBG_LEVEL_3, String( "TeamNoLongerSeesMan: ID %d(%S) to ID %d",pSoldier->ubID,pSoldier->name,pOpponent->ubID) ); @@ -5720,7 +5720,7 @@ void ProcessNoise( SoldierID ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubT UINT8 ubLoudestEffVolume, ubEffVolume; // UINT8 ubPlayVolume; UINT8 ubSourceTerrType; - UINT16 ubSource; + SoldierID ubSource; INT8 bTellPlayer = FALSE, bHeard, bSeen; SoldierID ubHeardLoudestBy = NOBODY; UINT8 ubNoiseDir = 0xff, ubLoudestNoiseDir = 0xff; @@ -7718,9 +7718,9 @@ void SetWatchedLocAsUsed( UINT16 ubID, INT32 sGridNo, INT8 bLevel ) BOOLEAN WatchedLocLocationIsEmpty( INT32 sGridNo, INT8 bLevel, INT8 bTeam ) { // look to see if there is anyone near the watched loc who is not on this team - UINT16 ubID; - INT32 sTempGridNo; - INT16 sX, sY; + SoldierID ubID; + INT32 sTempGridNo; + INT16 sX, sY; for ( sY = -WATCHED_LOC_RADIUS; sY <= WATCHED_LOC_RADIUS; sY++ ) { @@ -7732,7 +7732,7 @@ BOOLEAN WatchedLocLocationIsEmpty( INT32 sGridNo, INT8 bLevel, INT8 bTeam ) continue; } ubID = WhoIsThere2( sTempGridNo, bLevel ); - if ( ubID != NOBODY && MercPtrs[ ubID ]->bTeam != bTeam ) + if ( ubID != NOBODY && ubID->bTeam != bTeam ) { return( FALSE ); } diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 5ed40f53..e320e442 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -830,7 +830,8 @@ INT16 RandomFriendWithin(SOLDIERTYPE *pSoldier) { UINT32 uiLoop; UINT16 usMaxDist; - UINT16 ubFriendCount, ubFriendIDs[MAXMERCS], ubFriendID; + UINT16 ubFriendCount; + SoldierID ubFriendIDs[MAXMERCS], ubFriendID; UINT8 ubDirection; UINT8 ubDirsLeft; BOOLEAN fDirChecked[8]; @@ -5929,14 +5930,14 @@ INT32 RandomizeOpponentLocation(INT32 sSpot, SOLDIERTYPE *pOpponent, INT16 sMaxD } // first call PrepareThreatlist to make threat list -UINT16 ClosestKnownThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt) +SoldierID ClosestKnownThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt) { CHECKF(pSoldier); UINT32 uiLoop; INT32 sClosestOpponent = NOWHERE; INT32 iRange, iClosestRange; - UINT16 ubClosestOpponentID = NOBODY; + SoldierID ubClosestOpponentID = NOBODY; // use global defined threat list for (uiLoop = 0; uiLoop < uiThreatCnt; uiLoop++) @@ -5959,14 +5960,14 @@ UINT16 ClosestKnownThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt) } // first call PrepareThreatlist to make threat list -UINT16 ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt, UINT8 ubMax) +SoldierID ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt, UINT8 ubMax) { CHECKF(pSoldier); UINT32 uiLoop; INT32 sClosestOpponent = NOWHERE; INT32 iRange, iClosestRange; - UINT16 ubClosestOpponentID = NOBODY; + SoldierID ubClosestOpponentID = NOBODY; // use global defined threat list for (uiLoop = 0; uiLoop < uiThreatCnt; uiLoop++) diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index fe48412c..a6960b64 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -2909,7 +2909,7 @@ BOOLEAN PCDoesFirstAidOnNPC( UINT8 ubNPC ) void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) { // Loop through all mercs, gather closest mercs who can see and trigger one! - UINT16 ubMercsInSector[CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS] = { 0 }; //std::vector would probably be better here + SoldierID ubMercsInSector[CODE_MAXIMUM_NUMBER_OF_PLAYER_MERCS] = {}; //std::vector would probably be better here UINT16 ubNumMercs = 0; UINT16 ubChosenMerc; SOLDIERTYPE *pTeamSoldier, *pSoldier; @@ -2929,7 +2929,7 @@ void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) // Add guy if he's a candidate... if ( OK_INSECTOR_MERC( pTeamSoldier ) && pTeamSoldier->aiData.bOppList[ pSoldier->ubID ] == SEEN_CURRENTLY ) { - ubMercsInSector[ ubNumMercs ] = (UINT16)cnt; + ubMercsInSector[ ubNumMercs ] = cnt; ubNumMercs++; } } @@ -2945,11 +2945,11 @@ void TriggerClosestMercWhoCanSeeNPC( UINT8 ubNPC, NPCQuoteInfo *pQuotePtr ) // If 64, do something special if ( pQuotePtr->ubTriggerNPCRec == QUOTE_RESPONSE_TO_MIGUEL_SLASH_QUOTE_MERC_OR_RPC_LETGO ) { - TacticalCharacterDialogueWithSpecialEvent( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ], pQuotePtr->ubTriggerNPCRec, DIALOGUE_SPECIAL_EVENT_PCTRIGGERNPC, 57, 6 ); + TacticalCharacterDialogueWithSpecialEvent( ubMercsInSector[ ubChosenMerc ], pQuotePtr->ubTriggerNPCRec, DIALOGUE_SPECIAL_EVENT_PCTRIGGERNPC, 57, 6 ); } else { - TacticalCharacterDialogue( MercPtrs[ ubMercsInSector[ ubChosenMerc ] ], pQuotePtr->ubTriggerNPCRec ); + TacticalCharacterDialogue( ubMercsInSector[ ubChosenMerc ], pQuotePtr->ubTriggerNPCRec ); } } diff --git a/TacticalAI/ai.h b/TacticalAI/ai.h index 72af7137..3dd5ca2a 100644 --- a/TacticalAI/ai.h +++ b/TacticalAI/ai.h @@ -315,8 +315,8 @@ BOOLEAN AICheckIsFlanking( SOLDIERTYPE *pSoldier ); INT8 CalcMoraleNew(SOLDIERTYPE *pSoldier); UINT32 PrepareThreatlist(SOLDIERTYPE *pSoldier); -UINT16 ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt, UINT8 ubMax = SEEN_CURRENTLY); // first call PrepareThreatlist to make threat list -UINT16 ClosestKnownThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt); // first call PrepareThreatlist to make threat list +SoldierID ClosestSeenThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt, UINT8 ubMax = SEEN_CURRENTLY); // first call PrepareThreatlist to make threat list +SoldierID ClosestKnownThreatID(SOLDIERTYPE *pSoldier, UINT32 uiThreatCnt); // first call PrepareThreatlist to make threat list BOOLEAN ProneSightCoverAtSpot(SOLDIERTYPE *pSoldier, INT32 sSpot, BOOLEAN fUnlimited); BOOLEAN SightCoverAtSpot(SOLDIERTYPE *pSoldier, INT32 sSpot, BOOLEAN fUnlimited); diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 28170ec6..04bc9726 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -204,7 +204,7 @@ INT32 NewSmokeEffect( INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwn // OJW - 20091027 - Syncronising smoke effect start for multiplayer if (is_networked && is_client) { - SOLDIERTYPE* pSoldier = MercPtrs[ubOwner]; + SOLDIERTYPE* pSoldier = ubOwner; if (pSoldier != NULL) { if (pSoldier->bTeam == 0 || (pSoldier->bTeam == 1 && is_server)) diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 14dd2f31..df808584 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -1378,11 +1378,10 @@ void RenderOverheadOverlays() { UINT32 uiDestPitchBYTES; WORLDITEM *pWorldItem; - UINT32 i; SOLDIERTYPE *pSoldier; HVOBJECT hVObject; INT16 sX, sY; - UINT16 end; + SoldierID id, end; UINT16 usLineColor=0; UINT8 *pDestBuf; UINT8 ubPassengers = 0; @@ -1416,10 +1415,10 @@ void RenderOverheadOverlays() || RebelCommand::ShowApproximateEnemyLocations()) marklastenemy = TRUE; - for( i = 0; i < end; ++i ) + for( id = 0; id < end; ++id ) { //First, check to see if the soldier exists and is in the sector. - pSoldier = MercPtrs[ i ]; + pSoldier = id; if( !pSoldier->bActive || !pSoldier->bInSector ) continue; //Soldier is here. Calculate his screen position based on his current gridno. @@ -1695,7 +1694,7 @@ void RenderOverheadOverlays() FLOAT radius_inner = radius - thickness / 2; FLOAT radius_outer = radius + thickness / 2; - for( i = 0 ; i < guiNumWorldItems; ++i ) + for( UINT32 i = 0 ; i < guiNumWorldItems; ++i ) { pWorldItem = &gWorldItems[ i ]; if( !pWorldItem || !pWorldItem->fExists ) From b3b3270e1e5ae3e4cd425e9bb74cfd94ed7eb6f8 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 27 Jun 2025 19:59:01 +0300 Subject: [PATCH 317/571] Adjust constructors --- Tactical/Overhead Types.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 65e6ec04..02845695 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -387,13 +387,13 @@ typedef struct SoldierID // TODO: Remove once SoldierID is used everywhere and these are no longer needed inline operator UINT16() const { return i; } - SoldierID(const UINT16 val = TOTAL_SOLDIERS) : i(val) + constexpr SoldierID(const UINT16 val = TOTAL_SOLDIERS) : i(val) { // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid if ( i > TOTAL_SOLDIERS ) i = TOTAL_SOLDIERS; } - SoldierID( const UINT32 val ) : i( val ) + constexpr SoldierID( const UINT32 val ) : i( val ) { // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid if ( i > TOTAL_SOLDIERS ) @@ -402,7 +402,7 @@ typedef struct SoldierID constexpr SoldierID( const INT32 val ) : i( val ) { // Limit the maximum value to TOTAL_SOLDIERS. Anything beyond that is invalid - if ( i > TOTAL_SOLDIERS ) + if ( i > TOTAL_SOLDIERS || i < 0) i = TOTAL_SOLDIERS; } @@ -486,6 +486,5 @@ inline SoldierID operator+(const unsigned int lhs, const SoldierID rhs) { return inline SoldierID operator+(const INT16 lhs, const SoldierID rhs) { return SoldierID{ static_cast(lhs + rhs.i) }; } -//TODO: Change this to constexpr after SoldierID is ready and the user defined constructor from uint16 is not needed anymore. inline constexpr SoldierID NOBODY{ TOTAL_SOLDIERS }; #endif From 9d1e9e894835acf95eded054b1a3ef98e5694fcc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 27 Jun 2025 20:28:15 +0300 Subject: [PATCH 318/571] Fix line highlighting --- Strategic/Map Screen Interface.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 4812b167..4b3c4479 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -4469,7 +4469,12 @@ void BuildMouseRegionsForMoveBox( void ) MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + auto rowIndex = iCounter; + if (firstColumnFull) + { + rowIndex -= rowOffset; + } + MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, rowIndex); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, DONE_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, 0 ); iCounter++; @@ -4487,7 +4492,12 @@ void BuildMouseRegionsForMoveBox( void ) MSYS_NO_CURSOR, MoveMenuMvtCallback, MoveMenuBtnCallback ); // set user defines - MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 0, iCounter ); + auto rowIndex = iCounter; + if (firstColumnFull) + { + rowIndex -= rowOffset; + } + MSYS_SetRegionUserData(&gMoveMenuRegion[iCounter], 0, rowIndex); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 1, CANCEL_REGION ); MSYS_SetRegionUserData( &gMoveMenuRegion[ iCounter ], 2, 0 ); iCounter++; From 49a56d01ac6de314de0fdaffdee44143399fd768 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Tue, 8 Jul 2025 20:21:17 +0300 Subject: [PATCH 319/571] Load correct militia icons for 720p resolution --- Strategic/Map Screen Interface Map.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 73af166a..dc705df5 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -5283,12 +5283,12 @@ BOOLEAN LoadMilitiaPopUpBox( void ) // load the militia pop up box VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE; - if (iResolution >= _640x480 && iResolution < _800x600) - FilenameForBPP("INTERFACE\\Militia.sti", VObjectDesc.ImageFile); - else if (iResolution < _1024x768) + if ( isWidescreenUI() || iResolution >= _1024x768) + FilenameForBPP("INTERFACE\\Militia_1024x768.sti", VObjectDesc.ImageFile); + else if (iResolution >= _800x600) FilenameForBPP("INTERFACE\\Militia_800x600.sti", VObjectDesc.ImageFile); else - FilenameForBPP("INTERFACE\\Militia_1024x768.sti", VObjectDesc.ImageFile); + FilenameForBPP("INTERFACE\\Militia.sti", VObjectDesc.ImageFile); CHECKF(AddVideoObject(&VObjectDesc, &guiMilitia)); From 7bb7c543172533b5046eb8376a7f256ee00520dc Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 21 Jul 2025 03:30:22 +0300 Subject: [PATCH 320/571] Guard against integer underflow (#462) --- Strategic/Strategic AI.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index 378a3584..8a3ca8a1 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -7151,15 +7151,16 @@ void InitializeGroup( const GROUP_TYPE groupType, const UINT8 groupSize, UINT8 & tankCount++; } - if ( gGameExternalOptions.fASDAssignsJeeps && ASDSoldierUpgradeToJeep( ) ) + if ( troopCount > 0 && gGameExternalOptions.fASDAssignsJeeps && ASDSoldierUpgradeToJeep( ) ) { troopCount--; jeepCount++; } - if ( gGameExternalOptions.fASDAssignsRobots && ASDSoldierUpgradeToRobot() ) + if ( troopCount > 0 && gGameExternalOptions.fASDAssignsRobots && ASDSoldierUpgradeToRobot() ) { - const int numRobots = 1 + Random(difficultyMod); + // Limit amount of robots, if randomized difficulty bonus would cause us to go over the troopCount amount + const int numRobots = min( (1 + Random(difficultyMod)), troopCount); troopCount -= numRobots; robotCount += numRobots; } From 872a356e8283f1e8fd01f66b6b8093c652da5281 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Wed, 23 Jul 2025 14:36:15 +0300 Subject: [PATCH 321/571] Correct column size check --- TileEngine/worlddef.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index 628a35e3..a1fc4b44 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -2929,7 +2929,7 @@ BOOLEAN LoadWorld(const STR8 puiFilename, FLOAT* pMajorMapVersion, UINT8* pMinor SetWorldSize(iRowSize, iColSize); // We still have the "normal" map size AND the map is saved in vanilla format - if ((iRowSize <= OLD_WORLD_ROWS && iRowSize <= OLD_WORLD_COLS) && (dMajorMapVersion == VANILLA_MAJOR_MAP_VERSION && ubMinorMapVersion == VANILLA_MINOR_MAP_VERSION)) + if ((iRowSize <= OLD_WORLD_ROWS && iColSize <= OLD_WORLD_COLS) && (dMajorMapVersion == VANILLA_MAJOR_MAP_VERSION && ubMinorMapVersion == VANILLA_MINOR_MAP_VERSION)) { // Check "vanilla map saving" gfVanillaMode = TRUE;//dnl ch74 191013 From 8644e5f8b9543105e2067c49daac5f8f7ed9d1a5 Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+CptMoore@users.noreply.github.com> Date: Fri, 25 Jul 2025 10:24:55 +0200 Subject: [PATCH 322/571] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9eeb84e4..6a605397 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -200,6 +200,7 @@ jobs: git push --delete origin refs/tags/latest || true git tag latest git push --force origin refs/tags/latest + sleep 15 # make sure github can find the tag for gh release gh release create latest ../dist/* \ --generate-notes \ --title "Latest (unstable)" \ From eb3f62c3d529d3e74d8d4a5537f48b3953c33eb1 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Fri, 1 Aug 2025 20:52:22 +0200 Subject: [PATCH 323/571] Reverting Commit 9122d7a it made: CAN_FAN_THE_HAMMER = FALSE now disables the burst mode on pistols which effectivly resulted in pistols burst mode only being avaialbale with can fan the hammer active which further resulted in being required to fire from hip mode when using burst with pistols that's not a desired behaviour for burst on pistols, their burst should not depend on fan the hammer therefore reverted --- Tactical/Weapons.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 9649faa0..77e7e0a3 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -9957,10 +9957,6 @@ BOOLEAN IsGunBurstCapable(OBJECTTYPE* pObject, BOOLEAN fNotify, SOLDIERTYPE* pSo fCapable = TRUE; } } - else if (Weapon[pObject->usItem].fBurstOnlyByFanTheHammer) - { - fCapable = FALSE; - } } } } From 4ae331c19eb1146204c80ceb4e6d1d3e90e60792 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Sun, 3 Aug 2025 08:12:48 +0200 Subject: [PATCH 324/571] IniOption Food items can show without using Food - food items are usualy not shown in game without using Food - option ALWAYS_FOOD allows them to be shown even without - default is false, no food items without Food --- Ja2/GameSettings.cpp | 1 + Ja2/GameSettings.h | 1 + Tactical/Items.cpp | 23 +++++++++++++++-------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index c437d542..cd796702 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -1998,6 +1998,7 @@ void LoadGameExternalOptions() gGameExternalOptions.fFoodDecayInSectors = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_DECAY_IN_SECTORS", TRUE); gGameExternalOptions.sFoodDecayModificator = iniReader.ReadFloat("Tactical Food Settings", "FOOD_DECAY_MODIFICATOR", 1.0f, 0.1f, 10.0f); gGameExternalOptions.fFoodEatingSounds = iniReader.ReadBoolean("Tactical Food Settings", "FOOD_EATING_SOUNDS", TRUE); + gGameExternalOptions.fAlwaysFood = iniReader.ReadBoolean("Tactical Food Settings", "ALWAYS_FOOD", FALSE); //################# Disease Settings ################## gGameExternalOptions.fDisease = iniReader.ReadBoolean( "Disease Settings", "DISEASE", FALSE ); diff --git a/Ja2/GameSettings.h b/Ja2/GameSettings.h index 1aeb3404..6148086c 100644 --- a/Ja2/GameSettings.h +++ b/Ja2/GameSettings.h @@ -506,6 +506,7 @@ typedef struct FLOAT sFoodDecayModificator; BOOLEAN fFoodEatingSounds; + BOOLEAN fAlwaysFood; // Flugente: disease settings BOOLEAN fDisease; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index c1fe83a0..61f51e32 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1271,14 +1271,21 @@ BOOLEAN ItemIsLegal( UINT16 usItemIndex, BOOLEAN fIgnoreCoolness ) if ( Item[usItemIndex].ubCoolness == 0 && !fIgnoreCoolness ) return FALSE; - // silversurfer: no food items if the food system is off - if (!UsingFoodSystem() && Item[usItemIndex].foodtype > 0) - { - // silversurfer: Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. - // kitty: and only if food isn't a drug at the same time, to make sure using those drugs without food system is possible - if (Food[Item[usItemIndex].foodtype].bFoodPoints > 0 && Item[usItemIndex].drugtype == 0 ) - return FALSE; - } + // kitty: players might want food items in game for roleplay reasons, i.e. when interacting with npc-dealer in restaurant, no food might seems odd + // with the option "ALWAYS_FOOD" set TRUE, food items will show even without using the foodsystem + // should it be set to FALSE, no food items will be shown without using the foodsystem + if (!gGameExternalOptions.fAlwaysFood) + { + // silversurfer: no food items if the food system is off + if (!UsingFoodSystem() && Item[usItemIndex].foodtype > 0 ) + { + // silversurfer: Only restrict food for now. Water can be used to replenish lost energy so it is useful even without the food system. + // kitty: and only if food isn't a drug at the same time, to make sure using those drugs without food system is possible + if (Food[Item[usItemIndex].foodtype].bFoodPoints > 0 && Item[usItemIndex].drugtype == 0 ) + + return FALSE; + } + } // kitty: no disease items if the disease system is off // whether the item is exclusive is defined by tag From 1074e9c408e2ad1414d51512c65065965dd939de Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 7 Aug 2025 21:33:41 +0300 Subject: [PATCH 325/571] Fix save game compability for MERCPROFILESTRUCT --- Ja2/SaveLoadGame.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 4208cb56..71c4d713 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -1474,7 +1474,8 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for } else { - numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(this->usStrategicInsertionData), sizeof(UINT16), numBytesRead); + numBytesRead = ReadFieldByField( hFile, &this->usStrategicInsertionData, sizeof(UINT16), sizeof(UINT16), numBytesRead); + buffer += 4; // To make numBytesRead check match the struct size. 2 bytes from uint32 - uint16 and 2 bytes due to struct memory layout change when usStrategicInsertionData was increased to uint32 } numBytesRead = ReadFieldByField( hFile, &this->bFriendlyOrDirectDefaultResponseUsedRecently, sizeof(this->bFriendlyOrDirectDefaultResponseUsedRecently), sizeof(INT8), numBytesRead); From c3a34a660daf8bdaec1b594654022801c291d709 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:01:40 +0300 Subject: [PATCH 326/571] Check squads are on the same level --- Strategic/Strategic Movement.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index b1e0b6be..4afc1b94 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -2644,6 +2644,7 @@ BOOLEAN PossibleToCoordinateSimultaneousGroupArrivals( GROUP *pFirstGroup ) { if ( pGroup != pFirstGroup && (pGroup->usGroupTeam == OUR_TEAM || pGroup->usGroupTeam == MILITIA_TEAM) && pGroup->fBetweenSectors && pGroup->ubNextX == pFirstGroup->ubSectorX && pGroup->ubNextY == pFirstGroup->ubSectorY && + pFirstGroup->ubSectorZ == pGroup->ubSectorZ && !(pGroup->uiFlags & GROUPFLAG_SIMULTANEOUSARRIVAL_CHECKED) && !IsGroupTheHelicopterGroup( pGroup ) ) { From 56dc0088b6a725d72cc8b9c6fd47321efd7e02a3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:46:09 +0300 Subject: [PATCH 327/571] Fix underflow in loop --- Tactical/Overhead.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 936f8ebc..f3495a11 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -4896,7 +4896,7 @@ SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLes SoldierID bLastTeamID = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; SoldierID cnt = pSoldier->ubID - 1; - for ( ; cnt >= bLastTeamID; --cnt ) + for ( ; cnt > bLastTeamID; --cnt ) { pTeamSoldier = cnt; if ( fOnlyRegularMercs ) @@ -4928,7 +4928,7 @@ SoldierID FindPrevActiveAndAliveMerc( SOLDIERTYPE *pSoldier, BOOLEAN fGoodForLes cnt = gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; // look for all mercs on the same team, - for ( ; cnt >= bLastTeamID; --cnt ) + for ( ; cnt > bLastTeamID; --cnt ) { pTeamSoldier = cnt; if ( fOnlyRegularMercs ) From 6a9df9f22cbec3da2ab481cf42388b0027aded84 Mon Sep 17 00:00:00 2001 From: kitty624 <58940527+kitty624@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:30:09 +0200 Subject: [PATCH 328/571] Fixes to npc-actions Pacos --- Tactical/Interface Dialogue.cpp | 5 +++-- Tactical/Overhead.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index d805af37..d9cc75fd 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -2353,7 +2353,8 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum break; case NPC_ACTION_HAVE_PACOS_FOLLOW: pSoldier = FindSoldierByProfileID( 114, FALSE ); - sGridNo = 18193; //dnl!!! + sGridNo = 8537; //dnl!!! + //kitty: changed gridno from 18193 to 8537, that's at entrance door to rebel basement, where Fatima and Dimitri dialogue happens if (pSoldier) { if (NewOKDestination( pSoldier, sGridNo, TRUE, 0 ) ) @@ -4331,7 +4332,7 @@ void HandleNPCDoAction( UINT8 ubTargetNPC, UINT16 usActionCode, UINT8 ubQuoteNum case NPC_ACTION_PUT_PACOS_IN_BASEMENT: gMercProfiles[ PACOS ].sSectorX = 10; gMercProfiles[ PACOS ].sSectorY = MAP_ROW_A; - gMercProfiles[ PACOS ].bSectorZ = 0; + gMercProfiles[ PACOS ].bSectorZ = 1; //kitty: fixed - first level underground is 1, not 0 break; case NPC_ACTION_HISTORY_ASSASSIN: AddHistoryToPlayersLog( HISTORY_ASSASSIN, 0, GetWorldTotalMin(), gWorldSectorX, gWorldSectorY ); diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 14cdf1ac..ad349607 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -7915,7 +7915,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if ( CheckFact( FACT_FIRST_BATTLE_BEING_FOUGHT, 0 ) ) { // ATE: Need to trigger record for this event .... for NPC scripting - TriggerNPCRecord( PACOS, 18 ); + TriggerNPCRecord( PACOS, 20 ); // this is our first battle... and we won! SetFactTrue( FACT_FIRST_BATTLE_FOUGHT ); From 9b83d6a3bc01677281929b1c657f2f876159d756 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Aug 2025 16:39:52 +0300 Subject: [PATCH 329/571] Increase squad amount to 40 --- Laptop/IMP Gear.cpp | 8 ++--- Strategic/Assignments.h | 20 +++++++++++ Tactical/Squads.h | 22 +++++++++++- Utils/_ChineseText.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ Utils/_DutchText.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ Utils/_EnglishText.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ Utils/_FrenchText.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ Utils/_GermanText.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ Utils/_ItalianText.cpp | 60 +++++++++++++++++++++++++++++++ Utils/_PolishText.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ Utils/_RussianText.cpp | 80 +++++++++++++++++++++++++++++++++++++++++ 11 files changed, 665 insertions(+), 5 deletions(-) diff --git a/Laptop/IMP Gear.cpp b/Laptop/IMP Gear.cpp index 0d84fb2f..af3dba56 100644 --- a/Laptop/IMP Gear.cpp +++ b/Laptop/IMP Gear.cpp @@ -269,7 +269,7 @@ void IMPGearDisplay( ) gIMPGearGun1 = currentWeapon; std::vector > entries; - entries.push_back(std::make_pair(0, pLongAssignmentStrings[40])); //Reusing AssignmentString for "Empty" text + entries.push_back(std::make_pair(0, pLongAssignmentStrings[60])); //Reusing AssignmentString for "Empty" text if (Item[gIMPGearGun1].usItemClass & IC_GUN) { @@ -321,7 +321,7 @@ void IMPGearDisplay( ) std::vector > entries; - entries.push_back(std::make_pair(0, pLongAssignmentStrings[40])); //Reusing AssignmentString for "Empty" text + entries.push_back(std::make_pair(0, pLongAssignmentStrings[60])); //Reusing AssignmentString for "Empty" text if (Item[gIMPGearGun2].usItemClass & IC_GUN) @@ -372,7 +372,7 @@ void IMPGearDisplay( ) gIMPGearGun3 = currentWeapon; std::vector > entries; - entries.push_back(std::make_pair(0, pLongAssignmentStrings[40])); //Reusing AssignmentString for "Empty" text + entries.push_back(std::make_pair(0, pLongAssignmentStrings[60])); //Reusing AssignmentString for "Empty" text if (Item[gIMPGearGun3].usItemClass & IC_GUN) { @@ -1272,7 +1272,7 @@ void DistributePossibleItemsToVectors(void) // it is always possible to not select something for (int i = 0; i < NUM_INV_SLOTS; ++i) { - gIMPPossibleItems[i].push_back(std::make_pair(0, pLongAssignmentStrings[40])); //Reusing AssignmentString for "Empty" text + gIMPPossibleItems[i].push_back(std::make_pair(0, pLongAssignmentStrings[60])); //Reusing AssignmentString for "Empty" text SetChoiceForPocket(i, 0, 1); // Initialize all selections to empty at first } diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index fe5c2c05..ad54843b 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -56,6 +56,26 @@ enum SQUAD_18, SQUAD_19, SQUAD_20, + SQUAD_21, + SQUAD_22, + SQUAD_23, + SQUAD_24, + SQUAD_25, + SQUAD_26, + SQUAD_27, + SQUAD_28, + SQUAD_29, + SQUAD_30, + SQUAD_31, + SQUAD_32, + SQUAD_33, + SQUAD_34, + SQUAD_35, + SQUAD_36, + SQUAD_37, + SQUAD_38, + SQUAD_39, + SQUAD_40, ON_DUTY, DOCTOR, PATIENT, diff --git a/Tactical/Squads.h b/Tactical/Squads.h index 904cc5db..a4a145c2 100644 --- a/Tactical/Squads.h +++ b/Tactical/Squads.h @@ -30,6 +30,26 @@ enum{ EIGTHTEENTH_SQUAD, NINTEENTH_SQUAD, TWENTYTH_SQUAD, + SQUAD_TWENTYONE, + SQUAD_TWENTYTWO, + SQUAD_TWENTYTHREE, + SQUAD_TWENTYFOUR, + SQUAD_TWENTYFIVE, + SQUAD_TWENTYSIX, + SQUAD_TWENTYSEVEN, + SQUAD_TWENTYEIGHT, + SQUAD_TWENTYNINE, + SQUAD_THIRTY, + SQUAD_THIRTYONE, + SQUAD_THIRTYTWO, + SQUAD_THIRTYTHREE, + SQUAD_THIRTYFOUR, + SQUAD_THIRTYFIVE, + SQUAD_THIRTYSIX, + SQUAD_THIRTYSEVEN, + SQUAD_THIRTYEIGHT, + SQUAD_THIRTYNINE, + SQUAD_FOURTY, NUMBER_OF_SQUADS, }; @@ -175,4 +195,4 @@ void CheckSquadMovementGroups( void ); //SQUAD10: Check for squads that are oversized at current resolution and move them to another squad void FixOversizedSquadsInSector( void ); -#endif \ No newline at end of file +#endif diff --git a/Utils/_ChineseText.cpp b/Utils/_ChineseText.cpp index 30fd7ce4..923dcc50 100644 --- a/Utils/_ChineseText.cpp +++ b/Utils/_ChineseText.cpp @@ -2433,6 +2433,26 @@ STR16 pAssignmentStrings[] = L"第18å°é˜Ÿ", L"第19å°é˜Ÿ", L"第20å°é˜Ÿ", + L"第21å°é˜Ÿ", + L"第22å°é˜Ÿ", + L"第23å°é˜Ÿ", + L"第24å°é˜Ÿ", + L"第25å°é˜Ÿ", + L"第26å°é˜Ÿ", + L"第27å°é˜Ÿ", + L"第28å°é˜Ÿ", + L"第29å°é˜Ÿ", + L"第30å°é˜Ÿ", + L"第31å°é˜Ÿ", + L"第32å°é˜Ÿ", + L"第33å°é˜Ÿ", + L"第34å°é˜Ÿ", + L"第35å°é˜Ÿ", + L"第36å°é˜Ÿ", + L"第37å°é˜Ÿ", + L"第38å°é˜Ÿ", + L"第39å°é˜Ÿ", + L"第40å°é˜Ÿ", L"编队",// on active duty L"医生",// administering medical aid L"病人", // getting medical aid @@ -2545,6 +2565,26 @@ STR16 pPersonnelAssignmentStrings[] = L"第18å°é˜Ÿ", L"第19å°é˜Ÿ", L"第20å°é˜Ÿ", + L"第21å°é˜Ÿ", + L"第22å°é˜Ÿ", + L"第23å°é˜Ÿ", + L"第24å°é˜Ÿ", + L"第25å°é˜Ÿ", + L"第26å°é˜Ÿ", + L"第27å°é˜Ÿ", + L"第28å°é˜Ÿ", + L"第29å°é˜Ÿ", + L"第30å°é˜Ÿ", + L"第31å°é˜Ÿ", + L"第32å°é˜Ÿ", + L"第33å°é˜Ÿ", + L"第34å°é˜Ÿ", + L"第35å°é˜Ÿ", + L"第36å°é˜Ÿ", + L"第37å°é˜Ÿ", + L"第38å°é˜Ÿ", + L"第39å°é˜Ÿ", + L"第40å°é˜Ÿ", L"编队", L"医生", L"病人", @@ -2615,6 +2655,26 @@ STR16 pLongAssignmentStrings[] = L"第18å°é˜Ÿ", L"第19å°é˜Ÿ", L"第20å°é˜Ÿ", + L"第21å°é˜Ÿ", + L"第22å°é˜Ÿ", + L"第23å°é˜Ÿ", + L"第24å°é˜Ÿ", + L"第25å°é˜Ÿ", + L"第26å°é˜Ÿ", + L"第27å°é˜Ÿ", + L"第28å°é˜Ÿ", + L"第29å°é˜Ÿ", + L"第30å°é˜Ÿ", + L"第31å°é˜Ÿ", + L"第32å°é˜Ÿ", + L"第33å°é˜Ÿ", + L"第34å°é˜Ÿ", + L"第35å°é˜Ÿ", + L"第36å°é˜Ÿ", + L"第37å°é˜Ÿ", + L"第38å°é˜Ÿ", + L"第39å°é˜Ÿ", + L"第40å°é˜Ÿ", L"编队", L"医生", L"病人", @@ -3064,6 +3124,26 @@ STR16 pSquadMenuStrings[] = L"第18å°é˜Ÿ", L"第19å°é˜Ÿ", L"第20å°é˜Ÿ", + L"第21å°é˜Ÿ", + L"第22å°é˜Ÿ", + L"第23å°é˜Ÿ", + L"第24å°é˜Ÿ", + L"第25å°é˜Ÿ", + L"第26å°é˜Ÿ", + L"第27å°é˜Ÿ", + L"第28å°é˜Ÿ", + L"第29å°é˜Ÿ", + L"第30å°é˜Ÿ", + L"第31å°é˜Ÿ", + L"第32å°é˜Ÿ", + L"第33å°é˜Ÿ", + L"第34å°é˜Ÿ", + L"第35å°é˜Ÿ", + L"第36å°é˜Ÿ", + L"第37å°é˜Ÿ", + L"第38å°é˜Ÿ", + L"第39å°é˜Ÿ", + L"第40å°é˜Ÿ", L"å–æ¶ˆ", }; diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index 4c56a70b..a4b8fd8f 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -2432,6 +2432,26 @@ STR16 pAssignmentStrings[] = L"Team 18", L"Team 19", L"Team 20", + L"Team 21", + L"Team 22", + L"Team 23", + L"Team 24", + L"Team 25", + L"Team 26", + L"Team 27", + L"Team 28", + L"Team 29", + L"Team 30", + L"Team 31", + L"Team 32", + L"Team 33", + L"Team 34", + L"Team 35", + L"Team 36", + L"Team 37", + L"Team 38", + L"Team 39", + L"Team 40", L"Dienst", // on active duty L"Dokter", // administering medical aid L"Patiënt", // getting medical aid @@ -2544,6 +2564,26 @@ STR16 pPersonnelAssignmentStrings[] = L"Team 18", L"Team 19", L"Team 20", + L"Team 21", + L"Team 22", + L"Team 23", + L"Team 24", + L"Team 25", + L"Team 26", + L"Team 27", + L"Team 28", + L"Team 29", + L"Team 30", + L"Team 31", + L"Team 32", + L"Team 33", + L"Team 34", + L"Team 35", + L"Team 36", + L"Team 37", + L"Team 38", + L"Team 39", + L"Team 40", L"Dienst", // on active duty L"Dokter", // administering medical aid L"Patiënt", // getting medical aid @@ -2614,6 +2654,26 @@ STR16 pLongAssignmentStrings[] = L"Team 18", L"Team 19", L"Team 20", + L"Team 21", + L"Team 22", + L"Team 23", + L"Team 24", + L"Team 25", + L"Team 26", + L"Team 27", + L"Team 28", + L"Team 29", + L"Team 30", + L"Team 31", + L"Team 32", + L"Team 33", + L"Team 34", + L"Team 35", + L"Team 36", + L"Team 37", + L"Team 38", + L"Team 39", + L"Team 40", L"Dienst", // on active duty L"Dokter", // administering medical aid L"Patiënt", // getting medical aid @@ -3065,6 +3125,26 @@ STR16 pSquadMenuStrings[] = L"Team 18", L"Team 19", L"Team 20", + L"Team 21", + L"Team 22", + L"Team 23", + L"Team 24", + L"Team 25", + L"Team 26", + L"Team 27", + L"Team 28", + L"Team 29", + L"Team 30", + L"Team 31", + L"Team 32", + L"Team 33", + L"Team 34", + L"Team 35", + L"Team 36", + L"Team 37", + L"Team 38", + L"Team 39", + L"Team 40", L"Stop", }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 820bef40..5d9d07a4 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -2433,6 +2433,26 @@ STR16 pAssignmentStrings[] = L"Squad 18", L"Squad 19", L"Squad 20", + L"Squad 21", + L"Squad 22", + L"Squad 23", + L"Squad 24", + L"Squad 25", + L"Squad 26", + L"Squad 27", + L"Squad 28", + L"Squad 29", + L"Squad 30", + L"Squad 31", + L"Squad 32", + L"Squad 33", + L"Squad 34", + L"Squad 35", + L"Squad 36", + L"Squad 37", + L"Squad 38", + L"Squad 39", + L"Squad 40", L"On Duty", // on active duty L"Doctor", // administering medical aid L"Patient", // getting medical aid @@ -2545,6 +2565,26 @@ STR16 pPersonnelAssignmentStrings[] = L"Squad 18", L"Squad 19", L"Squad 20", + L"Squad 21", + L"Squad 22", + L"Squad 23", + L"Squad 24", + L"Squad 25", + L"Squad 26", + L"Squad 27", + L"Squad 28", + L"Squad 29", + L"Squad 30", + L"Squad 31", + L"Squad 32", + L"Squad 33", + L"Squad 34", + L"Squad 35", + L"Squad 36", + L"Squad 37", + L"Squad 38", + L"Squad 39", + L"Squad 40", L"On Duty", L"Doctor", L"Patient", @@ -2615,6 +2655,26 @@ STR16 pLongAssignmentStrings[] = L"Squad 18", L"Squad 19", L"Squad 20", + L"Squad 21", + L"Squad 22", + L"Squad 23", + L"Squad 24", + L"Squad 25", + L"Squad 26", + L"Squad 27", + L"Squad 28", + L"Squad 29", + L"Squad 30", + L"Squad 31", + L"Squad 32", + L"Squad 33", + L"Squad 34", + L"Squad 35", + L"Squad 36", + L"Squad 37", + L"Squad 38", + L"Squad 39", + L"Squad 40", L"On Duty", L"Doctor", L"Patient", @@ -3064,6 +3124,26 @@ STR16 pSquadMenuStrings[] = L"Squad 18", L"Squad 19", L"Squad 20", + L"Squad 21", + L"Squad 22", + L"Squad 23", + L"Squad 24", + L"Squad 25", + L"Squad 26", + L"Squad 27", + L"Squad 28", + L"Squad 29", + L"Squad 30", + L"Squad 31", + L"Squad 32", + L"Squad 33", + L"Squad 34", + L"Squad 35", + L"Squad 36", + L"Squad 37", + L"Squad 38", + L"Squad 39", + L"Squad 40", L"Cancel", }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 77fc295f..60a785b6 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -2441,6 +2441,26 @@ STR16 pAssignmentStrings[] = L"Esc. 18", L"Esc. 19", L"Esc. 20", + L"Esc. 21", + L"Esc. 22", + L"Esc. 23", + L"Esc. 24", + L"Esc. 25", + L"Esc. 26", + L"Esc. 27", + L"Esc. 28", + L"Esc. 29", + L"Esc. 30", + L"Esc. 31", + L"Esc. 32", + L"Esc. 33", + L"Esc. 34", + L"Esc. 35", + L"Esc. 36", + L"Esc. 37", + L"Esc. 38", + L"Esc. 39", + L"Esc. 40", L"Service", // on active duty L"Docteur", // administering medical aid L"Patient(e)", // getting medical aid @@ -2553,6 +2573,26 @@ STR16 pPersonnelAssignmentStrings[] = L"Esc. 18", L"Esc. 19", L"Esc. 20", + L"Esc. 21", + L"Esc. 22", + L"Esc. 23", + L"Esc. 24", + L"Esc. 25", + L"Esc. 26", + L"Esc. 27", + L"Esc. 28", + L"Esc. 29", + L"Esc. 30", + L"Esc. 31", + L"Esc. 32", + L"Esc. 33", + L"Esc. 34", + L"Esc. 35", + L"Esc. 36", + L"Esc. 37", + L"Esc. 38", + L"Esc. 39", + L"Esc. 40", L"Service", L"Docteur", L"Patient", @@ -2623,6 +2663,26 @@ STR16 pLongAssignmentStrings[] = L"Esc. 18", L"Esc. 19", L"Esc. 20", + L"Esc. 21", + L"Esc. 22", + L"Esc. 23", + L"Esc. 24", + L"Esc. 25", + L"Esc. 26", + L"Esc. 27", + L"Esc. 28", + L"Esc. 29", + L"Esc. 30", + L"Esc. 31", + L"Esc. 32", + L"Esc. 33", + L"Esc. 34", + L"Esc. 35", + L"Esc. 36", + L"Esc. 37", + L"Esc. 38", + L"Esc. 39", + L"Esc. 40", L"Service", L"Docteur", L"Patient", @@ -3072,6 +3132,26 @@ STR16 pSquadMenuStrings[] = L"Esc. 18", L"Esc. 19", L"Esc. 20", + L"Esc. 21", + L"Esc. 22", + L"Esc. 23", + L"Esc. 24", + L"Esc. 25", + L"Esc. 26", + L"Esc. 27", + L"Esc. 28", + L"Esc. 29", + L"Esc. 30", + L"Esc. 31", + L"Esc. 32", + L"Esc. 33", + L"Esc. 34", + L"Esc. 35", + L"Esc. 36", + L"Esc. 37", + L"Esc. 38", + L"Esc. 39", + L"Esc. 40", L"Annuler", }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index 62bc2deb..c6eb5f45 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -2472,6 +2472,26 @@ STR16 pAssignmentStrings[] = L"Trupp 18", L"Trupp 19", L"Trupp 20", + L"Trupp 21", + L"Trupp 22", + L"Trupp 23", + L"Trupp 24", + L"Trupp 25", + L"Trupp 26", + L"Trupp 27", + L"Trupp 28", + L"Trupp 29", + L"Trupp 30", + L"Trupp 31", + L"Trupp 32", + L"Trupp 33", + L"Trupp 34", + L"Trupp 35", + L"Trupp 36", + L"Trupp 37", + L"Trupp 38", + L"Trupp 39", + L"Trupp 40", L"Dienst", // on active duty L"Doktor", // administering medical aid L"Patient", // getting medical aid @@ -2580,6 +2600,26 @@ STR16 pPersonnelAssignmentStrings[] = L"Trupp 18", L"Trupp 19", L"Trupp 20", + L"Trupp 21", + L"Trupp 22", + L"Trupp 23", + L"Trupp 24", + L"Trupp 25", + L"Trupp 26", + L"Trupp 27", + L"Trupp 28", + L"Trupp 29", + L"Trupp 30", + L"Trupp 31", + L"Trupp 32", + L"Trupp 33", + L"Trupp 34", + L"Trupp 35", + L"Trupp 36", + L"Trupp 37", + L"Trupp 38", + L"Trupp 39", + L"Trupp 40", L"Dienst", L"Doktor", L"Patient", @@ -2648,6 +2688,26 @@ STR16 pLongAssignmentStrings[] = L"Trupp 18", L"Trupp 19", L"Trupp 20", + L"Trupp 21", + L"Trupp 22", + L"Trupp 23", + L"Trupp 24", + L"Trupp 25", + L"Trupp 26", + L"Trupp 27", + L"Trupp 28", + L"Trupp 29", + L"Trupp 30", + L"Trupp 31", + L"Trupp 32", + L"Trupp 33", + L"Trupp 34", + L"Trupp 35", + L"Trupp 36", + L"Trupp 37", + L"Trupp 38", + L"Trupp 39", + L"Trupp 40", L"Dienst", L"Doktor", L"Patient", @@ -3093,6 +3153,26 @@ STR16 pSquadMenuStrings[] = L"Trupp 18", L"Trupp 19", L"Trupp 20", + L"Trupp 21", + L"Trupp 22", + L"Trupp 23", + L"Trupp 24", + L"Trupp 25", + L"Trupp 26", + L"Trupp 27", + L"Trupp 28", + L"Trupp 29", + L"Trupp 30", + L"Trupp 31", + L"Trupp 32", + L"Trupp 33", + L"Trupp 34", + L"Trupp 35", + L"Trupp 36", + L"Trupp 37", + L"Trupp 38", + L"Trupp 39", + L"Trupp 40", L"Abbrechen", }; diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 1968ae29..a65c4ae3 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -2539,6 +2539,26 @@ STR16 pPersonnelAssignmentStrings[] = L"Squadra 18", L"Squadra 19", L"Squadra 20", + L"Squadra 21", + L"Squadra 22", + L"Squadra 23", + L"Squadra 24", + L"Squadra 25", + L"Squadra 26", + L"Squadra 27", + L"Squadra 28", + L"Squadra 29", + L"Squadra 30", + L"Squadra 31", + L"Squadra 32", + L"Squadra 33", + L"Squadra 34", + L"Squadra 35", + L"Squadra 36", + L"Squadra 37", + L"Squadra 38", + L"Squadra 39", + L"Squadra 40", L"In servizio", L"Dottore", L"Paziente", @@ -2609,6 +2629,26 @@ STR16 pLongAssignmentStrings[] = L"Squadra 18", L"Squadra 19", L"Squadra 20", + L"Squadra 21", + L"Squadra 22", + L"Squadra 23", + L"Squadra 24", + L"Squadra 25", + L"Squadra 26", + L"Squadra 27", + L"Squadra 28", + L"Squadra 29", + L"Squadra 30", + L"Squadra 31", + L"Squadra 32", + L"Squadra 33", + L"Squadra 34", + L"Squadra 35", + L"Squadra 36", + L"Squadra 37", + L"Squadra 38", + L"Squadra 39", + L"Squadra 40", L"In servizio", L"Dottore", L"Paziente", @@ -3060,6 +3100,26 @@ STR16 pSquadMenuStrings[] = L"Squadra 18", L"Squadra 19", L"Squadra 20", + L"Squadra 21", + L"Squadra 22", + L"Squadra 23", + L"Squadra 24", + L"Squadra 25", + L"Squadra 26", + L"Squadra 27", + L"Squadra 28", + L"Squadra 29", + L"Squadra 30", + L"Squadra 31", + L"Squadra 32", + L"Squadra 33", + L"Squadra 34", + L"Squadra 35", + L"Squadra 36", + L"Squadra 37", + L"Squadra 38", + L"Squadra 39", + L"Squadra 40", L"Annulla", }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 379f3f5a..3285ad37 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -2439,6 +2439,26 @@ STR16 pAssignmentStrings[] = L"Oddz. 18", L"Oddz. 19", L"Oddz. 20", + L"Oddz. 21", + L"Oddz. 22", + L"Oddz. 23", + L"Oddz. 24", + L"Oddz. 25", + L"Oddz. 26", + L"Oddz. 27", + L"Oddz. 28", + L"Oddz. 29", + L"Oddz. 30", + L"Oddz. 31", + L"Oddz. 32", + L"Oddz. 33", + L"Oddz. 34", + L"Oddz. 35", + L"Oddz. 36", + L"Oddz. 37", + L"Oddz. 38", + L"Oddz. 39", + L"Oddz. 40", L"SÅ‚użba", // on active duty L"Lekarz", // administering medical aid L"Pacjent", // getting medical aid @@ -2551,6 +2571,26 @@ STR16 pPersonnelAssignmentStrings[] = L"Oddz. 18", L"Oddz. 19", L"Oddz. 20", + L"Oddz. 21", + L"Oddz. 22", + L"Oddz. 23", + L"Oddz. 24", + L"Oddz. 25", + L"Oddz. 26", + L"Oddz. 27", + L"Oddz. 28", + L"Oddz. 29", + L"Oddz. 30", + L"Oddz. 31", + L"Oddz. 32", + L"Oddz. 33", + L"Oddz. 34", + L"Oddz. 35", + L"Oddz. 36", + L"Oddz. 37", + L"Oddz. 38", + L"Oddz. 39", + L"Oddz. 40", L"SÅ‚użba", L"Lekarz", L"Pacjent", @@ -2621,6 +2661,26 @@ STR16 pLongAssignmentStrings[] = L"OddziaÅ‚ 18", L"OddziaÅ‚ 19", L"OddziaÅ‚ 20", + L"OddziaÅ‚ 21", + L"OddziaÅ‚ 22", + L"OddziaÅ‚ 23", + L"OddziaÅ‚ 24", + L"OddziaÅ‚ 25", + L"OddziaÅ‚ 26", + L"OddziaÅ‚ 27", + L"OddziaÅ‚ 28", + L"OddziaÅ‚ 29", + L"OddziaÅ‚ 30", + L"OddziaÅ‚ 31", + L"OddziaÅ‚ 32", + L"OddziaÅ‚ 33", + L"OddziaÅ‚ 34", + L"OddziaÅ‚ 35", + L"OddziaÅ‚ 36", + L"OddziaÅ‚ 37", + L"OddziaÅ‚ 38", + L"OddziaÅ‚ 39", + L"OddziaÅ‚ 40", L"SÅ‚użba", L"Lekarz", L"Pacjent", @@ -3070,6 +3130,26 @@ STR16 pSquadMenuStrings[] = L"OddziaÅ‚ 18", L"OddziaÅ‚ 19", L"OddziaÅ‚ 20", + L"OddziaÅ‚ 21", + L"OddziaÅ‚ 22", + L"OddziaÅ‚ 23", + L"OddziaÅ‚ 24", + L"OddziaÅ‚ 25", + L"OddziaÅ‚ 26", + L"OddziaÅ‚ 27", + L"OddziaÅ‚ 28", + L"OddziaÅ‚ 29", + L"OddziaÅ‚ 30", + L"OddziaÅ‚ 31", + L"OddziaÅ‚ 32", + L"OddziaÅ‚ 33", + L"OddziaÅ‚ 34", + L"OddziaÅ‚ 35", + L"OddziaÅ‚ 36", + L"OddziaÅ‚ 37", + L"OddziaÅ‚ 38", + L"OddziaÅ‚ 39", + L"OddziaÅ‚ 40", L"Anuluj", }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 9b9b99e2..bea56f5e 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -2433,6 +2433,26 @@ STR16 pAssignmentStrings[] = L"ОтрÑд 18", L"ОтрÑд 19", L"ОтрÑд 20", + L"ОтрÑд 21", + L"ОтрÑд 22", + L"ОтрÑд 23", + L"ОтрÑд 24", + L"ОтрÑд 25", + L"ОтрÑд 26", + L"ОтрÑд 27", + L"ОтрÑд 28", + L"ОтрÑд 29", + L"ОтрÑд 30", + L"ОтрÑд 31", + L"ОтрÑд 32", + L"ОтрÑд 33", + L"ОтрÑд 34", + L"ОтрÑд 35", + L"ОтрÑд 36", + L"ОтрÑд 37", + L"ОтрÑд 38", + L"ОтрÑд 39", + L"ОтрÑд 40", L"Ðа Ñлужбе", // on active duty L"Медик", // administering medical aid L"Пациент", // getting medical aid @@ -2545,6 +2565,26 @@ STR16 pPersonnelAssignmentStrings[] = L"ОтрÑд 18", L"ОтрÑд 19", L"ОтрÑд 20", + L"ОтрÑд 21", + L"ОтрÑд 22", + L"ОтрÑд 23", + L"ОтрÑд 24", + L"ОтрÑд 25", + L"ОтрÑд 26", + L"ОтрÑд 27", + L"ОтрÑд 28", + L"ОтрÑд 29", + L"ОтрÑд 30", + L"ОтрÑд 31", + L"ОтрÑд 32", + L"ОтрÑд 33", + L"ОтрÑд 34", + L"ОтрÑд 35", + L"ОтрÑд 36", + L"ОтрÑд 37", + L"ОтрÑд 38", + L"ОтрÑд 39", + L"ОтрÑд 40", L"Ðа Ñлужбе", L"Медик", L"Пациент", @@ -2615,6 +2655,26 @@ STR16 pLongAssignmentStrings[] = L"ОтрÑд 18", L"ОтрÑд 19", L"ОтрÑд 20", + L"ОтрÑд 21", + L"ОтрÑд 22", + L"ОтрÑд 23", + L"ОтрÑд 24", + L"ОтрÑд 25", + L"ОтрÑд 26", + L"ОтрÑд 27", + L"ОтрÑд 28", + L"ОтрÑд 29", + L"ОтрÑд 30", + L"ОтрÑд 31", + L"ОтрÑд 32", + L"ОтрÑд 33", + L"ОтрÑд 34", + L"ОтрÑд 35", + L"ОтрÑд 36", + L"ОтрÑд 37", + L"ОтрÑд 38", + L"ОтрÑд 39", + L"ОтрÑд 40", L"Ðа Ñлужбе", L"Медик", L"Пациент", @@ -3064,6 +3124,26 @@ STR16 pSquadMenuStrings[] = L"ОтрÑд 18", L"ОтрÑд 19", L"ОтрÑд 20", + L"ОтрÑд 21", + L"ОтрÑд 22", + L"ОтрÑд 23", + L"ОтрÑд 24", + L"ОтрÑд 25", + L"ОтрÑд 26", + L"ОтрÑд 27", + L"ОтрÑд 28", + L"ОтрÑд 29", + L"ОтрÑд 30", + L"ОтрÑд 31", + L"ОтрÑд 32", + L"ОтрÑд 33", + L"ОтрÑд 34", + L"ОтрÑд 35", + L"ОтрÑд 36", + L"ОтрÑд 37", + L"ОтрÑд 38", + L"ОтрÑд 39", + L"ОтрÑд 40", L"Отмена", }; From d078a3439f1241b53b00ec58548201af0e7d2a93 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Aug 2025 17:01:13 +0300 Subject: [PATCH 330/571] Fix squad movement popupbox for increased squads --- Strategic/Map Screen Interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 4b3c4479..0e85e45a 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -3777,7 +3777,7 @@ void AddStringsToMoveBox( void ) CHAR16 sString[ 128 ], sStringB[ 128 ]; UINT32 hStringHandle; BOOLEAN fFirstOne = TRUE; - const INT32 columnMaxEntries = 5 * gGameOptions.ubSquadSize; + const INT32 columnMaxEntries = 40; INT32 entries = 0; bool isFirstColumnFull = false; bool secondColumnFull = false; From 63f614f957f087fce4cafa4b7f342763bd74f2a3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Aug 2025 17:41:40 +0300 Subject: [PATCH 331/571] Add FLAGS64 typedef --- sgp/Types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sgp/Types.h b/sgp/Types.h index 6c304ad3..a0b14a31 100644 --- a/sgp/Types.h +++ b/sgp/Types.h @@ -52,7 +52,8 @@ typedef CHAR16 * STR16; // flags (individual bits used) typedef unsigned char FLAGS8; typedef unsigned short FLAGS16; -typedef unsigned long FLAGS32; +typedef unsigned long FLAGS32; +typedef UINT64 FLAGS64; // other typedef unsigned char BOOLEAN; typedef void * PTR; From c78f8faefc19efb6071770bbc55ac6b6e2f9080b Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Aug 2025 17:41:51 +0300 Subject: [PATCH 332/571] Whitespace changes --- sgp/Types.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sgp/Types.h b/sgp/Types.h index a0b14a31..5ccea912 100644 --- a/sgp/Types.h +++ b/sgp/Types.h @@ -29,38 +29,38 @@ // HEY WIZARDRY DUDES, JA2 ISN'T THE ONLY PROGRAM WE COMPILE! :-) -typedef unsigned int UINT32; -typedef signed __int64 INT64; // WANNE - BMP: Used for Big Maps -typedef signed int INT32; +typedef unsigned int UINT32; +typedef signed __int64 INT64; // WANNE - BMP: Used for Big Maps +typedef signed int INT32; typedef unsigned __int64 UINT64; //typedef unsigned long long UINT128; //Madd: Doing away with this redundant type // integers typedef unsigned char UINT8; -typedef signed char INT8; +typedef signed char INT8; typedef unsigned short UINT16; typedef signed short INT16; // floats typedef float FLOAT; typedef double DOUBLE; // strings -typedef char CHAR8; -typedef wchar_t CHAR16; -typedef CHAR8 * STR; -typedef CHAR8 * STR8; -typedef CHAR16 * STR16; +typedef char CHAR8; +typedef wchar_t CHAR16; +typedef CHAR8 * STR; +typedef CHAR8 * STR8; +typedef CHAR16 * STR16; // flags (individual bits used) -typedef unsigned char FLAGS8; +typedef unsigned char FLAGS8; typedef unsigned short FLAGS16; typedef unsigned long FLAGS32; typedef UINT64 FLAGS64; // other -typedef unsigned char BOOLEAN; -typedef void * PTR; +typedef unsigned char BOOLEAN; +typedef void * PTR; typedef unsigned short HNDL; -typedef UINT8 BYTE; -typedef CHAR8 STRING512[512]; -typedef UINT32 HWFILE; +typedef UINT8 BYTE; +typedef CHAR8 STRING512[512]; +typedef UINT32 HWFILE; #define SGPFILENAME_LEN 100 typedef CHAR8 SGPFILENAME[SGPFILENAME_LEN]; From b7bfd8a2eb94e9f10fd22c5bbb6387ab20e18ac3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Aug 2025 17:42:25 +0300 Subject: [PATCH 333/571] Use FLAGS64 for flagmasks --- Tactical/Item Types.h | 4 ++-- Tactical/Items.cpp | 6 +++--- Tactical/Items.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 67600237..98f57ded 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -1052,8 +1052,8 @@ typedef struct UINT64 nasLayoutClass; UINT64 ulAvailableAttachmentPoint; UINT64 ulAttachmentPoint; - UINT64 usItemFlag; // bitflags to store various item properties (better than introducing 64 BOOLEAN values). If I only had thought of this earlier.... - UINT64 usItemFlag2; // bitflags to store various item properties + FLAGS64 usItemFlag; // bitflags to store various item properties (better than introducing 64 BOOLEAN values). If I only had thought of this earlier.... + FLAGS64 usItemFlag2; // bitflags to store various item properties UINT32 uiIndex; UINT32 usItemClass; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index c88fd215..645ba111 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -15249,18 +15249,18 @@ void CheckBombSpecifics( OBJECTTYPE * pObj, INT8* detonatortype, INT8* setting, } // Flugente: check for specific flags -BOOLEAN HasItemFlag( UINT16 usItem, UINT64 aFlag ) +BOOLEAN HasItemFlag( UINT16 usItem, FLAGS64 aFlag ) { return( (Item[usItem].usItemFlag & aFlag) != 0 ); } -BOOLEAN HasItemFlag2(UINT16 usItem, UINT64 aFlag) +BOOLEAN HasItemFlag2(UINT16 usItem, FLAGS64 aFlag) { return((Item[usItem].usItemFlag2 & aFlag) != 0); } // Flugente: get first item number that has this flag. Use with caution, as we search in all items -BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag ) +BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, FLAGS64 aFlag ) { UINT16 i; for ( i = 1; i < gMAXITEMS_READ; ++i ) diff --git a/Tactical/Items.h b/Tactical/Items.h index fe9465b1..9b533363 100644 --- a/Tactical/Items.h +++ b/Tactical/Items.h @@ -566,11 +566,11 @@ UINT64 GetAvailableAttachmentPoint ( OBJECTTYPE * pObject, UINT8 subObject ); void CheckBombSpecifics( OBJECTTYPE * pObj, INT8* detonatortype, INT8* setting, INT8* defusefrequency ); // Flugente: check for specific flags -BOOLEAN HasItemFlag(UINT16 usItem, UINT64 aFlag); -BOOLEAN HasItemFlag2(UINT16 usItem, UINT64 aFlag); +BOOLEAN HasItemFlag(UINT16 usItem, FLAGS64 aFlag); +BOOLEAN HasItemFlag2(UINT16 usItem, FLAGS64 aFlag); // Flugente: get first item number that has this flag. Use with caution, as we search in all items -BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, UINT64 aFlag ); +BOOLEAN GetFirstItemWithFlag( UINT16* pusItem, FLAGS64 aFlag ); // Flugente: check if this object is currently fed from an external source (belts in inventory, other mercs) BOOLEAN ObjectIsBeingFedExternal(SOLDIERTYPE* pSoldier, OBJECTTYPE * pObject); From fd9611ae0407c909bfccc1a5968aba4cced50365 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Aug 2025 18:38:53 +0300 Subject: [PATCH 334/571] Remove compiler warnings --- Tactical/Civ Quotes.cpp | 2 +- Tactical/Items.cpp | 2 +- Tactical/LOS.cpp | 6 +++--- Tactical/Soldier Control.cpp | 6 +++--- TacticalAI/AIMain.cpp | 11 +++++------ TileEngine/Explosion Control.cpp | 4 ++-- TileEngine/SmokeEffects.cpp | 2 +- TileEngine/physics.cpp | 2 +- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 589c8643..418b1443 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -2308,7 +2308,7 @@ BOOLEAN PlayVoiceTaunt(SOLDIERTYPE *pCiv, TAUNTTYPE iTauntType, SOLDIERTYPE *pTa if ((OutFile = fopen("VoiceTauntLog.txt", "a+t")) != NULL) { fprintf(OutFile, "Soldier [%d] TauntType %d %s\n", - pCiv->ubID, + pCiv->ubID.i, iTauntType, filename); fclose(OutFile); diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index a6a0923d..b0a4ce8b 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -9316,7 +9316,7 @@ BOOLEAN DamageItemOnGround( OBJECTTYPE * pObject, INT32 sGridNo, INT8 bLevel, IN { #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"DamageItemOnGround ( usItem : %i , sGridNo : %i , bLevel : %i , iDamage : %i , ubOwner : %i )\n",pObject->usItem, sGridNo , bLevel , iDamage , ubOwner ); + sprintf(tmpMPDbgString,"DamageItemOnGround ( usItem : %i , sGridNo : %i , bLevel : %i , iDamage : %i , ubOwner : %i )\n",pObject->usItem, sGridNo , bLevel , iDamage , ubOwner.i ); MPDebugMsg(tmpMPDbgString); #endif diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 044e99fc..230df008 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -5639,7 +5639,7 @@ INT8 FireBulletGivenTarget( SOLDIERTYPE * pFirer, FLOAT dEndX, FLOAT dEndY, FLOA fprintf(OutFile, "{ % 9.8f , % 9.8f , % 9.8f , % 9.8f }, //DEBUG: merc %4d fired pellet %4d of %4d using method %4d %12s with SpreadPattern %4d %s\n", ddRawHorizAngle, ddRawVerticAngle, ddHorizAngle, ddVerticAngle, - pFirer->ubID, ubLoop, ubShots, + pFirer->ubID.i, ubLoop, ubShots, gpSpreadPattern[ubSpreadIndex].method, gSpreadPatternMethodNames[gpSpreadPattern[ubSpreadIndex].method], ubSpreadIndex, gpSpreadPattern[ubSpreadIndex].Name ); @@ -6284,7 +6284,7 @@ INT8 FireBulletGivenTargetTrapOnly( SOLDIERTYPE* pThrower, OBJECTTYPE* pObj, INT fprintf(OutFile, "{ % 9.8f , % 9.8f , % 9.8f , % 9.8f }, //DEBUG: merc %4d fired pellet %4d of %4d using method %4d %12s with SpreadPattern %4d %s\n", ddRawHorizAngle, ddRawVerticAngle, ddHorizAngle, ddVerticAngle, - NOBODY, ubLoop, ubShots, + NOBODY.i, ubLoop, ubShots, gpSpreadPattern[ubSpreadIndex].method, gSpreadPatternMethodNames[gpSpreadPattern[ubSpreadIndex].method], ubSpreadIndex, gpSpreadPattern[ubSpreadIndex].Name ); @@ -6834,7 +6834,7 @@ INT8 FireBulletGivenTarget_NoObjectNoSoldier( UINT16 usItem, UINT8 ammotype, UIN fprintf( OutFile, "{ % 9.8f , % 9.8f , % 9.8f , % 9.8f }, //DEBUG: merc %4d fired pellet %4d of %4d using method %4d %12s with SpreadPattern %4d %s\n", ddRawHorizAngle, ddRawVerticAngle, ddHorizAngle, ddVerticAngle, - NOBODY, ubLoop, ubShots, + NOBODY.i, ubLoop, ubShots, gpSpreadPattern[ubSpreadIndex].method, gSpreadPatternMethodNames[gpSpreadPattern[ubSpreadIndex].method], ubSpreadIndex, gpSpreadPattern[ubSpreadIndex].Name ); diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 5341dad7..1d7d0b6e 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -23977,13 +23977,13 @@ void DebugValidateSoldierData( ) !(pSoldier->flags.uiStatusFlags & (SOLDIER_DRIVER | SOLDIER_PASSENGER)) ) { // This is bad! - swprintf( sString, L"Soldier Data Error: Soldier %d is alive but has a zero group ID.", cnt ); + swprintf( sString, L"Soldier Data Error: Soldier %d is alive but has a zero group ID.", cnt.i ); fProblemDetected = TRUE; } else if ( (pSoldier->ubGroupID != 0) && (GetGroup( pSoldier->ubGroupID ) == NULL) ) { // This is bad! - swprintf( sString, L"Soldier Data Error: Soldier %d has an invalid group ID of %d.", cnt, pSoldier->ubGroupID ); + swprintf( sString, L"Soldier Data Error: Soldier %d has an invalid group ID of %d.", cnt.i, pSoldier->ubGroupID ); fProblemDetected = TRUE; } } @@ -24003,7 +24003,7 @@ void DebugValidateSoldierData( ) (pSoldier->sSectorY <= 0) || (pSoldier->sSectorY >= 17) || (pSoldier->bSectorZ < 0) || (pSoldier->bSectorZ > (SPY_LOCATION( pSoldier->bAssignment ) ? 13 : 3) ) ) ) { - swprintf( sString, L"Soldier Data Error: Soldier %d is located at %d/%d/%d.", cnt, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); + swprintf( sString, L"Soldier Data Error: Soldier %d is located at %d/%d/%d.", cnt.i, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ ); fProblemDetected = TRUE; } } diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index 51ea4558..c342c478 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -235,7 +235,7 @@ void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction ) sprintf(msg, ""); - sprintf(buf, "[%d] (%d)", pSoldier->ubID, pSoldier->sGridNo); + sprintf(buf, "[%d] (%d)", pSoldier->ubID.i, pSoldier->sGridNo); strcat(msg, buf); if (pSoldier->ubProfile != NO_PROFILE) @@ -301,7 +301,7 @@ void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction ) } // also log to individual file for selected soldier - sprintf(buf, "Logs\\AI_Decisions [%d].txt", pSoldier->ubID); + sprintf(buf, "Logs\\AI_Decisions [%d].txt", pSoldier->ubID.i); if ((DebugFile = fopen(buf, "a+t")) != NULL) { if (bMsgType == AI_MSG_START) @@ -697,19 +697,18 @@ void HandleSoldierAI( SOLDIERTYPE *pSoldier ) // FIXME - this function is named // ATE: Display message that deadlock occured... LiveMessage( "Breaking Deadlock" ); - ScreenMsg(FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Aborting AI deadlock for [%d] %s %s data %d", pSoldier->ubID, pSoldier->GetName(), utf8_to_wstring(std::string(szAction[pSoldier->aiData.bAction])), pSoldier->aiData.usActionData); + ScreenMsg(FONT_MCOLOR_LTRED, MSG_INTERFACE, L"Aborting AI deadlock for [%d] %s %s data %d", pSoldier->ubID.i, pSoldier->GetName(), utf8_to_wstring(std::string(szAction[pSoldier->aiData.bAction])), pSoldier->aiData.usActionData); DebugAI(String("Aborting AI deadlock for [%d] %s data %d", pSoldier->ubID, szAction[pSoldier->aiData.bAction], pSoldier->aiData.usActionData)); #ifdef JA2TESTVERSION // display deadlock message gfUIInDeadlock = TRUE; - gUIDeadlockedSoldier = pSoldier->ubID; - DebugAI( String("DEADLOCK soldier %d action %s ABC %d", pSoldier->ubID, gzActionStr[pSoldier->aiData.bAction], gTacticalStatus.ubAttackBusyCount ) ); + DebugAI( String("DEADLOCK soldier %d action %s ABC %d", pSoldier->ubID.i, gzActionStr[pSoldier->aiData.bAction], gTacticalStatus.ubAttackBusyCount ) ); #else // If we are in beta version, also report message! #ifdef JA2BETAVERSION - ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_ERROR, L"Aborting AI deadlock for %d. Please sent DEBUG.TXT file and SAVE.", pSoldier->ubID ); + ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_ERROR, L"Aborting AI deadlock for %d. Please sent DEBUG.TXT file and SAVE.", pSoldier->ubID.i ); #endif // just abort EndAIDeadlock(); diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index d64a7526..03b88c2a 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -2168,7 +2168,7 @@ BOOLEAN ExpAffect( INT32 sBombGridNo, INT32 sGridNo, UINT32 uiDist, UINT16 usIte #ifdef JA2BETAVERSION if (is_networked) { CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"ExpAffect ( sBombGridNo : %i , sGridNo : %i , uiDist : %i , usItem : %i , ubOwner : %i , sSubsequent : %i , fMercHit : %i , bLevel : %i , iSmokeEffectID : %i )\n",sBombGridNo, sGridNo , uiDist , usItem , ubOwner , sSubsequent , (int)*pfMercHit , bLevel , iSmokeEffectID ); + sprintf(tmpMPDbgString,"ExpAffect ( sBombGridNo : %i , sGridNo : %i , uiDist : %i , usItem : %i , ubOwner : %i , sSubsequent : %i , fMercHit : %i , bLevel : %i , iSmokeEffectID : %i )\n",sBombGridNo, sGridNo , uiDist , usItem , ubOwner.i , sSubsequent , (int)*pfMercHit , bLevel , iSmokeEffectID ); MPDebugMsg(tmpMPDbgString); } #endif @@ -2953,7 +2953,7 @@ void SpreadEffect( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, SoldierID ubOwn } #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString,"SpreadEffect ( sGridNo : %i , ubRadius : %i , usItem : %i , ubOwner : %i , fSubsequent : %i , bLevel : %i , iSmokeEffectID : %i , fFromRemote : %i , fNewSmoke : %i )\n",sGridNo, ubRadius , usItem , ubOwner , (int)fSubsequent , bLevel , iSmokeEffectID , fFromRemoteClient , fNewSmokeEffect ); + sprintf(tmpMPDbgString,"SpreadEffect ( sGridNo : %i , ubRadius : %i , usItem : %i , ubOwner : %i , fSubsequent : %i , bLevel : %i , iSmokeEffectID : %i , fFromRemote : %i , fNewSmoke : %i )\n",sGridNo, ubRadius , usItem , ubOwner.i , (int)fSubsequent , bLevel , iSmokeEffectID , fFromRemoteClient , fNewSmokeEffect ); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 04bc9726..2828b22e 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -366,7 +366,7 @@ INT32 NewSmokeEffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, SoldierID ubOwne } #ifdef JA2BETAVERSION CHAR tmpMPDbgString[512]; - sprintf(tmpMPDbgString, "NewSmokeEffect ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i )\n", sGridNo, usItem, ubOwner, bLevel, iSmokeIndex); + sprintf(tmpMPDbgString, "NewSmokeEffect ( sGridNo : %i , usItem : %i , ubOwner : %i , bLevel : %i , iSmokeEffectID : %i )\n", sGridNo, usItem, ubOwner.i, bLevel, iSmokeIndex); MPDebugMsg(tmpMPDbgString); gfMPDebugOutputRandoms = true; #endif diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index f05398c2..b4af4896 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -2188,7 +2188,7 @@ BOOLEAN CalculateLaunchItemChanceToGetThrough( SOLDIERTYPE *pSoldier, OBJECTTYPE if ( pSoldier->sGridNo == sGridNo ) { - printf("Warning! Soldier #%d attempted to launch item at himself\n", pSoldier->ubID); + printf("Warning! Soldier #%d attempted to launch item at himself\n", pSoldier->ubID.i); return FALSE; } // Ge7t basic launch params... From f3194718e4d385967c01af8baa8eb82941cd57b3 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Fri, 8 Aug 2025 21:21:48 +0300 Subject: [PATCH 335/571] Remove useless check for savegame version ITS breaks save games. --- Ja2/SaveLoadGame.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 1674d28a..251f600a 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -1980,17 +1980,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile) //the soldier type info has changed at version 102 //CHRISL: To accomodate future changes to this structure, we'll load each value field by field numBytesRead = 0; - if (guiCurrentSaveGameVersion >= INCREASED_TEAMSIZES) - { - numBytesRead = ReadFieldByField(hFile, &this->ubID, sizeof(ubID), sizeof(UINT16), numBytesRead); - } - else - { - numBytesRead = ReadFieldByField(hFile, &this->ubID, sizeof(ubID), sizeof(UINT8), numBytesRead); - // Read and discard bReserved1 so numBytesRead matches the struct size later - UINT8 bReserved1 = 0; - numBytesRead = ReadFieldByField(hFile, &bReserved1, sizeof(bReserved1), sizeof(UINT8), numBytesRead); - } + numBytesRead = ReadFieldByField(hFile, &this->ubID, sizeof(ubID), sizeof(UINT16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->name, sizeof(name), sizeof(CHAR16), numBytesRead); numBytesRead = ReadFieldByField(hFile, &this->ubBodyType, sizeof(ubBodyType), sizeof(UINT8), numBytesRead); From 616d9a08e6604c6dee309cbb57684115b36dde03 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Tue, 12 Aug 2025 02:07:11 -0300 Subject: [PATCH 336/571] Fix NOTIFY_IF_SLEEP_FAILS for multiple mercs selected --- Strategic/Assignments.cpp | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 3645f296..3993c715 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -18251,7 +18251,6 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn INT32 iCounter = 0; SOLDIERTYPE *pSoldier = NULL; UINT8 ubNumberOfSelectedSoldiers = 0; - CHAR16 sString[ 128 ]; for( iCounter = 0; iCounter < giMAXIMUM_NUMBER_OF_PLAYER_SLOTS; ++iCounter ) { @@ -18306,27 +18305,21 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn } } - // if there was anyone processed, check for success and inform player of failure - if( ubNumberOfSelectedSoldiers ) + if( ubNumberOfSelectedSoldiers == 0 ) { - if( fSuccess == FALSE ) - { - if( fWakeUp ) - { - // inform player not everyone could be woke up - swprintf( sString, pMapErrorString[ 27 ] ); - } - else - { - // inform player not everyone could be put to sleep - swprintf( sString, pMapErrorString[ 26 ]); - } + return fSuccess; + } - if( fDisplayWarning ) - { - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL); - } - } + if( !fDisplayWarning ) { + return fSuccess; + } + + CHAR16 sString[ 128 ]; + swprintf( sString, fWakeUp ? pMapErrorString[ 27 ] : pMapErrorString[ 26 ] ); + if( gGameExternalOptions.fSleepDisplayFailNotification ) + { + // inform player not everyone could be woke up or put to sleep + DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL); } return( fSuccess ); From 11202d7e7e595012233a4c93874c4e42b355f6c0 Mon Sep 17 00:00:00 2001 From: Kitty <58940527+kitty624@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:53:10 +0200 Subject: [PATCH 337/571] Expanded and sorted nationalities (#485) - added Tracona for use with UB, etc - sorted alphabetical (english) for more ease of use during IMP creation - that sorting starts only after original nationalities (from after Metaviran) - expanded and adjusted the existing ones - tried to achieve a decent amount from every continent - while sorting the language specific files, preserved existing translations - adjusted MercProfiles in related gamedir change --- Tactical/soldier profile type.h | 121 +++++++++++------ i18n/_ChineseText.cpp | 224 +++++++++++++++++++++----------- i18n/_DutchText.cpp | 220 ++++++++++++++++++++----------- i18n/_EnglishText.cpp | 220 ++++++++++++++++++++----------- i18n/_FrenchText.cpp | 220 ++++++++++++++++++++----------- i18n/_GermanText.cpp | 220 ++++++++++++++++++++----------- i18n/_ItalianText.cpp | 220 ++++++++++++++++++++----------- i18n/_PolishText.cpp | 220 ++++++++++++++++++++----------- i18n/_RussianText.cpp | 218 +++++++++++++++++++++---------- 9 files changed, 1258 insertions(+), 625 deletions(-) diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index 222d5401..e57155ee 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -242,15 +242,15 @@ typedef enum { // old Sirtech values AMERICAN_NAT = 0, // take that, Murica! Sirtech knew you have no value :-) - ARAB_NAT = 1, + ARAB_NAT = 1, AUSTRALIAN_NAT = 2, BRITISH_NAT = 3, CANADIAN_NAT = 4, CUBAN_NAT = 5, DANISH_NAT = 6, FRENCH_NAT = 7, - RUSSIAN_NAT = 8, - NIGERIAN_NAT = 9, // this was simply not defined in original data (I did not find any country), but we can't have any holes in here, so just invented soemthing + RUSSIAN_NAT = 8, // kitty: changed 9 from nigerian (moved down) to traconian (UB takes place in Tracona) + TRACONIAN_NAT = 9, // this was simply not defined in original data (I did not find any country), but we can't have any holes in here, so just invented soemthing SWISS_NAT = 10, JAMAICAN_NAT = 11, POLISH_NAT = 12, @@ -261,64 +261,105 @@ typedef enum SCOTTISH_NAT = 17, ARULCAN_NAT = 18, GERMAN_NAT = 19, - AFRICAN_NAT = 20, + AFRICAN_NAT = 20, ITALIAN_NAT = 21, DUTCH_NAT = 22, ROMANIAN_NAT = 23, METAVIRAN_NAT = 24, // new values, because why not - GREEK_NAT, // 25 - ESTONIAN_NAT, - VENEZUELAN_NAT , - JAPANESE_NAT, - TURKISH_NAT, - INDIAN_NAT, // 30 - MEXICAN_NAT, - NORWEGIAN_NAT, - SPANISH_NAT, - BRASILIAN_NAT, - FINNISH_NAT, // 35 - IRANIAN_NAT, - ISRAELI_NAT, - BULGARIAN_NAT, - SWEDISH_NAT, - IRAQI_NAT, // 40 - SYRIAN_NAT, - BELGIAN_NAT, - PORTOGUESE_NAT, - BELARUSIAN_NAT, - SERBIAN_NAT, // 45 - PAKISTANI_NAT, + // kitty: + // added a few more and removed some, hoping to achieve a decent amount from every inhabited continent (plus one, in the 90's, relatively well-known fictional one) + // 0-24 original ja2 nationalities (except 9, see there) + // sorted non-original ones in (english) alphabetic order for some more ease of use during IMP creation + AFGHAN_NAT, // 25 ALBANIAN_NAT, ARGENTINIAN_NAT, ARMENIAN_NAT, - AZERBAIJANI_NAT, // 50 + AZERBAIJANI_NAT, + BANGLADESHI_NAT, // 30 + BELARUSIAN_NAT, + BELGIAN_NAT, + BENINESE_NAT, BOLIVIAN_NAT, - CHILEAN_NAT, - CIRCASSIAN_NAT, + BOSNIAN_NAT, // 35 + BRASILIAN_NAT, + BULGARIAN_NAT, + CAMBODIAN_NAT, + CHADIAN_NAT, + CHILEAN_NAT, // 40 COLUMBIAN_NAT, - EGYPTIAN_NAT, // 55 + CONGOLESE_NAT, + CROATIAN_NAT, + ECUADORIAN_NAT, + EGYPTIAN_NAT, // 45 + ENGLISH_NAT, + ERITREAN_NAT, + ESTONIAN_NAT, ETHIOPIAN_NAT, + FILIPINO_NAT, // 50 + FINNISH_NAT, GEORGIAN_NAT, + GREEK_NAT, + GUATEMALAN_NAT, + HAITIAN_NAT, // 55 + HONDURAN_NAT, + INDIAN_NAT, + INDONESIAN_NAT, + IRANIAN_NAT, + IRAQI_NAT, // 60 + ISLANDIC_NAT, + ISRAELI_NAT, + JAPANESE_NAT, JORDANIAN_NAT, - KAZAKHSTANI_NAT, - KENYAN_NAT, // 60 - KOREAN_NAT, + KAZAKHSTANI_NAT, // 65 + KOREAN_NAT, KYRGYZSTANI_NAT, + LAOTIAN_NAT, + LATVIAN_NAT, + LEBANESE_NAT, // 70 + LITHUANIAN_NAT, + LYBIAN_NAT, + MACEDONIAN_NAT, + MALAYSIAN_NAT, + MEXICAN_NAT, // 75 MONGOLIAN_NAT, - PALESTINIAN_NAT, - PANAMANIAN_NAT, // 65 - RHODESIAN_NAT, + MOROCCAN_NAT, + MOZAMBICAN_NAT, + MYANMA_NAT, + NAMIBIAN_NAT, // 80 + NICARAGUAN_NAT, + NIGERIAN_NAT, + NIGERIEN_NAT, + NORWEGIAN_NAT, + PAKISTANI_NAT, // 85 + PANAMANIAN_NAT, + PORTOGUESE_NAT, + RWANDANESE_NAT, SALVADORAN_NAT, - SAUDI_NAT, + SAUDI_NAT, // 90 + SERBIAN_NAT, + SLOVAKIAN_NAT, + SLOVENIAN_NAT, SOMALI_NAT, - THAI_NAT, // 70 + SPANISH_NAT, // 95 + SUDANESE_NAT, + SWEDISH_NAT, + SYRIAN_NAT, + THAI_NAT, + TOGOLESE_NAT, // 100 + TUNISIAN_NAT, + TURKISH_NAT, + UGANDAN_NAT, UKRAINIAN_NAT, + URUGUAYAN_NAT, // 105 UZBEKISTANI_NAT, + VENEZUELAN_NAT, + VIETNAMESE_NAT, WELSH_NAT, - YAZIDI_NAT, - ZIMBABWEAN_NAT, // 75 + YEMENI_NAT, // 110 + ZAMUNDAN_NAT, // Zamunda + ZIMBABWEAN_NAT, NUM_NATIONALITIES } Nationalities; diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index 56deb055..fa9f7f99 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -9424,13 +9424,13 @@ STR16 szNationalityText[]= L"丹麦人", L"法国人", L"俄国人", - L"尼日利亚人", + L"Tracona人", // (UB takes place in Tracona) L"瑞士人", // 10 L"牙买加人", L"波兰人", L"中国人", L"爱尔兰人", - L"å—éžäºº", // 15 + L"å—éžäºº", // 15 L"匈牙利人", L"è‹æ ¼å…°äºº", L"Arulco人", @@ -9442,57 +9442,94 @@ STR16 szNationalityText[]= L"Metavira人", // newly added from here on - L"希腊人", // 25 - L"爱沙尼亚人", - L"委内瑞拉人", - L"日本人", - L"土耳其人", - L"å°åº¦äºº", // 30 - L"墨西哥人", - L"挪å¨äºº", - L"西ç­ç‰™äºº", - L"巴西人", - L"芬兰人", // 35 - L"伊朗人", - L"以色列人", - L"ä¿åŠ åˆ©äºšäºº", - L"瑞典人", - L"伊拉克人", // 40 - L"å™åˆ©äºšäºº", - L"比利时人", - L"è‘¡è„牙人", - L"白俄罗斯人", - L"塞尔维亚人", // 45 - L"巴基斯å¦äºº", + L"Afghan", // 25 L"Albanian", L"Argentinian", L"Armenian", - L"Azerbaijani", // 50 + L"Azerbaijani", + L"Bangladeshi ", // 30 + L"白俄罗斯人", + L"比利时人", + L"Beninese", L"Bolivian", - L"Chilean", - L"Circassian", + L"Bosnian", // 35 + L"巴西人", + L"ä¿åŠ åˆ©äºšäºº", + L"Cambodian", + L"Chadian", + L"Chilean", // 40 L"Columbian", - L"Egyptian", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"Egyptian", // 45 + L"English", + L"Eritrean", + L"爱沙尼亚人", L"Ethiopian", + L"Filipino", // 50 + L"芬兰人", L"Georgian", + L"希腊人", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"å°åº¦äºº", + L"Indonesian", + L"伊朗人", + L"伊拉克人", // 60 + L"Islandic", + L"以色列人", + L"日本人", L"Jordanian", - L"Kazakhstani", - L"Kenyan", // 60 + L"Kazakhstani", // 65 L"Korean", L"Kyrgyzstani", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"墨西哥人", // 75 L"Mongolian", - L"Palestinian", - L"Panamanian", // 65 - L"Rhodesian", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"尼日利亚人", + L"Nigerien", + L"挪å¨äºº", + L"Pakistani", // 85 + L"Panamanian", + L"è‘¡è„牙人", + L"Rwandanese", L"Salvadoran", - L"Saudi", + L"Saudi", // 90 + L"塞尔维亚人", + L"Slovakian", + L"Slovenian", L"Somali", - L"Thai", // 70 + L"西ç­ç‰™äºº", // 95 + L"Sudanese", + L"瑞典人", + L"å™åˆ©äºšäºº", + L"Thai", + L"Togolese", // 100 + L"Tunisian", + L"土耳其人", + L"Ugandan", L"Ukrainian", + L"Uruguayan", // 105 L"Uzbekistani", + L"委内瑞拉人", + L"Vietnamese", L"Welsh", - L"Yazidi", - L"Zimbabwean", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Zimbabwean", }; STR16 szNationalityTextAdjective[] = @@ -9506,13 +9543,13 @@ STR16 szNationalityTextAdjective[] = L"丹麦人", L"法国人", L"俄国人", - L"尼日利亚人", + L"traconia人" // UB takes place in Tracona L"瑞士人", // 10 L"牙买加人", L"波兰人", L"中国人", L"爱尔兰人", - L"å—éžäºº", // 15 + L"å—éžäºº", // 15 L"匈牙利人", L"è‹æ ¼å…°äºº", L"Arulco人", @@ -9524,57 +9561,94 @@ STR16 szNationalityTextAdjective[] = L"Metavira人", // newly added from here on - L"希腊人", // 25 - L"爱沙尼亚人", - L"委内瑞拉人", - L"日本人", - L"土耳其人", - L"å°åº¦äºº", // 30 - L"墨西哥人", - L"挪å¨äºº", - L"西ç­ç‰™äºº", - L"巴西人", - L"芬兰人", // 35 - L"伊朗人", - L"以色列人", - L"ä¿åŠ åˆ©äºšäºº", - L"瑞典人", - L"伊拉克人", // 40 - L"å™åˆ©äºšäºº", - L"比利时人", - L"è‘¡è„牙人", - L"白俄罗斯人", - L"塞尔维亚人", // 45 - L"巴基斯å¦äºº", + L"afghans", // 25 L"albanians", L"argentinians", L"armenians", - L"azerbaijani", // 50 + L"azerbaijani", + L"bangladeshi", // 30 + L"白俄罗斯人", + L"比利时人", + L"beninese", L"bolivians", - L"chileans", - L"circassians", + L"bosnians", // 35 + L"巴西人", + L"ä¿åŠ åˆ©äºšäºº", + L"cambodians", + L"chadians", + L"chileans", // 40 L"columbians", - L"egyptians", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"egyptians", // 45 + L"englishmen", + L"eritreans", + L"爱沙尼亚人", L"ethiopians", + L"filipinos", // 50 + L"芬兰人", L"georgians", + L"希腊人", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"å°åº¦äºº", + L"indonesians", + L"伊朗人", + L"伊拉克人", // 60 + L"islandics", + L"以色列人", + L"日本人", L"jordanians", - L"kazakhstani", - L"kenyans", // 60 + L"kazakhstani", // 65 L"koreans", L"kyrgyzstani", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"墨西哥人", // 75 L"mongolians", - L"palestinians", - L"panamanians", // 65 - L"rhodesians", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"尼日利亚人", + L"nigeriens", + L"挪å¨äºº", + L"巴基斯å¦äºº", // 85 + L"panamanians", + L"è‘¡è„牙人", + L"rwandanese", L"salvadorans", - L"saudis", - L"somalis", - L"thais", // 70 + L"saudis", // 90 + L"塞尔维亚人", + L"slovakians", + L"slovenians", + L"somali", + L"西ç­ç‰™äºº", // 95 + L"sudanese", + L"瑞典人", + L"å™åˆ©äºšäºº", + L"thais", + L"togolese", // 100 + L"tunisians", + L"土耳其人", + L"ugandans", L"ukrainians", + L"uruguayans", // 105 L"uzbekistani", + L"委内瑞拉人", + L"vietnamese", L"welshs", - L"yazidis", - L"zimbabweans", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"zimbabweans", }; // special text used if we do not hate any nation (value of -1) diff --git a/i18n/_DutchText.cpp b/i18n/_DutchText.cpp index 580bb33c..c2413fac 100644 --- a/i18n/_DutchText.cpp +++ b/i18n/_DutchText.cpp @@ -9436,7 +9436,7 @@ STR16 szNationalityText[]= L"Danish", L"French", L"Russian", - L"Nigerian", + L"Traconian", L"Swiss", // 10 L"Jamaican", L"Polish", @@ -9454,57 +9454,94 @@ STR16 szNationalityText[]= L"Metaviran", // newly added from here on - L"Greek", // 25 - L"Estonian", - L"Venezuelan", - L"Japanese", - L"Turkish", - L"Indian", // 30 - L"Mexican", - L"Norwegian", - L"Spanish", - L"Brasilian", - L"Finnish", // 35 - L"Iranian", - L"Israeli", - L"Bulgarian", - L"Swedish", - L"Iraqi", // 40 - L"Syrian", - L"Belgian", - L"Portoguese", - L"Belarusian", // TODO.Translate - L"Serbian", // 45 - L"Pakistani", + L"Afghan", // 25 L"Albanian", L"Argentinian", L"Armenian", - L"Azerbaijani", // 50 + L"Azerbaijani", + L"Bangladeshi ", // 30 + L"Belarusian", + L"Belgian", + L"Beninese", L"Bolivian", - L"Chilean", - L"Circassian", + L"Bosnian", // 35 + L"Brasilian", + L"Bulgarian", + L"Cambodian", + L"Chadian", + L"Chilean", // 40 L"Columbian", - L"Egyptian", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"Egyptian", // 45 + L"English", + L"Eritrean", + L"Estonian", L"Ethiopian", + L"Filipino", // 50 + L"Finnish", L"Georgian", + L"Greek", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"Indian", + L"Indonesian", + L"Iranian", + L"Iraqi", // 60 + L"Islandic", + L"Israeli", + L"Japanese", L"Jordanian", - L"Kazakhstani", - L"Kenyan", // 60 + L"Kazakhstani", // 65 L"Korean", L"Kyrgyzstani", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"Mexican", // 75 L"Mongolian", - L"Palestinian", - L"Panamanian", // 65 - L"Rhodesian", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"Nigerian", + L"Nigerien", + L"Norwegian", + L"Pakistani", // 85 + L"Panamanian", + L"Portoguese", + L"Rwandanese", L"Salvadoran", - L"Saudi", + L"Saudi", // 90 + L"Serbian", + L"Slovakian", + L"Slovenian", L"Somali", - L"Thai", // 70 + L"Spanish", // 95 + L"Sudanese", + L"Swedish", + L"Syrian", + L"Thai", + L"Togolese", // 100 + L"Tunisian", + L"Turkish", + L"Ugandan", L"Ukrainian", + L"Uruguayan", // 105 L"Uzbekistani", + L"Venezuelan", + L"Vietnamese", L"Welsh", - L"Yazidi", - L"Zimbabwean", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Zimbabwean", }; STR16 szNationalityTextAdjective[] = // TODO.Translate @@ -9518,7 +9555,7 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"danes", L"frenchmen", L"russians", - L"nigerians", + L"traconians", L"swiss", // 10 L"jamaicans", L"poles", @@ -9536,57 +9573,94 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"metavirans", // newly added from here on - L"greek", // 25 - L"estonians", - L"venezuelans", - L"japanese", - L"turks", - L"indians", // 30 - L"mexicans", - L"norwegians", - L"spaniards", - L"brasilians", - L"finns", // 35 - L"iranians", - L"israelis", - L"bulgarians", - L"swedes", - L"iraqis", // 40 - L"syrians", - L"belgians", - L"portoguese", - L"belarusian", - L"serbians", // 45 - L"pakistanis", + L"afghans", // 25 L"albanians", L"argentinians", L"armenians", - L"azerbaijani", // 50 + L"azerbaijani", + L"bangladeshi", // 30 + L"belarusians", + L"belgians", + L"beninese", L"bolivians", - L"chileans", - L"circassians", + L"bosnians", // 35 + L"brasilians", + L"bulgarians", + L"cambodians", + L"chadians", + L"chileans", // 40 L"columbians", - L"egyptians", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"egyptians", // 45 + L"englishmen", + L"eritreans", + L"estonians", L"ethiopians", + L"filipinos", // 50 + L"finns", L"georgians", + L"greek", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"indians", + L"indonesians", + L"iranians", + L"iraqis", // 60 + L"islandics", + L"israelis", + L"japanese", L"jordanians", - L"kazakhstani", - L"kenyans", // 60 + L"kazakhstani", // 65 L"koreans", L"kyrgyzstani", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"mexicans", // 75 L"mongolians", - L"palestinians", - L"panamanians", // 65 - L"rhodesians", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"nigerians", + L"nigeriens", + L"norwegians", + L"pakistanis", // 85 + L"panamanians", + L"portoguese", + L"rwandanese", L"salvadorans", - L"saudis", - L"somalis", - L"thais", // 70 + L"saudis", // 90 + L"serbians", + L"slovakians", + L"slovenians", + L"somali", + L"spaniards", // 95 + L"sudanese", + L"swedes", + L"syrians", + L"thais", + L"togolese", // 100 + L"tunisians", + L"turks", + L"ugandans", L"ukrainians", + L"uruguayans", // 105 L"uzbekistani", + L"venezuelans", + L"vietnamese", L"welshs", - L"yazidis", - L"zimbabweans", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"zimbabweans", }; // special text used if we do not hate any nation (value of -1) diff --git a/i18n/_EnglishText.cpp b/i18n/_EnglishText.cpp index 377ad755..00cee405 100644 --- a/i18n/_EnglishText.cpp +++ b/i18n/_EnglishText.cpp @@ -9424,7 +9424,7 @@ STR16 szNationalityText[]= L"Danish", L"French", L"Russian", - L"Nigerian", + L"Traconian", // UB takes place in Tracona L"Swiss", // 10 L"Jamaican", L"Polish", @@ -9442,57 +9442,94 @@ STR16 szNationalityText[]= L"Metaviran", // newly added from here on - L"Greek", // 25 - L"Estonian", - L"Venezuelan", - L"Japanese", - L"Turkish", - L"Indian", // 30 - L"Mexican", - L"Norwegian", - L"Spanish", - L"Brasilian", - L"Finnish", // 35 - L"Iranian", - L"Israeli", - L"Bulgarian", - L"Swedish", - L"Iraqi", // 40 - L"Syrian", - L"Belgian", - L"Portoguese", - L"Belarusian", - L"Serbian", // 45 - L"Pakistani", + L"Afghan", // 25 L"Albanian", L"Argentinian", L"Armenian", - L"Azerbaijani", // 50 + L"Azerbaijani", + L"Bangladeshi ", // 30 + L"Belarusian", + L"Belgian", + L"Beninese", L"Bolivian", - L"Chilean", - L"Circassian", + L"Bosnian", // 35 + L"Brasilian", + L"Bulgarian", + L"Cambodian", + L"Chadian", + L"Chilean", // 40 L"Columbian", - L"Egyptian", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"Egyptian", // 45 + L"English", + L"Eritrean", + L"Estonian", L"Ethiopian", + L"Filipino", // 50 + L"Finnish", L"Georgian", + L"Greek", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"Indian", + L"Indonesian", + L"Iranian", + L"Iraqi", // 60 + L"Islandic", + L"Israeli", + L"Japanese", L"Jordanian", - L"Kazakhstani", - L"Kenyan", // 60 + L"Kazakhstani", // 65 L"Korean", L"Kyrgyzstani", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"Mexican", // 75 L"Mongolian", - L"Palestinian", - L"Panamanian", // 65 - L"Rhodesian", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"Nigerian", + L"Nigerien", + L"Norwegian", + L"Pakistani", // 85 + L"Panamanian", + L"Portoguese", + L"Rwandanese", L"Salvadoran", - L"Saudi", + L"Saudi", // 90 + L"Serbian", + L"Slovakian", + L"Slovenian", L"Somali", - L"Thai", // 70 + L"Spanish", // 95 + L"Sudanese", + L"Swedish", + L"Syrian", + L"Thai", + L"Togolese", // 100 + L"Tunisian", + L"Turkish", + L"Ugandan", L"Ukrainian", + L"Uruguayan", // 105 L"Uzbekistani", + L"Venezuelan", + L"Vietnamese", L"Welsh", - L"Yazidi", - L"Zimbabwean", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Zimbabwean", }; STR16 szNationalityTextAdjective[] = @@ -9506,7 +9543,7 @@ STR16 szNationalityTextAdjective[] = L"danes", L"frenchmen", L"russians", - L"nigerians", + L"traconians", L"swiss", // 10 L"jamaicans", L"poles", @@ -9524,57 +9561,94 @@ STR16 szNationalityTextAdjective[] = L"metavirans", // newly added from here on - L"greek", // 25 - L"estonians", - L"venezuelans", - L"japanese", - L"turks", - L"indians", // 30 - L"mexicans", - L"norwegians", - L"spaniards", - L"brasilians", - L"finns", // 35 - L"iranians", - L"israelis", - L"bulgarians", - L"swedes", - L"iraqis", // 40 - L"syrians", - L"belgians", - L"portoguese", - L"belarusians", - L"serbians", // 45 - L"pakistanis", + L"afghans", // 25 L"albanians", L"argentinians", L"armenians", - L"azerbaijani", // 50 + L"azerbaijani", + L"bangladeshi", // 30 + L"belarusians", + L"belgians", + L"beninese", L"bolivians", - L"chileans", - L"circassians", + L"bosnians", // 35 + L"brasilians", + L"bulgarians", + L"cambodians", + L"chadians", + L"chileans", // 40 L"columbians", - L"egyptians", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"egyptians", // 45 + L"englishmen", + L"eritreans", + L"estonians", L"ethiopians", + L"filipinos", // 50 + L"finns", L"georgians", + L"greek", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"indians", + L"indonesians", + L"iranians", + L"iraqis", // 60 + L"islandics", + L"israelis", + L"japanese", L"jordanians", - L"kazakhstani", - L"kenyans", // 60 + L"kazakhstani", // 65 L"koreans", L"kyrgyzstani", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"mexicans", // 75 L"mongolians", - L"palestinians", - L"panamanians", // 65 - L"rhodesians", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"nigerians", + L"nigeriens", + L"norwegians", + L"pakistanis", // 85 + L"panamanians", + L"portoguese", + L"rwandanese", L"salvadorans", - L"saudis", - L"somalis", - L"thais", // 70 + L"saudis", // 90 + L"serbians", + L"slovakians", + L"slovenians", + L"somali", + L"spaniards", // 95 + L"sudanese", + L"swedes", + L"syrians", + L"thais", + L"togolese", // 100 + L"tunisians", + L"turks", + L"ugandans", L"ukrainians", + L"uruguayans", // 105 L"uzbekistani", + L"venezuelans", + L"vietnamese", L"welshs", - L"yazidis", - L"zimbabweans", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"zimbabweans", }; // special text used if we do not hate any nation (value of -1) diff --git a/i18n/_FrenchText.cpp b/i18n/_FrenchText.cpp index fbd776a8..cc9980cb 100644 --- a/i18n/_FrenchText.cpp +++ b/i18n/_FrenchText.cpp @@ -9418,7 +9418,7 @@ STR16 szNationalityText[]= L"Danois", L"Français", L"Russe", - L"Nigérian", + L"Traconian", L"Suisse", // 10 L"Jamaïcain", L"Polonais", @@ -9436,57 +9436,94 @@ STR16 szNationalityText[]= L"Métavirien", // newly added from here on - L"Grec", // 25 - L"Estonien", - L"Vénézuélien", - L"Japonais", - L"Turc", - L"Indien", // 30 - L"Mexicain", - L"Norvégien", - L"Espagnol", - L"Brésilien", - L"Finlandais", // 35 - L"Iranien", - L"Israélien", - L"Bulgare", - L"Suédois", - L"Irakien", // 40 - L"Syrien", - L"Belge", - L"Portugais", - L"Belarusian", // TODO.Translate - L"Serbian", // 45 - L"Pakistani", + L"Afghan", // 25 L"Albanian", L"Argentinian", L"Armenian", - L"Azerbaijani", // 50 + L"Azerbaijani", + L"Bangladeshi ", // 30 + L"Belarusian", + L"Belge", + L"Beninese", L"Bolivian", - L"Chilean", - L"Circassian", + L"Bosnian", // 35 + L"Brésilien", + L"Bulgare", + L"Cambodian", + L"Chadian", + L"Chilean", // 40 L"Columbian", - L"Egyptian", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"Egyptian", // 45 + L"English", + L"Eritrean", + L"Estonien", L"Ethiopian", + L"Filipino", // 50 + L"Finlandais", L"Georgian", + L"Grec", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"Indien", + L"Indonesian", + L"Iranien", + L"Irakien", // 60 + L"Islandic", + L"Israélien", + L"Japonais", L"Jordanian", - L"Kazakhstani", - L"Kenyan", // 60 + L"Kazakhstani", // 65 L"Korean", L"Kyrgyzstani", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"Mexicain", // 75 L"Mongolian", - L"Palestinian", - L"Panamanian", // 65 - L"Rhodesian", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"Nigérian", + L"Nigerien", + L"Norvégien", + L"Pakistani", // 85 + L"Panamanian", + L"Portugais", + L"Rwandanese", L"Salvadoran", - L"Saudi", + L"Saudi", // 90 + L"Serbian", + L"Slovakian", + L"Slovenian", L"Somali", - L"Thai", // 70 + L"Espagnol", // 95 + L"Sudanese", + L"Suédois", + L"Syrien", + L"Thai", + L"Togolese", // 100 + L"Tunisian", + L"Turc", + L"Ugandan", L"Ukrainian", + L"Uruguayan", // 105 L"Uzbekistani", + L"Vénézuélien", + L"Vietnamese", L"Welsh", - L"Yazidi", - L"Zimbabwean", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Zimbabwean", }; STR16 szNationalityTextAdjective[] = // TODO.Translate @@ -9500,7 +9537,7 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"danes", L"frenchmen", L"russians", - L"nigerians", + L"traconians", L"swiss", // 10 L"jamaicans", L"poles", @@ -9518,57 +9555,94 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"metavirans", // newly added from here on - L"greek", // 25 - L"estonians", - L"venezuelans", - L"japanese", - L"turks", - L"indians", // 30 - L"mexicans", - L"norwegians", - L"spaniards", - L"brasilians", - L"finns", // 35 - L"iranians", - L"israelis", - L"bulgarians", - L"swedes", - L"iraqis", // 40 - L"syrians", - L"belgians", - L"portoguese", - L"belarusian", - L"serbians", // 45 - L"pakistanis", + L"afghans", // 25 L"albanians", L"argentinians", L"armenians", - L"azerbaijani", // 50 + L"azerbaijani", + L"bangladeshi", // 30 + L"belarusians", + L"belgians", + L"beninese", L"bolivians", - L"chileans", - L"circassians", + L"bosnians", // 35 + L"brasilians", + L"bulgarians", + L"cambodians", + L"chadians", + L"chileans", // 40 L"columbians", - L"egyptians", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"egyptians", // 45 + L"englishmen", + L"eritreans", + L"estonians", L"ethiopians", + L"filipinos", // 50 + L"finns", L"georgians", + L"greek", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"indians", + L"indonesians", + L"iranians", + L"iraqis", // 60 + L"islandics", + L"israelis", + L"japanese", L"jordanians", - L"kazakhstani", - L"kenyans", // 60 + L"kazakhstani", // 65 L"koreans", L"kyrgyzstani", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"mexicans", // 75 L"mongolians", - L"palestinians", - L"panamanians", // 65 - L"rhodesians", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"nigerians", + L"nigeriens", + L"norwegians", + L"pakistanis", // 85 + L"panamanians", + L"portoguese", + L"rwandanese", L"salvadorans", - L"saudis", - L"somalis", - L"thais", // 70 + L"saudis", // 90 + L"serbians", + L"slovakians", + L"slovenians", + L"somali", + L"spaniards", // 95 + L"sudanese", + L"swedes", + L"syrians", + L"thais", + L"togolese", // 100 + L"tunisians", + L"turks", + L"ugandans", L"ukrainians", + L"uruguayans", // 105 L"uzbekistani", + L"venezuelans", + L"vietnamese", L"welshs", - L"yazidis", - L"zimbabweans", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"zimbabweans", }; // special text used if we do not hate any nation (value of -1) diff --git a/i18n/_GermanText.cpp b/i18n/_GermanText.cpp index 4b66db3f..cba8f6e5 100644 --- a/i18n/_GermanText.cpp +++ b/i18n/_GermanText.cpp @@ -9287,7 +9287,7 @@ STR16 szNationalityText[]= L"Danish", L"French", L"Russian", - L"Nigerian", + L"Traconian", L"Swiss", // 10 L"Jamaican", L"Polish", @@ -9305,57 +9305,94 @@ STR16 szNationalityText[]= L"Metaviran", // newly added from here on - L"Greek", // 25 - L"Estonian", - L"Venezuelan", - L"Japanese", - L"Turkish", - L"Indian", // 30 - L"Mexican", - L"Norwegian", - L"Spanish", - L"Brasilian", - L"Finnish", // 35 - L"Iranian", - L"Israeli", - L"Bulgarian", - L"Swedish", - L"Iraqi", // 40 - L"Syrian", - L"Belgian", - L"Portoguese", - L"Belarusian", // TODO.Translate - L"Serbian", // 45 - L"Pakistani", + L"Afghan", // 25 L"Albanian", L"Argentinian", L"Armenian", - L"Azerbaijani", // 50 + L"Azerbaijani", + L"Bangladeshi ", // 30 + L"Belarusian", + L"Belgian", + L"Beninese", L"Bolivian", - L"Chilean", - L"Circassian", + L"Bosnian", // 35 + L"Brasilian", + L"Bulgarian", + L"Cambodian", + L"Chadian", + L"Chilean", // 40 L"Columbian", - L"Egyptian", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"Egyptian", // 45 + L"English", + L"Eritrean", + L"Estonian", L"Ethiopian", + L"Filipino", // 50 + L"Finnish", L"Georgian", + L"Greek", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"Indian", + L"Indonesian", + L"Iranian", + L"Iraqi", // 60 + L"Islandic", + L"Israeli", + L"Japanese", L"Jordanian", - L"Kazakhstani", - L"Kenyan", // 60 + L"Kazakhstani", // 65 L"Korean", L"Kyrgyzstani", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"Mexican", // 75 L"Mongolian", - L"Palestinian", - L"Panamanian", // 65 - L"Rhodesian", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"Nigerian", + L"Nigerien", + L"Norwegian", + L"Pakistani", // 85 + L"Panamanian", + L"Portoguese", + L"Rwandanese", L"Salvadoran", - L"Saudi", + L"Saudi", // 90 + L"Serbian", + L"Slovakian", + L"Slovenian", L"Somali", - L"Thai", // 70 + L"Spanish", // 95 + L"Sudanese", + L"Swedish", + L"Syrian", + L"Thai", + L"Togolese", // 100 + L"Tunisian", + L"Turkish", + L"Ugandan", L"Ukrainian", + L"Uruguayan", // 105 L"Uzbekistani", + L"Venezuelan", + L"Vietnamese", L"Welsh", - L"Yazidi", - L"Zimbabwean", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Zimbabwean", }; // TODO.Translate @@ -9370,7 +9407,7 @@ STR16 szNationalityTextAdjective[] = L"danes", L"frenchmen", L"russians", - L"nigerians", + L"traconians", L"swiss", // 10 L"jamaicans", L"poles", @@ -9388,57 +9425,94 @@ STR16 szNationalityTextAdjective[] = L"metavirans", // newly added from here on - L"greek", // 25 - L"estonians", - L"venezuelans", - L"japanese", - L"turks", - L"indians", // 30 - L"mexicans", - L"norwegians", - L"spaniards", - L"brasilians", - L"finns", // 35 - L"iranians", - L"israelis", - L"bulgarians", - L"swedes", - L"iraqis", // 40 - L"syrians", - L"belgians", - L"portoguese", - L"belarusian", - L"serbians", // 45 - L"pakistanis", + L"afghans", // 25 L"albanians", L"argentinians", L"armenians", - L"azerbaijani", // 50 + L"azerbaijani", + L"bangladeshi", // 30 + L"belarusians", + L"belgians", + L"beninese", L"bolivians", - L"chileans", - L"circassians", + L"bosnians", // 35 + L"brasilians", + L"bulgarians", + L"cambodians", + L"chadians", + L"chileans", // 40 L"columbians", - L"egyptians", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"egyptians", // 45 + L"englishmen", + L"eritreans", + L"estonians", L"ethiopians", + L"filipinos", // 50 + L"finns", L"georgians", + L"greek", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"indians", + L"indonesians", + L"iranians", + L"iraqis", // 60 + L"islandics", + L"israelis", + L"japanese", L"jordanians", - L"kazakhstani", - L"kenyans", // 60 + L"kazakhstani", // 65 L"koreans", L"kyrgyzstani", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"mexicans", // 75 L"mongolians", - L"palestinians", - L"panamanians", // 65 - L"rhodesians", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"nigerians", + L"nigeriens", + L"norwegians", + L"pakistanis", // 85 + L"panamanians", + L"portoguese", + L"rwandanese", L"salvadorans", - L"saudis", - L"somalis", - L"thais", // 70 + L"saudis", // 90 + L"serbians", + L"slovakians", + L"slovenians", + L"somali", + L"spaniards", // 95 + L"sudanese", + L"swedes", + L"syrians", + L"thais", + L"togolese", // 100 + L"tunisians", + L"turks", + L"ugandans", L"ukrainians", + L"uruguayans", // 105 L"uzbekistani", + L"venezuelans", + L"vietnamese", L"welshs", - L"yazidis", - L"zimbabweans", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"zimbabweans", }; // special text used if we do not hate any nation (value of -1) diff --git a/i18n/_ItalianText.cpp b/i18n/_ItalianText.cpp index 0601468b..c9e9dd39 100644 --- a/i18n/_ItalianText.cpp +++ b/i18n/_ItalianText.cpp @@ -9427,7 +9427,7 @@ STR16 szNationalityText[]= L"Danish", L"French", L"Russian", - L"Nigerian", + L"Traconian", L"Swiss", // 10 L"Jamaican", L"Polish", @@ -9445,57 +9445,94 @@ STR16 szNationalityText[]= L"Metaviran", // newly added from here on - L"Greek", // 25 - L"Estonian", - L"Venezuelan", - L"Japanese", - L"Turkish", - L"Indian", // 30 - L"Mexican", - L"Norwegian", - L"Spanish", - L"Brasilian", - L"Finnish", // 35 - L"Iranian", - L"Israeli", - L"Bulgarian", - L"Swedish", - L"Iraqi", // 40 - L"Syrian", - L"Belgian", - L"Portoguese", - L"Belarusian", // TODO.Translate - L"Serbian", // 45 - L"Pakistani", + L"Afghan", // 25 L"Albanian", L"Argentinian", L"Armenian", - L"Azerbaijani", // 50 + L"Azerbaijani", + L"Bangladeshi ", // 30 + L"Belarusian", + L"Belgian", + L"Beninese", L"Bolivian", - L"Chilean", - L"Circassian", + L"Bosnian", // 35 + L"Brasilian", + L"Bulgarian", + L"Cambodian", + L"Chadian", + L"Chilean", // 40 L"Columbian", - L"Egyptian", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"Egyptian", // 45 + L"English", + L"Eritrean", + L"Estonian", L"Ethiopian", + L"Filipino", // 50 + L"Finnish", L"Georgian", + L"Greek", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"Indian", + L"Indonesian", + L"Iranian", + L"Iraqi", // 60 + L"Islandic", + L"Israeli", + L"Japanese", L"Jordanian", - L"Kazakhstani", - L"Kenyan", // 60 + L"Kazakhstani", // 65 L"Korean", L"Kyrgyzstani", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"Mexican", // 75 L"Mongolian", - L"Palestinian", - L"Panamanian", // 65 - L"Rhodesian", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"Nigerian", + L"Nigerien", + L"Norwegian", + L"Pakistani", // 85 + L"Panamanian", + L"Portoguese", + L"Rwandanese", L"Salvadoran", - L"Saudi", + L"Saudi", // 90 + L"Serbian", + L"Slovakian", + L"Slovenian", L"Somali", - L"Thai", // 70 + L"Spanish", // 95 + L"Sudanese", + L"Swedish", + L"Syrian", + L"Thai", + L"Togolese", // 100 + L"Tunisian", + L"Turkish", + L"Ugandan", L"Ukrainian", + L"Uruguayan", // 105 L"Uzbekistani", + L"Venezuelan", + L"Vietnamese", L"Welsh", - L"Yazidi", - L"Zimbabwean", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Zimbabwean", }; STR16 szNationalityTextAdjective[] = // TODO.Translate @@ -9509,7 +9546,7 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"danes", L"frenchmen", L"russians", - L"nigerians", + L"traconians", L"swiss", // 10 L"jamaicans", L"poles", @@ -9527,57 +9564,94 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"metavirans", // newly added from here on - L"greek", // 25 - L"estonians", - L"venezuelans", - L"japanese", - L"turks", - L"indians", // 30 - L"mexicans", - L"norwegians", - L"spaniards", - L"brasilians", - L"finns", // 35 - L"iranians", - L"israelis", - L"bulgarians", - L"swedes", - L"iraqis", // 40 - L"syrians", - L"belgians", - L"portoguese", - L"belarusian", - L"serbians", // 45 - L"pakistanis", + L"afghans", // 25 L"albanians", L"argentinians", L"armenians", - L"azerbaijani", // 50 + L"azerbaijani", + L"bangladeshi", // 30 + L"belarusians", + L"belgians", + L"beninese", L"bolivians", - L"chileans", - L"circassians", + L"bosnians", // 35 + L"brasilians", + L"bulgarians", + L"cambodians", + L"chadians", + L"chileans", // 40 L"columbians", - L"egyptians", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"egyptians", // 45 + L"englishmen", + L"eritreans", + L"estonians", L"ethiopians", + L"filipinos", // 50 + L"finns", L"georgians", + L"greek", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"indians", + L"indonesians", + L"iranians", + L"iraqis", // 60 + L"islandics", + L"israelis", + L"japanese", L"jordanians", - L"kazakhstani", - L"kenyans", // 60 + L"kazakhstani", // 65 L"koreans", L"kyrgyzstani", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"mexicans", // 75 L"mongolians", - L"palestinians", - L"panamanians", // 65 - L"rhodesians", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"nigerians", + L"nigeriens", + L"norwegians", + L"pakistanis", // 85 + L"panamanians", + L"portoguese", + L"rwandanese", L"salvadorans", - L"saudis", - L"somalis", - L"thais", // 70 + L"saudis", // 90 + L"serbians", + L"slovakians", + L"slovenians", + L"somali", + L"spaniards", // 95 + L"sudanese", + L"swedes", + L"syrians", + L"thais", + L"togolese", // 100 + L"tunisians", + L"turks", + L"ugandans", L"ukrainians", + L"uruguayans", // 105 L"uzbekistani", + L"venezuelans", + L"vietnamese", L"welshs", - L"yazidis", - L"zimbabweans", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"zimbabweans", }; // special text used if we do not hate any nation (value of -1) diff --git a/i18n/_PolishText.cpp b/i18n/_PolishText.cpp index f49fe637..a395a803 100644 --- a/i18n/_PolishText.cpp +++ b/i18n/_PolishText.cpp @@ -9440,7 +9440,7 @@ STR16 szNationalityText[]= L"Danish", L"French", L"Russian", - L"Nigerian", + L"Traconian", L"Swiss", // 10 L"Jamaican", L"Polish", @@ -9458,57 +9458,94 @@ STR16 szNationalityText[]= L"Metaviran", // newly added from here on - L"Greek", // 25 - L"Estonian", - L"Venezuelan", - L"Japanese", - L"Turkish", - L"Indian", // 30 - L"Mexican", - L"Norwegian", - L"Spanish", - L"Brasilian", - L"Finnish", // 35 - L"Iranian", - L"Israeli", - L"Bulgarian", - L"Swedish", - L"Iraqi", // 40 - L"Syrian", - L"Belgian", - L"Portoguese", - L"Belarusian", // TODO.Translate - L"Serbian", // 45 - L"Pakistani", + L"Afghan", // 25 L"Albanian", L"Argentinian", L"Armenian", - L"Azerbaijani", // 50 + L"Azerbaijani", + L"Bangladeshi ", // 30 + L"Belarusian", + L"Belgian", + L"Beninese", L"Bolivian", - L"Chilean", - L"Circassian", + L"Bosnian", // 35 + L"Brasilian", + L"Bulgarian", + L"Cambodian", + L"Chadian", + L"Chilean", // 40 L"Columbian", - L"Egyptian", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"Egyptian", // 45 + L"English", + L"Eritrean", + L"Estonian", L"Ethiopian", + L"Filipino", // 50 + L"Finnish", L"Georgian", + L"Greek", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"Indian", + L"Indonesian", + L"Iranian", + L"Iraqi", // 60 + L"Islandic", + L"Israeli", + L"Japanese", L"Jordanian", - L"Kazakhstani", - L"Kenyan", // 60 + L"Kazakhstani", // 65 L"Korean", L"Kyrgyzstani", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"Mexican", // 75 L"Mongolian", - L"Palestinian", - L"Panamanian", // 65 - L"Rhodesian", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"Nigerian", + L"Nigerien", + L"Norwegian", + L"Pakistani", // 85 + L"Panamanian", + L"Portoguese", + L"Rwandanese", L"Salvadoran", - L"Saudi", + L"Saudi", // 90 + L"Serbian", + L"Slovakian", + L"Slovenian", L"Somali", - L"Thai", // 70 + L"Spanish", // 95 + L"Sudanese", + L"Swedish", + L"Syrian", + L"Thai", + L"Togolese", // 100 + L"Tunisian", + L"Turkish", + L"Ugandan", L"Ukrainian", + L"Uruguayan", // 105 L"Uzbekistani", + L"Venezuelan", + L"Vietnamese", L"Welsh", - L"Yazidi", - L"Zimbabwean", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Zimbabwean", }; STR16 szNationalityTextAdjective[] = // TODO.Translate @@ -9522,7 +9559,7 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"danes", L"frenchmen", L"russians", - L"nigerians", + L"traconians", L"swiss", // 10 L"jamaicans", L"poles", @@ -9540,57 +9577,94 @@ STR16 szNationalityTextAdjective[] = // TODO.Translate L"metavirans", // newly added from here on - L"greek", // 25 - L"estonians", - L"venezuelans", - L"japanese", - L"turks", - L"indians", // 30 - L"mexicans", - L"norwegians", - L"spaniards", - L"brasilians", - L"finns", // 35 - L"iranians", - L"israelis", - L"bulgarians", - L"swedes", - L"iraqis", // 40 - L"syrians", - L"belgians", - L"portoguese", - L"belarusian", - L"serbians", // 45 - L"pakistanis", + L"afghans", // 25 L"albanians", L"argentinians", L"armenians", - L"azerbaijani", // 50 + L"azerbaijani", + L"bangladeshi", // 30 + L"belarusians", + L"belgians", + L"beninese", L"bolivians", - L"chileans", - L"circassians", + L"bosnians", // 35 + L"brasilians", + L"bulgarians", + L"cambodians", + L"chadians", + L"chileans", // 40 L"columbians", - L"egyptians", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"egyptians", // 45 + L"englishmen", + L"eritreans", + L"estonians", L"ethiopians", + L"filipinos", // 50 + L"finns", L"georgians", + L"greek", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"indians", + L"indonesians", + L"iranians", + L"iraqis", // 60 + L"islandics", + L"israelis", + L"japanese", L"jordanians", - L"kazakhstani", - L"kenyans", // 60 + L"kazakhstani", // 65 L"koreans", L"kyrgyzstani", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"mexicans", // 75 L"mongolians", - L"palestinians", - L"panamanians", // 65 - L"rhodesians", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"nigerians", + L"nigeriens", + L"norwegians", + L"pakistanis", // 85 + L"panamanians", + L"portoguese", + L"rwandanese", L"salvadorans", - L"saudis", - L"somalis", - L"thais", // 70 + L"saudis", // 90 + L"serbians", + L"slovakians", + L"slovenians", + L"somali", + L"spaniards", // 95 + L"sudanese", + L"swedes", + L"syrians", + L"thais", + L"togolese", // 100 + L"tunisians", + L"turks", + L"ugandans", L"ukrainians", + L"uruguayans", // 105 L"uzbekistani", + L"venezuelans", + L"vietnamese", L"welshs", - L"yazidis", - L"zimbabweans", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"zimbabweans", }; // special text used if we do not hate any nation (value of -1) diff --git a/i18n/_RussianText.cpp b/i18n/_RussianText.cpp index 5b1a777e..b5bdf85d 100644 --- a/i18n/_RussianText.cpp +++ b/i18n/_RussianText.cpp @@ -9419,7 +9419,7 @@ STR16 szNationalityText[]= L"Датчанин", L"Француз", L"РуÑÑкий", - L"Ðигериец", + L"Traconian", // UB takes place in Tracona L"Швейцарец", // 10 L"Ямаец", L"ПолÑк", @@ -9437,57 +9437,94 @@ STR16 szNationalityText[]= L"Метавирец", // newly added from here on - L"Грек", // 25 - L"ЭÑтонец", - L"ВенеÑуÑлец", - L"Японец", - L"Турок", - L"Индиец", // 30 - L"МекÑиканец", - L"Ðорвежец", - L"ИÑпанец", - L"Бразилец", - L"Финн", // 35 - L"Иранец", - L"ИзраильтÑнин", - L"Болгарин", - L"Швед", - L"Иракец", // 40 - L"Сириец", - L"Бельгиец", - L"Португалец", - L"БелоруÑ", - L"Серб", // 45 - L"ПакиÑтанец", + L"Afghan", // 25 L"Ðлбанец", L"Ðргентинец", L"ÐрмÑнин", - L"Ðзербайджанец", // 50 + L"Ðзербайджанец", + L"Bangladeshi ", // 30 + L"БелоруÑ", + L"Бельгиец", + L"Beninese", L"Боливиец", - L"Чилиец", - L"ЧеркеÑ", + L"Bosnian", // 35 + L"Бразилец", + L"Болгарин", + L"Cambodian", + L"Chadian", + L"Чилиец", // 40 L"Колумбиец", - L"ЕгиптÑнин", // 55 + L"Congolese", + L"Croatian", + L"Ecuadorian", + L"ЕгиптÑнин", // 45 + L"English", + L"Eritrean", + L"ЭÑтонец", L"Эфиоп", + L"Filipino", // 50 + L"Финн", L"Грузин", + L"Грек", + L"Guatemalan", + L"Haitian", // 55 + L"Honduran", + L"Индиец", + L"Indonesian", + L"Иранец", + L"Иракец", // 60 + L"Islandic", + L"ИзраильтÑнин", + L"Японец", L"Иорданец", - L"КазахÑтанец", - L"Кениец", // 60 + L"КазахÑтанец", // 65 L"Кореец", L"КыргызÑтанец", + L"Laotian", + L"Latvian", + L"Lebanese", // 70 + L"Lithuanian", + L"Lybian", + L"Macedonian", + L"Malaysian", + L"МекÑиканец", // 75 L"Монгол", - L"ПалеÑтинец", - L"Панамец", // 65 - L"Родезиец", + L"Moroccan", + L"Mozambican", + L"Myanma", + L"Namibian", // 80 + L"Nicaraguan", + L"Ðигериец", + L"Nigerien", + L"Ðорвежец", + L"ПакиÑтанец", // 85 + L"Панамец", + L"Португалец", + L"Rwandanese", L"Сальвадорец", - L"Саудовец", + L"Саудовец", // 90 + L"Серб", + L"Slovakian", + L"Slovenian", L"Сомалиец", - L"Таец", // 70 + L"ИÑпанец", // 95 + L"Sudanese", + L"Швед", + L"Сириец", + L"Таец", + L"Togolese", // 100 + L"Tunisian", + L"Турок", + L"Ugandan", L"Украинец", + L"Uruguayan", // 105 L"УзбекиÑтанец", + L"ВенеÑуÑлец", + L"Vietnamese", L"Валлиец", - L"Езид", - L"Зимбабвиец", // 75 + L"Yemeni", // 110 + L"Zamundan", // Zamunda + L"Зимбабвиец", }; STR16 szNationalityTextAdjective[] = @@ -9501,7 +9538,7 @@ STR16 szNationalityTextAdjective[] = L"датчан", L"французов", L"руÑÑких", - L"нигерийцев", + L"traconians", L"швейцарцев", // 10 L"Ñмайцев", L"полÑков", @@ -9519,57 +9556,94 @@ STR16 szNationalityTextAdjective[] = L"метавирцев", // newly added from here on - L"греков", // 25 - L"ÑÑтонцев", - L"венеÑуÑльцев", - L"Ñпонцев", - L"турков", - L"индийцев", // 30 - L"мекÑиканцев", - L"норвежцев", - L"иÑпанцев", - L"бразильцев", - L"финнов", // 35 - L"иранцев", - L"израильтÑнинов", - L"болгаров", - L"шведов", - L"иракцев", // 40 - L"Ñирийцев", - L"бельгийцев", - L"португальцев", - L"белоруÑов", - L"Ñербов", // 45 - L"пакиÑтанцев", + L"afghans", // 25 L"албанцев", L"аргентинцев", L"армÑн", - L"азербайджанцев", // 50 + L"азербайджанцев", + L"bangladeshi", // 30 + L"белоруÑов", + L"бельгийцев", + L"beninese", L"боливийцев", - L"чилийцев", - L"черкеÑов", + L"bosnians", // 35 + L"бразильцев", + L"болгаров", + L"cambodians", + L"chadians", + L"чилийцев", // 40 L"колумбийцев", - L"египтÑн", // 55 + L"congolese", + L"croatians", + L"ecuadorians", + L"египтÑн", // 45 + L"englishmen", + L"eritreans", + L"ÑÑтонцев", L"Ñфиопов", + L"filipinos", // 50 + L"финнов", L"грузин", + L"греков", + L"guatemalans", + L"haitians", // 55 + L"hondurans", + L"индийцев", + L"indonesians", + L"иранцев", + L"иракцев", // 60 + L"islandics", + L"израильтÑнинов", + L"Ñпонцев", L"иорданцев", - L"казахÑтанцев", - L"кенийцев", // 60 + L"казахÑтанцев", // 65 L"корейцев", L"кыргызÑтанцев", + L"laotians", + L"latvians", + L"lebanese", // 70 + L"lithuanians", + L"lybians", + L"macedonians", + L"malaysians", + L"мекÑиканцев", // 75 L"монголов", - L"палеÑтинцев", - L"панамцев", // 65 - L"родезийцев", + L"moroccans", + L"mozambicans", + L"myanmarians", + L"namibians", // 80 + L"nicaraguans", + L"нигерийцев", + L"nigeriens", + L"норвежцев", + L"пакиÑтанцев", // 85 + L"панамцев", + L"португальцев", + L"rwandanese", L"Ñальвадорцев", - L"Ñаудовцев", + L"Ñаудовцев", // 90 + L"Ñербов", + L"slovakians", + L"slovenians", L"Ñомалийцев", - L"тайцев", // 70 + L"иÑпанцев", // 95 + L"sudanese", + L"шведов", + L"Ñирийцев", + L"тайцев", + L"togolese", // 100 + L"tunisians", + L"турков", + L"ugandans", L"украинцев", + L"uruguayans", // 105 L"узбекиÑтанцев", + L"венеÑуÑльцев", + L"vietnamese", L"валлийцев", - L"езидов", - L"зимбабвийцев", // 75 + L"yemenites", // 110 + L"zamundans", // Zamunda + L"зимбабвийцев", }; // special text used if we do not hate any nation (value of -1) From e8399bb7c8a78b5d30ab4c71217a57bc892eca79 Mon Sep 17 00:00:00 2001 From: BeatAroundTheBuscher <81776525+BeatAroundTheBuscher@users.noreply.github.com> Date: Fri, 15 Aug 2025 22:52:43 +0200 Subject: [PATCH 338/571] Make backpack AP stance costs depend on actual weight instead of a bool checking if a backpack is equipped or not (#486) * Externalize the Divisor for usBackPackWeight A new ini value BACKPACK_WEIGHT_FACTOR is introduced to replace the hard coded 50. The value goes from 1 to 250 and its default value is 50 as before. * Refactor usBPPenalty into its own function GetBackbackAPPenaltyFromBackpack The same code is also used in GetAPsCrouch as well as GetAPsProne The intent of the change is to make sure that backpacks including their content do not add an additional AP cost of +1. Now it checks if the backpack weight is > ubBackPackWeightFactorForAPPenalty (default value 50). The min exists to make sure that the AP cost does not become higher than previously. Previously the bool fBackpackCheck was used to add +1 if there is any backpack. But this also includes an empty tactical sling (backpack with 0.2 kg) and therefore makes the item much less interesting to use. --- Ja2/GameSettings.cpp | 3 +++ Ja2/GameSettings.h | 3 +++ Tactical/Points.cpp | 46 +++++++++++++++++++++++++++++--------------- Tactical/Points.h | 3 +++ 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index cd796702..6f31793b 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -1679,6 +1679,9 @@ void LoadGameExternalOptions() //JMich.BackpackClimb gGameExternalOptions.sBackpackWeightToClimb = iniReader.ReadInteger("Tactical Gameplay Settings", "MAX_BACKPACK_WEIGHT_TO_CLIMB", -1); gGameExternalOptions.fUseGlobalBackpackSettings = iniReader.ReadBoolean("Tactical Gameplay Settings", "USE_GLOBAL_BACKPACK_SETTINGS", TRUE); + + // Buscher + gGameExternalOptions.ubBackPackWeightFactorForAPPenalty = iniReader.ReadInteger("Tactical Gameplay Settings", "BACKPACK_WEIGHT_FACTOR", 50, 1, 250); // sevenfm gGameExternalOptions.fShowEnemyWeapon = iniReader.ReadBoolean("Tactical Gameplay Settings","SHOW_ENEMY_WEAPON", FALSE); diff --git a/Ja2/GameSettings.h b/Ja2/GameSettings.h index 6148086c..74fba2dd 100644 --- a/Ja2/GameSettings.h +++ b/Ja2/GameSettings.h @@ -1361,6 +1361,9 @@ typedef struct INT16 sBackpackWeightToClimb; BOOLEAN fUseGlobalBackpackSettings; + // Buscher + UINT8 ubBackPackWeightFactorForAPPenalty; + // sevenfm: show enemy weapon above soldier in tactical BOOLEAN fShowEnemyWeapon; BOOLEAN fShowEnemyExtendedInfo; diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index ee07e3f0..927425f9 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -604,19 +604,7 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 u UINT16 usBPPenalty = APBPConstants[AP_MODIFIER_PACK]; if ( bSlot == BPACKPOCKPOS ) //Backpack caried on back { - OBJECTTYPE * pObj = &( pSoldier->inv[ BPACKPOCKPOS ] ); - UINT16 usBackPackWeight = CalculateObjectWeight( pObj ); - // CalculateObjectWeight checks for active LBE gear. Unfortunatly our backpack is not active since we are carying it. - // Sounds not intuitive at all, active means the LBE caries items (marked with blue *), but when put on the LBE adittional slots of our soldier - // are activated where something can be carried. So we have to add the weights of those slots as well. - std::vector vbLBESlots; - GetLBESlots( BPACKPOCKPOS, vbLBESlots ); - for ( UINT8 i = 0; i < vbLBESlots.size() ; i++ ) - { - pObj = &( pSoldier->inv[ vbLBESlots[ i ] ] ); - usBackPackWeight += CalculateObjectWeight( pObj ); - } - usBPPenalty = min( ( usBackPackWeight / 50 ), usBPPenalty ); //1 AP penalty for each 5kg of weight up to the penalty defined by AP_MODIFIER_PACK (default = 4) + usBPPenalty = GetBackbackAPPenaltyFromBackpack(pSoldier); } else //Backpack caried not on back (maybe somewhere inside another LBE or in Hand?) { @@ -3979,7 +3967,8 @@ INT16 GetAPsCrouch( SOLDIERTYPE *pSoldier, BOOLEAN fBackpackCheck ) // if backpack and new inventory if ( fBackpackCheck && (UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) - iFinalAPsToCrouch += fBackpackCheck;//dnl ch70 160913 was 1 + // min was added to stick with the behaviour above (+1) assuming the backpack is heavier than BACKPACK_WEIGHT_FACTOR + iFinalAPsToCrouch += min(1, GetBackbackAPPenaltyFromBackpack(pSoldier)); // -x% APs needed to change stance for MA trait if ( HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && ( gGameOptions.fNewTraitSystem )) @@ -3999,7 +3988,8 @@ INT16 GetAPsProne( SOLDIERTYPE *pSoldier, BOOLEAN fBackpackCheck ) // if backpack and new inventory if ( fBackpackCheck && (UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() == true && !pSoldier->flags.ZipperFlag) - iFinalAPsToLieDown += fBackpackCheck;//dnl ch70 160913 was 1 + // min was added to stick with the behaviour above (+1) assuming the backpack is heavier than BACKPACK_WEIGHT_FACTOR + iFinalAPsToLieDown += min(1, GetBackbackAPPenaltyFromBackpack(pSoldier)); // -x% APs needed to change stance for MA trait if ( HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && ( gGameOptions.fNewTraitSystem )) @@ -4403,3 +4393,29 @@ INT16 GetAPsToStartDrag(SOLDIERTYPE *pSoldier, BOOLEAN fStance) return sAPCost; } +INT16 GetBackbackAPPenaltyFromBackpack(SOLDIERTYPE *pSoldier) +{ + UINT16 usBPPenalty = 0; + OBJECTTYPE * pObj = &( pSoldier->inv[ BPACKPOCKPOS ] ); + + if ((UsingNewInventorySystem() == true) && pSoldier->inv[BPACKPOCKPOS].exists() && pObj != NULL) + { + UINT16 usBackPackWeight = CalculateObjectWeight( pObj ); + // CalculateObjectWeight checks for active LBE gear. Unfortunatly our backpack is not active since we are carying it. + // Sounds not intuitive at all, active means the LBE caries items (marked with blue *), but when put on the LBE adittional slots of our soldier + // are activated where something can be carried. So we have to add the weights of those slots as well. + std::vector vbLBESlots; + GetLBESlots( BPACKPOCKPOS, vbLBESlots ); + for ( UINT8 i = 0; i < vbLBESlots.size() ; i++ ) + { + pObj = &( pSoldier->inv[ vbLBESlots[ i ] ] ); + usBackPackWeight += CalculateObjectWeight( pObj ); + } + //1 AP penalty for each 5kg of weight up to the penalty defined by AP_MODIFIER_PACK (default = 4) + // BUSCHER: Externalized the weight factor (previously 50 = 5.0 kg) + // usBPPenalty = min( ( usBackPackWeight / 50 ), usBPPenalty ); + usBPPenalty = min( ( usBackPackWeight / gGameExternalOptions.ubBackPackWeightFactorForAPPenalty), APBPConstants[AP_MODIFIER_PACK] ); + + } + return usBPPenalty; +} \ No newline at end of file diff --git a/Tactical/Points.h b/Tactical/Points.h index 7ca66c9d..9bf9dec9 100644 --- a/Tactical/Points.h +++ b/Tactical/Points.h @@ -391,4 +391,7 @@ INT32 GetBPCostForRecoilkick( SOLDIERTYPE * pSoldier ); INT16 GetAPsToBreakWindow(SOLDIERTYPE *pSoldier, BOOLEAN fStance); INT16 GetAPsToStartDrag(SOLDIERTYPE *pSoldier, BOOLEAN fStance); +// Buscher +INT16 GetBackbackAPPenaltyFromBackpack(SOLDIERTYPE *pSoldier); + #endif From e9b12908f7ccd81b3ac9fea012ebcb1448a0fc79 Mon Sep 17 00:00:00 2001 From: BeatAroundTheBuscher <81776525+BeatAroundTheBuscher@users.noreply.github.com> Date: Sat, 16 Aug 2025 03:40:43 +0200 Subject: [PATCH 339/571] ASD/ARC: Fix Error by One in gasCan Vector (#472) * ASD/ARC: Fix Error by One in gasCan Vector * Add size check for the gasCan vector as part of ARC * Remove unused Vectors for ARC --- Strategic/Rebel Command.cpp | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index 2f8a05c2..7c169657 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -129,21 +129,10 @@ namespace ItemIdCache { // cache these values on load so that we don't need to search for them every time something happens std::vector gasCans; - std::vector firstAidKits; - std::vector medKits; - std::vector toolKits; - std::vector ammo[10]; // coolness void Clear() { gasCans.clear(); - firstAidKits.clear(); - medKits.clear(); - toolKits.clear(); - for (int i = 0; i < 10; ++i) - { - ammo[i].clear(); - } } } @@ -4418,23 +4407,6 @@ void SetupInfo() for (UINT16 i = 0; i < MAXITEMS; ++i) { if (ItemIsGascan(i)) ItemIdCache::gasCans.push_back(i); - else if (ItemIsFirstAidKit(i)) ItemIdCache::firstAidKits.push_back(i); - else if (ItemIsMedicalKit(i)) ItemIdCache::medKits.push_back(i); - else if (ItemIsToolkit(i)) ItemIdCache::toolKits.push_back(i); - else if (Item[i].usItemClass & IC_AMMO) - { - if (Magazine[Item[i].ubClassIndex].ubMagType == AMMO_BOX) - { - if ((gGameOptions.fGunNut || !ItemIsOnlyInTonsOfGuns(i)) - && (gGameOptions.ubGameStyle == STYLE_SCIFI || !ItemIsOnlyInScifi(i))) - { - // coolness runs from 1-10, so apply offset - const UINT8 coolness = min(max(1, Item[i].ubCoolness), 10); - ItemIdCache::ammo[coolness-1].push_back(i); - } - } - } - } } @@ -4772,8 +4744,10 @@ void ApplyAdditionalASDEffects() { case MissionHelpers::DISRUPT_ASD_STEAL_FUEL: { - // spawn a gas can - CreateItemAtAirport(ItemIdCache::gasCans.at(ItemIdCache::gasCans.size()), 75 + Random(26)); + // only spawn a gas can if at least one gas can is known by the game (ItemIsGascan) + if (ItemIdCache::gasCans.size() > 0) + // The gas can is spawned like a Bobby Ray delivery (you need to open the crate) + CreateItemAtAirport(ItemIdCache::gasCans.at(ItemIdCache::gasCans.size() -1), 75 + Random(26)); // say it came from the ASD's reserves AddStrategicAIResources(ASD_FUEL, -(gGameExternalOptions.gASDResource_Fuel_Jeep + Random(gGameExternalOptions.gASDResource_Fuel_Jeep))); From ed00830202dec89eadeb4fae61b2d60b0bfa23b2 Mon Sep 17 00:00:00 2001 From: BeatAroundTheBuscher <81776525+BeatAroundTheBuscher@users.noreply.github.com> Date: Sun, 17 Aug 2025 03:01:12 +0200 Subject: [PATCH 340/571] Fixes Upper/Lower Casing for include paths (#487) * Fixing upper/lower case for includes types.h, zconf.h and zlib.h were renamed so that global includes like Types.h are not used. --- CMakeLists.txt | 2 +- Console/Cursors.cpp | 2 +- Console/Dialogs.cpp | 2 +- Console/FileStream.cpp | 2 +- Editor/Button Defines.h | 2 +- Editor/Cursor Modes.cpp | 2 +- Editor/Cursor Modes.h | 2 +- Editor/Editor Callback Prototypes.h | 2 +- Editor/Editor Modes.cpp | 2 +- Editor/Editor Modes.h | 2 +- Editor/Editor Taskbar Creation.cpp | 4 +- Editor/Editor Taskbar Creation.h | 2 +- Editor/Editor Taskbar Utils.cpp | 4 +- Editor/Editor Taskbar Utils.h | 2 +- Editor/Editor Undo.cpp | 4 +- Editor/Editor Undo.h | 2 +- Editor/EditorBuildings.cpp | 2 +- Editor/EditorBuildings.h | 2 +- Editor/EditorDefines.h | 4 +- Editor/EditorItems.cpp | 20 ++--- Editor/EditorItems.h | 2 +- Editor/EditorMapInfo.cpp | 18 ++--- Editor/EditorMapInfo.h | 2 +- Editor/EditorMercs.cpp | 20 ++--- Editor/EditorMercs.h | 2 +- Editor/EditorTerrain.cpp | 8 +- Editor/EditorTerrain.h | 2 +- Editor/Item Statistics.cpp | 6 +- Editor/Item Statistics.h | 2 +- Editor/LoadScreen.cpp | 4 +- Editor/LoadScreen.h | 4 +- Editor/Road Smoothing.cpp | 2 +- Editor/Road Smoothing.h | 2 +- Editor/Sector Summary.cpp | 8 +- Editor/Sector Summary.h | 2 +- Editor/SmartMethod.h | 2 +- Editor/Smoothing Utils.h | 2 +- Editor/Summary Info.h | 4 +- Editor/edit_sys.h | 2 +- Editor/editscreen.cpp | 18 ++--- Editor/editscreen.h | 2 +- Editor/messagebox.cpp | 2 +- Editor/messagebox.h | 2 +- Editor/newsmooth.cpp | 2 +- Editor/newsmooth.h | 2 +- Editor/popupmenu.cpp | 12 +-- Editor/popupmenu.h | 2 +- Editor/selectwin.cpp | 2 +- Editor/selectwin.h | 4 +- Editor/smooth.cpp | 6 +- Editor/smooth.h | 2 +- Ja2/Credits.cpp | 22 +++--- Ja2/Fade Screen.cpp | 8 +- Ja2/FeaturesScreen.cpp | 20 ++--- Ja2/GameInitOptionsScreen.cpp | 14 ++-- Ja2/GameSettings.cpp | 10 +-- Ja2/GameSettings.h | 2 +- Ja2/GameVersion.cpp | 2 +- Ja2/HelpScreen.cpp | 14 ++-- Ja2/Init.cpp | 16 ++-- Ja2/Intro.cpp | 10 +-- Ja2/JA2 Splash.cpp | 4 +- Ja2/Ja25Update.cpp | 36 ++++----- Ja2/Ja25Update.h | 2 +- Ja2/Loading Screen.cpp | 8 +- Ja2/MPChatScreen.cpp | 12 +-- Ja2/MPConnectScreen.cpp | 16 ++-- Ja2/MPHostScreen.cpp | 18 ++--- Ja2/MPJoinScreen.cpp | 18 ++--- Ja2/MPScoreScreen.cpp | 12 +-- Ja2/MainMenuScreen.cpp | 28 +++---- Ja2/MessageBoxScreen.cpp | 12 +-- Ja2/Options Screen.cpp | 20 ++--- Ja2/SaveLoadGame.cpp | 66 ++++++++--------- Ja2/SaveLoadScreen.cpp | 24 +++--- Ja2/Screens.h | 4 +- Ja2/TimeLogging.h | 2 +- Ja2/aniviewscreen.cpp | 8 +- Ja2/builddefines.h | 2 +- Ja2/gameloop.cpp | 14 ++-- Ja2/gameloop.h | 2 +- Ja2/gamescreen.cpp | 48 ++++++------ Ja2/gamescreen.h | 2 +- Ja2/jascreens.cpp | 30 ++++---- Ja2/jascreens.h | 2 +- Ja2/legion cfg.cpp | 24 +++--- Ja2/ub_config.cpp | 24 +++--- Laptop/AimFacialIndex.cpp | 4 +- Laptop/AimMembers.cpp | 26 +++---- Laptop/AimSort.cpp | 2 +- Laptop/BobbyR.cpp | 8 +- Laptop/BobbyRAmmo.cpp | 2 +- Laptop/BobbyRGuns.cpp | 6 +- Laptop/BobbyRMailOrder.cpp | 6 +- Laptop/BobbyRShipments.cpp | 8 +- Laptop/BriefingRoom.cpp | 4 +- Laptop/BriefingRoomM.cpp | 4 +- Laptop/BrokenLink.cpp | 6 +- Laptop/CampaignHistoryMain.cpp | 2 +- Laptop/CampaignStats.cpp | 2 +- Laptop/CharProfile.cpp | 4 +- Laptop/Encyclopedia_Data_new.cpp | 2 +- Laptop/Encyclopedia_new.cpp | 2 +- Laptop/FacilityProduction.cpp | 2 +- Laptop/IMP AboutUs.cpp | 4 +- Laptop/IMP Attribute Entrance.cpp | 4 +- Laptop/IMP Attribute Finish.cpp | 4 +- Laptop/IMP Attribute Selection.cpp | 6 +- Laptop/IMP Background.cpp | 10 +-- Laptop/IMP Background.h | 2 +- Laptop/IMP Begin Screen.cpp | 10 +-- Laptop/IMP Character Trait.cpp | 10 +-- Laptop/IMP Character Trait.h | 2 +- .../IMP Character and Disability Entrance.cpp | 6 +- Laptop/IMP Color Choosing.cpp | 10 +-- Laptop/IMP Color Choosing.h | 2 +- Laptop/IMP Compile Character.cpp | 4 +- Laptop/IMP Confirm.cpp | 10 +-- Laptop/IMP Disability Trait.cpp | 10 +-- Laptop/IMP Disability Trait.h | 2 +- Laptop/IMP Finish.cpp | 6 +- Laptop/IMP Gear Entrance.cpp | 4 +- Laptop/IMP Gear Entrance.h | 2 +- Laptop/IMP Gear.cpp | 10 +-- Laptop/IMP Gear.h | 2 +- Laptop/IMP HomePage.cpp | 4 +- Laptop/IMP MainPage.cpp | 4 +- Laptop/IMP Minor Trait.cpp | 10 +-- Laptop/IMP Minor Trait.h | 2 +- Laptop/IMP Personality Entrance.cpp | 4 +- Laptop/IMP Personality Finish.cpp | 4 +- Laptop/IMP Personality Quiz.cpp | 4 +- Laptop/IMP Portraits.cpp | 4 +- Laptop/IMP Prejudice.cpp | 10 +-- Laptop/IMP Prejudice.h | 2 +- Laptop/IMP Skill Trait.cpp | 10 +-- Laptop/IMP Skill Trait.h | 2 +- Laptop/IMP Text System.cpp | 10 +-- Laptop/IMP Voices.cpp | 6 +- Laptop/IMPVideoObjects.cpp | 2 +- Laptop/Intelmarket.cpp | 2 +- Laptop/MilitiaWebsite.cpp | 4 +- Laptop/PMC.cpp | 4 +- Laptop/PostalService.cpp | 4 +- Laptop/PostalService.h | 12 +-- Laptop/Store Inventory.cpp | 8 +- Laptop/WHO.cpp | 2 +- Laptop/XML_DeliveryMethods.cpp | 6 +- Laptop/XML_ShippingDestinations.cpp | 6 +- Laptop/aim.cpp | 4 +- Laptop/email.cpp | 8 +- Laptop/files.cpp | 8 +- Laptop/finances.cpp | 6 +- Laptop/florist Order Form.cpp | 10 +-- Laptop/history.cpp | 10 +-- Laptop/insurance Contract.cpp | 6 +- Laptop/insurance.cpp | 2 +- Laptop/laptop.cpp | 22 +++--- Laptop/laptop.h | 2 +- Laptop/merccompare.cpp | 2 +- Laptop/mercs Account.cpp | 4 +- Laptop/mercs Files.cpp | 8 +- Laptop/mercs No Account.cpp | 2 +- Laptop/mercs.cpp | 8 +- Laptop/personnel.cpp | 8 +- Laptop/personnel.h | 2 +- Laptop/sirtech.cpp | 2 +- ModularizedTacticalAI/src/LegacyAIPlan.cpp | 2 +- .../src/LegacyAIPlanFactory.cpp | 2 +- .../src/LegacyArmedVehiclePlan.cpp | 2 +- ModularizedTacticalAI/src/Plan.cpp | 4 +- Multiplayer/client.cpp | 52 ++++++------- Multiplayer/connect.h | 2 +- Multiplayer/raknet/Gen_RPC8.h | 2 +- Multiplayer/server.cpp | 10 +-- Multiplayer/transfer_rules.cpp | 2 +- Strategic/AI Viewer.cpp | 8 +- Strategic/ASD.cpp | 6 +- Strategic/ASD.h | 2 +- Strategic/Assignments.cpp | 18 ++--- Strategic/Assignments.h | 2 +- Strategic/Auto Resolve.cpp | 14 ++-- Strategic/Campaign Init.cpp | 4 +- Strategic/Creature Spreading.cpp | 6 +- Strategic/Facilities.cpp | 2 +- Strategic/Facilities.h | 2 +- Strategic/Game Clock.cpp | 10 +-- Strategic/Game Event Hook.cpp | 14 ++-- Strategic/Game Events.cpp | 2 +- Strategic/Game Init.cpp | 30 ++++---- Strategic/Hourly Update.cpp | 2 +- Strategic/Ja25 Strategic Ai.cpp | 38 +++++----- Strategic/LuaInitNPCs.cpp | 2 +- Strategic/LuaInitNPCs.h | 2 +- Strategic/Luaglobal.h | 2 +- Strategic/Map Screen Helicopter.cpp | 12 +-- Strategic/Map Screen Helicopter.h | 2 +- Strategic/Map Screen Interface Border.cpp | 2 +- Strategic/Map Screen Interface Border.h | 2 +- Strategic/Map Screen Interface Bottom.cpp | 16 ++-- .../Map Screen Interface Map Inventory.cpp | 6 +- Strategic/Map Screen Interface Map.cpp | 2 +- .../Map Screen Interface TownMine Info.cpp | 6 +- .../Map Screen Interface TownMine Info.h | 2 +- Strategic/Map Screen Interface.cpp | 14 ++-- Strategic/Map Screen Interface.h | 2 +- Strategic/MapScreen Quotes.cpp | 10 +-- Strategic/Meanwhile.cpp | 32 ++++---- Strategic/Merc Contract.cpp | 10 +-- Strategic/MilitiaIndividual.cpp | 2 +- Strategic/MilitiaSquads.cpp | 6 +- Strategic/MilitiaSquads.h | 4 +- Strategic/MiniEvents.h | 2 +- Strategic/Player Command.cpp | 14 ++-- Strategic/PreBattle Interface.cpp | 12 +-- Strategic/Queen Command.cpp | 14 ++-- Strategic/Quest Debug System.cpp | 22 +++--- Strategic/Quests.cpp | 16 ++-- Strategic/Rebel Command.cpp | 2 +- Strategic/Rebel Command.h | 2 +- Strategic/Reinforcement.cpp | 6 +- Strategic/Scheduling.cpp | 8 +- Strategic/Scheduling.h | 2 +- Strategic/Strategic AI.cpp | 4 +- Strategic/Strategic Event Handler.cpp | 8 +- Strategic/Strategic Event Handler.h | 2 +- Strategic/Strategic Merc Handler.cpp | 16 ++-- Strategic/Strategic Mines LUA.h | 2 +- Strategic/Strategic Mines.cpp | 6 +- Strategic/Strategic Mines.h | 2 +- Strategic/Strategic Movement Costs.cpp | 2 +- Strategic/Strategic Movement.cpp | 14 ++-- Strategic/Strategic Pathing.cpp | 2 +- Strategic/Strategic Status.cpp | 2 +- Strategic/Strategic Town Loyalty.cpp | 8 +- Strategic/Strategic Town Loyalty.h | 2 +- Strategic/Strategic Transport Groups.h | 2 +- Strategic/Strategic Turns.cpp | 18 ++--- Strategic/Town Militia.cpp | 8 +- Strategic/Town Militia.h | 2 +- Strategic/UndergroundInit.h | 2 +- Strategic/XML_ExtraItems.cpp | 2 +- Strategic/XML_Facilities.cpp | 2 +- Strategic/XML_FacilityTypes.cpp | 2 +- Strategic/XML_SquadNames.cpp | 2 +- Strategic/mapscreen.cpp | 38 +++++----- Strategic/mapscreen.h | 2 +- Strategic/strategic town reputation.cpp | 6 +- Strategic/strategic.cpp | 6 +- Strategic/strategic.h | 4 +- Strategic/strategicmap.cpp | 66 ++++++++--------- Strategic/strategicmap.h | 2 +- Tactical/Air Raid.cpp | 34 ++++----- Tactical/Air Raid.h | 2 +- Tactical/Animation Cache.cpp | 4 +- Tactical/Animation Control.cpp | 8 +- Tactical/Animation Data.cpp | 8 +- Tactical/Arms Dealer Init.cpp | 12 +-- Tactical/ArmsDealerInvInit.cpp | 12 +-- Tactical/Auto Bandage.cpp | 24 +++--- Tactical/Boxing.cpp | 10 +-- Tactical/Bullets.h | 4 +- Tactical/Campaign.cpp | 10 +-- Tactical/Civ Quotes.cpp | 16 ++-- Tactical/Dialogue Control.cpp | 42 +++++------ Tactical/Disease.h | 2 +- Tactical/DisplayCover.cpp | 10 +-- Tactical/Drugs And Alcohol.cpp | 16 ++-- Tactical/DynamicDialogue.h | 2 +- Tactical/End Game.cpp | 8 +- Tactical/Enemy Soldier Save.cpp | 16 ++-- Tactical/EnemyItemDrops.cpp | 4 +- Tactical/Faces.cpp | 28 +++---- Tactical/Food.cpp | 10 +-- Tactical/GAP.cpp | 4 +- Tactical/Handle Doors.cpp | 14 ++-- Tactical/Handle Items.cpp | 66 ++++++++--------- Tactical/Handle UI Plan.cpp | 12 +-- Tactical/Handle UI.cpp | 74 +++++++++---------- Tactical/Interface Control.cpp | 30 ++++---- Tactical/Interface Cursors.cpp | 14 ++-- Tactical/Interface Dialogue.cpp | 58 +++++++-------- Tactical/Interface Enhanced.cpp | 32 ++++---- Tactical/Interface Items.cpp | 52 ++++++------- Tactical/Interface Items.h | 2 +- Tactical/Interface Panels.cpp | 46 ++++++------ Tactical/Interface Utils.cpp | 10 +-- Tactical/Interface.cpp | 48 ++++++------ Tactical/Interface.h | 2 +- Tactical/InterfaceItemImages.cpp | 2 +- Tactical/InterfaceItemImages.h | 2 +- Tactical/Inventory Choosing.cpp | 4 +- Tactical/Item Types.cpp | 8 +- Tactical/Items.cpp | 30 ++++---- Tactical/Ja25_Tactical.cpp | 20 ++--- Tactical/Keys.cpp | 26 +++---- Tactical/LOS.cpp | 32 ++++---- Tactical/LogicalBodyTypes/AbstractXMLLoader.h | 2 +- Tactical/LogicalBodyTypes/PaletteTable.h | 2 +- Tactical/Map Information.cpp | 6 +- Tactical/Merc Entering.cpp | 28 +++---- Tactical/Merc Hiring.cpp | 16 ++-- Tactical/Militia Control.cpp | 12 +-- Tactical/Militia Control.h | 2 +- Tactical/Minigame.cpp | 16 ++-- Tactical/Morale.cpp | 12 +-- Tactical/Morale.h | 2 +- Tactical/Overhead Types.h | 2 +- Tactical/Overhead.cpp | 70 +++++++++--------- Tactical/Overhead.h | 2 +- Tactical/PATHAI.H | 2 +- Tactical/PATHAI.cpp | 20 ++--- Tactical/Points.cpp | 30 ++++---- Tactical/Rain.cpp | 34 ++++----- Tactical/RandomMerc.cpp | 4 +- Tactical/Real Time Input.cpp | 46 ++++++------ Tactical/Rotting Corpses.cpp | 40 +++++----- Tactical/Rotting Corpses.h | 2 +- Tactical/ShopKeeper Interface.cpp | 30 ++++---- Tactical/SkillCheck.cpp | 4 +- Tactical/SkillMenu.cpp | 2 +- Tactical/Soldier Add.cpp | 26 +++---- Tactical/Soldier Ani.cpp | 50 ++++++------- Tactical/Soldier Control.cpp | 62 ++++++++-------- Tactical/Soldier Create.cpp | 26 +++---- Tactical/Soldier Create.h | 2 +- Tactical/Soldier Find.cpp | 18 ++--- Tactical/Soldier Functions.h | 2 +- Tactical/Soldier Init List.cpp | 18 ++--- Tactical/Soldier Profile.cpp | 26 +++---- Tactical/Soldier Profile.h | 2 +- Tactical/Soldier Tile.cpp | 20 ++--- Tactical/Soldier macros.h | 6 +- Tactical/SoldierTooltips.cpp | 16 ++-- Tactical/Spread Burst.cpp | 20 ++--- Tactical/Squads.cpp | 10 +-- Tactical/Strategic Exit GUI.cpp | 8 +- Tactical/Structure Wrap.cpp | 10 +-- Tactical/Tactical Save.cpp | 22 +++--- Tactical/Tactical Save.h | 6 +- Tactical/Tactical Turns.cpp | 26 +++---- Tactical/TeamTurns.cpp | 38 +++++----- Tactical/Turn Based Input.cpp | 72 +++++++++--------- Tactical/UI Cursors.cpp | 32 ++++---- Tactical/VehicleMenu.cpp | 6 +- Tactical/Vehicles.cpp | 24 +++--- Tactical/Vehicles.h | 2 +- Tactical/Weapons.cpp | 36 ++++----- Tactical/World Items.cpp | 18 ++--- Tactical/World Items.h | 2 +- Tactical/XML.h | 2 +- Tactical/XML_AmmoStrings.cpp | 6 +- Tactical/XML_AmmoTypes.cpp | 4 +- Tactical/XML_Armour.cpp | 4 +- Tactical/XML_AttachmentInfo.cpp | 4 +- Tactical/XML_AttachmentSlots.cpp | 4 +- Tactical/XML_Attachments.cpp | 6 +- Tactical/XML_BurstSounds.cpp | 28 +++---- Tactical/XML_Clothes.cpp | 2 +- Tactical/XML_ComboMergeInfo.cpp | 4 +- Tactical/XML_CompatibleFaceItems.cpp | 4 +- Tactical/XML_Disease.cpp | 2 +- Tactical/XML_Drugs.cpp | 2 +- Tactical/XML_EnemyAmmoDrops.cpp | 4 +- Tactical/XML_EnemyArmourDrops.cpp | 4 +- Tactical/XML_EnemyExplosiveDrops.cpp | 4 +- Tactical/XML_EnemyItemChoice.cpp | 4 +- Tactical/XML_EnemyMiscDrops.cpp | 4 +- Tactical/XML_EnemyWeaponChoice.cpp | 4 +- Tactical/XML_EnemyWeaponDrops.cpp | 26 +++---- Tactical/XML_Explosive.cpp | 4 +- Tactical/XML_Food.cpp | 2 +- Tactical/XML_FoodOpinions.cpp | 2 +- Tactical/XML_IMPItemChoices.cpp | 4 +- Tactical/XML_IncompatibleAttachments.cpp | 4 +- Tactical/XML_InteractiveTiles.cpp | 2 +- Tactical/XML_ItemAdjustments.cpp | 6 +- Tactical/XML_LBEPocket.cpp | 4 +- Tactical/XML_Launchable.cpp | 4 +- Tactical/XML_LoadBearingEquipment.cpp | 4 +- Tactical/XML_Magazine.cpp | 4 +- Tactical/XML_MercStartingGear.cpp | 4 +- Tactical/XML_Merchants.cpp | 2 +- Tactical/XML_Merge.cpp | 6 +- Tactical/XML_NewFaceGear.cpp | 2 +- Tactical/XML_Opinions.cpp | 2 +- Tactical/XML_Profiles.cpp | 2 +- Tactical/XML_RandomItem.cpp | 2 +- Tactical/XML_RandomStats.cpp | 2 +- Tactical/XML_SectorLoadscreens.cpp | 4 +- Tactical/XML_SpreadPatterns.cpp | 28 +++---- Tactical/XML_StructureConstruct.cpp | 2 +- Tactical/XML_StructureDeconstruct.cpp | 2 +- Tactical/XML_Structure_Move.cpp | 2 +- Tactical/XML_TonyInventory.cpp | 4 +- Tactical/XML_Vehicles.cpp | 12 +-- Tactical/bullets.cpp | 8 +- Tactical/faces.h | 2 +- Tactical/fov.cpp | 26 +++---- Tactical/fov.h | 2 +- Tactical/interface Dialogue.h | 2 +- Tactical/opplist.cpp | 40 +++++----- Tactical/soldier profile type.h | 2 +- Tactical/soldier tile.h | 2 +- TacticalAI/AIList.cpp | 2 +- TacticalAI/AIList.h | 2 +- TacticalAI/AIMain.cpp | 28 +++---- TacticalAI/AIUtils.cpp | 10 +-- TacticalAI/Attacks.cpp | 6 +- TacticalAI/CreatureDecideAction.cpp | 4 +- TacticalAI/DecideAction.cpp | 16 ++-- TacticalAI/FindLocations.cpp | 10 +-- TacticalAI/Knowledge.cpp | 2 +- TacticalAI/Medical.cpp | 8 +- TacticalAI/Movement.cpp | 6 +- TacticalAI/NPC.cpp | 20 ++--- TacticalAI/PanicButtons.cpp | 4 +- TacticalAI/QuestDebug.cpp | 4 +- TacticalAI/Realtime.cpp | 10 +-- TacticalAI/ZombieDecideAction.cpp | 16 ++-- TileEngine/Ambient Control.cpp | 4 +- TileEngine/Ambient Control.h | 2 +- TileEngine/Buildings.cpp | 4 +- TileEngine/Exit Grids.cpp | 6 +- TileEngine/Exit Grids.h | 2 +- TileEngine/Explosion Control.cpp | 40 +++++----- TileEngine/Interactive Tiles.cpp | 12 +-- TileEngine/Isometric Utils.cpp | 14 ++-- TileEngine/LightEffects.cpp | 8 +- TileEngine/Map Edgepoints.cpp | 6 +- TileEngine/Radar Screen.cpp | 4 +- TileEngine/Render Dirty.cpp | 2 +- TileEngine/Render Fun.cpp | 6 +- TileEngine/SaveLoadMap.cpp | 16 ++-- TileEngine/SaveLoadMap.h | 2 +- TileEngine/Shade Table Util.cpp | 2 +- TileEngine/Smell.cpp | 8 +- TileEngine/Smell.h | 2 +- TileEngine/SmokeEffects.cpp | 18 ++--- TileEngine/Tactical Placement GUI.cpp | 10 +-- TileEngine/Tile Animation.cpp | 12 +-- TileEngine/Tile Cache.cpp | 8 +- TileEngine/Tile Surface.cpp | 4 +- TileEngine/WorldDat.cpp | 8 +- TileEngine/WorldDat.h | 2 +- TileEngine/XML_ExplosionData.cpp | 4 +- TileEngine/environment.cpp | 4 +- TileEngine/lighting.cpp | 8 +- TileEngine/overhead map.cpp | 16 ++-- TileEngine/physics.cpp | 20 ++--- TileEngine/pits.cpp | 2 +- TileEngine/renderworld.cpp | 14 ++-- TileEngine/structure.cpp | 18 ++--- TileEngine/structure.h | 2 +- TileEngine/sysutil.cpp | 2 +- TileEngine/sysutil.h | 4 +- TileEngine/tiledef.cpp | 8 +- TileEngine/worlddef.cpp | 22 +++--- TileEngine/worldman.cpp | 8 +- Utils/Animated ProgressBar.cpp | 6 +- Utils/Cinematics Bink.cpp | 14 ++-- Utils/Cinematics.cpp | 4 +- Utils/Cinematics.h | 2 +- Utils/Cursors.cpp | 8 +- Utils/Encrypted File.cpp | 4 +- Utils/Event Pump.cpp | 4 +- Utils/Font Control.cpp | 2 +- Utils/Font Control.h | 2 +- Utils/INIReader.cpp | 4 +- Utils/INIReader.h | 4 +- Utils/KeyMap.cpp | 2 +- Utils/KeyMap.h | 2 +- Utils/MapUtility.cpp | 20 ++--- Utils/MercTextBox.cpp | 2 +- Utils/MercTextBox.h | 2 +- Utils/Multilingual Text Code Generator.cpp | 4 +- Utils/Music Control.cpp | 6 +- Utils/STIConvert.cpp | 8 +- Utils/Slider.cpp | 6 +- Utils/Sound Control.cpp | 4 +- Utils/Text Input.cpp | 6 +- Utils/Text Utils.cpp | 4 +- Utils/Timer Control.cpp | 8 +- Utils/Utilities.cpp | 10 +-- Utils/Utilities.h | 2 +- Utils/Utils All.h | 54 +++++++------- Utils/Win Util.cpp | 2 +- Utils/WordWrap.cpp | 2 +- Utils/XMLAccess.cpp | 2 +- Utils/XMLProperties.cpp | 2 +- Utils/XML_Items.cpp | 28 +++---- Utils/XML_Language.h | 2 +- Utils/XML_SenderNameList.h | 2 +- Utils/message.cpp | 10 +-- Utils/message.h | 4 +- Utils/popup_class.cpp | 8 +- ext/VFS/ext/7z/CMakeLists.txt | 2 +- ext/VFS/ext/7z/doc/lzma.txt | 2 +- ext/VFS/ext/7z/src/7zBuf.h | 2 +- ext/VFS/ext/7z/src/7zCrc.h | 2 +- ext/VFS/ext/7z/src/7zFile.h | 2 +- ext/VFS/ext/7z/src/7zStream.c | 2 +- ext/VFS/ext/7z/src/Bcj2.h | 2 +- ext/VFS/ext/7z/src/Bra.h | 2 +- ext/VFS/ext/7z/src/CpuArch.h | 2 +- ext/VFS/ext/7z/src/Delta.h | 2 +- ext/VFS/ext/7z/src/LzFind.h | 2 +- ext/VFS/ext/7z/src/Lzma86.h | 2 +- ext/VFS/ext/7z/src/LzmaDec.h | 2 +- ext/VFS/ext/7z/src/LzmaEnc.h | 2 +- ext/VFS/ext/7z/src/LzmaLib.h | 2 +- ext/VFS/ext/7z/src/Ppmd.h | 2 +- ext/VFS/ext/7z/src/Sha256.h | 2 +- ext/VFS/ext/7z/src/Threads.h | 2 +- ext/VFS/ext/7z/src/XzCrc64.h | 2 +- ext/VFS/ext/7z/src/{Types.h => types.h} | 2 +- ext/VFS/include/vfs/Tools/vfs_hp_timer.h | 2 +- ext/export/src/export/jsd/structure.cpp | 2 +- ext/export/src/export/sti/Image.h | 2 +- ext/export/src/export/sti/STCI_lib.cpp | 2 +- ext/export/src/export/sti/STCI_lib.h | 2 +- ext/export/src/export/sti/stci_image_utils.h | 2 +- ext/export/src/ja2/imgfmt.h | 2 +- ext/export/src/ja2/{Types.h => types.h} | 0 i18n/ExportStrings.cpp | 8 +- i18n/Multi Language Graphic Utils.cpp | 4 +- i18n/_ChineseText.cpp | 4 +- i18n/_DutchText.cpp | 4 +- i18n/_EnglishText.cpp | 4 +- i18n/_FrenchText.cpp | 4 +- i18n/_GermanText.cpp | 4 +- i18n/_ItalianText.cpp | 4 +- i18n/_Ja25ChineseText.cpp | 4 +- i18n/_Ja25DutchText.cpp | 4 +- i18n/_Ja25EnglishText.cpp | 4 +- i18n/_Ja25FrenchText.cpp | 4 +- i18n/_Ja25GermanText.cpp | 4 +- i18n/_Ja25ItalianText.cpp | 4 +- i18n/_Ja25PolishText.cpp | 4 +- i18n/_Ja25RussianText.cpp | 4 +- i18n/_PolishText.cpp | 4 +- i18n/_RussianText.cpp | 4 +- i18n/include/Text.h | 2 +- i18n/include/language.hpp | 2 +- lua/Lua Interpreter.h | 2 +- lua/lua.cpp | 2 +- lua/lua_class_interface.cpp | 2 +- lua/lua_state.cpp | 2 +- lua/lwstring.cpp | 2 +- lua/lwstring.h | 2 +- sgp/Button System.cpp | 6 +- sgp/Compression.cpp | 2 +- sgp/Cursor Control.h | 8 +- sgp/DEBUG.H | 2 +- sgp/DEBUG.cpp | 4 +- sgp/DirectDraw Calls.cpp | 2 +- sgp/DirectX Common.cpp | 2 +- sgp/FileMan.cpp | 4 +- sgp/FileMan.h | 2 +- sgp/Font.cpp | 6 +- sgp/Font.h | 2 +- sgp/LibraryDataBase.cpp | 4 +- sgp/LibraryDataBase.h | 2 +- sgp/MemMan.cpp | 2 +- sgp/PCX.cpp | 4 +- sgp/Random.cpp | 4 +- sgp/SMACK.H | 2 +- sgp/STCI.cpp | 4 +- sgp/WinFont.cpp | 8 +- sgp/himage.cpp | 6 +- sgp/imgfmt.h | 2 +- sgp/impTGA.cpp | 6 +- sgp/input.cpp | 4 +- sgp/mousesystem.cpp | 6 +- sgp/random.h | 4 +- sgp/sgp.cpp | 10 +-- sgp/sgp.h | 2 +- sgp/sgp_logger.cpp | 4 +- sgp/shading.cpp | 2 +- sgp/soundman.cpp | 2 +- sgp/{Types.h => types.h} | 0 sgp/video.cpp | 14 ++-- sgp/video.h | 8 +- sgp/vobject.cpp | 4 +- sgp/vobject_blitters.cpp | 4 +- sgp/vsurface.cpp | 4 +- sgp/{ZCONF.H => zconf.h} | 2 +- sgp/{ZLIB.H => zlib.h} | 0 588 files changed, 2576 insertions(+), 2576 deletions(-) rename ext/VFS/ext/7z/src/{Types.h => types.h} (95%) rename ext/export/src/ja2/{Types.h => types.h} (100%) rename sgp/{Types.h => types.h} (100%) rename sgp/{ZCONF.H => zconf.h} (95%) rename sgp/{ZLIB.H => zlib.h} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9be4f1c6..4201e90f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ include_directories( "${CMAKE_SOURCE_DIR}/Strategic" "${CMAKE_SOURCE_DIR}/sgp" "${CMAKE_SOURCE_DIR}/Ja2/Res" - "${CMAKE_SOURCE_DIR}/Lua" + "${CMAKE_SOURCE_DIR}/lua" "${CMAKE_SOURCE_DIR}/Laptop" "${CMAKE_SOURCE_DIR}/Multiplayer" "${CMAKE_SOURCE_DIR}/Editor" diff --git a/Console/Cursors.cpp b/Console/Cursors.cpp index 56579cae..88b9087c 100644 --- a/Console/Cursors.cpp +++ b/Console/Cursors.cpp @@ -27,7 +27,7 @@ // Cursors.h - cursor classes //#include "stdafx.h" -#include +#include #include #include "Cursors.h" diff --git a/Console/Dialogs.cpp b/Console/Dialogs.cpp index 0ffc2f20..18574e04 100644 --- a/Console/Dialogs.cpp +++ b/Console/Dialogs.cpp @@ -29,7 +29,7 @@ // About dialog class, etc... //#include "stdafx.h" -#include +#include #include "resource.h" #include "Console.h" diff --git a/Console/FileStream.cpp b/Console/FileStream.cpp index c78c0028..2e56aedd 100644 --- a/Console/FileStream.cpp +++ b/Console/FileStream.cpp @@ -33,7 +33,7 @@ //#include "stdafx.h" //#include -#include +#include #include #include "FileStream.h" diff --git a/Editor/Button Defines.h b/Editor/Button Defines.h index 677aa6ce..991bb93c 100644 --- a/Editor/Button Defines.h +++ b/Editor/Button Defines.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __BUTTON_DEFINES_H diff --git a/Editor/Cursor Modes.cpp b/Editor/Cursor Modes.cpp index 16bb60b7..a4f60979 100644 --- a/Editor/Cursor Modes.cpp +++ b/Editor/Cursor Modes.cpp @@ -7,7 +7,7 @@ #include "renderworld.h" #include "random.h" #include "worldman.h" - #include "interface.h" + #include "Interface.h" #include "Isometric Utils.h" #include "editscreen.h" #include "EditorDefines.h" diff --git a/Editor/Cursor Modes.h b/Editor/Cursor Modes.h index c4994185..fe9e3af3 100644 --- a/Editor/Cursor Modes.h +++ b/Editor/Cursor Modes.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __CURSOR_MODES_H diff --git a/Editor/Editor Callback Prototypes.h b/Editor/Editor Callback Prototypes.h index 3cb2ff60..3794ab35 100644 --- a/Editor/Editor Callback Prototypes.h +++ b/Editor/Editor Callback Prototypes.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITOR_CALLBACK_PROTOTYPES_H diff --git a/Editor/Editor Modes.cpp b/Editor/Editor Modes.cpp index f8cd9084..81d23d08 100644 --- a/Editor/Editor Modes.cpp +++ b/Editor/Editor Modes.cpp @@ -17,7 +17,7 @@ #include "environment.h" #include "worlddef.h" #include "Exit Grids.h" - #include "Worldman.h" + #include "worldman.h" BOOLEAN gfShowExitGrids = FALSE; diff --git a/Editor/Editor Modes.h b/Editor/Editor Modes.h index 3eae7696..de860f51 100644 --- a/Editor/Editor Modes.h +++ b/Editor/Editor Modes.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITOR_MODES_H diff --git a/Editor/Editor Taskbar Creation.cpp b/Editor/Editor Taskbar Creation.cpp index 1b7f5c50..15f74641 100644 --- a/Editor/Editor Taskbar Creation.cpp +++ b/Editor/Editor Taskbar Creation.cpp @@ -5,7 +5,7 @@ //sgp #include "Button System.h" #include "Font Control.h" - #include "debug.h" + #include "DEBUG.H" //editor #include "EditorDefines.h" #include "Editor Callback Prototypes.h" @@ -14,7 +14,7 @@ #include "EditorMapInfo.h" //tactical #include "Soldier Create.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "local.h" #include "Text.h" diff --git a/Editor/Editor Taskbar Creation.h b/Editor/Editor Taskbar Creation.h index ca645a7e..a91061e8 100644 --- a/Editor/Editor Taskbar Creation.h +++ b/Editor/Editor Taskbar Creation.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITOR_TASKBAR_CREATION_H diff --git a/Editor/Editor Taskbar Utils.cpp b/Editor/Editor Taskbar Utils.cpp index 75a77b06..a3944735 100644 --- a/Editor/Editor Taskbar Utils.cpp +++ b/Editor/Editor Taskbar Utils.cpp @@ -11,13 +11,13 @@ #include "WorldDat.h" #include "Render Dirty.h" #include "sysutil.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "environment.h" #include "Interface Items.h" #include "Soldier Find.h" #include "World Items.h" #include "Text.h" - #include "Overhead map.h" + #include "overhead map.h" #include "Cursor Modes.h" #include "editscreen.h" #include "EditorTerrain.h" diff --git a/Editor/Editor Taskbar Utils.h b/Editor/Editor Taskbar Utils.h index 563452e6..930bb8fc 100644 --- a/Editor/Editor Taskbar Utils.h +++ b/Editor/Editor Taskbar Utils.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITOR_TASKBAR_UTILS_H diff --git a/Editor/Editor Undo.cpp b/Editor/Editor Undo.cpp index 0d09d8b9..642d4833 100644 --- a/Editor/Editor Undo.cpp +++ b/Editor/Editor Undo.cpp @@ -6,7 +6,7 @@ #include "worldman.h" #include "smooth.h" #include "input.h" - #include "debug.h" + #include "DEBUG.H" #include "Isometric Utils.h" #include "editscreen.h" @@ -15,7 +15,7 @@ #include "Cursor Modes.h" #include "Exit Grids.h" //dnl ch86 110214 - #include "keys.h" + #include "Keys.h" #include "EditorItems.h" #include "EditorMapInfo.h" diff --git a/Editor/Editor Undo.h b/Editor/Editor Undo.h index c7b470a4..e399eba4 100644 --- a/Editor/Editor Undo.h +++ b/Editor/Editor Undo.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITOR_UNDO_H diff --git a/Editor/EditorBuildings.cpp b/Editor/EditorBuildings.cpp index fd7f9c29..d6ecccf2 100644 --- a/Editor/EditorBuildings.cpp +++ b/Editor/EditorBuildings.cpp @@ -18,7 +18,7 @@ #include "Editor Modes.h" #include "Smoothing Utils.h" #include "Text Input.h" - #include "keys.h" + #include "Keys.h" #include "environment.h" #include "selectwin.h" #include "Simple Render Utils.h" diff --git a/Editor/EditorBuildings.h b/Editor/EditorBuildings.h index bfeb0a8f..4fe900f4 100644 --- a/Editor/EditorBuildings.h +++ b/Editor/EditorBuildings.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITORBUILDINGS_H diff --git a/Editor/EditorDefines.h b/Editor/EditorDefines.h index 28f40081..053c3348 100644 --- a/Editor/EditorDefines.h +++ b/Editor/EditorDefines.h @@ -1,10 +1,10 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITORDEFINES_H #define __EDITORDEFINES_H -#include "Types.h" +#include "types.h" #include "Button Defines.h" diff --git a/Editor/EditorItems.cpp b/Editor/EditorItems.cpp index 7c0b3364..bd8751db 100644 --- a/Editor/EditorItems.cpp +++ b/Editor/EditorItems.cpp @@ -9,34 +9,34 @@ #include "vobject.h" #include "mousesystem.h" #include "Button System.h" - #include "wcheck.h" + #include "WCheck.h" #include "vsurface.h" #include "input.h" #include "sysutil.h" - #include "font.h" + #include "Font.h" #include "Font Control.h" #include "editscreen.h" #include "selectwin.h" #include "video.h" #include "vobject_blitters.h" - #include "interface panels.h" - #include "interface items.h" - #include "text.h" - #include "utilities.h" + #include "Interface Panels.h" + #include "Interface Items.h" + #include "Text.h" + #include "Utilities.h" #include "Action Items.h" #include "World Items.h" #include "EditorDefines.h" #include "EditorItems.h" #include "EditorMercs.h" - #include "weapons.h" + #include "Weapons.h" #include "Editor Taskbar Utils.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "Item Statistics.h" #include "Simple Render Utils.h" #include "worldman.h" #include "random.h" - #include "Pits.h" - #include "keys.h" + #include "pits.h" + #include "Keys.h" #include "InterfaceItemImages.h" #include "Editor Undo.h"//dnl ch86 220214 diff --git a/Editor/EditorItems.h b/Editor/EditorItems.h index e56fbfdf..04aff1dc 100644 --- a/Editor/EditorItems.h +++ b/Editor/EditorItems.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITORITEMS_H diff --git a/Editor/EditorMapInfo.cpp b/Editor/EditorMapInfo.cpp index b4335ab3..adec5870 100644 --- a/Editor/EditorMapInfo.cpp +++ b/Editor/EditorMapInfo.cpp @@ -9,23 +9,23 @@ #include "vobject.h" #include "mousesystem.h" #include "Button System.h" - #include "wcheck.h" + #include "WCheck.h" #include "vsurface.h" #include "line.h" #include "input.h" #include "sysutil.h" - #include "font.h" + #include "Font.h" #include "Font Control.h" #include "editscreen.h" #include "selectwin.h" #include "video.h" #include "vobject_blitters.h" - #include "interface panels.h" - #include "interface items.h" - #include "utilities.h" + #include "Interface Panels.h" + #include "Interface Items.h" + #include "Utilities.h" #include "World Items.h" #include "worldman.h" - #include "overhead.h" //GetSoldier + #include "Overhead.h" //GetSoldier #include "renderworld.h" #include "Animation Data.h" #include "Animation Control.h" @@ -37,11 +37,11 @@ #include "Soldier Init List.h" #include "strategicmap.h" #include "Soldier Add.h" - #include "Soldier Profile Type.h" + #include "soldier profile type.h" #include "Soldier Profile.h" #include "Text Input.h" - #include "Random.h" - #include "wordwrap.h" + #include "random.h" + #include "WordWrap.h" #include "EditorItems.h" #include "Editor Taskbar Utils.h" #include "Exit Grids.h" diff --git a/Editor/EditorMapInfo.h b/Editor/EditorMapInfo.h index b9cbdf7a..03f93db3 100644 --- a/Editor/EditorMapInfo.h +++ b/Editor/EditorMapInfo.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITORMAPINFO_H diff --git a/Editor/EditorMercs.cpp b/Editor/EditorMercs.cpp index 737d3a6f..f91421bd 100644 --- a/Editor/EditorMercs.cpp +++ b/Editor/EditorMercs.cpp @@ -9,24 +9,24 @@ #include "vobject.h" #include "mousesystem.h" #include "Button System.h" - #include "wcheck.h" + #include "WCheck.h" #include "vsurface.h" #include "line.h" #include "input.h" #include "sysutil.h" - #include "font.h" + #include "Font.h" #include "Font Control.h" #include "editscreen.h" #include "selectwin.h" #include "video.h" #include "vobject_blitters.h" - #include "interface panels.h" - #include "interface items.h" - #include "text.h" - #include "utilities.h" + #include "Interface Panels.h" + #include "Interface Items.h" + #include "Text.h" + #include "Utilities.h" #include "World Items.h" #include "worldman.h" - #include "overhead.h" //GetSoldier + #include "Overhead.h" //GetSoldier #include "renderworld.h" #include "Animation Data.h" #include "Animation Control.h" @@ -39,11 +39,11 @@ #include "Soldier Init List.h" #include "strategicmap.h" #include "Soldier Add.h" - #include "Soldier Profile Type.h" + #include "soldier profile type.h" #include "Soldier Profile.h" #include "Text Input.h" - #include "Random.h" - #include "wordwrap.h" + #include "random.h" + #include "WordWrap.h" #include "EditorItems.h" #include "Editor Taskbar Utils.h" #include "Exit Grids.h" diff --git a/Editor/EditorMercs.h b/Editor/EditorMercs.h index 71e66ccd..64dc4a9e 100644 --- a/Editor/EditorMercs.h +++ b/Editor/EditorMercs.h @@ -1,6 +1,6 @@ #pragma once -#include "BuildDefines.h" +#include "builddefines.h" //----------------------------------------------- // diff --git a/Editor/EditorTerrain.cpp b/Editor/EditorTerrain.cpp index 932b44ef..14560d0c 100644 --- a/Editor/EditorTerrain.cpp +++ b/Editor/EditorTerrain.cpp @@ -9,18 +9,18 @@ #include "vobject.h" #include "mousesystem.h" #include "Button System.h" - #include "wcheck.h" + #include "WCheck.h" #include "vsurface.h" #include "input.h" #include "sysutil.h" - #include "font.h" + #include "Font.h" #include "Font Control.h" #include "editscreen.h" #include "selectwin.h" #include "video.h" #include "vobject_blitters.h" - #include "interface panels.h" - #include "utilities.h" + #include "Interface Panels.h" + #include "Utilities.h" #include "World Items.h" #include "EditorDefines.h" #include "EditorTerrain.h" diff --git a/Editor/EditorTerrain.h b/Editor/EditorTerrain.h index 5b48ff0d..8be6a062 100644 --- a/Editor/EditorTerrain.h +++ b/Editor/EditorTerrain.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDITORTERRAIN_H diff --git a/Editor/Item Statistics.cpp b/Editor/Item Statistics.cpp index 57a1851b..da20b785 100644 --- a/Editor/Item Statistics.cpp +++ b/Editor/Item Statistics.cpp @@ -7,7 +7,7 @@ #include "types.h" #include "mousesystem.h" #include "Button System.h" - #include "font control.h" + #include "Font Control.h" #include "EditorDefines.h" #include "Editor Taskbar Utils.h" #include "EditorMercs.h" @@ -20,10 +20,10 @@ #include "Weapons.h" #include "Items.h" #include "editscreen.h" - #include "Random.h" + #include "random.h" #include "Handle Items.h" #include "World Items.h" - #include "PopupMenu.h" + #include "popupmenu.h" #include "pits.h" #include "Text.h" diff --git a/Editor/Item Statistics.h b/Editor/Item Statistics.h index 63b80a6c..be19922d 100644 --- a/Editor/Item Statistics.h +++ b/Editor/Item Statistics.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifndef __ITEM_STATISTICS_H #define __ITEM_STATISTICS_H diff --git a/Editor/LoadScreen.cpp b/Editor/LoadScreen.cpp index cba550c2..4cd76d65 100644 --- a/Editor/LoadScreen.cpp +++ b/Editor/LoadScreen.cpp @@ -5,8 +5,8 @@ #include #include "Font Control.h" #include "renderworld.h" - #include "render dirty.h" - #include "loadscreen.h" + #include "Render Dirty.h" + #include "LoadScreen.h" #include "selectwin.h" #include "EditorDefines.h" #include "messagebox.h" diff --git a/Editor/LoadScreen.h b/Editor/LoadScreen.h index 24518194..f5216028 100644 --- a/Editor/LoadScreen.h +++ b/Editor/LoadScreen.h @@ -1,5 +1,5 @@ -#include "BuildDefines.h" -#include "Fileman.h" +#include "builddefines.h" +#include "FileMan.h" #define FILENAME_BUFLEN (30 + 4 + 1)//dnl ch39 190909 +4 is for ".dat", +1 is for '\0' //dnl ch81 021213 diff --git a/Editor/Road Smoothing.cpp b/Editor/Road Smoothing.cpp index 26787509..9c26abcd 100644 --- a/Editor/Road Smoothing.cpp +++ b/Editor/Road Smoothing.cpp @@ -4,7 +4,7 @@ #include "types.h" #include "Road Smoothing.h" - #include "tiledat.h" + #include "TileDat.h" #include "worlddef.h" #include "worldman.h" #include "Editor Undo.h" diff --git a/Editor/Road Smoothing.h b/Editor/Road Smoothing.h index f1b899d9..f91f9b2f 100644 --- a/Editor/Road Smoothing.h +++ b/Editor/Road Smoothing.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR diff --git a/Editor/Sector Summary.cpp b/Editor/Sector Summary.cpp index 9c328cfa..739d0931 100644 --- a/Editor/Sector Summary.cpp +++ b/Editor/Sector Summary.cpp @@ -15,22 +15,22 @@ #include "line.h" #include "input.h" #include "vobject_blitters.h" - #include "loadscreen.h" + #include "LoadScreen.h" #include "Text Input.h" #include "mousesystem.h" #include "strategicmap.h" - #include "Fileman.h" + #include "FileMan.h" #include "Exit Grids.h" #include "Map Information.h" #include "Summary Info.h" #include "Animated ProgressBar.h" #include "worlddef.h" - #include "worlddat.h" + #include "WorldDat.h" #include "EditorDefines.h" #include "editscreen.h" #include "english.h" #include "World Items.h" - #include "text.h" + #include "Text.h" #include "Soldier Create.h" #include "GameVersion.h" #include "Campaign Types.h" diff --git a/Editor/Sector Summary.h b/Editor/Sector Summary.h index c1c97758..21246830 100644 --- a/Editor/Sector Summary.h +++ b/Editor/Sector Summary.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __SECTOR_SUMMARY_H diff --git a/Editor/SmartMethod.h b/Editor/SmartMethod.h index 09aedce9..7717e4a4 100644 --- a/Editor/SmartMethod.h +++ b/Editor/SmartMethod.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __SMARTMETHOD_H diff --git a/Editor/Smoothing Utils.h b/Editor/Smoothing Utils.h index 7da29628..325c926c 100644 --- a/Editor/Smoothing Utils.h +++ b/Editor/Smoothing Utils.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __SMOOTHING_UTILS_H diff --git a/Editor/Summary Info.h b/Editor/Summary Info.h index 9aae3973..e8ee9be5 100644 --- a/Editor/Summary Info.h +++ b/Editor/Summary Info.h @@ -1,10 +1,10 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __SUMMARY_INFO_H #define __SUMMARY_INFO_H -#include "Types.h" +#include "types.h" //dnl ch28 #define GLOBAL_SUMMARY_VERSION 15 diff --git a/Editor/edit_sys.h b/Editor/edit_sys.h index b7c5693b..a4f702be 100644 --- a/Editor/edit_sys.h +++ b/Editor/edit_sys.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __EDIT_SYS_H diff --git a/Editor/editscreen.cpp b/Editor/editscreen.cpp index 563561ed..759a30c5 100644 --- a/Editor/editscreen.cpp +++ b/Editor/editscreen.cpp @@ -12,22 +12,22 @@ #include "edit_sys.h" #include "screenids.h" #include "editscreen.h" - #include "sys globals.h" + #include "Sys Globals.h" #include "SmartMethod.h" #include "selectwin.h" #include "Interface.h" #include "lighting.h" #include "Interactive Tiles.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "Overhead.h" #include "Handle UI.h" #include "Event Pump.h" #include "world items.h" - #include "loadscreen.h" - #include "render dirty.h" - #include "isometric utils.h" + #include "LoadScreen.h" + #include "Render Dirty.h" + #include "Isometric Utils.h" #include "message.h" - #include "render fun.h" + #include "Render Fun.h" #include "popupmenu.h" #include "overhead map.h" #include "EditorDefines.h" @@ -39,7 +39,7 @@ #include "newsmooth.h" #include "Smoothing Utils.h" #include "messagebox.h" - #include "messageboxscreen.h" + #include "MessageBoxScreen.h" #include "Soldier Create.h" #include "Soldier Init List.h" #include "Text Input.h" @@ -59,7 +59,7 @@ #include "line.h" #include "english.h" #include "random.h" - #include "scheduling.h" + #include "Scheduling.h" #include "Road Smoothing.h" #include "strategicmap.h" #include "message.h" @@ -70,7 +70,7 @@ #include "GameSettings.h" #include "Summary Info.h" #include "connect.h"//dnl - #include "cursors.h"//dnl ch2 210909 + #include "Cursors.h"//dnl ch2 210909 #include "Cursor Control.h"//dnl ch2 210909 #include "maputility.h"//dnl ch49 061009 #include "Text.h" diff --git a/Editor/editscreen.h b/Editor/editscreen.h index 1f3c591a..c28c617b 100644 --- a/Editor/editscreen.h +++ b/Editor/editscreen.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef EDITSCREEN_H diff --git a/Editor/messagebox.cpp b/Editor/messagebox.cpp index 52226450..5e3221fc 100644 --- a/Editor/messagebox.cpp +++ b/Editor/messagebox.cpp @@ -4,7 +4,7 @@ #include "vobject.h" #include "video.h" - #include "font.h" + #include "Font.h" #include "Font Control.h" #include "messagebox.h" #include "input.h" diff --git a/Editor/messagebox.h b/Editor/messagebox.h index 9f0a57fa..f43e0682 100644 --- a/Editor/messagebox.h +++ b/Editor/messagebox.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __MESSAGEBOX_H diff --git a/Editor/newsmooth.cpp b/Editor/newsmooth.cpp index 2123937a..bbfc694b 100644 --- a/Editor/newsmooth.cpp +++ b/Editor/newsmooth.cpp @@ -14,7 +14,7 @@ #include "Editor Undo.h" #include "Structure Internals.h" #include "environment.h" - #include "Random.h" + #include "random.h" #include "Render Fun.h" diff --git a/Editor/newsmooth.h b/Editor/newsmooth.h index 640b7f22..b2889a82 100644 --- a/Editor/newsmooth.h +++ b/Editor/newsmooth.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __NEWSMOOTH_H diff --git a/Editor/popupmenu.cpp b/Editor/popupmenu.cpp index 8d43a90a..34feabd6 100644 --- a/Editor/popupmenu.cpp +++ b/Editor/popupmenu.cpp @@ -16,18 +16,18 @@ #include "tiledef.h" #include "sysutil.h" - #include "font.h" + #include "Font.h" #include "Font Control.h" #include "line.h" - #include "worlddat.h" + #include "WorldDat.h" #include "selectwin.h" #include "popupmenu.h" #include "EditorDefines.h" - #include "render dirty.h" - #include "debug.h" + #include "Render Dirty.h" + #include "DEBUG.H" #include "mousesystem.h" - #include "cursors.h" - #include "overhead types.h" + #include "Cursors.h" + #include "Overhead Types.h" #include "EditorMercs.h" #include "Scheduling.h" #include "english.h" diff --git a/Editor/popupmenu.h b/Editor/popupmenu.h index 94c2ec3f..fe5ffb19 100644 --- a/Editor/popupmenu.h +++ b/Editor/popupmenu.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR //popupmenu.h diff --git a/Editor/selectwin.cpp b/Editor/selectwin.cpp index baf826a4..6eeb97cd 100644 --- a/Editor/selectwin.cpp +++ b/Editor/selectwin.cpp @@ -6,7 +6,7 @@ #include "tiledef.h" #include "vsurface.h" - #include "worlddat.h" + #include "WorldDat.h" #include "random.h" #include "sysutil.h" #include "Font Control.h" diff --git a/Editor/selectwin.h b/Editor/selectwin.h index 7d9c8981..c5fb5388 100644 --- a/Editor/selectwin.h +++ b/Editor/selectwin.h @@ -1,10 +1,10 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef _SELECTION_WIN_H_ #define _SELECTION_WIN_H_ -#include "Types.h" +#include "types.h" #include "vobject.h" #include "mousesystem.h" diff --git a/Editor/smooth.cpp b/Editor/smooth.cpp index c835a29a..b9400401 100644 --- a/Editor/smooth.cpp +++ b/Editor/smooth.cpp @@ -5,15 +5,15 @@ #include "stdlib.h" #include "FileMan.h" #include "time.h" - #include "debug.h" + #include "DEBUG.H" #include "tiledef.h" #include "worlddef.h" #include "worldman.h" #include "smooth.h" #include "editscreen.h" #include "selectwin.h" - #include "isometric utils.h" - #include "structure wrap.h" + #include "Isometric Utils.h" + #include "Structure Wrap.h" #include "Exit Grids.h" #include "Editor Undo.h" diff --git a/Editor/smooth.h b/Editor/smooth.h index 4637d179..9201ef7c 100644 --- a/Editor/smooth.h +++ b/Editor/smooth.h @@ -1,4 +1,4 @@ -#include "BuildDefines.h" +#include "builddefines.h" #ifdef JA2EDITOR #ifndef __SMOOTH_H diff --git a/Ja2/Credits.cpp b/Ja2/Credits.cpp index f2d1fdeb..24a8b6aa 100644 --- a/Ja2/Credits.cpp +++ b/Ja2/Credits.cpp @@ -1,24 +1,24 @@ - #include "Types.h" + #include "types.h" #include "Credits.h" #include "vsurface.h" #include "mousesystem.h" #include "Text.h" - #include "wordwrap.h" - #include "Video.h" - #include "render dirty.h" + #include "WordWrap.h" + #include "video.h" + #include "Render Dirty.h" #include "local.h" - #include "utilities.h" + #include "Utilities.h" #include "WCheck.h" #include "screenids.h" #include "Font Control.h" - #include "cursors.h" - #include "font.h" - #include "wordwrap.h" + #include "Cursors.h" + #include "Font.h" + #include "WordWrap.h" #include "sysutil.h" - #include "Input.h" + #include "input.h" #include "english.h" - #include "encrypted file.h" - #include "Random.h" + #include "Encrypted File.h" + #include "random.h" //externals extern HVSURFACE ghFrameBuffer; diff --git a/Ja2/Fade Screen.cpp b/Ja2/Fade Screen.cpp index 2f44de73..635f9b29 100644 --- a/Ja2/Fade Screen.cpp +++ b/Ja2/Fade Screen.cpp @@ -1,12 +1,12 @@ #include "sgp.h" #include "screenids.h" #include "Timer Control.h" - #include "sys globals.h" - #include "fade screen.h" + #include "Sys Globals.h" + #include "Fade Screen.h" #include "sysutil.h" #include "vobject_blitters.h" - #include "cursor control.h" - #include "music control.h" + #include "Cursor Control.h" + #include "Music Control.h" #include "Render Dirty.h" #include "gameloop.h" diff --git a/Ja2/FeaturesScreen.cpp b/Ja2/FeaturesScreen.cpp index 50535f97..34ce1f74 100644 --- a/Ja2/FeaturesScreen.cpp +++ b/Ja2/FeaturesScreen.cpp @@ -1,6 +1,6 @@ -#include "Types.h" +#include "types.h" #include "FeaturesScreen.h" -#include "Video.h" +#include "video.h" #include "Font Control.h" #include "Game Clock.h" #include "Text Input.h" @@ -10,29 +10,29 @@ #include "WordWrap.h" #include "WCheck.h" #include "Utilities.h" -#include "Debug.h" +#include "DEBUG.H" #include "Sound Control.h" #include "Ambient Control.h" -#include "Worlddat.h" -#include "Worlddef.h" +#include "WorldDat.h" +#include "worlddef.h" #include "GameSettings.h" #include "Game Init.h" -#include "English.h" +#include "english.h" #include "Overhead.h" -#include "Gap.h" +#include "GAP.H" #include "Cursors.h" -#include "SysUtil.h" +#include "sysutil.h" #include "Exit Grids.h" #include "Text.h" #include "Interface Control.h" -#include "Message.h" +#include "message.h" #include "Multi Language Graphic Utils.h" #include "Map Information.h" #include "Sys Globals.h" #include "insurance.h" #include "connect.h" -#include "WorldMan.h" +#include "worldman.h" #include "Init.h" #include "Game Events.h" diff --git a/Ja2/GameInitOptionsScreen.cpp b/Ja2/GameInitOptionsScreen.cpp index b2eb2216..08ebadbf 100644 --- a/Ja2/GameInitOptionsScreen.cpp +++ b/Ja2/GameInitOptionsScreen.cpp @@ -1,19 +1,19 @@ - #include "Types.h" + #include "types.h" #include "GameInitOptionsScreen.h" #include "GameSettings.h" #include "Utilities.h" - #include "wCheck.h" + #include "WCheck.h" #include "Font Control.h" #include "WordWrap.h" #include "Render Dirty.h" - #include "Input.h" + #include "input.h" #include "Options Screen.h" - #include "English.h" - #include "Sysutil.h" + #include "english.h" + #include "sysutil.h" #include "Fade Screen.h" #include "Cursor Control.h" #include "Music Control.h" - #include "cursors.h" + #include "Cursors.h" #include "Intro.h" #include "Text.h" #include "_Ja25EnglishText.h" @@ -21,7 +21,7 @@ #include "gameloop.h" #include "connect.h" -#include "saveloadscreen.h" +#include "SaveLoadScreen.h" #ifdef JA2UB #include "ub_config.h" diff --git a/Ja2/GameSettings.cpp b/Ja2/GameSettings.cpp index 6f31793b..2010e851 100644 --- a/Ja2/GameSettings.cpp +++ b/Ja2/GameSettings.cpp @@ -1,7 +1,7 @@ - #include "Types.h" + #include "types.h" #include "GameSettings.h" #include "FileMan.h" - #include "String.h" + #include "string.h" #include "Sound Control.h" #include "SaveLoadScreen.h" #include "Music Control.h" @@ -9,19 +9,19 @@ #include "Overhead.h" #include "GameVersion.h" #include "LibraryDataBase.h" - #include "Debug.h" + #include "DEBUG.H" #include "HelpScreen.h" #include "INIReader.h" #include "Shade Table Util.h" #include "soldier profile type.h" - #include "Random.h" + #include "random.h" #include "SaveLoadGame.h" #include "sgp.h" #include "screenids.h" #include "Font Control.h" #include "message.h" #include "Campaign.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "strategicmap.h" #include "Queen Command.h" #include "Game Clock.h" diff --git a/Ja2/GameSettings.h b/Ja2/GameSettings.h index 74fba2dd..54027660 100644 --- a/Ja2/GameSettings.h +++ b/Ja2/GameSettings.h @@ -1,7 +1,7 @@ #ifndef _GAME_SETTINGS__H_ #define _GAME_SETTINGS__H_ -#include "Types.h" +#include "types.h" #include "Strategic Status.h" #include "Morale.h" #include "GameInitOptionsScreen.h" diff --git a/Ja2/GameVersion.cpp b/Ja2/GameVersion.cpp index d91a7c51..6a38c8a5 100644 --- a/Ja2/GameVersion.cpp +++ b/Ja2/GameVersion.cpp @@ -1,4 +1,4 @@ - #include "Types.h" + #include "types.h" #include "GameVersion.h" // diff --git a/Ja2/HelpScreen.cpp b/Ja2/HelpScreen.cpp index dcf0ccc4..9583b102 100644 --- a/Ja2/HelpScreen.cpp +++ b/Ja2/HelpScreen.cpp @@ -1,19 +1,19 @@ #include "sgp.h" #include "sysutil.h" #include "vobject_blitters.h" - #include "wcheck.h" - #include "cursors.h" - #include "font control.h" - #include "cursor control.h" - #include "render dirty.h" + #include "WCheck.h" + #include "Cursors.h" + #include "Font Control.h" + #include "Cursor Control.h" + #include "Render Dirty.h" #include "Text.h" #include "Utilities.h" #include "WordWrap.h" #include "Font Control.h" - #include "text.h" + #include "Text.h" #include "HelpScreen.h" #include "HelpScreenText.h" - #include "Line.h" + #include "line.h" #include "Game Clock.h" #include "GameSettings.h" #include "laptop.h" diff --git a/Ja2/Init.cpp b/Ja2/Init.cpp index a80bf217..ca6840c5 100644 --- a/Ja2/Init.cpp +++ b/Ja2/Init.cpp @@ -1,7 +1,7 @@ #include "builddefines.h" #include #include "sgp.h" - #include "Gameloop.h" + #include "gameloop.h" #include "Screens.h" #include "INIReader.h" #include "vobject_blitters.h" @@ -10,7 +10,7 @@ #include "sysutil.h" #include "worlddef.h" #include "Animation Data.h" - #include "overhead.h" + #include "Overhead.h" #include "Font Control.h" #include "Button System.h" #include "Timer Control.h" @@ -21,18 +21,18 @@ #include "Event Pump.h" #include "lighting.h" #include "Cursor Control.h" - #include "music control.h" + #include "Music Control.h" #include "video.h" #include "mapscreen.h" - #include "interface items.h" - #include "Maputility.h" + #include "Interface Items.h" + #include "maputility.h" #include "strategic.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "Text.h" #include "laptop.h" #include "NPC.h" #include "MercTextBox.h" - #include "tile cache.h" + #include "Tile Cache.h" #include "strategicmap.h" #include "Map Information.h" #include "Shade Table Util.h" @@ -44,7 +44,7 @@ #include "jascreens.h" #include "XML.h" #include "SaveLoadGame.h" - #include "weapons.h" + #include "Weapons.h" #include "Strategic Movement.h" #include "Vehicles.h" #include "Multilingual Text Code Generator.h" diff --git a/Ja2/Intro.cpp b/Ja2/Intro.cpp index 113873cd..7fc5cbf7 100644 --- a/Ja2/Intro.cpp +++ b/Ja2/Intro.cpp @@ -1,14 +1,14 @@ #include "sgp.h" #include "sysutil.h" #include "vobject_blitters.h" - #include "font control.h" - #include "cursor control.h" - #include "render dirty.h" + #include "Font Control.h" + #include "Cursor Control.h" + #include "Render Dirty.h" #include "Text.h" #include "Utilities.h" #include "WordWrap.h" - #include "text.h" - #include "Line.h" + #include "Text.h" + #include "line.h" #include "Intro.h" #include "Cinematics.h" #include "Cinematics Bink.h" diff --git a/Ja2/JA2 Splash.cpp b/Ja2/JA2 Splash.cpp index c7d9634d..6aab7b97 100644 --- a/Ja2/JA2 Splash.cpp +++ b/Ja2/JA2 Splash.cpp @@ -1,7 +1,7 @@ -#include "Types.h" +#include "types.h" #include "vsurface.h" #include "mainmenuscreen.h" -#include "Video.h" +#include "video.h" #include "Timer Control.h" #include "Multi Language Graphic Utils.h" #include diff --git a/Ja2/Ja25Update.cpp b/Ja2/Ja25Update.cpp index 4fd737e1..a038c64e 100644 --- a/Ja2/Ja25Update.cpp +++ b/Ja2/Ja25Update.cpp @@ -4,7 +4,7 @@ #include #include "Render Fun.h" #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "MemMan.h" #include "Overhead Types.h" //#include "Soldier Control.h" @@ -12,21 +12,21 @@ #include "Animation Data.h" #include "Animation Control.h" #include -#include "pathai.h" -#include "Random.h" +#include "PATHAI.H" +#include "random.h" #include "Isometric Utils.h" #include "renderworld.h" #include "video.h" -#include "weapons.h" +#include "Weapons.h" #include "vobject_blitters.h" #include "Handle UI.h" -#include "Event pump.h" +#include "Event Pump.h" #include "ai.h" -#include "interface.h" +#include "Interface.h" #include "lighting.h" #include "faces.h" #include "Soldier Profile.h" -#include "soldier macros.h" +#include "Soldier macros.h" #include "english.h" #include "Squads.h" @@ -34,33 +34,33 @@ #include "Networking.h" #include "NetworkEvent.h" #endif -#include "items.h" -#include "Soundman.h" -#include "utilities.h" -#include "Strategic.h" +#include "Items.h" +#include "soundman.h" +#include "Utilities.h" +#include "strategic.h" #include "soldier tile.h" #include "Smell.h" #include "Keys.h" -#include "dialogue control.h" -#include "soldier functions.h" +#include "Dialogue Control.h" +#include "Soldier Functions.h" #include "Exit Grids.h" #include "Quests.h" #include "message.h" #include "SkillCheck.h" -#include "interface dialogue.h" +#include "interface Dialogue.h" #include "GameSettings.h" #include "ShopKeeper Interface.h" -#include "vehicles.h" +#include "Vehicles.h" #include "strategicmap.h" -#include "morale.h" -#include "drugs and alcohol.h" +#include "Morale.h" +#include "Drugs And Alcohol.h" #include "SkillCheck.h" #include "Map Information.h" #include "Buildings.h" #include "Text.h" #include "Campaign Types.h" #include "Strategic Status.h" -#include "civ quotes.h" +#include "Civ Quotes.h" #include "Debug Control.h" #ifdef JA2UB diff --git a/Ja2/Ja25Update.h b/Ja2/Ja25Update.h index a2edef1c..d9948a29 100644 --- a/Ja2/Ja25Update.h +++ b/Ja2/Ja25Update.h @@ -1,7 +1,7 @@ #ifndef JA25UPDATE__C_ #define JA25UPDATE__C_ -#include "Types.h" +#include "types.h" #ifdef JA2UB diff --git a/Ja2/Loading Screen.cpp b/Ja2/Loading Screen.cpp index 2650cc9f..0ade7191 100644 --- a/Ja2/Loading Screen.cpp +++ b/Ja2/Loading Screen.cpp @@ -4,12 +4,12 @@ #include "Campaign Types.h" #include "Game Clock.h" #include "GameSettings.h" - #include "Random.h" - #include "Debug.h" + #include "random.h" + #include "DEBUG.H" #include "local.h" #include "Font Control.h" - #include "font.h" - #include "render dirty.h" + #include "Font.h" + #include "Render Dirty.h" #include "Strategic Movement.h" #include "UndergroundInit.h" #include diff --git a/Ja2/MPChatScreen.cpp b/Ja2/MPChatScreen.cpp index 78ed6a65..5742e3bf 100644 --- a/Ja2/MPChatScreen.cpp +++ b/Ja2/MPChatScreen.cpp @@ -1,26 +1,26 @@ #include "sgp.h" #include "screenids.h" #include "Timer Control.h" - #include "fade screen.h" + #include "Fade Screen.h" #include "sysutil.h" #include "vobject_blitters.h" #include "MercTextBox.h" - #include "cursors.h" - #include "font control.h" + #include "Cursors.h" + #include "Font Control.h" #include "Map Screen Interface.h" #include "renderworld.h" #include "gameloop.h" #include "english.h" #include "GameSettings.h" - #include "cursor control.h" + #include "Cursor Control.h" #include "laptop.h" - #include "text.h" + #include "Text.h" #include "Text Input.h" #include "overhead map.h" #include "MPChatScreen.h" #include "WordWrap.h" #include "message.h" -#include "utilities.h" +#include "Utilities.h" #include "connect.h" #define CHATBOX_WIDTH 310 // 350 is the max size, the PrepareMercPopupBox will add the X_MARGIN to both sides diff --git a/Ja2/MPConnectScreen.cpp b/Ja2/MPConnectScreen.cpp index b6a1214a..a07c64b8 100644 --- a/Ja2/MPConnectScreen.cpp +++ b/Ja2/MPConnectScreen.cpp @@ -1,19 +1,19 @@ - #include "Types.h" + #include "types.h" #include "MPConnectScreen.h" #include "GameSettings.h" #include "Utilities.h" - #include "wCheck.h" + #include "WCheck.h" #include "Font Control.h" #include "WordWrap.h" #include "Render Dirty.h" - #include "Input.h" + #include "input.h" #include "Options Screen.h" - #include "English.h" - #include "Sysutil.h" + #include "english.h" + #include "sysutil.h" #include "Fade Screen.h" #include "Cursor Control.h" #include "Music Control.h" - #include "cursors.h" + #include "Cursors.h" #include "Text.h" #include "Text Input.h" #include "Soldier Profile.h" @@ -25,8 +25,8 @@ #include "connect.h" #include "network.h" // for client name #include "message.h" -#include "init.h" -#include "xml.h" +#include "Init.h" +#include "XML.h" //////////////////////////////////////////// diff --git a/Ja2/MPHostScreen.cpp b/Ja2/MPHostScreen.cpp index 21ec5580..15a7025d 100644 --- a/Ja2/MPHostScreen.cpp +++ b/Ja2/MPHostScreen.cpp @@ -1,18 +1,18 @@ - #include "Types.h" + #include "types.h" #include "MPHostScreen.h" #include "GameSettings.h" #include "Utilities.h" - #include "wCheck.h" + #include "WCheck.h" #include "Font Control.h" #include "WordWrap.h" #include "Render Dirty.h" - #include "Input.h" + #include "input.h" #include "Options Screen.h" - #include "English.h" - #include "Sysutil.h" + #include "english.h" + #include "sysutil.h" #include "Fade Screen.h" #include "Cursor Control.h" - #include "cursors.h" + #include "Cursors.h" #include "Intro.h" #include "Text.h" #include "Text Input.h" @@ -22,7 +22,7 @@ #include "gameloop.h" #include "connect.h" #include "network.h" -#include "saveloadscreen.h" +#include "SaveLoadScreen.h" #include "GameInitOptionsScreen.h" @@ -31,9 +31,9 @@ #include #include #include "MPJoinScreen.h" -#include "MainMenuScreen.h" +#include "mainmenuscreen.h" #include "Init.h" -#include "xml.h" +#include "XML.h" //////////////////////////////////////////// // diff --git a/Ja2/MPJoinScreen.cpp b/Ja2/MPJoinScreen.cpp index 9eebad5f..9670f37f 100644 --- a/Ja2/MPJoinScreen.cpp +++ b/Ja2/MPJoinScreen.cpp @@ -1,18 +1,18 @@ - #include "Types.h" + #include "types.h" #include "MPJoinScreen.h" #include "GameSettings.h" #include "Utilities.h" - #include "wCheck.h" + #include "WCheck.h" #include "Font Control.h" #include "WordWrap.h" #include "Render Dirty.h" - #include "Input.h" + #include "input.h" #include "Options Screen.h" - #include "English.h" - #include "Sysutil.h" + #include "english.h" + #include "sysutil.h" #include "Fade Screen.h" #include "Cursor Control.h" - #include "cursors.h" + #include "Cursors.h" #include "Text.h" #include "Text Input.h" #include "Soldier Profile.h" @@ -20,15 +20,15 @@ #include "gameloop.h" #include "connect.h" #include "network.h" // for client name -#include "saveloadscreen.h" -#include "game init.h" +#include "SaveLoadScreen.h" +#include "Game Init.h" #include #include #include #include -#include "Random.h" +#include "random.h" //////////////////////////////////////////// // diff --git a/Ja2/MPScoreScreen.cpp b/Ja2/MPScoreScreen.cpp index 51d6e1a2..6a2812db 100644 --- a/Ja2/MPScoreScreen.cpp +++ b/Ja2/MPScoreScreen.cpp @@ -1,19 +1,19 @@ - #include "Types.h" + #include "types.h" #include "MPScoreScreen.h" #include "GameSettings.h" #include "Utilities.h" - #include "wCheck.h" + #include "WCheck.h" #include "Font Control.h" #include "WordWrap.h" #include "Render Dirty.h" - #include "Input.h" + #include "input.h" #include "Options Screen.h" - #include "English.h" - #include "Sysutil.h" + #include "english.h" + #include "sysutil.h" #include "Fade Screen.h" #include "Cursor Control.h" #include "Music Control.h" - #include "cursors.h" + #include "Cursors.h" #include "Intro.h" #include "Text.h" #include "Text Input.h" diff --git a/Ja2/MainMenuScreen.cpp b/Ja2/MainMenuScreen.cpp index 22d2a266..5069bbb6 100644 --- a/Ja2/MainMenuScreen.cpp +++ b/Ja2/MainMenuScreen.cpp @@ -4,35 +4,35 @@ #include "sysutil.h" #include "vobject_blitters.h" #include "MercTextBox.h" - #include "cursors.h" - #include "font control.h" + #include "Cursors.h" + #include "Font Control.h" #include "mainmenuscreen.h" - #include "cursor control.h" - #include "render dirty.h" - #include "music control.h" + #include "Cursor Control.h" + #include "Render Dirty.h" + #include "Music Control.h" #include "GameSettings.h" #include "SaveLoadScreen.h" #include "SaveLoadGame.h" #include "Options Screen.h" - #include "English.h" - #include "Gameloop.h" + #include "english.h" + #include "gameloop.h" #include "Game Init.h" #include "Utilities.h" #include "WordWrap.h" #include "Font Control.h" - #include "text.h" + #include "Text.h" #include "Multi Language Graphic Utils.h" #include "Encrypted File.h" - #include "ja2 splash.h" + #include "JA2 Splash.h" #include "GameVersion.h" -#include "gamesettings.h" +#include "GameSettings.h" #include "connect.h" #include "strategic.h" -#include "strategic movement.h" -#include "overhead.h" -#include "init.h" -#include "xml.h" +#include "Strategic Movement.h" +#include "Overhead.h" +#include "Init.h" +#include "XML.h" #include #include diff --git a/Ja2/MessageBoxScreen.cpp b/Ja2/MessageBoxScreen.cpp index 79f9feb5..5166fb3f 100644 --- a/Ja2/MessageBoxScreen.cpp +++ b/Ja2/MessageBoxScreen.cpp @@ -1,21 +1,21 @@ #include "sgp.h" #include "screenids.h" - #include "fade screen.h" + #include "Fade Screen.h" #include "sysutil.h" #include "vobject_blitters.h" #include "MercTextBox.h" - #include "cursors.h" - #include "messageboxscreen.h" - #include "font control.h" + #include "Cursors.h" + #include "MessageBoxScreen.h" + #include "Font Control.h" #include "Map Screen Interface.h" #include "renderworld.h" #include "gameloop.h" #include "english.h" #include "GameSettings.h" #include "Interface Control.h" - #include "cursor control.h" + #include "Cursor Control.h" #include "laptop.h" - #include "text.h" + #include "Text.h" #include "Text Input.h" #include "overhead map.h" #include "DropDown.h" // added by Flugente diff --git a/Ja2/Options Screen.cpp b/Ja2/Options Screen.cpp index 6a9ce3d1..bd57e8bf 100644 --- a/Ja2/Options Screen.cpp +++ b/Ja2/Options Screen.cpp @@ -1,6 +1,6 @@ - #include "Types.h" + #include "types.h" #include "Options Screen.h" - #include "Video.h" + #include "video.h" #include "Font Control.h" #include "Game Clock.h" #include "Text Input.h" @@ -11,24 +11,24 @@ #include "WCheck.h" #include "Utilities.h" #include "Slider.h" - #include "Debug.h" + #include "DEBUG.H" #include "Music Control.h" #include "Sound Control.h" #include "soundman.h" #include "Ambient Control.h" - #include "Worlddat.h" - #include "Worlddef.h" + #include "WorldDat.h" + #include "worlddef.h" #include "GameSettings.h" #include "Game Init.h" - #include "English.h" + #include "english.h" #include "Overhead.h" - #include "Gap.h" + #include "GAP.H" #include "Cursors.h" - #include "SysUtil.h" + #include "sysutil.h" #include "Exit Grids.h" #include "Text.h" #include "Interface Control.h" - #include "Message.h" + #include "message.h" #include "Multi Language Graphic Utils.h" #include "Map Information.h" #include "SmokeEffects.h" @@ -36,7 +36,7 @@ #include "Cheats.h" #include "connect.h" -#include "WorldMan.h" +#include "worldman.h" #include "Init.h" #include "Game Events.h" #include "PostalService.h" diff --git a/Ja2/SaveLoadGame.cpp b/Ja2/SaveLoadGame.cpp index 71c4d713..79cadef6 100644 --- a/Ja2/SaveLoadGame.cpp +++ b/Ja2/SaveLoadGame.cpp @@ -1,32 +1,32 @@ - #include "Types.h" + #include "types.h" #include "Soldier Profile.h" #include "FileMan.h" #include #include - #include "Debug.h" - #include "OverHead.h" + #include "DEBUG.H" + #include "Overhead.h" #include "Keys.h" #include "finances.h" - #include "History.h" + #include "history.h" #include "files.h" - #include "Laptop.h" - #include "iniReader.h" - #include "Email.h" - #include "Strategicmap.h" + #include "laptop.h" + #include "INIReader.h" + #include "email.h" + #include "strategicmap.h" #include "Game Events.h" #include "Game Clock.h" #include "Soldier Create.h" - #include "WorldDef.h" + #include "worlddef.h" #include "LaptopSave.h" #include "strategicmap.h" #include "Queen Command.h" #include "SaveLoadGame.h" #include "Tactical Save.h" #include "Squads.h" - #include "Environment.h" - #include "Lighting.h" + #include "environment.h" + #include "lighting.h" #include "Strategic Movement.h" - #include "Strategic.h" + #include "strategic.h" #include "Isometric Utils.h" #include "Quests.h" #include "opplist.h" @@ -38,17 +38,17 @@ #include "GameSettings.h" #include "Music Control.h" #include "Options Screen.h" - #include "Ai.h" - #include "RenderWorld.h" + #include "ai.h" + #include "renderworld.h" #include "SmokeEffects.h" - #include "Random.h" + #include "random.h" #include "Map Screen Interface.h" #include "Map Screen Interface Border.h" #include "Map Screen Interface Bottom.h" #include "Interface.h" #include "Map Screen Helicopter.h" - #include "Environment.h" + #include "environment.h" #include "Arms Dealer Init.h" #include "Tactical Placement GUI.h" @@ -57,43 +57,43 @@ #include "Vehicles.h" #include "Merc Contract.h" #include "Bullets.h" - #include "air raid.h" + #include "Air Raid.h" #include "physics.h" #include "Strategic Pathing.h" #include "TeamTurns.h" - #include "explosion control.h" + #include "Explosion Control.h" #include "Creature Spreading.h" #include "Strategic Status.h" - #include "Prebattle Interface.h" + #include "PreBattle Interface.h" #include "Boxing.h" #include "Strategic AI.h" #include "Map Screen Interface Map.h" #include "Meanwhile.h" - #include "dialogue control.h" - #include "text.h" - #include "Map Screen Interface.h" - #include "lighteffects.h" + #include "Dialogue Control.h" + #include "Text.h" + #include "Map Screen Interface.h" + #include "LightEffects.h" #include "HelpScreen.h" #include "Animated ProgressBar.h" - #include "merctextbox.h" - #include "render dirty.h" + #include "MercTextBox.h" + #include "Render Dirty.h" #include "Map Information.h" #include "Interface Items.h" #include "Civ Quotes.h" #include "Scheduling.h" #include "Animation Data.h" #include "Game Init.h" - #include "cheats.h" + #include "Cheats.h" #include "Strategic Event Handler.h" - #include "interface panels.h" - #include "interface dialogue.h" + #include "Interface Panels.h" + #include "interface Dialogue.h" #include "Assignments.h" #include "Interface Items.h" - #include "Shopkeeper Interface.h" - #include "postalservice.h" + #include "ShopKeeper Interface.h" + #include "PostalService.h" // HEADROCK HAM B1: Additional Include for HAM #include "MilitiaSquads.h" // HEADROCK HAM 3.5: Another include for HAM @@ -110,17 +110,17 @@ #include "Rebel Command.h" #include "BobbyR.h" -#include "Imp Portraits.h" +#include "IMP Portraits.h" #include "Loading Screen.h" #include "Interface Utils.h" #include "Squads.h" #include "IMP Confirm.h" #include "Enemy Soldier Save.h" #include "BobbyRMailOrder.h" -#include "Mercs.h" +#include "mercs.h" #include "INIReader.h" #include "mercs.h" -#include "soldier Profile.h" +#include "Soldier Profile.h" #ifdef JA2UB #include "Ja25 Strategic Ai.h" #include "Ja25_Tactical.h" diff --git a/Ja2/SaveLoadScreen.cpp b/Ja2/SaveLoadScreen.cpp index e5442659..a1a30800 100644 --- a/Ja2/SaveLoadScreen.cpp +++ b/Ja2/SaveLoadScreen.cpp @@ -1,34 +1,34 @@ - #include "Types.h" + #include "types.h" #include "SaveLoadScreen.h" - #include "Video.h" + #include "video.h" #include "Font Control.h" #include "Game Clock.h" #include "Render Dirty.h" #include "Text Input.h" #include "SaveLoadGame.h" - #include "Stdio.h" + #include "stdio.h" #include "WordWrap.h" - #include "StrategicMap.h" - #include "Finances.h" + #include "strategicmap.h" + #include "finances.h" #include "WCheck.h" #include "Utilities.h" #include "Cursors.h" - #include "VObject.h" + #include "vobject.h" #include "Merc Hiring.h" #include "LaptopSave.h" #include "Options Screen.h" #include "GameVersion.h" - #include "SysUtil.h" + #include "sysutil.h" #include "Tactical Save.h" - #include "OverHead.h" + #include "Overhead.h" #include "gamescreen.h" #include "GameSettings.h" - #include "fade screen.h" - #include "English.h" - #include "Gameloop.h" + #include "Fade Screen.h" + #include "english.h" + #include "gameloop.h" #include "Game Init.h" #include "Text.h" - #include "Message.h" + #include "message.h" #include "Map Screen Interface.h" #include "Multi Language Graphic Utils.h" #include "Campaign Types.h" diff --git a/Ja2/Screens.h b/Ja2/Screens.h index f94c05c8..d8f556a5 100644 --- a/Ja2/Screens.h +++ b/Ja2/Screens.h @@ -1,8 +1,8 @@ #ifndef __SCREEN_MANAGER #define __SCREEN_MANAGER -#include "Types.h" -#include "ScreenIds.h" +#include "types.h" +#include "screenids.h" // Each screen in the game comes with a Status flag (what was the last thing the screen was doing), an Initialization // function (which loads up the screen if necessary), a Handler function which is called while the screen is showing and diff --git a/Ja2/TimeLogging.h b/Ja2/TimeLogging.h index 7caab289..2478faa2 100644 --- a/Ja2/TimeLogging.h +++ b/Ja2/TimeLogging.h @@ -1,5 +1,5 @@ #pragma once -#include "Types.h" +#include "types.h" void TimingLogInitialize(const CHAR8* filename); void TimingLog(const CHAR8* logEvent, int n); diff --git a/Ja2/aniviewscreen.cpp b/Ja2/aniviewscreen.cpp index 638e67a2..6cf3a7b8 100644 --- a/Ja2/aniviewscreen.cpp +++ b/Ja2/aniviewscreen.cpp @@ -9,9 +9,9 @@ #include "worlddef.h" #include "renderworld.h" #include "input.h" - #include "font.h" + #include "Font.h" #include "screenids.h" - #include "overhead.h" + #include "Overhead.h" #include "sysutil.h" #include "Font Control.h" #include "Animation Control.h" @@ -23,8 +23,8 @@ #include #include #include "english.h" - #include "Fileman.h" - #include "messageboxscreen.h" + #include "FileMan.h" + #include "MessageBoxScreen.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; diff --git a/Ja2/builddefines.h b/Ja2/builddefines.h index eb71defe..9391b6c3 100644 --- a/Ja2/builddefines.h +++ b/Ja2/builddefines.h @@ -77,6 +77,6 @@ #define _CRT_NON_CONFORMING_SWPRINTFS #define _SCL_SECURE_NO_WARNINGS -#include "Profiler.h" +#include "profiler.h" #endif diff --git a/Ja2/gameloop.cpp b/Ja2/gameloop.cpp index d65f7dae..56a8493f 100644 --- a/Ja2/gameloop.cpp +++ b/Ja2/gameloop.cpp @@ -1,17 +1,17 @@ #include #include #include "sgp.h" - #include "Gameloop.h" + #include "gameloop.h" #include "Screens.h" - #include "cursors.h" - #include "init.h" - #include "music control.h" - #include "sys globals.h" + #include "Cursors.h" + #include "Init.h" + #include "Music Control.h" + #include "Sys Globals.h" #include "laptop.h" #include "mapscreen.h" #include "Game Clock.h" #include "Timer Control.h" - #include "overhead.h" + #include "Overhead.h" #include "LibraryDataBase.h" #include "Map Screen Interface.h" #include "Tactical Save.h" @@ -19,7 +19,7 @@ #include "GameSettings.h" #include "mapscreen.h" #include "Interface Control.h" - #include "text.h" + #include "Text.h" #include "HelpScreen.h" #include "PreBattle Interface.h" #include "Tactical Placement GUI.h"//dnl ch45 071009 diff --git a/Ja2/gameloop.h b/Ja2/gameloop.h index 6c5d2357..1f4fe3ea 100644 --- a/Ja2/gameloop.h +++ b/Ja2/gameloop.h @@ -1,7 +1,7 @@ #ifndef __GAMELOOP_ #define __GAMELOOP_ -#include "Types.h" +#include "types.h" // main game loop systems #define INIT_SYSTEM 0 diff --git a/Ja2/gamescreen.cpp b/Ja2/gamescreen.cpp index ba3ceb80..b3028c8b 100644 --- a/Ja2/gamescreen.cpp +++ b/Ja2/gamescreen.cpp @@ -6,10 +6,10 @@ #include "vobject.h" #include "worlddef.h" #include "renderworld.h" - #include "font.h" + #include "Font.h" #include "screenids.h" - #include "screens.h" - #include "overhead.h" + #include "Screens.h" + #include "Overhead.h" #include "Isometric Utils.h" #include "sysutil.h" #include "input.h" @@ -22,60 +22,60 @@ #include "Handle UI.h" #include #include - #include "cursors.h" + #include "Cursors.h" #include "vobject_blitters.h" #include "Button System.h" #include "lighting.h" #include "renderworld.h" - #include "sys globals.h" + #include "Sys Globals.h" #include "environment.h" - #include "bullets.h" + #include "Bullets.h" #include "Assignments.h" #include "message.h" #include #include "overhead map.h" #include "Strategic Exit GUI.h" - #include "strategic movement.h" + #include "Strategic Movement.h" #include "Tactical Placement GUI.h" - #include "Air raid.h" + #include "Air Raid.h" #include "Game Clock.h" - #include "game init.h" + #include "Game Init.h" //DEF: Test Code #ifdef NETWORKED #include "Networking.h" #endif - #include "interface control.h" - #include "game clock.h" + #include "Interface Control.h" + #include "Game Clock.h" #include "physics.h" - #include "fade screen.h" - #include "dialogue control.h" - #include "soldier macros.h" + #include "Fade Screen.h" + #include "Dialogue Control.h" + #include "Soldier macros.h" #include "faces.h" #include "strategicmap.h" #include "gamescreen.h" - #include "interface.h" - #include "cursor control.h" - #include "strategic turns.h" + #include "Interface.h" + #include "Cursor Control.h" + #include "Strategic Turns.h" #include "merc entering.h" - #include "soldier create.h" + #include "Soldier Create.h" #include "Soldier Init List.h" - #include "interface panels.h" + #include "Interface Panels.h" #include "Map Information.h" #include "environment.h" #include "Squads.h" - #include "interface dialogue.h" - #include "auto bandage.h" - #include "meanwhile.h" - #include "strategic ai.h" + #include "interface Dialogue.h" + #include "Auto Bandage.h" + #include "Meanwhile.h" + #include "Strategic AI.h" #include "HelpScreen.h" #include "PreBattle Interface.h" #include "Sound Control.h" #include "MessageBoxScreen.h" #include "Text.h" #include "GameSettings.h" - #include "Random.h" + #include "random.h" #include "editscreen.h" #include "Scheduling.h" #include "Animated ProgressBar.h" diff --git a/Ja2/gamescreen.h b/Ja2/gamescreen.h index de0696a4..da597829 100644 --- a/Ja2/gamescreen.h +++ b/Ja2/gamescreen.h @@ -2,7 +2,7 @@ #define _GAMESCREEN_H -#include "fade screen.h" +#include "Fade Screen.h" #define ARE_IN_FADE_IN( ) ( gfFadeIn || gfFadeInitialized ) diff --git a/Ja2/jascreens.cpp b/Ja2/jascreens.cpp index 9e7df483..7fec7bab 100644 --- a/Ja2/jascreens.cpp +++ b/Ja2/jascreens.cpp @@ -6,13 +6,13 @@ #include "himage.h" #include "vobject.h" #include "vobject_blitters.h" - #include "wcheck.h" + #include "WCheck.h" #include "input.h" - #include "font.h" + #include "Font.h" #include "timer.h" #include "mousesystem.h" #include "screenids.h" - #include "screens.h" + #include "Screens.h" #include "Font Control.h" #include "sysutil.h" #include "tiledef.h" @@ -22,30 +22,30 @@ #include #include "Timer Control.h" #include "Sys Globals.h" - #include "interface.h" - #include "overhead.h" - #include "utilities.h" - #include "render dirty.h" + #include "Interface.h" + #include "Overhead.h" + #include "Utilities.h" + #include "Render Dirty.h" #include "jascreens.h" #include "gameloop.h" #include "Event Pump.h" - #include "animation cache.h" + #include "Animation Cache.h" #include "lighting.h" #include "mainmenuscreen.h" #include "Game Init.h" - #include "init.h" - #include "cursor control.h" - #include "utilities.h" + #include "Init.h" + #include "Cursor Control.h" + #include "Utilities.h" #include "GameVersion.h" - #include "game clock.h" + #include "Game Clock.h" #include "gamescreen.h" #include "english.h" - #include "Random.h" + #include "random.h" #include "WordWrap.h" #include "Sound Control.h" #include "WordWrap.h" - #include "text.h" - #include "IniReader.h" + #include "Text.h" + #include "INIReader.h" #include "sgp_logger.h" #include diff --git a/Ja2/jascreens.h b/Ja2/jascreens.h index 1822b377..a05ddbb6 100644 --- a/Ja2/jascreens.h +++ b/Ja2/jascreens.h @@ -2,7 +2,7 @@ #define __JASCREENS_H_ #include "sgp.h" -#include "ScreenIds.h" +#include "screenids.h" #include "mousesystem.h" #include "Button System.h" #include diff --git a/Ja2/legion cfg.cpp b/Ja2/legion cfg.cpp index 2004c497..4bf3f8df 100644 --- a/Ja2/legion cfg.cpp +++ b/Ja2/legion cfg.cpp @@ -1,10 +1,10 @@ //legion 2 - #include "Types.h" #include "types.h" - #include "Random.h" + #include "types.h" + #include "random.h" #include "Campaign Types.h" #include "Queen Command.h" - #include "overhead.h" + #include "Overhead.h" #include "Strategic Movement.h" #include "Strategic Status.h" #include "GameSettings.h" @@ -17,36 +17,36 @@ #include "laptop.h" #include "worlddef.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "email.h" - #include "soldier profile.h" + #include "Soldier Profile.h" #include "strategicmap.h" - #include "game init.h" - #include "animation data.h" - #include "soldier create.h" + #include "Game Init.h" + #include "Animation Data.h" + #include "Soldier Create.h" #include "Soldier Init List.h" #include "strategic.h" #include "Squads.h" #include "Strategic Town Loyalty.h" #include "Strategic Mines.h" #include "gameloop.h" - #include "Random.h" + #include "random.h" #include "Map Screen Interface.h" #include "Tactical Save.h" #include "Campaign Types.h" - #include "Message.h" + #include "message.h" #include "Game Event Hook.h" #include "Strategic Movement.h" #include "Quests.h" #include "Strategic AI.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "GameSettings.h" #include "INIReader.h" #include "Soldier Profile.h" #include "XML.h" #include "Item Types.h" #include "Items.h" - #include "text.h" + #include "Text.h" #include "GameSettings.h" #ifdef JA2UB diff --git a/Ja2/ub_config.cpp b/Ja2/ub_config.cpp index 908f7584..d16ff60c 100644 --- a/Ja2/ub_config.cpp +++ b/Ja2/ub_config.cpp @@ -1,9 +1,9 @@ - #include "Types.h" #include "types.h" - #include "Random.h" + #include "types.h" + #include "random.h" #include "Campaign Types.h" #include "Queen Command.h" - #include "overhead.h" + #include "Overhead.h" #include "Strategic Movement.h" #include "Strategic Status.h" #include "GameSettings.h" @@ -16,36 +16,36 @@ #include "laptop.h" #include "worlddef.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "email.h" - #include "soldier profile.h" + #include "Soldier Profile.h" #include "strategicmap.h" - #include "game init.h" - #include "animation data.h" - #include "soldier create.h" + #include "Game Init.h" + #include "Animation Data.h" + #include "Soldier Create.h" #include "Soldier Init List.h" #include "strategic.h" #include "Squads.h" #include "Strategic Town Loyalty.h" #include "Strategic Mines.h" #include "gameloop.h" - #include "Random.h" + #include "random.h" #include "Map Screen Interface.h" #include "Tactical Save.h" #include "Campaign Types.h" - #include "Message.h" + #include "message.h" #include "Game Event Hook.h" #include "Strategic Movement.h" #include "Quests.h" #include "Strategic AI.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "GameSettings.h" #include "INIReader.h" #include "Soldier Profile.h" #include "XML.h" #include "Item Types.h" #include "Items.h" - #include "text.h" + #include "Text.h" #include "GameSettings.h" #ifdef JA2UB diff --git a/Laptop/AimFacialIndex.cpp b/Laptop/AimFacialIndex.cpp index 60b88e78..e6230f51 100644 --- a/Laptop/AimFacialIndex.cpp +++ b/Laptop/AimFacialIndex.cpp @@ -4,11 +4,11 @@ #include "Utilities.h" #include "WCheck.h" #include "stdio.h" - #include "Aim.h" + #include "aim.h" #include "Soldier Profile.h" #include "email.h" #include "Text.h" - #include "aimsort.h" + #include "AimSort.h" #include "Assignments.h" #include "GameSettings.h" #include "english.h" diff --git a/Laptop/AimMembers.cpp b/Laptop/AimMembers.cpp index 490d0a63..e5485db0 100644 --- a/Laptop/AimMembers.cpp +++ b/Laptop/AimMembers.cpp @@ -1,30 +1,30 @@ #include "email.h" #include "laptop.h" #include "AimMembers.h" - #include "Aim.h" + #include "aim.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "stdio.h" #include "sysutil.h" #include "Soldier Profile.h" #include "Soldier Control.h" - #include "InterFace Items.h" - #include "overhead.h" + #include "Interface Items.h" + #include "Overhead.h" #include "WordWrap.h" #include "finances.h" #include "vsurface.h" - #include "VObject.h" + #include "vobject.h" #include "Game Clock.h" - #include "overhead.h" - #include "Faces.h" - #include "dialogue control.h" - #include "text.h" - #include "History.h" + #include "Overhead.h" + #include "faces.h" + #include "Dialogue Control.h" + #include "Text.h" + #include "history.h" #include "Game Event Hook.h" #include "MercTextBox.h" #include "Render Dirty.h" - #include "weapons.h" + #include "Weapons.h" #include "Soldier Add.h" #include "Merc Hiring.h" #include "strategic.h" @@ -32,7 +32,7 @@ #include "LaptopSave.h" #include "english.h" #include "GameSettings.h" - #include "Random.h" + #include "random.h" #include "Strategic Status.h" #include "Merc Contract.h" #include "Strategic Merc Handler.h" @@ -40,7 +40,7 @@ #include "Sound Control.h" #include "Quests.h" #include "strategicmap.h" - #include "Personnel.h" + #include "personnel.h" #include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item #include "Strategic Town Loyalty.h" diff --git a/Laptop/AimSort.cpp b/Laptop/AimSort.cpp index 1b5b0f05..3652bf56 100644 --- a/Laptop/AimSort.cpp +++ b/Laptop/AimSort.cpp @@ -1,6 +1,6 @@ #include "laptop.h" #include "AimSort.h" - #include "Aim.h" + #include "aim.h" #include "WCheck.h" #include "Utilities.h" #include "WordWrap.h" diff --git a/Laptop/BobbyR.cpp b/Laptop/BobbyR.cpp index fcba33a6..504ce303 100644 --- a/Laptop/BobbyR.cpp +++ b/Laptop/BobbyR.cpp @@ -5,20 +5,20 @@ #include "WCheck.h" #include "WordWrap.h" #include "Cursors.h" - #include "interface items.h" + #include "Interface Items.h" #include "Weapons.h" #include "Store Inventory.h" #include "Game Event Hook.h" #include "Game Clock.h" #include "LaptopSave.h" - #include "Random.h" + #include "random.h" #include "Text.h" #include "Multi Language Graphic Utils.h" // #include "Utility.h" - #include "armsdealerinvinit.h" + #include "ArmsDealerInvInit.h" #include "GameSettings.h" #include "message.h" - #include "postalservice.h" + #include "PostalService.h" #ifdef JA2TESTVERSION diff --git a/Laptop/BobbyRAmmo.cpp b/Laptop/BobbyRAmmo.cpp index 8b4b6a53..162932b8 100644 --- a/Laptop/BobbyRAmmo.cpp +++ b/Laptop/BobbyRAmmo.cpp @@ -6,7 +6,7 @@ #include "WCheck.h" #include "WordWrap.h" #include "Encrypted File.h" - #include "text.h" + #include "Text.h" UINT32 guiAmmoBackground; UINT32 guiAmmoGrid; diff --git a/Laptop/BobbyRGuns.cpp b/Laptop/BobbyRGuns.cpp index c8ae1e61..d8cc71c4 100644 --- a/Laptop/BobbyRGuns.cpp +++ b/Laptop/BobbyRGuns.cpp @@ -5,12 +5,12 @@ #include "WCheck.h" #include "WordWrap.h" #include "Cursors.h" - #include "interface items.h" + #include "Interface Items.h" #include "Encrypted File.h" - #include "text.h" + #include "Text.h" #include "Store Inventory.h" #include "LaptopSave.h" - #include "Finances.h" + #include "finances.h" #include "Overhead.h" #include "Weapons.h" #include "GameSettings.h" diff --git a/Laptop/BobbyRMailOrder.cpp b/Laptop/BobbyRMailOrder.cpp index a145c7a7..b5243636 100644 --- a/Laptop/BobbyRMailOrder.cpp +++ b/Laptop/BobbyRMailOrder.cpp @@ -10,7 +10,7 @@ #include "finances.h" #include "Game Clock.h" #include "Game Event Hook.h" - #include "Random.h" + #include "random.h" #include "LaptopSave.h" #include "Soldier Profile.h" #include "input.h" @@ -20,8 +20,8 @@ #include "Multi Language Graphic Utils.h" #include "strategic.h" #include "strategicmap.h" - #include "isometric utils.h" - #include "postalservice.h" + #include "Isometric Utils.h" + #include "PostalService.h" #include "english.h" #include diff --git a/Laptop/BobbyRShipments.cpp b/Laptop/BobbyRShipments.cpp index 28f208f3..dc8db902 100644 --- a/Laptop/BobbyRShipments.cpp +++ b/Laptop/BobbyRShipments.cpp @@ -1,13 +1,13 @@ #include "laptop.h" #include "BobbyRShipments.h" - #include "bobbyr.h" - #include "utilities.h" + #include "BobbyR.h" + #include "Utilities.h" #include "WCheck.h" #include "Text.h" #include "BobbyRGuns.h" - #include "cursors.h" + #include "Cursors.h" #include "BobbyRMailOrder.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "strategic.h" #include "strategicmap.h" #include "PostalService.h" diff --git a/Laptop/BriefingRoom.cpp b/Laptop/BriefingRoom.cpp index dc5c6711..b209eb9e 100644 --- a/Laptop/BriefingRoom.cpp +++ b/Laptop/BriefingRoom.cpp @@ -1,7 +1,7 @@ #include "Utilities.h" #include "WCheck.h" - #include "timer control.h" - #include "Debug.h" + #include "Timer Control.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" #include "email.h" diff --git a/Laptop/BriefingRoomM.cpp b/Laptop/BriefingRoomM.cpp index 69a0c0da..511eff63 100644 --- a/Laptop/BriefingRoomM.cpp +++ b/Laptop/BriefingRoomM.cpp @@ -1,7 +1,7 @@ #include "Utilities.h" #include "WCheck.h" - #include "timer control.h" - #include "Debug.h" + #include "Timer Control.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" #include "email.h" diff --git a/Laptop/BrokenLink.cpp b/Laptop/BrokenLink.cpp index 8c6fb157..4bcdc696 100644 --- a/Laptop/BrokenLink.cpp +++ b/Laptop/BrokenLink.cpp @@ -1,9 +1,9 @@ - #include "Types.h" - #include "font.h" + #include "types.h" + #include "Font.h" #include "laptop.h" #include "Font Control.h" #include "Text.h" - #include "wordwrap.h" + #include "WordWrap.h" #define BROKEN_LINK__FONT FONT12ARIAL #define BROKEN_LINK__COLOR FONT_MCOLOR_BLACK diff --git a/Laptop/CampaignHistoryMain.cpp b/Laptop/CampaignHistoryMain.cpp index e030ff87..9d13a13e 100644 --- a/Laptop/CampaignHistoryMain.cpp +++ b/Laptop/CampaignHistoryMain.cpp @@ -10,7 +10,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" - #include "Line.h" + #include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" diff --git a/Laptop/CampaignStats.cpp b/Laptop/CampaignStats.cpp index bfc4e91d..2acae08b 100644 --- a/Laptop/CampaignStats.cpp +++ b/Laptop/CampaignStats.cpp @@ -11,7 +11,7 @@ #include "Game Clock.h" #include "Soldier macros.h" #include "Text.h" -#include "Laptop.h" +#include "laptop.h" #include "LaptopSave.h" #include "email.h" #include "DynamicDialogue.h" diff --git a/Laptop/CharProfile.cpp b/Laptop/CharProfile.cpp index 182f4bf7..92b16ebc 100644 --- a/Laptop/CharProfile.cpp +++ b/Laptop/CharProfile.cpp @@ -1,5 +1,5 @@ #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "CharProfile.h" #include "IMP AboutUs.h" #include "IMP Attribute Entrance.h" @@ -19,7 +19,7 @@ #include "IMP Personality Finish.h" #include "IMPVideoObjects.h" #include "IMP Confirm.h" - #include "messageboxscreen.h" + #include "MessageBoxScreen.h" #include "LaptopSave.h" // These 5 added - SANDRO #include "IMP Character and Disability Entrance.h" diff --git a/Laptop/Encyclopedia_Data_new.cpp b/Laptop/Encyclopedia_Data_new.cpp index 2dff5b82..e488c1d0 100644 --- a/Laptop/Encyclopedia_Data_new.cpp +++ b/Laptop/Encyclopedia_Data_new.cpp @@ -1,4 +1,4 @@ - #include "Types.h" + #include "types.h" #include "WCheck.h" #include #include "GameSettings.h" diff --git a/Laptop/Encyclopedia_new.cpp b/Laptop/Encyclopedia_new.cpp index 08596e8c..5122d4ef 100644 --- a/Laptop/Encyclopedia_new.cpp +++ b/Laptop/Encyclopedia_new.cpp @@ -29,7 +29,7 @@ /// uncomment to use just graphic + mouseregion instead of real buttons. No sounds, no button states, just plain 'hyperlinks'. #define ENC_USE_BUTTONSYSTEM - #include "Types.h" + #include "types.h" #include "WCheck.h" #include "DEBUG.H" #include "GameSettings.h" diff --git a/Laptop/FacilityProduction.cpp b/Laptop/FacilityProduction.cpp index ea60571d..e195b14e 100644 --- a/Laptop/FacilityProduction.cpp +++ b/Laptop/FacilityProduction.cpp @@ -8,7 +8,7 @@ #include "WCheck.h" #include "Utilities.h" #include "WordWrap.h" -#include "Line.h" +#include "line.h" #include "Text.h" #include "FacilityProduction.h" #include "Map Screen Interface.h" diff --git a/Laptop/IMP AboutUs.cpp b/Laptop/IMP AboutUs.cpp index 991aaca5..eceef0d6 100644 --- a/Laptop/IMP AboutUs.cpp +++ b/Laptop/IMP AboutUs.cpp @@ -2,10 +2,10 @@ #include "CharProfile.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" diff --git a/Laptop/IMP Attribute Entrance.cpp b/Laptop/IMP Attribute Entrance.cpp index 0ec42966..16fa7de3 100644 --- a/Laptop/IMP Attribute Entrance.cpp +++ b/Laptop/IMP Attribute Entrance.cpp @@ -3,10 +3,10 @@ #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" diff --git a/Laptop/IMP Attribute Finish.cpp b/Laptop/IMP Attribute Finish.cpp index b87813f1..80689bc4 100644 --- a/Laptop/IMP Attribute Finish.cpp +++ b/Laptop/IMP Attribute Finish.cpp @@ -5,10 +5,10 @@ #include "Utilities.h" #include "input.h" #include "Isometric Utils.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" #include "IMP Attribute Selection.h" diff --git a/Laptop/IMP Attribute Selection.cpp b/Laptop/IMP Attribute Selection.cpp index 6400f0f0..0a720b40 100644 --- a/Laptop/IMP Attribute Selection.cpp +++ b/Laptop/IMP Attribute Selection.cpp @@ -6,14 +6,14 @@ #include "input.h" #include "Isometric Utils.h" #include "IMP Skill Trait.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" #include "IMP Compile Character.h" - #include "text.h" + #include "Text.h" #include "GameSettings.h" // Added these 3 - SANDRO #include "IMP Disability Trait.h" diff --git a/Laptop/IMP Background.cpp b/Laptop/IMP Background.cpp index 14b30fa4..577bd094 100644 --- a/Laptop/IMP Background.cpp +++ b/Laptop/IMP Background.cpp @@ -1,17 +1,17 @@ #include "IMP Background.h" #include "IMP Skill Trait.h" #include "Button System.h" - #include "utilities.h" - #include "Debug.h" + #include "Utilities.h" + #include "DEBUG.H" #include "Text.h" #include "Font Control.h" - #include "font.h" + #include "Font.h" #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "_Ja25EnglishText.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "CharProfile.h" #include "soldier profile type.h" #include "IMP Compile Character.h" diff --git a/Laptop/IMP Background.h b/Laptop/IMP Background.h index ffd1dce9..9c8a5e1e 100644 --- a/Laptop/IMP Background.h +++ b/Laptop/IMP Background.h @@ -1,7 +1,7 @@ #ifndef __IMP_BACKGROUND__H_ #define __IMP_BACKGROUND__H_ -#include "Types.h" +#include "types.h" #include "mousesystem.h" void EnterIMPBackground( void ); diff --git a/Laptop/IMP Begin Screen.cpp b/Laptop/IMP Begin Screen.cpp index 3037f6b6..eb46951d 100644 --- a/Laptop/IMP Begin Screen.cpp +++ b/Laptop/IMP Begin Screen.cpp @@ -5,23 +5,23 @@ #include "IMPVideoObjects.h" #include "Utilities.h" #include "Timer Control.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Finish.h" #include "IMP Text System.h" #include "Text Input.h" - #include "messageboxscreen.h" - #include "Soldier Profile Type.h" + #include "MessageBoxScreen.h" + #include "soldier profile type.h" #include "IMP Portraits.h" #include "IMP Attribute Selection.h" #include "english.h" #include "line.h" #include "Merc Hiring.h" #include "strategic.h" - #include "text.h" + #include "Text.h" #include "LaptopSave.h" #include diff --git a/Laptop/IMP Character Trait.cpp b/Laptop/IMP Character Trait.cpp index e7703298..cf2e85ce 100644 --- a/Laptop/IMP Character Trait.cpp +++ b/Laptop/IMP Character Trait.cpp @@ -1,16 +1,16 @@ #include "IMP Character Trait.h" #include "Button System.h" - #include "utilities.h" - #include "Debug.h" + #include "Utilities.h" + #include "DEBUG.H" #include "Text.h" #include "Font Control.h" - #include "font.h" + #include "Font.h" #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "_Ja25EnglishText.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "CharProfile.h" #include "GameSettings.h" diff --git a/Laptop/IMP Character Trait.h b/Laptop/IMP Character Trait.h index 06ed9747..df46f8a7 100644 --- a/Laptop/IMP Character Trait.h +++ b/Laptop/IMP Character Trait.h @@ -1,7 +1,7 @@ #ifndef __IMP_CHARACTER_TRAIT__H_ #define __IMP_CHARACTER_TRAIT__H_ -#include "Types.h" +#include "types.h" void EnterIMPCharacterTrait( void ); void RenderIMPCharacterTrait( void ); diff --git a/Laptop/IMP Character and Disability Entrance.cpp b/Laptop/IMP Character and Disability Entrance.cpp index 5cae0c9a..c61a5ec9 100644 --- a/Laptop/IMP Character and Disability Entrance.cpp +++ b/Laptop/IMP Character and Disability Entrance.cpp @@ -3,13 +3,13 @@ #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" - #include "text.h" + #include "Text.h" // IMP personality entrance buttons diff --git a/Laptop/IMP Color Choosing.cpp b/Laptop/IMP Color Choosing.cpp index 310cf62d..2a239ba5 100644 --- a/Laptop/IMP Color Choosing.cpp +++ b/Laptop/IMP Color Choosing.cpp @@ -1,15 +1,15 @@ #include "IMP Color Choosing.h" #include "Button System.h" - #include "utilities.h" - #include "Debug.h" + #include "Utilities.h" + #include "DEBUG.H" #include "Text.h" #include "Font Control.h" - #include "font.h" + #include "Font.h" #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "CharProfile.h" #include "soldier profile type.h" #include "IMP Portraits.h" diff --git a/Laptop/IMP Color Choosing.h b/Laptop/IMP Color Choosing.h index 162d9de3..bc486872 100644 --- a/Laptop/IMP Color Choosing.h +++ b/Laptop/IMP Color Choosing.h @@ -1,7 +1,7 @@ #ifndef __IMP_COLOR_CHOOSING_SKIN_HAIR__H_ #define __IMP_COLOR_CHOOSING_SKIN_HAIR__H_ -#include "Types.h" +#include "types.h" void EnterIMPColorChoice( void ); void RenderIMPColorChoice( void ); diff --git a/Laptop/IMP Compile Character.cpp b/Laptop/IMP Compile Character.cpp index 0420b1c4..ea7ae826 100644 --- a/Laptop/IMP Compile Character.cpp +++ b/Laptop/IMP Compile Character.cpp @@ -1,7 +1,7 @@ #include "laptop.h" #include "CharProfile.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" #include "GameSettings.h" @@ -12,7 +12,7 @@ #include "IMP Attribute Selection.h" #include "IMP Portraits.h" #include "IMP Compile Character.h" - #include "Soldier Profile Type.h" + #include "soldier profile type.h" #include "Soldier Profile.h" #include "Animation Data.h" #include "random.h" diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index b5a0ac1a..8a9572d2 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -3,10 +3,10 @@ #include "IMP HomePage.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Compile Character.h" #include "soldier profile type.h" @@ -14,7 +14,7 @@ #include "IMP Confirm.h" #include "finances.h" #include "Soldier Profile.h" - #include "Soldier Profile Type.h" + #include "soldier profile type.h" #include "Soldier Control.h" #include "IMP Portraits.h" #include "Overhead.h" @@ -25,8 +25,8 @@ #include "Game Event Hook.h" #include "LaptopSave.h" #include "strategic.h" - #include "weapons.h" - #include "Random.h" + #include "Weapons.h" + #include "random.h" #include "GameVersion.h" #include "GameSettings.h" #include "IMP Gear.h" // added by Flugente diff --git a/Laptop/IMP Disability Trait.cpp b/Laptop/IMP Disability Trait.cpp index b5a8e1be..944cdd24 100644 --- a/Laptop/IMP Disability Trait.cpp +++ b/Laptop/IMP Disability Trait.cpp @@ -1,16 +1,16 @@ #include "IMP Disability Trait.h" #include "Button System.h" - #include "utilities.h" - #include "Debug.h" + #include "Utilities.h" + #include "DEBUG.H" #include "Text.h" #include "Font Control.h" - #include "font.h" + #include "Font.h" #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "_Ja25EnglishText.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "CharProfile.h" #include "GameSettings.h" diff --git a/Laptop/IMP Disability Trait.h b/Laptop/IMP Disability Trait.h index 58ffd66a..1022c896 100644 --- a/Laptop/IMP Disability Trait.h +++ b/Laptop/IMP Disability Trait.h @@ -1,7 +1,7 @@ #ifndef __IMP_DISABILITY_TRAIT__H_ #define __IMP_DISABILITY_TRAIT__H_ -#include "Types.h" +#include "types.h" void EnterIMPDisabilityTrait( void ); void RenderIMPDisabilityTrait( void ); diff --git a/Laptop/IMP Finish.cpp b/Laptop/IMP Finish.cpp index f1a8bdbb..60c2d71f 100644 --- a/Laptop/IMP Finish.cpp +++ b/Laptop/IMP Finish.cpp @@ -7,15 +7,15 @@ #include "Utilities.h" #include "WCheck.h" #include "Timer Control.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Attribute Selection.h" #include "IMP Text System.h" #include "soundman.h" - #include "text.h" + #include "Text.h" #include "IMP Confirm.h" diff --git a/Laptop/IMP Gear Entrance.cpp b/Laptop/IMP Gear Entrance.cpp index 88da8903..a1f7c057 100644 --- a/Laptop/IMP Gear Entrance.cpp +++ b/Laptop/IMP Gear Entrance.cpp @@ -8,10 +8,10 @@ #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "Utilities.h" -#include "Debug.h" +#include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" -#include "cursors.h" +#include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" #include "Text.h" diff --git a/Laptop/IMP Gear Entrance.h b/Laptop/IMP Gear Entrance.h index 1a73e253..7bcb4c22 100644 --- a/Laptop/IMP Gear Entrance.h +++ b/Laptop/IMP Gear Entrance.h @@ -6,7 +6,7 @@ * @author Flugente (bears-pit.com) */ -#include "Types.h" +#include "types.h" void EnterIMPGearEntrance( void ); void RenderIMPGearEntrance( void ); diff --git a/Laptop/IMP Gear.cpp b/Laptop/IMP Gear.cpp index 0d84fb2f..a969e7b0 100644 --- a/Laptop/IMP Gear.cpp +++ b/Laptop/IMP Gear.cpp @@ -6,17 +6,17 @@ #include "IMP Gear.h" #include "IMP Skill Trait.h" #include "Button System.h" -#include "utilities.h" -#include "Debug.h" +#include "Utilities.h" +#include "DEBUG.H" #include "Text.h" #include "Font Control.h" -#include "font.h" +#include "Font.h" #include "laptop.h" -#include "cursors.h" +#include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "_Ja25EnglishText.h" -#include "wordwrap.h" +#include "WordWrap.h" #include "CharProfile.h" #include "soldier profile type.h" #include "IMP Compile Character.h" diff --git a/Laptop/IMP Gear.h b/Laptop/IMP Gear.h index 01d1971d..3cca01ae 100644 --- a/Laptop/IMP Gear.h +++ b/Laptop/IMP Gear.h @@ -6,7 +6,7 @@ * @author Flugente (bears-pit.com) */ -#include "Types.h" +#include "types.h" #include "soldier profile type.h" void EnterIMPGear( void ); diff --git a/Laptop/IMP HomePage.cpp b/Laptop/IMP HomePage.cpp index b54fa8a3..65c8568f 100644 --- a/Laptop/IMP HomePage.cpp +++ b/Laptop/IMP HomePage.cpp @@ -2,11 +2,11 @@ #include "IMP HomePage.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "IMP Compile Character.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" #include "Timer Control.h" diff --git a/Laptop/IMP MainPage.cpp b/Laptop/IMP MainPage.cpp index 41acd733..026067bf 100644 --- a/Laptop/IMP MainPage.cpp +++ b/Laptop/IMP MainPage.cpp @@ -3,10 +3,10 @@ #include "IMPVideoObjects.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Attribute Selection.h" #include "IMP Text System.h" diff --git a/Laptop/IMP Minor Trait.cpp b/Laptop/IMP Minor Trait.cpp index 848b4c49..c7f053c2 100644 --- a/Laptop/IMP Minor Trait.cpp +++ b/Laptop/IMP Minor Trait.cpp @@ -1,17 +1,17 @@ #include "IMP Minor Trait.h" #include "IMP Skill Trait.h" #include "Button System.h" - #include "utilities.h" - #include "Debug.h" + #include "Utilities.h" + #include "DEBUG.H" #include "Text.h" #include "Font Control.h" - #include "font.h" + #include "Font.h" #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "_Ja25EnglishText.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "CharProfile.h" #include "soldier profile type.h" #include "IMP Compile Character.h" diff --git a/Laptop/IMP Minor Trait.h b/Laptop/IMP Minor Trait.h index 14d2501c..43bb0b91 100644 --- a/Laptop/IMP Minor Trait.h +++ b/Laptop/IMP Minor Trait.h @@ -1,7 +1,7 @@ #ifndef __IMP_MINOR_TRAIT__H_ #define __IMP_MINOR_TRAIT__H_ -#include "Types.h" +#include "types.h" void EnterIMPMinorTrait( void ); void RenderIMPMinorTrait( void ); diff --git a/Laptop/IMP Personality Entrance.cpp b/Laptop/IMP Personality Entrance.cpp index 2402663f..ea88eabe 100644 --- a/Laptop/IMP Personality Entrance.cpp +++ b/Laptop/IMP Personality Entrance.cpp @@ -3,10 +3,10 @@ #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" diff --git a/Laptop/IMP Personality Finish.cpp b/Laptop/IMP Personality Finish.cpp index cd5a0de5..61794594 100644 --- a/Laptop/IMP Personality Finish.cpp +++ b/Laptop/IMP Personality Finish.cpp @@ -3,10 +3,10 @@ #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" #include "IMP Compile Character.h" diff --git a/Laptop/IMP Personality Quiz.cpp b/Laptop/IMP Personality Quiz.cpp index 3a1cfe8f..ed30843f 100644 --- a/Laptop/IMP Personality Quiz.cpp +++ b/Laptop/IMP Personality Quiz.cpp @@ -3,10 +3,10 @@ #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "Utilities.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Compile Character.h" #include "soldier profile type.h" diff --git a/Laptop/IMP Portraits.cpp b/Laptop/IMP Portraits.cpp index 9ba70518..8ad0de12 100644 --- a/Laptop/IMP Portraits.cpp +++ b/Laptop/IMP Portraits.cpp @@ -6,10 +6,10 @@ #include "WCheck.h" #include "input.h" #include "Isometric Utils.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "IMP Text System.h" diff --git a/Laptop/IMP Prejudice.cpp b/Laptop/IMP Prejudice.cpp index 11712753..0b5b3fe6 100644 --- a/Laptop/IMP Prejudice.cpp +++ b/Laptop/IMP Prejudice.cpp @@ -6,17 +6,17 @@ #include "IMP Prejudice.h" #include "IMP Skill Trait.h" #include "Button System.h" - #include "utilities.h" - #include "Debug.h" + #include "Utilities.h" + #include "DEBUG.H" #include "Text.h" #include "Font Control.h" - #include "font.h" + #include "Font.h" #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "_Ja25EnglishText.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "CharProfile.h" #include "soldier profile type.h" #include "IMP Compile Character.h" diff --git a/Laptop/IMP Prejudice.h b/Laptop/IMP Prejudice.h index 572f24bc..8bdcf304 100644 --- a/Laptop/IMP Prejudice.h +++ b/Laptop/IMP Prejudice.h @@ -6,7 +6,7 @@ * @author Flugente (bears-pit.com) */ -#include "Types.h" +#include "types.h" void EnterIMPPrejudice( void ); void RenderIMPPrejudice( void ); diff --git a/Laptop/IMP Skill Trait.cpp b/Laptop/IMP Skill Trait.cpp index 93fab856..fbfd0e39 100644 --- a/Laptop/IMP Skill Trait.cpp +++ b/Laptop/IMP Skill Trait.cpp @@ -1,16 +1,16 @@ #include "IMP Skill Trait.h" #include "Button System.h" - #include "utilities.h" - #include "Debug.h" + #include "Utilities.h" + #include "DEBUG.H" #include "Text.h" #include "Font Control.h" - #include "font.h" + #include "Font.h" #include "laptop.h" - #include "cursors.h" + #include "Cursors.h" #include "IMP MainPage.h" #include "IMPVideoObjects.h" #include "_Ja25EnglishText.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "CharProfile.h" #include "soldier profile type.h" #include "IMP Compile Character.h" diff --git a/Laptop/IMP Skill Trait.h b/Laptop/IMP Skill Trait.h index 7f537213..8eda49cf 100644 --- a/Laptop/IMP Skill Trait.h +++ b/Laptop/IMP Skill Trait.h @@ -1,7 +1,7 @@ #ifndef __IMP_SKILL_TRAIT__H_ #define __IMP_SKILL_TRAIT__H_ -#include "Types.h" +#include "types.h" void EnterIMPSkillTrait( void ); void RenderIMPSkillTrait( void ); diff --git a/Laptop/IMP Text System.cpp b/Laptop/IMP Text System.cpp index 9555ef80..06fd15d4 100644 --- a/Laptop/IMP Text System.cpp +++ b/Laptop/IMP Text System.cpp @@ -12,24 +12,24 @@ #include "IMP Confirm.h" #include "GameSettings.h" #include "Text.h" - #include "_Ja25Englishtext.h" + #include "_Ja25EnglishText.h" #ifdef JA2UB #include "laptop.h" #include "email.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" - #include "soldier profile.h" + #include "Cursors.h" + #include "Soldier Profile.h" #include "IMP Compile Character.h" #include "IMP Voices.h" #include "IMP Portraits.h" #include "Game Clock.h" #include "environment.h" #include "AimMembers.h" - #include "Random.h" + #include "random.h" #include "Text.h" #include "LaptopSave.h" #include "finances.h" diff --git a/Laptop/IMP Voices.cpp b/Laptop/IMP Voices.cpp index ed2398f7..dda39cfd 100644 --- a/Laptop/IMP Voices.cpp +++ b/Laptop/IMP Voices.cpp @@ -5,14 +5,14 @@ #include "Utilities.h" #include "input.h" #include "Isometric Utils.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "laptop.h" #include "Sound Control.h" #include "IMP Text System.h" - #include "text.h" + #include "Text.h" #include "soldier profile type.h" #include "GameSettings.h" #include "LaptopSave.h" diff --git a/Laptop/IMPVideoObjects.cpp b/Laptop/IMPVideoObjects.cpp index 57948a69..63198d6e 100644 --- a/Laptop/IMPVideoObjects.cpp +++ b/Laptop/IMPVideoObjects.cpp @@ -1,7 +1,7 @@ #include "IMPVideoObjects.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" #include "laptop.h" diff --git a/Laptop/Intelmarket.cpp b/Laptop/Intelmarket.cpp index 99d3c839..8a2d62f4 100644 --- a/Laptop/Intelmarket.cpp +++ b/Laptop/Intelmarket.cpp @@ -10,7 +10,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" -#include "Line.h" +#include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" diff --git a/Laptop/MilitiaWebsite.cpp b/Laptop/MilitiaWebsite.cpp index 16104a7e..96e093d0 100644 --- a/Laptop/MilitiaWebsite.cpp +++ b/Laptop/MilitiaWebsite.cpp @@ -10,7 +10,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" -#include "Line.h" +#include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" @@ -32,7 +32,7 @@ #include "GameVersion.h" #include "message.h" #include "Game Event Hook.h" -#include "militia control.h" +#include "Militia Control.h" #include "Town Militia.h" #include "Strategic Town Loyalty.h" diff --git a/Laptop/PMC.cpp b/Laptop/PMC.cpp index aac3c86f..76ffbc68 100644 --- a/Laptop/PMC.cpp +++ b/Laptop/PMC.cpp @@ -10,7 +10,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" -#include "Line.h" +#include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" @@ -32,7 +32,7 @@ #include "GameVersion.h" #include "message.h" #include "Game Event Hook.h" -#include "militia control.h" +#include "Militia Control.h" #include "Town Militia.h" #include "Strategic Town Loyalty.h" #include "MilitiaIndividual.h" diff --git a/Laptop/PostalService.cpp b/Laptop/PostalService.cpp index b1fbf9f7..5081540f 100644 --- a/Laptop/PostalService.cpp +++ b/Laptop/PostalService.cpp @@ -1,11 +1,11 @@ #include "SaveLoadMap.h" #include "Structure Wrap.h" #include "Tactical Save.h" -#include "postalservice.h" +#include "PostalService.h" #include "strategic.h" #include "strategicmap.h" #include "random.h" -#include "game clock.h" +#include "Game Clock.h" #include "GameSettings.h" #include #include diff --git a/Laptop/PostalService.h b/Laptop/PostalService.h index dfd4df5c..3830a973 100644 --- a/Laptop/PostalService.h +++ b/Laptop/PostalService.h @@ -4,12 +4,12 @@ #include "SaveLoadMap.h" #include "Structure Wrap.h" #include "Tactical Save.h" -#include "laptopsave.h" -#include "postalservice.h" -#include "isometric utils.h" -#include "debug.h" -#include "game event hook.h" -#include "game events.h" +#include "LaptopSave.h" +#include "PostalService.h" +#include "Isometric Utils.h" +#include "DEBUG.H" +#include "Game Event Hook.h" +#include "Game Events.h" #include #include #include diff --git a/Laptop/Store Inventory.cpp b/Laptop/Store Inventory.cpp index b21fa906..cdf7be05 100644 --- a/Laptop/Store Inventory.cpp +++ b/Laptop/Store Inventory.cpp @@ -1,11 +1,11 @@ - #include "Types.h" + #include "types.h" #include "Store Inventory.h" - #include "Random.h" + #include "random.h" #include "Weapons.h" - #include "Debug.h" + #include "DEBUG.H" #include "LaptopSave.h" #include "ShopKeeper Interface.h" - #include "armsdealerinvinit.h" + #include "ArmsDealerInvInit.h" #include "GameSettings.h" diff --git a/Laptop/WHO.cpp b/Laptop/WHO.cpp index 1b077b9f..ff5f498a 100644 --- a/Laptop/WHO.cpp +++ b/Laptop/WHO.cpp @@ -10,7 +10,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" -#include "Line.h" +#include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" diff --git a/Laptop/XML_DeliveryMethods.cpp b/Laptop/XML_DeliveryMethods.cpp index 07751b22..652cea6b 100644 --- a/Laptop/XML_DeliveryMethods.cpp +++ b/Laptop/XML_DeliveryMethods.cpp @@ -1,7 +1,7 @@ #include "sgp.h" -#include "overhead types.h" -#include "overhead.h" -#include "text.h" +#include "Overhead Types.h" +#include "Overhead.h" +#include "Text.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Laptop/XML_ShippingDestinations.cpp b/Laptop/XML_ShippingDestinations.cpp index e17b76ea..01ea3206 100644 --- a/Laptop/XML_ShippingDestinations.cpp +++ b/Laptop/XML_ShippingDestinations.cpp @@ -1,7 +1,7 @@ #include "sgp.h" -#include "overhead types.h" -#include "overhead.h" -#include "text.h" +#include "Overhead Types.h" +#include "Overhead.h" +#include "Text.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Laptop/aim.cpp b/Laptop/aim.cpp index a03a80d5..e5c50446 100644 --- a/Laptop/aim.cpp +++ b/Laptop/aim.cpp @@ -2,8 +2,8 @@ #include "aim.h" #include "Utilities.h" #include "WCheck.h" - #include "timer control.h" - #include "Debug.h" + #include "Timer Control.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" #include "email.h" diff --git a/Laptop/email.cpp b/Laptop/email.cpp index 6c12710f..43305543 100644 --- a/Laptop/email.cpp +++ b/Laptop/email.cpp @@ -2,17 +2,17 @@ #include "email.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" - #include "soldier profile.h" + #include "Cursors.h" + #include "Soldier Profile.h" #include "CharProfile.h" #include "IMP Compile Character.h" #include "IMP Portraits.h" #include "Game Clock.h" #include "AimMembers.h" - #include "Random.h" + #include "random.h" #include "Text.h" #include "LaptopSave.h" #include "finances.h" diff --git a/Laptop/files.cpp b/Laptop/files.cpp index 3de647b9..d3705523 100644 --- a/Laptop/files.cpp +++ b/Laptop/files.cpp @@ -3,15 +3,15 @@ #include #include "laptop.h" #include "files.h" - #include "Game clock.h" + #include "Game Clock.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "email.h" - #include "text.h" + #include "Text.h" // HEADROCK PROFEX: This is required to display the proper facial image. #include "Soldier Profile.h" #include "GameSettings.h" diff --git a/Laptop/finances.cpp b/Laptop/finances.cpp index ac542863..e785f1a3 100644 --- a/Laptop/finances.cpp +++ b/Laptop/finances.cpp @@ -1,12 +1,12 @@ #include "laptop.h" #include "finances.h" - #include "Game clock.h" + #include "Game Clock.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "Soldier Profile.h" #include "Text.h" #include "Strategic Mines.h" diff --git a/Laptop/florist Order Form.cpp b/Laptop/florist Order Form.cpp index b62696fb..1bba206a 100644 --- a/Laptop/florist Order Form.cpp +++ b/Laptop/florist Order Form.cpp @@ -10,15 +10,15 @@ #include "Encrypted File.h" #include "florist Cards.h" #include "Text Input.h" - #include "Finances.h" - #include "Game clock.h" + #include "finances.h" + #include "Game Clock.h" #include "english.h" #include "Text.h" #include "LaptopSave.h" - #include "Random.h" - #include "postalservice.h" + #include "random.h" + #include "PostalService.h" -#include "meanwhile.h" +#include "Meanwhile.h" #define FLOWER_ORDER_TINY_FONT FONT10ARIAL diff --git a/Laptop/history.cpp b/Laptop/history.cpp index 3ca4a8c4..42880242 100644 --- a/Laptop/history.cpp +++ b/Laptop/history.cpp @@ -1,16 +1,16 @@ #include "laptop.h" - #include "History.h" - #include "Game clock.h" + #include "history.h" + #include "Game Clock.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "Soldier Profile.h" #include "strategicmap.h" #include "QuestText.h" - #include "text.h" + #include "Text.h" #include "message.h" #include "LaptopSave.h" diff --git a/Laptop/insurance Contract.cpp b/Laptop/insurance Contract.cpp index c85cc170..441c40d2 100644 --- a/Laptop/insurance Contract.cpp +++ b/Laptop/insurance Contract.cpp @@ -13,12 +13,12 @@ #include "Soldier Add.h" #include "Game Clock.h" #include "finances.h" - #include "History.h" + #include "history.h" #include "Game Event Hook.h" #include "LaptopSave.h" #include "english.h" #include "Text.h" - #include "Random.h" + #include "random.h" #include "Strategic Status.h" #include "Assignments.h" #include "Map Screen Interface.h" @@ -27,7 +27,7 @@ #ifdef JA2UB #include "ub_config.h" -#include "quests.h" +#include "Quests.h" #endif #define INS_CTRCT_ORDER_GRID_WIDTH 132 diff --git a/Laptop/insurance.cpp b/Laptop/insurance.cpp index 6cb3ce2b..8fc7c326 100644 --- a/Laptop/insurance.cpp +++ b/Laptop/insurance.cpp @@ -5,7 +5,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" - #include "Line.h" + #include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" diff --git a/Laptop/laptop.cpp b/Laptop/laptop.cpp index 00c2f161..e6da5bcb 100644 --- a/Laptop/laptop.cpp +++ b/Laptop/laptop.cpp @@ -3,8 +3,8 @@ #include "WCheck.h" #include "Render Dirty.h" #include "sysutil.h" - #include "screens.h" - #include "cursors.h" + #include "Screens.h" + #include "Cursors.h" #include "Event Pump.h" #include "laptop.h" #include "aim.h" @@ -45,26 +45,26 @@ #include "Interface Control.h" #include "Game Event Hook.h" #include "WordWrap.h" - #include "Game init.h" + #include "Game Init.h" #include "Game Clock.h" #include "vobject_blitters.h" #include "Soldier Profile.h" #include "Overhead.h" #include "environment.h" #include "LibraryDataBase.h" - #include "music control.h" + #include "Music Control.h" #include "SaveLoadGame.h" #include "LaptopSave.h" - #include "RenderWorld.h" + #include "renderworld.h" #include "gameloop.h" #include "english.h" #include "random.h" #include "Merc Hiring.h" #include "Map Screen Interface.h" - #include "ambient control.h" + #include "Ambient Control.h" #include "Sound Control.h" - #include "text.h" - #include "Message.h" + #include "Text.h" + #include "message.h" #include "Map Screen Interface Bottom.h" #include "Cursor Control.h" #include "Quests.h" @@ -72,8 +72,8 @@ #include "BrokenLink.h" #include "BobbyRShipments.h" #include "Dialogue Control.h" - #include "helpscreen.h" - #include "cheats.h" + #include "HelpScreen.h" + #include "Cheats.h" #include "Strategic Status.h" #include "Arms Dealer Init.h" #include "GameSettings.h" @@ -81,7 +81,7 @@ #include "Encyclopedia_Data_new.h" #include "CampaignHistoryMain.h" // added by Flugente #include "CampaignHistory_Summary.h" // added by Flugente - #include "MercCompare.h" // added by Flugente + #include "merccompare.h" // added by Flugente #include "WHO.h" // added by Flugente #include "PMC.h" // added by Flugente #include "MilitiaWebsite.h" // added by Flugente diff --git a/Laptop/laptop.h b/Laptop/laptop.h index a558dd1b..f02f4b6d 100644 --- a/Laptop/laptop.h +++ b/Laptop/laptop.h @@ -4,7 +4,7 @@ #include "types.h" #include "sgp.h" #include "Font Control.h" -#include "messageboxscreen.h" +#include "MessageBoxScreen.h" diff --git a/Laptop/merccompare.cpp b/Laptop/merccompare.cpp index 413853d5..03b6d9fb 100644 --- a/Laptop/merccompare.cpp +++ b/Laptop/merccompare.cpp @@ -10,7 +10,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" -#include "Line.h" +#include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" diff --git a/Laptop/mercs Account.cpp b/Laptop/mercs Account.cpp index b312ef2b..a6748721 100644 --- a/Laptop/mercs Account.cpp +++ b/Laptop/mercs Account.cpp @@ -10,8 +10,8 @@ #include "Game Clock.h" #include "Soldier Add.h" #include "Overhead.h" - #include "History.h" - #include "Email.h" + #include "history.h" + #include "email.h" #include "LaptopSave.h" #include "Text.h" #include "Speck Quotes.h" diff --git a/Laptop/mercs Files.cpp b/Laptop/mercs Files.cpp index a32a7a7c..b9e8efe4 100644 --- a/Laptop/mercs Files.cpp +++ b/Laptop/mercs Files.cpp @@ -10,10 +10,10 @@ #include "stdio.h" #include "Encrypted File.h" #include "AimMembers.h" - #include "InterFace Items.h" + #include "Interface Items.h" #include "Game Clock.h" #include "Soldier Add.h" - #include "OverHead.h" + #include "Overhead.h" #include "Game Clock.h" #include "message.h" #include "Font.h" @@ -23,11 +23,11 @@ #include "Multi Language Graphic Utils.h" #include "Quests.h" #include "Assignments.h" - #include "Input.h" + #include "input.h" #include "english.h" #include "finances.h" #include "GameSettings.h" - #include "Personnel.h" + #include "personnel.h" #include "Encyclopedia_new.h" //update encyclopedia item visibility when viewing that item #include "mousesystem.h" diff --git a/Laptop/mercs No Account.cpp b/Laptop/mercs No Account.cpp index d7e7d2a5..ad659ff2 100644 --- a/Laptop/mercs No Account.cpp +++ b/Laptop/mercs No Account.cpp @@ -6,7 +6,7 @@ #include "WordWrap.h" #include "Cursors.h" #include "LaptopSave.h" - #include "Random.h" + #include "random.h" #include "Text.h" #include "Speck Quotes.h" diff --git a/Laptop/mercs.cpp b/Laptop/mercs.cpp index 0f96750a..c3378a06 100644 --- a/Laptop/mercs.cpp +++ b/Laptop/mercs.cpp @@ -6,13 +6,13 @@ #include "Cursors.h" #include "Overhead.h" #include "Soldier Add.h" - #include "Email.h" + #include "email.h" #include "Game Clock.h" - #include "Faces.h" - #include "dialogue control.h" + #include "faces.h" + #include "Dialogue Control.h" #include "MercTextBox.h" #include "Merc Hiring.h" - #include "Random.h" + #include "random.h" #include "LaptopSave.h" #include "GameSettings.h" #include "Text.h" diff --git a/Laptop/personnel.cpp b/Laptop/personnel.cpp index 935b5cf0..a16a7325 100644 --- a/Laptop/personnel.cpp +++ b/Laptop/personnel.cpp @@ -2,10 +2,10 @@ #include "personnel.h" #include "Utilities.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "WordWrap.h" #include "Encrypted File.h" - #include "cursors.h" + #include "Cursors.h" #include "Overhead.h" #include "Soldier Profile.h" #include "Text.h" @@ -26,9 +26,9 @@ #include "strategicmap.h" #include "GameSettings.h" #include "Merc Contract.h" - #include "_Ja25Englishtext.h" // added by SANDRO + #include "_Ja25EnglishText.h" // added by SANDRO -#include "Soldier Macros.h" +#include "Soldier macros.h" #include "InterfaceItemImages.h" #include "IMP Skill Trait.h" // added by Flugente diff --git a/Laptop/personnel.h b/Laptop/personnel.h index 5b48dccd..f6a62c1f 100644 --- a/Laptop/personnel.h +++ b/Laptop/personnel.h @@ -2,7 +2,7 @@ #define __PERSONNEL_H -#include "Types.h" +#include "types.h" #include "Soldier Control.h" diff --git a/Laptop/sirtech.cpp b/Laptop/sirtech.cpp index 3709ed6e..b9c79358 100644 --- a/Laptop/sirtech.cpp +++ b/Laptop/sirtech.cpp @@ -1,5 +1,5 @@ #include "laptop.h" - #include "SirTech.h" + #include "sirtech.h" void GameInitSirTech() { diff --git a/ModularizedTacticalAI/src/LegacyAIPlan.cpp b/ModularizedTacticalAI/src/LegacyAIPlan.cpp index d672870e..e687ed25 100644 --- a/ModularizedTacticalAI/src/LegacyAIPlan.cpp +++ b/ModularizedTacticalAI/src/LegacyAIPlan.cpp @@ -9,7 +9,7 @@ #include "../../TacticalAI/AIInternals.h" // ACTING_ON_SCHEDULE #include "../../TacticalAI/NPC.h" // NPCReachedDestination #include "../../Tactical/Animation Control.h" // defines ANIM_... -#include "../../Tactical/Soldier Macros.h" // CREATURE_OR_BLOODCAT +#include "../../Tactical/Soldier macros.h" // CREATURE_OR_BLOODCAT #include "../../Tactical/opplist.h" // EndMuzzleFlash #include "../../Tactical/Dialogue Control.h" // DialogueQueueIsEmpty #include "../../TileEngine/Isometric Utils.h" // defines NOWHERE diff --git a/ModularizedTacticalAI/src/LegacyAIPlanFactory.cpp b/ModularizedTacticalAI/src/LegacyAIPlanFactory.cpp index a71e8be5..e8c29a83 100644 --- a/ModularizedTacticalAI/src/LegacyAIPlanFactory.cpp +++ b/ModularizedTacticalAI/src/LegacyAIPlanFactory.cpp @@ -13,7 +13,7 @@ #include "../../TacticalAI/AIInternals.h" // DEBUGAIMSG #include "../../Tactical/Soldier Control.h" // For SOLDIERTYPE definition #include "../../Tactical/Animation Data.h" // For the definition of, wait for it... BLOODCAT! -#include "soldier macros.h" +#include "Soldier macros.h" #include diff --git a/ModularizedTacticalAI/src/LegacyArmedVehiclePlan.cpp b/ModularizedTacticalAI/src/LegacyArmedVehiclePlan.cpp index 7d0112d3..1141b507 100644 --- a/ModularizedTacticalAI/src/LegacyArmedVehiclePlan.cpp +++ b/ModularizedTacticalAI/src/LegacyArmedVehiclePlan.cpp @@ -5,7 +5,7 @@ #include "../include/LegacyArmedVehiclePlan.h" #include "Soldier Control.h" // definition of SOLDIERTYPE -#include "aiinternals.h" +#include "AIInternals.h" namespace AI { diff --git a/ModularizedTacticalAI/src/Plan.cpp b/ModularizedTacticalAI/src/Plan.cpp index ce08b220..8c3efb4e 100644 --- a/ModularizedTacticalAI/src/Plan.cpp +++ b/ModularizedTacticalAI/src/Plan.cpp @@ -4,7 +4,7 @@ #include "../../TacticalAI/AIInternals.h" // ACTING_ON_SCHEDULE #include "../../TacticalAI/NPC.h" // NPCReachedDestination #include "../../Tactical/Animation Control.h" // defines ANIM_... -#include "../../Tactical/Soldier Macros.h" // CREATURE_OR_BLOODCAT +#include "../../Tactical/Soldier macros.h" // CREATURE_OR_BLOODCAT #include "../../Tactical/opplist.h" // EndMuzzleFlash #include "../../Tactical/Dialogue Control.h" // DialogueQueueIsEmpty #include "../../TileEngine/Isometric Utils.h" // defines NOWHERE @@ -12,7 +12,7 @@ #include "../../Utils/Font Control.h" // ScreenMsg about deadlock #include "../../Utils/message.h" // ditto #include "../../TileEngine/Render Fun.h" // defines InARoom -#include "../../Strategic/quests.h" // IN_BROTHEL +#include "../../Strategic/Quests.h" // IN_BROTHEL void HandleAITacticalTraversal(SOLDIERTYPE* pSoldier); // defined in TacticalAI/AIMain.cpp diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index 05803259..b2494545 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -1,10 +1,10 @@ #include "builddefines.h" - #include "bullets.h" + #include "Bullets.h" #include #include - #include "wcheck.h" + #include "WCheck.h" #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "math.h" #include "worlddef.h" #include "worldman.h" @@ -19,27 +19,27 @@ #include "Render Fun.h" #include "Render Dirty.h" #include "mousesystem.h" - #include "interface.h" + #include "Interface.h" #include "sysutil.h" #include "FileMan.h" - #include "points.h" - #include "Random.h" + #include "Points.h" + #include "random.h" #include "ai.h" #include "Interactive Tiles.h" - #include "soldier ani.h" + #include "Soldier Ani.h" #include "english.h" - #include "overhead.h" + #include "Overhead.h" #include "Soldier Profile.h" #include "Game Clock.h" - #include "soldier create.h" + #include "Soldier Create.h" #include "Merc Hiring.h" #include "Game Event Hook.h" #include "message.h" #include "strategicmap.h" #include "strategic.h" - #include "items.h" + #include "Items.h" #include "Soldier Add.h" - #include "History.h" + #include "history.h" #include "Squads.h" #include "Strategic Merc Handler.h" #include "Dialogue Control.h" @@ -47,7 +47,7 @@ #include "Map Screen Interface Map.h" #include "screenids.h" #include "jascreens.h" - #include "text.h" + #include "Text.h" #include "Merc Contract.h" #include "LaptopSave.h" #include "personnel.h" @@ -55,12 +55,12 @@ #include "Map Screen Interface Bottom.h" #include "Quests.h" #include "GameSettings.h" - #include "Mercs.h" + #include "mercs.h" #include "Handle Doors.h" #include "Campaign Types.h" #include "Tactical Save.h" #include "BobbyRMailOrder.h" - #include "Finances.h" + #include "finances.h" #include "TeamTurns.h" #include "gameloop.h" #include "Options Screen.h" @@ -89,15 +89,15 @@ #include #include #include -#include "music control.h" -#include "map edgepoints.h" +#include "Music Control.h" +#include "Map Edgepoints.h" #include "fresh_header.h" #include "network.h" #include "opplist.h" -#include "tactical placement gui.h" -#include "prebattle interface.h" +#include "Tactical Placement GUI.h" +#include "PreBattle Interface.h" #include "mapscreen.h" #include "MessageBoxScreen.h" @@ -110,25 +110,25 @@ #include #include "transfer_rules.h" -#include "keys.h" +#include "Keys.h" #include "new.h" -#include "Types.h" +#include "types.h" #include "connect.h" #include "message.h" -#include "Event pump.h" +#include "Event Pump.h" #include "Soldier Init List.h" #include "Overhead.h" -#include "weapons.h" +#include "Weapons.h" #include "Merc Hiring.h" -#include "soldier profile.h" +#include "Soldier Profile.h" #include "environment.h" #include "lighting.h" #include "laptop.h" -#include "interface panels.h" -#include "game init.h" +#include "Interface Panels.h" +#include "Game Init.h" #include "Debug Control.h" #include "MPConnectScreen.h" -#include "IniReader.h" +#include "INIReader.h" #include "Map Screen Interface Border.h" extern CHAR16 gzFileTransferDirectory[100]; diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index d1d94f10..f5eff451 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -3,7 +3,7 @@ #include "Soldier Init List.h" #include "Merc Hiring.h" -#include "event pump.h" +#include "Event Pump.h" #include "Bullets.h" #include "builddefines.h" diff --git a/Multiplayer/raknet/Gen_RPC8.h b/Multiplayer/raknet/Gen_RPC8.h index 1f6f98bc..1a35d182 100644 --- a/Multiplayer/raknet/Gen_RPC8.h +++ b/Multiplayer/raknet/Gen_RPC8.h @@ -12,7 +12,7 @@ #endif #include //#define ASSEMBLY_BLOCK asm -//#include "Types.h" +//#include "types.h" #include "BitStream.h" // #define AUTO_RPC_NO_ASM diff --git a/Multiplayer/server.cpp b/Multiplayer/server.cpp index c1829415..7c932b04 100644 --- a/Multiplayer/server.cpp +++ b/Multiplayer/server.cpp @@ -21,18 +21,18 @@ #include #include "connect.h" #include "types.h" -#include "gamesettings.h" +#include "GameSettings.h" #include "message.h" #include "FileMan.h" -#include "IniReader.h" +#include "INIReader.h" #include #include "transfer_rules.h" #include "MPJoinScreen.h" -#include "game init.h" -#include "text.h" +#include "Game Init.h" +#include "Text.h" #include "network.h" #include "message.h" -#include "overhead.h" +#include "Overhead.h" #include "fresh_header.h" #include "Debug Control.h" #include "MPXmlTeams.hpp" diff --git a/Multiplayer/transfer_rules.cpp b/Multiplayer/transfer_rules.cpp index aac4e2fb..761ec4ed 100644 --- a/Multiplayer/transfer_rules.cpp +++ b/Multiplayer/transfer_rules.cpp @@ -1,5 +1,5 @@ #include "transfer_rules.h" -#include "Debug.h" +#include "DEBUG.H" #include #include #include diff --git a/Strategic/AI Viewer.cpp b/Strategic/AI Viewer.cpp index 01203c01..f7a4e5fe 100644 --- a/Strategic/AI Viewer.cpp +++ b/Strategic/AI Viewer.cpp @@ -15,13 +15,13 @@ #include "Text Input.h" #include "mousesystem.h" #include "strategicmap.h" - #include "Fileman.h" + #include "FileMan.h" #include "Map Information.h" - #include "render dirty.h" + #include "Render Dirty.h" #include "Game Clock.h" #include "Campaign Types.h" #include "Queen Command.h" - #include "overhead.h" + #include "Overhead.h" #include "Strategic Movement.h" #include "GameSettings.h" #include "Game Event Hook.h" @@ -32,7 +32,7 @@ #include "Campaign.h" #include "Auto Resolve.h" #include "Strategic Status.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "Town Militia.h" // added by Flugente #ifdef JA2BETAVERSION diff --git a/Strategic/ASD.cpp b/Strategic/ASD.cpp index 41bad719..bc42caa6 100644 --- a/Strategic/ASD.cpp +++ b/Strategic/ASD.cpp @@ -10,7 +10,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" -#include "Line.h" +#include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" @@ -27,10 +27,10 @@ #include "GameVersion.h" #include "message.h" #include "Game Event Hook.h" -#include "militia control.h" +#include "Militia Control.h" #include "Town Militia.h" #include "Strategic Town Loyalty.h" -#include "map information.h" +#include "Map Information.h" #include "Campaign.h" #include "random.h" diff --git a/Strategic/ASD.h b/Strategic/ASD.h index 62cd5b18..530c611c 100644 --- a/Strategic/ASD.h +++ b/Strategic/ASD.h @@ -6,7 +6,7 @@ * @author Flugente (bears-pit.com) */ -#include "Types.h" +#include "types.h" /** Flugente: Arulco special division decision code * diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 3993c715..b548c20b 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -1,22 +1,22 @@ #include "Assignments.h" - #include "Strategic.h" + #include "strategic.h" #include "Items.h" #include "Overhead.h" #include "Game Clock.h" #include "stdlib.h" - #include "Message.h" + #include "message.h" #include "Font Control.h" #include "Map Screen Interface.h" - #include "Soldier Profile Type.h" + #include "soldier profile type.h" #include "Soldier Profile.h" #include "Campaign.h" #include "Queen Command.h" #include "strategicmap.h" #include "Text.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "NPC.h" #include "Strategic Town Loyalty.h" - #include "animation control.h" + #include "Animation Control.h" #include "mapscreen.h" #include "Squads.h" #include "Map Screen Helicopter.h" @@ -26,20 +26,20 @@ #include "Map Screen Interface Map.h" #include "Strategic Movement.h" #include "laptop.h" - #include "Finances.h" + #include "finances.h" #include "LaptopSave.h" #include "renderworld.h" #include "Interface Control.h" #include "Interface.h" #include "Soldier Find.h" #include "ai.h" - #include "utilities.h" + #include "Utilities.h" #include "random.h" #include "line.h" #include "Soldier Add.h" #include "GameSettings.h" #include "Isometric Utils.h" - #include "Soldier Macros.h" + #include "Soldier macros.h" #include "Explosion Control.h" #include "SkillCheck.h" #include "Quests.h" @@ -54,7 +54,7 @@ #include "Strategic Status.h" #include "history.h" #include "Map Screen Interface Map Inventory.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" // added by SANDRO #include "AIInternals.h" #include "Morale.h" diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index 61d59e05..3241a057 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -3,7 +3,7 @@ // header for assignment manipulation/updating for characters -#include "Types.h" +#include "types.h" #include "Soldier Control.h" #include "mousesystem.h" #include "Strategic Movement.h" diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 3820ddf4..a64aa84d 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -16,8 +16,8 @@ #include "video.h" #include "input.h" #include "gamescreen.h" - #include "render dirty.h" - #include "vObject_Blitters.h" + #include "Render Dirty.h" + #include "vobject_blitters.h" #include "sysutil.h" #include "Font Control.h" #include "Soldier Create.h" @@ -32,10 +32,10 @@ #include "Tactical Save.h" #include "Strategic Status.h" #include "Map Screen Interface.h" - #include "text.h" + #include "Text.h" #include "WordWrap.h" #include "Squads.h" - #include "Random.h" + #include "random.h" #include "line.h" #include "english.h" #include "Strategic Pathing.h" @@ -48,17 +48,17 @@ #include "Strategic AI.h" #include "SkillCheck.h" #include "rt time defines.h" - #include "morale.h" + #include "Morale.h" #include "Strategic Town Loyalty.h" #include "GameSettings.h" #include "Soldier macros.h" #include "strategicmap.h" #include "Quests.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Inventory Choosing.h" #include "Game Event Hook.h" #include "Assignments.h" - #include "cheats.h" + #include "Cheats.h" #include "Map Information.h" #include "MilitiaSquads.h" // #include "Strategic AI.h" diff --git a/Strategic/Campaign Init.cpp b/Strategic/Campaign Init.cpp index 0da5809b..cc6477ae 100644 --- a/Strategic/Campaign Init.cpp +++ b/Strategic/Campaign Init.cpp @@ -1,10 +1,10 @@ #include "ASD.h" // added by Flugente #include "types.h" #include "Campaign Init.h" - #include "Random.h" + #include "random.h" #include "Campaign Types.h" #include "Queen Command.h" - #include "overhead.h" + #include "Overhead.h" #include "Strategic Movement.h" #include "Strategic Status.h" #include "GameSettings.h" diff --git a/Strategic/Creature Spreading.cpp b/Strategic/Creature Spreading.cpp index fac95c5a..79c67c90 100644 --- a/Strategic/Creature Spreading.cpp +++ b/Strategic/Creature Spreading.cpp @@ -1,12 +1,12 @@ #include "types.h" - #include "fileman.h" + #include "FileMan.h" #include "himage.h" #include "Creature Spreading.h" #include "Campaign Types.h" #include "Strategic Movement.h" #include "Game Event Hook.h" #include "GameSettings.h" - #include "Random.h" + #include "random.h" #include "message.h" #include "Font Control.h" #include "Soldier Init List.h" @@ -23,7 +23,7 @@ #include "Map Edgepoints.h" #include "Animation Data.h" #include "opplist.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Strategic AI.h" #include "MessageBoxScreen.h" #include "Map Information.h" diff --git a/Strategic/Facilities.cpp b/Strategic/Facilities.cpp index 52975d1a..aa7f0b77 100644 --- a/Strategic/Facilities.cpp +++ b/Strategic/Facilities.cpp @@ -21,7 +21,7 @@ #include "Strategic Town Loyalty.h" #include "Strategic Mines.h" #include "SkillCheck.h" - #include "Random.h" + #include "random.h" #include "strategicmap.h" #include "Game Clock.h" #include "Campaign.h" diff --git a/Strategic/Facilities.h b/Strategic/Facilities.h index 887e4344..ad5ec36d 100644 --- a/Strategic/Facilities.h +++ b/Strategic/Facilities.h @@ -1,7 +1,7 @@ #ifndef _FACILITIES_H #define _FACILITIES_H -#include "campaign types.h" +#include "Campaign Types.h" #include "Soldier Control.h" // Get a specific modifier for a specific assignment at a specific facility. Includes Ambient (non-assignment based) diff --git a/Strategic/Game Clock.cpp b/Strategic/Game Clock.cpp index 6b92c103..bb3d38c7 100644 --- a/Strategic/Game Clock.cpp +++ b/Strategic/Game Clock.cpp @@ -1,17 +1,17 @@ #include "sgp.h" #include "Game Clock.h" #include "Font.h" - #include "render dirty.h" + #include "Render Dirty.h" #include "Timer Control.h" - #include "overhead.h" + #include "Overhead.h" #include "environment.h" #include "Game Clock.h" #include "message.h" #include "Game Events.h" - #include "assignments.h" + #include "Assignments.h" #include "MercTextBox.h" - #include "Renderworld.h" - #include "Lighting.h" + #include "renderworld.h" + #include "lighting.h" #include "Map Screen Interface.h" #include "PreBattle Interface.h" #include "Event Pump.h" diff --git a/Strategic/Game Event Hook.cpp b/Strategic/Game Event Hook.cpp index 6a64799a..a268b3fa 100644 --- a/Strategic/Game Event Hook.cpp +++ b/Strategic/Game Event Hook.cpp @@ -12,21 +12,21 @@ #include "email.h" #include "Game Clock.h" #include "Merc Hiring.h" - #include "Insurance Contract.h" + #include "insurance Contract.h" #include "Strategic Merc Handler.h" #include "Strategic Movement.h" #include "Assignments.h" #include "Strategic Mines.h" #include "Strategic Town Loyalty.h" - #include "Message.h" + #include "message.h" #include "Map Screen Interface.h" #include "Map Screen Helicopter.h" #include "Scheduling.h" #include "Arms Dealer Init.h" - #include "Strategic town reputation.h" - #include "air raid.h" - #include "meanwhile.h" - #include "overhead.h" + #include "strategic town reputation.h" + #include "Air Raid.h" + #include "Meanwhile.h" + #include "Overhead.h" #include "random.h" #include "Creature Spreading.h" #include "Strategic AI.h" @@ -35,7 +35,7 @@ #include "INIReader.h" #include "GameSettings.h" #include "english.h" - #include "Input.h" + #include "input.h" #include "Soldier Profile.h" #include "laptop.h" #include "Campaign.h" diff --git a/Strategic/Game Events.cpp b/Strategic/Game Events.cpp index d6fc6d9b..b78a6172 100644 --- a/Strategic/Game Events.cpp +++ b/Strategic/Game Events.cpp @@ -4,7 +4,7 @@ #include "Game Events.h" #include "Game Clock.h" #include "MemMan.h" - #include "Debug.h" + #include "DEBUG.H" #include "Font Control.h" #include "message.h" #include "MiniEvents.h" diff --git a/Strategic/Game Init.cpp b/Strategic/Game Init.cpp index c47c0578..d4dc7cd2 100644 --- a/Strategic/Game Init.cpp +++ b/Strategic/Game Init.cpp @@ -3,15 +3,15 @@ #include "laptop.h" #include "worlddef.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "email.h" #include "Game Clock.h" - #include "soldier profile.h" + #include "Soldier Profile.h" #include "strategicmap.h" - #include "game init.h" - #include "animation data.h" + #include "Game Init.h" + #include "Animation Data.h" #include "finances.h" - #include "soldier create.h" + #include "Soldier Create.h" #include "Soldier Init List.h" #include "strategic.h" #include "history.h" @@ -21,32 +21,32 @@ #include "Strategic Town Loyalty.h" #include "Strategic Mines.h" #include "gameloop.h" - #include "Random.h" + #include "random.h" #include "Map Screen Interface.h" #include "Tactical Save.h" #include "Campaign Types.h" - #include "Message.h" + #include "message.h" #include "Game Event Hook.h" #include "Strategic Movement.h" #include "Creature Spreading.h" #include "Quests.h" #include "Strategic AI.h" - #include "Laptopsave.h" + #include "LaptopSave.h" #include "AimMembers.h" - #include "dialogue control.h" - #include "npc.h" + #include "Dialogue Control.h" + #include "NPC.h" #include "GameSettings.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" #include "Map Screen Interface Border.h" #include "Map Screen Helicopter.h" #include "Vehicles.h" #include "Map Screen Interface Map.h" #include "PreBattle Interface.h" - #include "bobbyr.h" - #include "helpscreen.h" + #include "BobbyR.h" + #include "HelpScreen.h" #include "Air Raid.h" #include "Interface.h" - #include "cheats.h" + #include "Cheats.h" #include "Interface Panels.h" // HEADROCK HAM 3.6: Include for adding facility debt reset #include "Facilities.h" @@ -61,7 +61,7 @@ #include "World Items.h" #include "Vehicles.h" -#include "text.h" +#include "Text.h" #include "connect.h" #include "XML.h" #include "mercs.h" diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index f6e3386e..2d573827 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -10,7 +10,7 @@ #include "jascreens.h" #include "screenids.h" #include "Items.h" - #include "Random.h" + #include "random.h" #include "finances.h" #include "history.h" #include "Dialogue Control.h" diff --git a/Strategic/Ja25 Strategic Ai.cpp b/Strategic/Ja25 Strategic Ai.cpp index 7e97ba21..c90111cc 100644 --- a/Strategic/Ja25 Strategic Ai.cpp +++ b/Strategic/Ja25 Strategic Ai.cpp @@ -12,61 +12,61 @@ #include "jascreens.h" #include "worlddef.h" #include "Soldier Control.h" - #include "overhead.h" - #include "isometric utils.h" + #include "Overhead.h" + #include "Isometric Utils.h" #include "worlddef.h" - #include "worlddat.h" - #include "text.h" - #include "Soldier add.h" - #include "soldier macros.h" + #include "WorldDat.h" + #include "Text.h" + #include "Soldier Add.h" + #include "Soldier macros.h" #include "Strategic Pathing.h" - #include "soldier create.h" - #include "handle UI.h" + #include "Soldier Create.h" + #include "Handle UI.h" #include "faces.h" #include "renderworld.h" #include "Map Information.h" #include "Assignments.h" #include "message.h" #include "Game Events.h" - #include "quests.h" + #include "Quests.h" #include "FileMan.h" - #include "animated progressbar.h" + #include "Animated ProgressBar.h" #include "Strategic Movement.h" #include "Campaign Types.h" #include "Exit Grids.h" #include "Tactical Save.h" - #include "animation control.h" - #include "squads.h" + #include "Animation Control.h" + #include "Squads.h" #include "Overhead.h" #include "Strategic Town Loyalty.h" #include "Queen Command.h" - #include "cursor control.h" + #include "Cursor Control.h" #include "PreBattle Interface.h" #include "gameloop.h" - #include "Random.h" + #include "random.h" #include "ai.h" - #include "keys.h" + #include "Keys.h" #include "Tactical Placement GUI.h" #include "Map Screen Helicopter.h" #include "Player Command.h" #include "Event Pump.h" - #include "air raid.h" + #include "Air Raid.h" #include "Strategic Mines.h" #include "SaveLoadMap.h" #include "Militia Control.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "Town Militia.h" #include "sysutil.h" #include "Debug Control.h" #include "Queen Command.h" #include "Strategic Event Handler.h" #include "MessageBoxScreen.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" #include "Map Screen Interface.h" #include "Bullets.h" #include "physics.h" #include "Auto Resolve.h" - #include "cursors.h" + #include "Cursors.h" #ifdef JA2UB #include "Soldier Init List.h" diff --git a/Strategic/LuaInitNPCs.cpp b/Strategic/LuaInitNPCs.cpp index 721a5a44..8ce8aa3b 100644 --- a/Strategic/LuaInitNPCs.cpp +++ b/Strategic/LuaInitNPCs.cpp @@ -42,7 +42,7 @@ #include "Game Events.h" #include "email.h" #include "worldman.h" -#include "text.h" +#include "Text.h" #include "Dialogue Control.h" #include "Boxing.h" diff --git a/Strategic/LuaInitNPCs.h b/Strategic/LuaInitNPCs.h index cd663ede..95d8ec27 100644 --- a/Strategic/LuaInitNPCs.h +++ b/Strategic/LuaInitNPCs.h @@ -1,7 +1,7 @@ #ifndef _LUAINITNPCS_H #define _LUAINITNPCS_H -#include "Types.h" +#include "types.h" typedef struct { diff --git a/Strategic/Luaglobal.h b/Strategic/Luaglobal.h index ec602857..ca87b0ff 100644 --- a/Strategic/Luaglobal.h +++ b/Strategic/Luaglobal.h @@ -1,7 +1,7 @@ #ifndef _LUAGLOBAL_H #define _LUAGLOBAL_H -#include "Types.h" +#include "types.h" extern "C" { #include "lua.h" diff --git a/Strategic/Map Screen Helicopter.cpp b/Strategic/Map Screen Helicopter.cpp index 8ba308f9..23f9f31f 100644 --- a/Strategic/Map Screen Helicopter.cpp +++ b/Strategic/Map Screen Helicopter.cpp @@ -1,17 +1,17 @@ #include "Map Screen Helicopter.h" #include "LaptopSave.h" #include "Vehicles.h" - #include "Finances.h" + #include "finances.h" #include "Quests.h" #include "Game Clock.h" #include "strategic.h" #include "Queen Command.h" #include "Strategic Pathing.h" - #include "Random.h" + #include "random.h" #include "Game Event Hook.h" - #include "String.h" + #include "string.h" #include "Dialogue Control.h" - #include "Message.h" + #include "message.h" #include "Strategic Movement.h" #include "Soldier Profile.h" #include "Assignments.h" @@ -19,14 +19,14 @@ #include "strategicmap.h" #include "worlddef.h" #include "worldman.h" - #include "tiledat.h" + #include "TileDat.h" #include "Map Screen Interface.h" #include "Text.h" #include "Squads.h" #include "Player Command.h" #include "Sound Control.h" #include "GameSettings.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Map Screen Interface Border.h" #include "Strategic Event Handler.h" #include "Overhead.h" diff --git a/Strategic/Map Screen Helicopter.h b/Strategic/Map Screen Helicopter.h index 05c8e7bf..4be1bb3e 100644 --- a/Strategic/Map Screen Helicopter.h +++ b/Strategic/Map Screen Helicopter.h @@ -1,7 +1,7 @@ #ifndef __MAP_SCREEN_HELICOPTER_H #define __MAP_SCREEN_HELICOPTER_H -#include "Types.h" +#include "types.h" #include "Soldier Control.h" // costs of flying through sectors diff --git a/Strategic/Map Screen Interface Border.cpp b/Strategic/Map Screen Interface Border.cpp index 4155783d..c538d8ab 100644 --- a/Strategic/Map Screen Interface Border.cpp +++ b/Strategic/Map Screen Interface Border.cpp @@ -1,5 +1,5 @@ #include "Map Screen Interface Border.h" - #include "Types.h" + #include "types.h" #include "vsurface.h" #include "mousesystem.h" #include "Button System.h" diff --git a/Strategic/Map Screen Interface Border.h b/Strategic/Map Screen Interface Border.h index 1447b461..3b4feb16 100644 --- a/Strategic/Map Screen Interface Border.h +++ b/Strategic/Map Screen Interface Border.h @@ -1,7 +1,7 @@ #ifndef __MAP_INTERFACE_BORDER_H #define __MAP_INTERFACE_BORDER_H -#include "Types.h" +#include "types.h" //#define MAP_BORDER_START_X 261 //#define MAP_BORDER_START_Y 0 diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index 49ee8f29..bb60945a 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -1,6 +1,6 @@ #include "Map Screen Interface Bottom.h" #include "Map Screen Interface Border.h" - #include "Types.h" + #include "types.h" #include "vsurface.h" #include "mousesystem.h" #include "Button System.h" @@ -9,16 +9,16 @@ #include "message.h" #include "mapscreen.h" #include "strategicmap.h" - #include "font control.h" + #include "Font Control.h" #include "Radar Screen.h" - #include "game clock.h" + #include "Game Clock.h" #include "sysutil.h" #include "Render Dirty.h" #include "Map Screen Interface.h" #include "Map Screen Interface Map.h" #include "Text.h" #include "Overhead.h" - #include "Prebattle Interface.h" + #include "PreBattle Interface.h" #include "Options Screen.h" #include "Cursor Control.h" #include "gameloop.h" @@ -26,11 +26,11 @@ #include "Tactical Save.h" #include "Campaign Types.h" #include "Air Raid.h" - #include "Finances.h" + #include "finances.h" #include "LaptopSave.h" #include "Interface Items.h" - #include "wordwrap.h" - #include "meanwhile.h" + #include "WordWrap.h" + #include "Meanwhile.h" #include "Dialogue Control.h" #include "Map Screen Helicopter.h" #include "Map Screen Interface TownMine Info.h" @@ -44,7 +44,7 @@ #include "SaveLoadScreen.h" #include "Interface Control.h" #include "Sys Globals.h" -#include "game init.h" +#include "Game Init.h" #ifdef JA2UB #include "Ja25 Strategic Ai.h" diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 9f2b21a4..35d25da5 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -20,12 +20,12 @@ #include "GameSettings.h" #include "Radar Screen.h" #include "message.h" - #include "weapons.h" + #include "Weapons.h" #include "finances.h" #include "Game Clock.h" #include "Sound Control.h" - #include "interface panels.h" - #include "wordwrap.h" + #include "Interface Panels.h" + #include "WordWrap.h" #include "Soldier macros.h" #include "rt time defines.h" #include "Encyclopedia_new.h" //Moa: item visibility diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index dc705df5..ccc7fbc1 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -17,7 +17,7 @@ #include "WCheck.h" #include "Assignments.h" #include "Squads.h" - #include "Message.h" + #include "message.h" #include "Soldier Profile.h" #include "Player Command.h" #include "Strategic Movement.h" diff --git a/Strategic/Map Screen Interface TownMine Info.cpp b/Strategic/Map Screen Interface TownMine Info.cpp index 17294d0a..d1b7a12b 100644 --- a/Strategic/Map Screen Interface TownMine Info.cpp +++ b/Strategic/Map Screen Interface TownMine Info.cpp @@ -1,6 +1,6 @@ #include "Map Screen Interface TownMine Info.h" #include "strategicmap.h" - #include "popupbox.h" + #include "PopUpBox.h" #include "Map Screen Interface.h" #include "Queen Command.h" #include "Player Command.h" @@ -15,7 +15,7 @@ #include "Strategic Mines.h" #include "finances.h" #include "Map Screen Interface Map Inventory.h" - #include "Strategic.h" + #include "strategic.h" #include "Utilities.h" #include "video.h" #include "Town Militia.h" @@ -23,7 +23,7 @@ #include "Map Screen Helicopter.h" #include "Tactical Save.h" #include "GameSettings.h" - #include "debug.h" + #include "DEBUG.H" #include "Overhead.h" // added by Flugente #include "Game Clock.h" // added by Flugente #include "Game Event Hook.h" // added by Flugente diff --git a/Strategic/Map Screen Interface TownMine Info.h b/Strategic/Map Screen Interface TownMine Info.h index 73d210f6..d989455c 100644 --- a/Strategic/Map Screen Interface TownMine Info.h +++ b/Strategic/Map Screen Interface TownMine Info.h @@ -1,7 +1,7 @@ #ifndef __MS_I_TOWNMINE_INFO_H #define __MS_I_TOWNMINE_INFO_H -#include "Types.h" +#include "types.h" extern BOOLEAN fShowTownInfo; diff --git a/Strategic/Map Screen Interface.cpp b/Strategic/Map Screen Interface.cpp index 678c4fd7..278dfecd 100644 --- a/Strategic/Map Screen Interface.cpp +++ b/Strategic/Map Screen Interface.cpp @@ -8,8 +8,8 @@ #include "Overhead.h" #include "Squads.h" #include "Sound Control.h" - #include "Soundman.h" - #include "Message.h" + #include "soundman.h" + #include "message.h" #include "PopUpBox.h" #include "Game Clock.h" #include "Handle Items.h" @@ -19,20 +19,20 @@ #include "Game Event Hook.h" #include "Tactical Save.h" #include "Quests.h" - #include "Strategicmap.h" + #include "strategicmap.h" #include "Soldier Profile.h" #include "Strategic Movement.h" #include "Dialogue Control.h" #include "Map Screen Interface Border.h" #include "Map Screen Interface Bottom.h" #include "Vehicles.h" - #include "LINE.H" + #include "line.h" #include "Text.h" #include "gameloop.h" #include "Map Screen Helicopter.h" #include "PreBattle Interface.h" #include "WordWrap.h" - #include "interface control.h" + #include "Interface Control.h" #include "GameSettings.h" #include "Campaign Types.h" #include "Map Screen Interface Map Inventory.h" @@ -40,7 +40,7 @@ #include "Keys.h" #include "Soldier macros.h" #include "Militia Control.h" - #include "Random.h" + #include "random.h" #include "Cursor Control.h" #include "renderworld.h" #include "Game Init.h" @@ -51,7 +51,7 @@ #include "Queen Command.h" #include "Render Fun.h" #include "Food.h" - #include "Personnel.h" + #include "personnel.h" #include "mapscreen.h" #include "connect.h" diff --git a/Strategic/Map Screen Interface.h b/Strategic/Map Screen Interface.h index 5e7aafaf..2e8d80ed 100644 --- a/Strategic/Map Screen Interface.h +++ b/Strategic/Map Screen Interface.h @@ -2,7 +2,7 @@ #define MAP_SCREEN_INTERFACE_H -#include "Types.h" +#include "types.h" #include "Soldier Control.h" #include "MessageBoxScreen.h" #include "Font Control.h" diff --git a/Strategic/MapScreen Quotes.cpp b/Strategic/MapScreen Quotes.cpp index b90be26f..72cb6375 100644 --- a/Strategic/MapScreen Quotes.cpp +++ b/Strategic/MapScreen Quotes.cpp @@ -6,8 +6,8 @@ #include "Soldier Control.h" #include "Overhead.h" #include "Squads.h" - #include "Soundman.h" - #include "Message.h" + #include "soundman.h" + #include "message.h" #include "PopUpBox.h" #include "Handle Items.h" #include "Interface Items.h" @@ -16,14 +16,14 @@ #include "Game Event Hook.h" #include "Tactical Save.h" #include "Quests.h" - #include "Strategicmap.h" + #include "strategicmap.h" #include "Soldier Profile.h" #include "Strategic Movement.h" #include "Dialogue Control.h" #include "Map Screen Interface Border.h" #include "Map Screen Interface Bottom.h" #include "Vehicles.h" - #include "LINE.H" + #include "line.h" #include "Text.h" #include "gameloop.h" #include "Map Screen Helicopter.h" @@ -36,7 +36,7 @@ #include "Keys.h" #include "Soldier macros.h" #include "Militia Control.h" - #include "Random.h" + #include "random.h" #include "Cursor Control.h" #include "renderworld.h" #include "Strategic Mines.h" diff --git a/Strategic/Meanwhile.cpp b/Strategic/Meanwhile.cpp index 52c578fd..ed189316 100644 --- a/Strategic/Meanwhile.cpp +++ b/Strategic/Meanwhile.cpp @@ -1,24 +1,24 @@ #include "sgp.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "PreBattle Interface.h" - #include "messageboxscreen.h" + #include "MessageBoxScreen.h" #include "strategicmap.h" - #include "fade screen.h" + #include "Fade Screen.h" #include "screenids.h" #include "jascreens.h" - #include "npc.h" - #include "game event hook.h" - #include "game clock.h" - #include "tactical save.h" - #include "soldier profile.h" - #include "overhead.h" - #include "dialogue control.h" + #include "NPC.h" + #include "Game Event Hook.h" + #include "Game Clock.h" + #include "Tactical Save.h" + #include "Soldier Profile.h" + #include "Overhead.h" + #include "Dialogue Control.h" #include "gameloop.h" - #include "npc.h" - #include "assignments.h" + #include "NPC.h" + #include "Assignments.h" #include "strategic.h" - #include "text.h" - #include "interface control.h" + #include "Text.h" + #include "Interface Control.h" #include "Interface Items.h" #include "Map Information.h" #include "Map Screen Interface Map.h" @@ -28,11 +28,11 @@ #include "Game Events.h" #include "GameSettings.h" #include "Strategic AI.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" #include "Quests.h" #include "Campaign Types.h" #include "Squads.h" - #include "Random.h" + #include "random.h" #include "GameInitOptionsScreen.h" diff --git a/Strategic/Merc Contract.cpp b/Strategic/Merc Contract.cpp index c5bbaf3d..291b99aa 100644 --- a/Strategic/Merc Contract.cpp +++ b/Strategic/Merc Contract.cpp @@ -1,15 +1,15 @@ #include "builddefines.h" - #include "Types.h" + #include "types.h" #include "Merc Contract.h" #include "Soldier Profile.h" - #include "History.h" + #include "history.h" #include "finances.h" #include "Game Clock.h" #include "Soldier Add.h" #include "Dialogue Control.h" #include "Soldier Create.h" - #include "Message.h" + #include "message.h" #include "Font Control.h" #include "personnel.h" #include "LaptopSave.h" @@ -23,7 +23,7 @@ #include "Interface Control.h" #include "gamescreen.h" #include "jascreens.h" - #include "Random.h" + #include "random.h" #include "Assignments.h" #include "Strategic Movement.h" #include "Squads.h" @@ -31,7 +31,7 @@ #include "Text.h" #include "Strategic Status.h" #include "mercs.h" - #include "insurance contract.h" + #include "insurance Contract.h" #include "Vehicles.h" #include "email.h" #include "Map Screen Helicopter.h" diff --git a/Strategic/MilitiaIndividual.cpp b/Strategic/MilitiaIndividual.cpp index dade1619..fa117f44 100644 --- a/Strategic/MilitiaIndividual.cpp +++ b/Strategic/MilitiaIndividual.cpp @@ -6,7 +6,7 @@ #include "MilitiaIndividual.h" #include "random.h" -#include "text.h" +#include "Text.h" #include "Overhead Types.h" #include "Game Clock.h" #include "strategicmap.h" diff --git a/Strategic/MilitiaSquads.cpp b/Strategic/MilitiaSquads.cpp index 303ea283..5694509c 100644 --- a/Strategic/MilitiaSquads.cpp +++ b/Strategic/MilitiaSquads.cpp @@ -7,13 +7,13 @@ #include "Strategic Town Loyalty.h" #include "Utilities.h" #include "random.h" - #include "text.h" + #include "Text.h" #include "Map Screen Interface.h" #include "Interface.h" - #include "Laptopsave.h" + #include "LaptopSave.h" #include "Game Clock.h" #include "Assignments.h" - #include "squads.h" + #include "Squads.h" #include "Soldier Create.h" #include "Dialogue Control.h" #include "GameSettings.h" diff --git a/Strategic/MilitiaSquads.h b/Strategic/MilitiaSquads.h index 499bd38c..4f09125e 100644 --- a/Strategic/MilitiaSquads.h +++ b/Strategic/MilitiaSquads.h @@ -3,9 +3,9 @@ // header for town militia strategic control module -#include "Types.h" +#include "types.h" #include "Soldier Control.h" -#include "campaign types.h" +#include "Campaign Types.h" //#define MAXIMUM_MILITIA_SQUAD_SIZE 30 diff --git a/Strategic/MiniEvents.h b/Strategic/MiniEvents.h index 5ed48a4e..2db09352 100644 --- a/Strategic/MiniEvents.h +++ b/Strategic/MiniEvents.h @@ -3,7 +3,7 @@ #define MINI_EVENT_Z_OFFSET 9 -#include "Types.h" +#include "types.h" void InitMiniEvents(); void CheckMiniEvents(UINT32 nextEventId); diff --git a/Strategic/Player Command.cpp b/Strategic/Player Command.cpp index 51fd7d7d..ba856cb3 100644 --- a/Strategic/Player Command.cpp +++ b/Strategic/Player Command.cpp @@ -1,18 +1,18 @@ #include "Player Command.h" #include "Queen Command.h" #include "Campaign Types.h" - #include "Strategic.h" + #include "strategic.h" #include "Strategic Town Loyalty.h" #include "Strategic Mines.h" - #include "text.h" - #include "laptopsave.h" - #include "quests.h" + #include "Text.h" + #include "LaptopSave.h" + #include "Quests.h" #include "Morale.h" #include "Overhead.h" #include "strategicmap.h" #include "Map Screen Helicopter.h" #include "Game Clock.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "email.h" #include "GameSettings.h" #include "Strategic Status.h" @@ -21,14 +21,14 @@ #include "Map Screen Interface.h" #include "Tactical Save.h" #include "interface Dialogue.h" - #include "Random.h" + #include "random.h" // HEADROCK HAM 3.6: Added for facility string printing... #include "PopUpBox.h" #include "CampaignStats.h" // added by Flugente #include "Town Militia.h" // added by Flugente #include "LuaInitNPCs.h" // added by Flugente -#include "postalservice.h" +#include "PostalService.h" #include "GameInitOptionsScreen.h" diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index 0f04d615..abc745b8 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -14,7 +14,7 @@ #include "Queen Command.h" #include "Strategic Movement.h" #include "Strategic Pathing.h" - #include "text.h" + #include "Text.h" #include "PopUpBox.h" #include "Player Command.h" #include "Cursors.h" @@ -22,19 +22,19 @@ #include "Sound Control.h" #include "english.h" #include "Map Screen Interface Bottom.h" - #include "overhead.h" + #include "Overhead.h" #include "Tactical Placement GUI.h" #include "Town Militia.h" - #include "campaign.h" + #include "Campaign.h" #include "GameSettings.h" - #include "Random.h" + #include "random.h" #include "Creature Spreading.h" #include "Multi Language Graphic Utils.h" #include "Map Screen Helicopter.h" #include "Quests.h" #include "Map Screen Interface Border.h" #include "Strategic Status.h" - #include "interface control.h" + #include "Interface Control.h" #include "Strategic Town Loyalty.h" #include "Squads.h" #include "Assignments.h" @@ -45,7 +45,7 @@ #include "Tactical Save.h" #include "message.h" #include "CampaignStats.h" // added by Flugente - #include "militiasquads.h" // added by Flugente + #include "MilitiaSquads.h" // added by Flugente #include "SkillCheck.h" // added by Flugente #include "Strategic Transport Groups.h" #include "Utilities.h" diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index b5ff2ce4..2b14d1b7 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -5,8 +5,8 @@ #include "Overhead Types.h" #include "strategicmap.h" #include "Soldier Init List.h" - #include "debug.h" - #include "Random.h" + #include "DEBUG.H" + #include "random.h" #include "Strategic Movement.h" #include "Overhead.h" #include "Strategic Pathing.h" @@ -15,10 +15,10 @@ #include "Map Edgepoints.h" #include "PreBattle Interface.h" #include "strategic status.h" - #include "squads.h" - #include "assignments.h" - #include "items.h" - #include "tactical save.h" + #include "Squads.h" + #include "Assignments.h" + #include "Items.h" + #include "Tactical Save.h" #include "Soldier Ani.h" #include "Strategic AI.h" #include "GameSettings.h" @@ -36,7 +36,7 @@ #include "Town Militia.h" #include "Dialogue Control.h" #include "Campaign Init.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Soldier macros.h" #include "Morale.h" #include "CampaignStats.h" // added by Flugente diff --git a/Strategic/Quest Debug System.cpp b/Strategic/Quest Debug System.cpp index 06d7457f..82fd36b3 100644 --- a/Strategic/Quest Debug System.cpp +++ b/Strategic/Quest Debug System.cpp @@ -1,10 +1,10 @@ #include "builddefines.h" - #include "Types.h" + #include "types.h" #include "Quest Debug System.h" #include "WCheck.h" #include "Font Control.h" - #include "Video.h" + #include "video.h" #include "Game Clock.h" #include "Render Dirty.h" #include "WordWrap.h" @@ -19,23 +19,23 @@ #include "Text Input.h" #include "Soldier Create.h" #include "strategicmap.h" - #include "soldier add.h" - #include "Opplist.h" + #include "Soldier Add.h" + #include "opplist.h" #include "Handle Items.h" #include "Game Clock.h" #include "environment.h" - #include "dialogue control.h" + #include "Dialogue Control.h" //#include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "MessageBoxScreen.h" - #include "Stdio.h" + #include "stdio.h" #include "english.h" #include "line.h" #include "Keys.h" - #include "Interface Dialogue.h" - #include "SysUtil.h" - #include "Message.h" - #include "Random.h" + #include "interface Dialogue.h" + #include "sysutil.h" + #include "message.h" + #include "random.h" //#ifdef JA2BETAVERSION diff --git a/Strategic/Quests.cpp b/Strategic/Quests.cpp index 55b7bb23..24e83f56 100644 --- a/Strategic/Quests.cpp +++ b/Strategic/Quests.cpp @@ -1,17 +1,17 @@ #include "sgp.h" #include "message.h" - #include "quests.h" - #include "game clock.h" - #include "StrategicMap.h" - #include "soldier profile.h" + #include "Quests.h" + #include "Game Clock.h" + #include "strategicmap.h" + #include "Soldier Profile.h" #include "LaptopSave.h" #include "Handle Items.h" - #include "overhead.h" - #include "Interface Dialogue.h" + #include "Overhead.h" + #include "interface Dialogue.h" #include "Soldier Profile.h" #include "Isometric Utils.h" #include "Render Fun.h" - #include "History.h" + #include "history.h" #include "Map Screen Helicopter.h" #include "Overhead.h" #include "Strategic Mines.h" @@ -23,7 +23,7 @@ #include "GameSettings.h" #include "Arms Dealer Init.h" #include "GameSettings.h" - #include "Random.h" + #include "random.h" #include "Assignments.h" #include "strategic.h" #include "Strategic Event Handler.h" diff --git a/Strategic/Rebel Command.cpp b/Strategic/Rebel Command.cpp index 7c169657..d8812ee4 100644 --- a/Strategic/Rebel Command.cpp +++ b/Strategic/Rebel Command.cpp @@ -75,7 +75,7 @@ Points of interest: #include "GameSettings.h" #include "GameVersion.h" #include "input.h" -#include "Line.h" +#include "line.h" #include "laptop.h" #include "message.h" #include "MessageBoxScreen.h" diff --git a/Strategic/Rebel Command.h b/Strategic/Rebel Command.h index 22b6fd3b..452355a8 100644 --- a/Strategic/Rebel Command.h +++ b/Strategic/Rebel Command.h @@ -4,7 +4,7 @@ #include "CampaignStats.h" #include "mapscreen.h" #include "Soldier Control.h" -#include "Types.h" +#include "types.h" #define REBEL_COMMAND_Z_OFFSET 9 #define REBEL_COMMAND_MAX_ACTIONS_PER_REGION 6 diff --git a/Strategic/Reinforcement.cpp b/Strategic/Reinforcement.cpp index 2adaa4f9..bdad2f07 100644 --- a/Strategic/Reinforcement.cpp +++ b/Strategic/Reinforcement.cpp @@ -7,12 +7,12 @@ #include "Strategic Town Loyalty.h" #include "Utilities.h" #include "random.h" - #include "text.h" + #include "Text.h" #include "Map Screen Interface.h" #include "Interface.h" - #include "Laptopsave.h" + #include "LaptopSave.h" #include "Assignments.h" - #include "squads.h" + #include "Squads.h" #include "Soldier Create.h" #include "Dialogue Control.h" #include "Queen Command.h" diff --git a/Strategic/Scheduling.cpp b/Strategic/Scheduling.cpp index 7408c37c..06992561 100644 --- a/Strategic/Scheduling.cpp +++ b/Strategic/Scheduling.cpp @@ -1,18 +1,18 @@ #include - #include "Fileman.h" + #include "FileMan.h" #include "types.h" #include "Scheduling.h" #include "message.h" - #include "overhead.h" + #include "Overhead.h" #include "Game Clock.h" #include "Game Event Hook.h" #include "worlddef.h" #include "Soldier Init List.h" #include "Isometric Utils.h" #include "ai.h" - #include "debug.h" - #include "Random.h" + #include "DEBUG.H" + #include "random.h" #include "Animation Data.h" #include "Map Information.h" #include "Keys.h" diff --git a/Strategic/Scheduling.h b/Strategic/Scheduling.h index aa80f5fb..5a076ac9 100644 --- a/Strategic/Scheduling.h +++ b/Strategic/Scheduling.h @@ -1,7 +1,7 @@ #ifndef __SCHEDULING_H #define __SCHEDULING_H -#include "BuildDefines.h" +#include "builddefines.h" #include "Soldier Init List.h" //Merc scheduling actions diff --git a/Strategic/Strategic AI.cpp b/Strategic/Strategic AI.cpp index 8a3ca8a1..6572c879 100644 --- a/Strategic/Strategic AI.cpp +++ b/Strategic/Strategic AI.cpp @@ -7,7 +7,7 @@ #include "Game Event Hook.h" #include "GameSettings.h" #include "Campaign Types.h" - #include "Random.h" + #include "random.h" #include "Strategic Pathing.h" #include "message.h" #include "strategicmap.h" @@ -30,7 +30,7 @@ #include "Soldier Profile.h" #include "Scheduling.h" #include "Map Information.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" #include "ASD.h" // added by Flugente #include "Rebel Command.h" #include "Game Event Hook.h" diff --git a/Strategic/Strategic Event Handler.cpp b/Strategic/Strategic Event Handler.cpp index 37147e6b..36a929b2 100644 --- a/Strategic/Strategic Event Handler.cpp +++ b/Strategic/Strategic Event Handler.cpp @@ -5,20 +5,20 @@ #include "Handle Items.h" #include "LaptopSave.h" #include "Tactical Save.h" - #include "StrategicMap.h" + #include "strategicmap.h" #include "Quests.h" #include "Soldier Profile.h" #include "Game Event Hook.h" #include "Game Clock.h" - #include "Interface Dialogue.h" - #include "Random.h" + #include "interface Dialogue.h" + #include "random.h" #include "Overhead.h" #include "Strategic Town Loyalty.h" #include "Soldier Init List.h" #include "SaveLoadMap.h" #include "Soldier Create.h" #include "Soldier Add.h" - #include "Renderworld.h" + #include "renderworld.h" #include "Soldier Profile.h" #include "email.h" #include "strategic.h" diff --git a/Strategic/Strategic Event Handler.h b/Strategic/Strategic Event Handler.h index 65e78aaa..362e4243 100644 --- a/Strategic/Strategic Event Handler.h +++ b/Strategic/Strategic Event Handler.h @@ -1,7 +1,7 @@ #ifndef _STRATEGIC_EVENT_HANDLER_H_ #define _STRATEGIC_EVENT_HANDLER_H_ -#include "Types.h" +#include "types.h" #define KINGPIN_MONEY_SECTOR_X gModSettings.ubKingpinMoneySectorX //5 #define KINGPIN_MONEY_SECTOR_Y gModSettings.ubKingpinMoneySectorY //MAP_ROW_D diff --git a/Strategic/Strategic Merc Handler.cpp b/Strategic/Strategic Merc Handler.cpp index 501e2643..4f5a8221 100644 --- a/Strategic/Strategic Merc Handler.cpp +++ b/Strategic/Strategic Merc Handler.cpp @@ -1,8 +1,8 @@ - #include "Types.h" + #include "types.h" #include "Strategic Merc Handler.h" - #include "History.h" - #include "Game clock.h" + #include "history.h" + #include "Game Clock.h" #include "insurance Contract.h" #include "Soldier Profile.h" #include "Game Event Hook.h" @@ -11,15 +11,15 @@ #include "Merc Contract.h" #include "Merc Hiring.h" #include "Dialogue Control.h" - #include "Random.h" + #include "random.h" #include "Morale.h" - #include "Mercs.h" + #include "mercs.h" #include "Mapscreen.h" - #include "weapons.h" - #include "Personnel.h" + #include "Weapons.h" + #include "personnel.h" #include "Strategic Movement.h" #include "LaptopSave.h" - #include "Message.h" + #include "message.h" #include "Text.h" #include "Interface.h" #include "strategic.h" diff --git a/Strategic/Strategic Mines LUA.h b/Strategic/Strategic Mines LUA.h index ff1f129f..d0314474 100644 --- a/Strategic/Strategic Mines LUA.h +++ b/Strategic/Strategic Mines LUA.h @@ -1,7 +1,7 @@ #ifndef STRATEGIC_MINES_LUA_H #define STRATEGIC_MINES_LUA_H -#include "Types.h" +#include "types.h" extern "C" { #include "lua.h" diff --git a/Strategic/Strategic Mines.cpp b/Strategic/Strategic Mines.cpp index 9e99ae85..c998d1bf 100644 --- a/Strategic/Strategic Mines.cpp +++ b/Strategic/Strategic Mines.cpp @@ -1,11 +1,11 @@ - #include + #include #include "Strategic Mines.h" - #include "Finances.h" + #include "finances.h" #include "Strategic Town Loyalty.h" #include "strategic.h" #include "Game Clock.h" #include "strategicmap.h" - #include "Random.h" + #include "random.h" #include "Soldier Profile.h" #include "Dialogue Control.h" #include "Map Screen Interface.h" diff --git a/Strategic/Strategic Mines.h b/Strategic/Strategic Mines.h index 63351652..74b85361 100644 --- a/Strategic/Strategic Mines.h +++ b/Strategic/Strategic Mines.h @@ -3,7 +3,7 @@ // the .h to the mine management system -#include "Types.h" +#include "types.h" #include "strategicmap.h" #include "mapscreen.h" diff --git a/Strategic/Strategic Movement Costs.cpp b/Strategic/Strategic Movement Costs.cpp index 4f45414e..a641a767 100644 --- a/Strategic/Strategic Movement Costs.cpp +++ b/Strategic/Strategic Movement Costs.cpp @@ -3,7 +3,7 @@ #include "Strategic Movement.h" #include "XML.h" #include "expat.h" - #include "Debug.h" + #include "DEBUG.H" #include "Debug Control.h" #include "Tactical Save.h" #include "Map Screen Interface Map.h" diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 4afc1b94..4e765ad1 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -3,33 +3,33 @@ #include #include "Strategic Movement.h" #include "MemMan.h" - #include "debug.h" + #include "DEBUG.H" #include "Campaign Types.h" #include "Game Event Hook.h" #include "Game Clock.h" #include "Queen Command.h" - #include "overhead.h" + #include "Overhead.h" #include "strategicmap.h" #include "jascreens.h" #include "Strategic Pathing.h" #include "Map Screen Interface Map.h" #include "PreBattle Interface.h" - #include "Strategic.h" + #include "strategic.h" #include "Assignments.h" #include "Text.h" #include "Font Control.h" #include "message.h" #include "mapscreen.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "Soldier Add.h" #include "Game Events.h" #include "Vehicles.h" #include "Map Screen Helicopter.h" #include "Map Screen Interface.h" #include "Squads.h" - #include "Random.h" - #include "soldier macros.h" + #include "random.h" + #include "Soldier macros.h" #include "Map Information.h" #include "Tactical Save.h" #include "Player Command.h" @@ -38,7 +38,7 @@ #include "Music Control.h" #include "Campaign.h" #include "Isometric Utils.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Inventory Choosing.h" #include "Map Screen Interface Border.h" #include "Auto Resolve.h" diff --git a/Strategic/Strategic Pathing.cpp b/Strategic/Strategic Pathing.cpp index 37c260bf..117f47d0 100644 --- a/Strategic/Strategic Pathing.cpp +++ b/Strategic/Strategic Pathing.cpp @@ -5,7 +5,7 @@ #include "sgp.h" #include "strategic.h" #include "mapscreen.h" - #include "overhead.h" + #include "Overhead.h" #include "strategicmap.h" #include "Strategic Pathing.h" #include "Map Screen Interface Border.h" diff --git a/Strategic/Strategic Status.cpp b/Strategic/Strategic Status.cpp index 0d0d571b..b1c30b39 100644 --- a/Strategic/Strategic Status.cpp +++ b/Strategic/Strategic Status.cpp @@ -6,7 +6,7 @@ #include "Strategic Mines.h" #include "email.h" #include "Game Clock.h" - #include "Debug.h" + #include "DEBUG.H" #include "GameSettings.h" #include "history.h" #include "Strategic Town Loyalty.h" diff --git a/Strategic/Strategic Town Loyalty.cpp b/Strategic/Strategic Town Loyalty.cpp index 9de36dc0..2db0a664 100644 --- a/Strategic/Strategic Town Loyalty.cpp +++ b/Strategic/Strategic Town Loyalty.cpp @@ -9,16 +9,16 @@ #include "Animation Data.h" #include "Quests.h" #include "Font.h" - #include "Message.h" + #include "message.h" #include "LOS.h" #include "World Items.h" #include "Tactical Save.h" #include "Soldier Profile.h" #include "Handle Items.h" #include "random.h" - #include "strategic movement.h" + #include "Strategic Movement.h" #include "Strategic Pathing.h" - #include "vehicles.h" + #include "Vehicles.h" #include "Game Clock.h" #include "Game Event Hook.h" #include "Morale.h" @@ -27,7 +27,7 @@ #include "MessageBoxScreen.h" #include "Town Militia.h" #include "history.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Strategic Status.h" // HEADROCK HAM B1: Added include for Dynamic Roaming Militia #include "MilitiaSquads.h" diff --git a/Strategic/Strategic Town Loyalty.h b/Strategic/Strategic Town Loyalty.h index 2d420c2f..bbea5f52 100644 --- a/Strategic/Strategic Town Loyalty.h +++ b/Strategic/Strategic Town Loyalty.h @@ -1,7 +1,7 @@ #ifndef __STRATEGIC_TOWN_LOYALTY_H #define __STRATEGIC_TOWN_LOYALTY_H -#include "Types.h" +#include "types.h" #include "mapscreen.h" #include "Soldier Control.h" diff --git a/Strategic/Strategic Transport Groups.h b/Strategic/Strategic Transport Groups.h index 3fd873c5..9cb67104 100644 --- a/Strategic/Strategic Transport Groups.h +++ b/Strategic/Strategic Transport Groups.h @@ -2,7 +2,7 @@ #define _STRATEGIC_TRANSPORT_GROUPS_H #include "Campaign Types.h" -#include "Types.h" +#include "types.h" #include enum TransportGroupSectorInfo diff --git a/Strategic/Strategic Turns.cpp b/Strategic/Strategic Turns.cpp index 8feb59e6..3dd8c124 100644 --- a/Strategic/Strategic Turns.cpp +++ b/Strategic/Strategic Turns.cpp @@ -2,20 +2,20 @@ #include "Game Clock.h" #include "Font Control.h" #include "Timer Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Game Clock.h" #include "message.h" #include "worlddef.h" - #include "soldier create.h" - #include "soldier add.h" - #include "strategic turns.h" - #include "isometric utils.h" - #include "animation data.h" - #include "animation control.h" + #include "Soldier Create.h" + #include "Soldier Add.h" + #include "Strategic Turns.h" + #include "Isometric Utils.h" + #include "Animation Data.h" + #include "Animation Control.h" #include "Tactical Turns.h" - #include "strategic turns.h" + #include "Strategic Turns.h" #include "rt time defines.h" - #include "assignments.h" + #include "Assignments.h" diff --git a/Strategic/Town Militia.cpp b/Strategic/Town Militia.cpp index feaf4aed..40eabc8f 100644 --- a/Strategic/Town Militia.cpp +++ b/Strategic/Town Militia.cpp @@ -9,21 +9,21 @@ #include "Strategic Town Loyalty.h" #include "Utilities.h" #include "random.h" - #include "text.h" + #include "Text.h" #include "Map Screen Interface.h" #include "Interface.h" - #include "Laptopsave.h" + #include "LaptopSave.h" #include "finances.h" #include "Game Clock.h" #include "Assignments.h" - #include "squads.h" + #include "Squads.h" #include "Soldier Create.h" #include "Dialogue Control.h" #include "GameSettings.h" #include "Queen Command.h" #include "PreBattle Interface.h" #include "Map Screen Interface Border.h" - #include "interface control.h" + #include "Interface Control.h" #include "Map Screen Interface Map.h" #include "laptop.h" // added by Flugente #include "Game Event Hook.h" // added by Flugente diff --git a/Strategic/Town Militia.h b/Strategic/Town Militia.h index a9ef3536..e2ec865f 100644 --- a/Strategic/Town Militia.h +++ b/Strategic/Town Militia.h @@ -3,7 +3,7 @@ // header for town militia strategic control module -#include "Types.h" +#include "types.h" #include "Soldier Control.h" // how many militia of all ranks can be in any one sector at once diff --git a/Strategic/UndergroundInit.h b/Strategic/UndergroundInit.h index e93ebbbf..d3181334 100644 --- a/Strategic/UndergroundInit.h +++ b/Strategic/UndergroundInit.h @@ -2,7 +2,7 @@ #define _UNDERGROUNDINIT_H #include "Campaign Types.h" -#include "Types.h" +#include "types.h" //#include "Strategic Mines LUA.h" #include "lua_state.h" diff --git a/Strategic/XML_ExtraItems.cpp b/Strategic/XML_ExtraItems.cpp index c5151d63..db41b14a 100644 --- a/Strategic/XML_ExtraItems.cpp +++ b/Strategic/XML_ExtraItems.cpp @@ -2,7 +2,7 @@ #include #include "XML.h" #include "expat.h" -#include "DEBUG.h" +#include "DEBUG.H" #include "string.h" #include "Tactical Save.h" #include "FileMan.h" diff --git a/Strategic/XML_Facilities.cpp b/Strategic/XML_Facilities.cpp index 84fcb759..198e61e1 100644 --- a/Strategic/XML_Facilities.cpp +++ b/Strategic/XML_Facilities.cpp @@ -11,7 +11,7 @@ #include "sgp.h" #include "Debug Control.h" #include "expat.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "XML.h" #include "FileMan.h" #include "Campaign Types.h" diff --git a/Strategic/XML_FacilityTypes.cpp b/Strategic/XML_FacilityTypes.cpp index 598cf88c..60e96453 100644 --- a/Strategic/XML_FacilityTypes.cpp +++ b/Strategic/XML_FacilityTypes.cpp @@ -12,7 +12,7 @@ #include "sgp.h" #include "Debug Control.h" #include "expat.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "XML.h" #include "FileMan.h" #include "Campaign Types.h" diff --git a/Strategic/XML_SquadNames.cpp b/Strategic/XML_SquadNames.cpp index 8d82d6b7..63734fa9 100644 --- a/Strategic/XML_SquadNames.cpp +++ b/Strategic/XML_SquadNames.cpp @@ -1,6 +1,6 @@ #include "sgp.h" #include "Map Screen Interface.h" - #include "overhead.h" + #include "Overhead.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index ebff1280..2703c65a 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -5,13 +5,13 @@ #include "gameloop.h" #include "sgp.h" #include "vobject.h" - #include "wcheck.h" + #include "WCheck.h" #include "worlddef.h" #include "input.h" - #include "font.h" + #include "Font.h" #include "screenids.h" - #include "screens.h" - #include "overhead.h" + #include "Screens.h" + #include "Overhead.h" #include "sysutil.h" #include "Event Pump.h" #include "Font Control.h" @@ -19,18 +19,18 @@ #include "Interface.h" #include "Handle UI.h" #include "Interface Items.h" - #include "interface utils.h" + #include "Interface Utils.h" #include "lighting.h" #include #include - #include "cursors.h" + #include "Cursors.h" #include "Soldier Profile.h" #include "Interface Panels.h" #include "Interface Control.h" - #include "sys globals.h" + #include "Sys Globals.h" #include "Radar Screen.h" #include "Render Dirty.h" - #include "utilities.h" + #include "Utilities.h" #include "Game Init.h" #include "renderworld.h" #include "finances.h" @@ -41,26 +41,26 @@ #include "faces.h" #include "PopUpBox.h" #include "Game Clock.h" - #include "items.h" + #include "Items.h" #include "Cursor Control.h" - #include "text.h" + #include "Text.h" #include "strategic.h" #include "strategicmap.h" - #include "strategic pathing.h" + #include "Strategic Pathing.h" #include "Map Screen Interface Bottom.h" #include "Map Screen Interface Border.h" #include "Map Screen Interface Map.h" #include "Map Screen Interface.h" #include "Assignments.h" - #include "points.h" + #include "Points.h" #include "Squads.h" #include "Merc Contract.h" #include "Sound Control.h" - #include "strategic turns.h" + #include "Strategic Turns.h" #include "Dialogue Control.h" #include "Map Screen Interface TownMine Info.h" #include "PreBattle Interface.h" - #include "Personnel.h" + #include "personnel.h" #include "Animated ProgressBar.h" #include "Queen Command.h" #include "LaptopSave.h" @@ -75,19 +75,19 @@ #include "SaveLoadScreen.h" #include "Options Screen.h" #include "Auto Resolve.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Campaign.h" - #include "Random.h" + #include "random.h" #include "Air Raid.h" - #include "quests.h" + #include "Quests.h" #include "Town Militia.h" - #include "weapons.h" + #include "Weapons.h" #include "Player Command.h" #include "Multi Language Graphic Utils.h" #include "HelpScreen.h" #include "Soldier macros.h" #include "Map Information.h" - #include "cheats.h" + #include "Cheats.h" #include "Strategic Town Loyalty.h" #include "GameSettings.h" #include "Militia Control.h" diff --git a/Strategic/mapscreen.h b/Strategic/mapscreen.h index 9bf934e0..3b5a5835 100644 --- a/Strategic/mapscreen.h +++ b/Strategic/mapscreen.h @@ -2,7 +2,7 @@ #define __MAPSCREEN_H -#include "Types.h" +#include "types.h" #include "Soldier Control.h" #define MAP_WORLD_X 18 diff --git a/Strategic/strategic town reputation.cpp b/Strategic/strategic town reputation.cpp index 06cc6a74..4ef2b90e 100644 --- a/Strategic/strategic town reputation.cpp +++ b/Strategic/strategic town reputation.cpp @@ -1,12 +1,12 @@ #include "types.h" #include "strategic town reputation.h" #include "soldier profile type.h" - #include "game event hook.h" + #include "Game Event Hook.h" #include "Soldier Profile.h" #include "Overhead.h" #include "Game Clock.h" - #include "strategic town loyalty.h" - #include "Debug.h" + #include "Strategic Town Loyalty.h" + #include "DEBUG.H" #include "message.h" diff --git a/Strategic/strategic.cpp b/Strategic/strategic.cpp index 09513662..9d05b97a 100644 --- a/Strategic/strategic.cpp +++ b/Strategic/strategic.cpp @@ -1,5 +1,5 @@ - #include "Strategic.h" - #include "Types.h" + #include "strategic.h" + #include "types.h" #include "Squads.h" #include "jascreens.h" #include "Assignments.h" @@ -13,7 +13,7 @@ #include "Vehicles.h" #include "Game Clock.h" #include "CampaignStats.h" // added by Flugente - #include "militiasquads.h" // added by Flugente + #include "MilitiaSquads.h" // added by Flugente #include "Game Event Hook.h" // added by Flugente #include "message.h" // added by Flugente #include "Text.h" // added by Flugente diff --git a/Strategic/strategic.h b/Strategic/strategic.h index c8d86357..5806f7f6 100644 --- a/Strategic/strategic.h +++ b/Strategic/strategic.h @@ -1,9 +1,9 @@ #ifndef __STRATEGIC_H #define __STRATEGIC_H // header for strategic structure -#include "Types.h" +#include "types.h" #include "mapscreen.h" -#include "soldier control.h" +#include "Soldier Control.h" // Flugente: airspace flags #define AIRSPACE_ENEMY_ACTIVE 0x01 //1 // controlled by enemy and active diff --git a/Strategic/strategicmap.cpp b/Strategic/strategicmap.cpp index 010e944e..ad66f7e6 100644 --- a/Strategic/strategicmap.cpp +++ b/Strategic/strategicmap.cpp @@ -12,24 +12,24 @@ #include "jascreens.h" #include "worlddef.h" #include "Soldier Control.h" -#include "overhead.h" -#include "interface panels.h" -#include "isometric utils.h" +#include "Overhead.h" +#include "Interface Panels.h" +#include "Isometric Utils.h" #include "Ambient Control.h" #include "worlddef.h" -#include "worlddat.h" -#include "text.h" -#include "Soldier add.h" -#include "soldier macros.h" +#include "WorldDat.h" +#include "Text.h" +#include "Soldier Add.h" +#include "Soldier macros.h" #include "Strategic Pathing.h" -#include "soldier create.h" -#include "handle UI.h" +#include "Soldier Create.h" +#include "Handle UI.h" #include "faces.h" #include "renderworld.h" #include "gamescreen.h" -#include "game clock.h" +#include "Game Clock.h" #include "Soldier Init List.h" -#include "strategic turns.h" +#include "Strategic Turns.h" #include "merc entering.h" #include "Map Information.h" #include "Assignments.h" @@ -37,50 +37,50 @@ #include "Font Control.h" #include "environment.h" #include "Game Events.h" -#include "quests.h" +#include "Quests.h" #include "FileMan.h" -#include "animated progressbar.h" -#include "music control.h" -#include "fade screen.h" +#include "Animated ProgressBar.h" +#include "Music Control.h" +#include "Fade Screen.h" #include "Strategic Movement.h" #include "Campaign Types.h" -#include "sys globals.h" +#include "Sys Globals.h" #include "Exit Grids.h" #include "Tactical Save.h" -#include "pathai.h" -#include "animation control.h" -#include "squads.h" +#include "PATHAI.H" +#include "Animation Control.h" +#include "Squads.h" #include "worldman.h" #include "Overhead.h" #include "Strategic Town Loyalty.h" #include "Queen Command.h" -#include "cursor control.h" +#include "Cursor Control.h" #include "PreBattle Interface.h" #include "Shade Table Util.h" #include "Scheduling.h" #include "gameloop.h" -#include "Random.h" +#include "random.h" #include "ai.h" #include "opplist.h" -#include "keys.h" +#include "Keys.h" #include "Tactical Placement GUI.h" #include "Map Screen Helicopter.h" -#include "map edgepoints.h" +#include "Map Edgepoints.h" #include "Player Command.h" #include "Event Pump.h" -#include "meanwhile.h" -#include "air raid.h" +#include "Meanwhile.h" +#include "Air Raid.h" #include "Strategic Mines.h" #include "Creature Spreading.h" #include "SaveLoadMap.h" #include "Militia Control.h" -#include "gamesettings.h" -#include "dialogue control.h" +#include "GameSettings.h" +#include "Dialogue Control.h" #include "Town Militia.h" #include "sysutil.h" #include "Sound Control.h" -#include "points.h" -#include "render dirty.h" +#include "Points.h" +#include "Render Dirty.h" #include "Debug Control.h" #include "expat.h" #include "Loading Screen.h" @@ -89,14 +89,14 @@ #include "NPC.h" #include "Strategic Event Handler.h" #include "MessageBoxScreen.h" -#include "interface dialogue.h" +#include "interface Dialogue.h" #include "Map Screen Interface.h" #include "history.h" #include "Bullets.h" #include "physics.h" #include "Explosion Control.h" #include "Auto Resolve.h" -#include "cursors.h" +#include "Cursors.h" #include "GameVersion.h" #include "LuaInitNPCs.h" @@ -408,8 +408,8 @@ UINT32 uiBuildShadeTableTime; UINT32 uiNumTablesSaved; UINT32 uiNumTablesLoaded; UINT32 uiNumImagesReloaded; -#include "render dirty.h" -#include "tiledat.h" +#include "Render Dirty.h" +#include "TileDat.h" #endif // SAM externalization stuff diff --git a/Strategic/strategicmap.h b/Strategic/strategicmap.h index e43191c5..786f1c13 100644 --- a/Strategic/strategicmap.h +++ b/Strategic/strategicmap.h @@ -2,7 +2,7 @@ #define __STRATMAP_H // this file is for manipulation of the strategic map structure #include "types.h" -#include "soldier control.h" +#include "Soldier Control.h" #include "FileMan.h" #include "mapscreen.h" diff --git a/Tactical/Air Raid.cpp b/Tactical/Air Raid.cpp index 120ad3d7..9e6c2fda 100644 --- a/Tactical/Air Raid.cpp +++ b/Tactical/Air Raid.cpp @@ -1,32 +1,32 @@ #include "sgp.h" - #include "air raid.h" - #include "game event hook.h" - #include "game clock.h" + #include "Air Raid.h" + #include "Game Event Hook.h" + #include "Game Clock.h" #include "strategicmap.h" #include "PreBattle Interface.h" #include "screenids.h" #include "jascreens.h" #include "random.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "Sound Control.h" - #include "timer control.h" - #include "dialogue control.h" - #include "overhead.h" + #include "Timer Control.h" + #include "Dialogue Control.h" + #include "Overhead.h" #include "message.h" - #include "isometric utils.h" - #include "soldier macros.h" - #include "los.h" + #include "Isometric Utils.h" + #include "Soldier macros.h" + #include "LOS.h" #include "math.h" - #include "explosion control.h" - #include "interface.h" - #include "music control.h" + #include "Explosion Control.h" + #include "Interface.h" + #include "Music Control.h" #include "Campaign Types.h" #include "GameSettings.h" - #include "text.h" + #include "Text.h" #include "Morale.h" - #include "Map screen helicopter.h" - #include "structure wrap.h" - #include "meanwhile.h" + #include "Map Screen Helicopter.h" + #include "Structure Wrap.h" + #include "Meanwhile.h" #include "GameInitOptionsScreen.h" diff --git a/Tactical/Air Raid.h b/Tactical/Air Raid.h index 14fc7cbd..3c213b3b 100644 --- a/Tactical/Air Raid.h +++ b/Tactical/Air Raid.h @@ -1,7 +1,7 @@ #ifndef AIR_RAID_H #define AIR_RAID_H -#include "soldier control.h" +#include "Soldier Control.h" #define AIR_RAID_BEGINNING_GAME 0x00000001 #define AIR_RAID_CAN_RANDOMIZE_TEASE_DIVES 0x00000002 diff --git a/Tactical/Animation Cache.cpp b/Tactical/Animation Cache.cpp index ec30ff95..ee3a3b7d 100644 --- a/Tactical/Animation Cache.cpp +++ b/Tactical/Animation Cache.cpp @@ -2,9 +2,9 @@ #include #include "types.h" - #include "wcheck.h" + #include "WCheck.h" #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "Animation Cache.h" #include "Animation Data.h" #include "Animation Control.h" diff --git a/Tactical/Animation Control.cpp b/Tactical/Animation Control.cpp index fb2d9275..bf1a8300 100644 --- a/Tactical/Animation Control.cpp +++ b/Tactical/Animation Control.cpp @@ -2,18 +2,18 @@ #include #include #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "Animation Control.h" #include "Animation Data.h" #include "FileMan.h" -#include "weapons.h" +#include "Weapons.h" #include "message.h" #include "structure.h" #include "worlddef.h" #include "worldman.h" -#include "rotting corpses.h" +#include "Rotting Corpses.h" #include "Debug Control.h" -#include "Random.h" +#include "random.h" #include "Soldier Control.h" #include "connect.h" diff --git a/Tactical/Animation Data.cpp b/Tactical/Animation Data.cpp index a75feb89..cf369488 100644 --- a/Tactical/Animation Data.cpp +++ b/Tactical/Animation Data.cpp @@ -1,9 +1,9 @@ #include "builddefines.h" #include #include - #include "wcheck.h" + #include "WCheck.h" #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "Animation Data.h" #include "Animation Control.h" @@ -11,9 +11,9 @@ #include "tiledef.h" #include "Sys Globals.h" #include "Debug Control.h" - #include "utilities.h" + #include "Utilities.h" #include "worlddef.h" - #include "Fileman.h" + #include "FileMan.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index 18744069..40682b17 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -1,15 +1,15 @@ - #include "Types.h" + #include "types.h" #include "stdlib.h" #include "Arms Dealer Init.h" - #include "String.h" - #include "Debug.h" - #include "Random.h" + #include "string.h" + #include "DEBUG.H" + #include "random.h" #include "Weapons.h" #include "FileMan.h" #include "Game Clock.h" #include "ArmsDealerInvInit.h" - #include "Message.h" - #include "soldier profile.h" + #include "message.h" + #include "Soldier Profile.h" #include "Handle Items.h" #include "Quests.h" #include "Scheduling.h" diff --git a/Tactical/ArmsDealerInvInit.cpp b/Tactical/ArmsDealerInvInit.cpp index c8376592..d0c05986 100644 --- a/Tactical/ArmsDealerInvInit.cpp +++ b/Tactical/ArmsDealerInvInit.cpp @@ -1,16 +1,16 @@ - #include "Types.h" + #include "types.h" #include "ArmsDealerInvInit.h" //#include "Item Types.h" #include "Arms Dealer Init.h" - #include "DEbug.h" - #include "weapons.h" + #include "DEBUG.H" + #include "Weapons.h" #include "Campaign.h" #include "GameSettings.h" #include "AIInternals.h" #include "LaptopSave.h" - #include "bobbyr.h" - #include "Random.h" - #include "Shopkeeper Interface.h" + #include "BobbyR.h" + #include "random.h" + #include "ShopKeeper Interface.h" #include "connect.h" #include "Rebel Command.h" diff --git a/Tactical/Auto Bandage.cpp b/Tactical/Auto Bandage.cpp index a70f5f0a..b426268b 100644 --- a/Tactical/Auto Bandage.cpp +++ b/Tactical/Auto Bandage.cpp @@ -1,29 +1,29 @@ #include "sgp.h" - #include "overhead.h" - #include "messageboxscreen.h" + #include "Overhead.h" + #include "MessageBoxScreen.h" #include "screenids.h" #include "Handle UI.h" #include "message.h" - #include "game clock.h" - #include "items.h" + #include "Game Clock.h" + #include "Items.h" #include "Text.h" #include "MercTextBox.h" - #include "interface.h" - #include "auto bandage.h" + #include "Interface.h" + #include "Auto Bandage.h" #include "renderworld.h" - #include "strategic turns.h" + #include "Strategic Turns.h" #include "Event Pump.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "ai.h" - #include "interface control.h" + #include "Interface Control.h" #include "strategicmap.h" - #include "animation control.h" + #include "Animation Control.h" #include "Map Screen Interface.h" #include "Soldier Profile.h" #include "Assignments.h" #include "WordWrap.h" - #include "cursors.h" - #include "English.h" + #include "Cursors.h" + #include "english.h" #include "SkillCheck.h" // added by Flugente #include "Music Control.h" diff --git a/Tactical/Boxing.cpp b/Tactical/Boxing.cpp index 02db51b6..0b1efae7 100644 --- a/Tactical/Boxing.cpp +++ b/Tactical/Boxing.cpp @@ -2,17 +2,17 @@ #include "Overhead.h" #include "Boxing.h" #include "Render Fun.h" - #include "Random.h" - #include "Worldman.h" + #include "random.h" + #include "worldman.h" #include "Soldier Profile.h" #include "NPC.h" - #include "Opplist.h" + #include "opplist.h" #include "ai.h" #include "Dialogue Control.h" #include "Handle UI.h" #include "Points.h" - #include "interface.h" - #include "interface dialogue.h" + #include "Interface.h" + #include "interface Dialogue.h" #include "TeamTurns.h" #include "Music Control.h" #include "history.h" diff --git a/Tactical/Bullets.h b/Tactical/Bullets.h index 4bff3c42..6ae4cbed 100644 --- a/Tactical/Bullets.h +++ b/Tactical/Bullets.h @@ -3,8 +3,8 @@ #include "types.h" #include "Soldier Control.h" -#include "los.h" -#include "tile animation.h" +#include "LOS.h" +#include "Tile Animation.h" #define BULLET_FLAG_CREATURE_SPIT 0x0001 diff --git a/Tactical/Campaign.cpp b/Tactical/Campaign.cpp index 54d1c78c..81afbea3 100644 --- a/Tactical/Campaign.cpp +++ b/Tactical/Campaign.cpp @@ -3,15 +3,15 @@ #include #include #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "MemMan.h" #include "Overhead Types.h" #include "random.h" - #include "campaign.h" - #include "dialogue control.h" + #include "Campaign.h" + #include "Dialogue Control.h" #include "Map Screen Interface.h" - #include "Message.h" + #include "message.h" #include "Game Clock.h" #include "Strategic Mines.h" #include "Strategic Status.h" @@ -22,7 +22,7 @@ #include "Interface.h" #include "Game Event Hook.h" #include "Overhead.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Quests.h" #include "Squads.h" #include "Soldier macros.h" diff --git a/Tactical/Civ Quotes.cpp b/Tactical/Civ Quotes.cpp index 4bcf45e3..12965cf1 100644 --- a/Tactical/Civ Quotes.cpp +++ b/Tactical/Civ Quotes.cpp @@ -1,34 +1,34 @@ #include "builddefines.h" #include -#include "Types.h" -#include "civ quotes.h" +#include "types.h" +#include "Civ Quotes.h" #include "mousesystem.h" #include "strategicmap.h" #include "WCheck.h" #include "FileMan.h" -#include "encrypted file.h" +#include "Encrypted File.h" #include "MessageBoxScreen.h" #include "Queen Command.h" #include "Overhead.h" -#include "render dirty.h" -#include "merctextbox.h" +#include "Render Dirty.h" +#include "MercTextBox.h" #include "ai.h" #include "Text.h" #include "screenids.h" #include "Animation Data.h" -#include "Video.h" +#include "video.h" #include "Font Control.h" #include "message.h" #include "local.h" #include "renderworld.h" #include "Interface.h" -#include "cursors.h" +#include "Cursors.h" #include "Dialogue Control.h" #include "Quests.h" #include "Strategic Town Loyalty.h" #include "NPC.h" #include "Strategic Mines.h" -#include "Random.h" +#include "random.h" #include "connect.h" // for enemy taunts diff --git a/Tactical/Dialogue Control.cpp b/Tactical/Dialogue Control.cpp index 10fa1d9c..224fe5c4 100644 --- a/Tactical/Dialogue Control.cpp +++ b/Tactical/Dialogue Control.cpp @@ -1,54 +1,54 @@ #include "sgp.h" - //#include "soldier control.h" + //#include "Soldier Control.h" #include "Encrypted File.h" #include "faces.h" - #include "wcheck.h" - #include "gap.h" - #include "overhead.h" + #include "WCheck.h" + #include "GAP.H" + #include "Overhead.h" #include "Sound Control.h" - #include "dialogue control.h" - #include "Message.h" - #include "render dirty.h" - #include "soldier profile.h" - #include "wordwrap.h" + #include "Dialogue Control.h" + #include "message.h" + #include "Render Dirty.h" + #include "Soldier Profile.h" + #include "WordWrap.h" #include "sysutil.h" #include "vobject_blitters.h" #include "AimMembers.h" #include "mercs.h" - #include "interface dialogue.h" - #include "merctextbox.h" + #include "interface Dialogue.h" + #include "MercTextBox.h" #include "renderworld.h" - #include "soldier macros.h" - #include "squads.h" + #include "Soldier macros.h" + #include "Squads.h" #include "screenids.h" - #include "interface utils.h" + #include "Interface Utils.h" #include "strategicmap.h" #include "PreBattle Interface.h" #include "Game Clock.h" #include "Quests.h" - #include "cursors.h" + #include "Cursors.h" #include "gamescreen.h" - #include "Random.h" + #include "random.h" #include "Map Screen Helicopter.h" #include "GameSettings.h" #include "ShopKeeper Interface.h" #include "Map Screen Interface.h" - #include "text.h" + #include "Text.h" #include "Merc Contract.h" #include "Town Militia.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "SkillCheck.h" #include "Interface Control.h" #include "finances.h" - #include "civ quotes.h" + #include "Civ Quotes.h" #include "Map Screen Interface Map.h" #include "opplist.h" #include "ai.h" #include "worldman.h" #include "Map Screen Interface Bottom.h" #include "Campaign.h" - #include "end game.h" - #include "los.h" + #include "End Game.h" + #include "LOS.h" #include "qarray.h" #include "Soldier Profile.h" #include diff --git a/Tactical/Disease.h b/Tactical/Disease.h index 3da6349c..15949f8b 100644 --- a/Tactical/Disease.h +++ b/Tactical/Disease.h @@ -6,7 +6,7 @@ * @author Flugente (bears-pit.com) */ -#include "Types.h" +#include "types.h" // number of different diseases. Altering this will alter the size of INT32 sDiseasePoints[NUM_DISEASES]; in SOLDIERTYPE #define NUM_DISEASES 20 diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index b4324511..d27d7949 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -1,21 +1,21 @@ #include "builddefines.h" -#include "Types.h" +#include "types.h" #include "Isometric Utils.h" //#include "Soldier Control.h" #include "Overhead.h" -#include "displaycover.h" +#include "DisplayCover.h" #include "Font Control.h" #include "_Ja25EnglishText.h" #include "message.h" #include "GameSettings.h" #include "renderworld.h" #include "Interface.h" -#include "Debug.h" +#include "DEBUG.H" #include "PATHAI.H" #include "worldman.h" #include "opplist.h" -#include "los.h" -#include "weapons.h" +#include "LOS.h" +#include "Weapons.h" #include "Game Clock.h" #include "Animation Control.h" #include "lighting.h" diff --git a/Tactical/Drugs And Alcohol.cpp b/Tactical/Drugs And Alcohol.cpp index 0c7c281c..e5119de4 100644 --- a/Tactical/Drugs And Alcohol.cpp +++ b/Tactical/Drugs And Alcohol.cpp @@ -1,17 +1,17 @@ #include "sgp.h" - #include "soldier control.h" - #include "soldier profile.h" - #include "drugs and alcohol.h" - #include "items.h" - #include "morale.h" - #include "points.h" + #include "Soldier Control.h" + #include "Soldier Profile.h" + #include "Drugs And Alcohol.h" + #include "Items.h" + #include "Morale.h" + #include "Points.h" #include "message.h" #include "GameSettings.h" // SANDRO - had to add this, dammit! - #include "Random.h" + #include "random.h" #include "Text.h" #include "Interface.h" #include "Food.h" // added by Flugente - #include "Animation data.h" // added by Flugente for SoldierBodyTypes + #include "Animation Data.h" // added by Flugente for SoldierBodyTypes #include "CampaignStats.h" // added by Flugente #include "DynamicDialogue.h"// added by Flugente diff --git a/Tactical/DynamicDialogue.h b/Tactical/DynamicDialogue.h index 2eca4b6b..57c57a9a 100644 --- a/Tactical/DynamicDialogue.h +++ b/Tactical/DynamicDialogue.h @@ -7,7 +7,7 @@ * @brief This file contains declarations of classes and functions used for dynamic dialogue */ -#include "Types.h" +#include "types.h" #include "Soldier Control.h" // Flugente: calculate A's opinion of B diff --git a/Tactical/End Game.cpp b/Tactical/End Game.cpp index 95d86d98..ee6eda90 100644 --- a/Tactical/End Game.cpp +++ b/Tactical/End Game.cpp @@ -1,14 +1,14 @@ #include "Overhead.h" #include "Render Fun.h" - #include "Random.h" - #include "Worldman.h" + #include "random.h" + #include "worldman.h" #include "Soldier Profile.h" #include "NPC.h" #include "ai.h" #include "Dialogue Control.h" #include "Handle UI.h" - #include "end game.h" + #include "End Game.h" #include "Intro.h" #include "Exit Grids.h" #include "strategicmap.h" @@ -20,7 +20,7 @@ #include "Music Control.h" #include "Soldier macros.h" #include "qarray.h" - #include "los.h" + #include "LOS.h" #include "Strategic AI.h" #include "Squads.h" #include "PreBattle Interface.h" diff --git a/Tactical/Enemy Soldier Save.cpp b/Tactical/Enemy Soldier Save.cpp index 0d11d98a..09c4c2fd 100644 --- a/Tactical/Enemy Soldier Save.cpp +++ b/Tactical/Enemy Soldier Save.cpp @@ -6,19 +6,19 @@ #include "types.h" #include "strategicmap.h" - #include "overhead.h" - #include "isometric utils.h" + #include "Overhead.h" + #include "Isometric Utils.h" - #include "soldier add.h" - #include "soldier create.h" + #include "Soldier Add.h" + #include "Soldier Create.h" #include "Soldier Init List.h" - #include "debug.h" - #include "Random.h" - #include "items.h" + #include "DEBUG.H" + #include "random.h" + #include "Items.h" #include "Map Information.h" - #include "soldier profile.h" + #include "Soldier Profile.h" #include "EditorMercs.h" #include "Animation Data.h" #include "message.h" diff --git a/Tactical/EnemyItemDrops.cpp b/Tactical/EnemyItemDrops.cpp index 0d720289..fdda9f4a 100644 --- a/Tactical/EnemyItemDrops.cpp +++ b/Tactical/EnemyItemDrops.cpp @@ -1,5 +1,5 @@ - #include "Types.h" - #include "DEbug.h" + #include "types.h" + #include "DEBUG.H" #include "EnemyItemDrops.h" WEAPON_DROPS gEnemyWeaponDrops[MAX_DROP_ITEMS]; diff --git a/Tactical/Faces.cpp b/Tactical/Faces.cpp index 6eaa12e8..cd6e505a 100644 --- a/Tactical/Faces.cpp +++ b/Tactical/Faces.cpp @@ -8,30 +8,30 @@ #include "vsurface.h" #include "Render Dirty.h" #include "sysutil.h" - #include "wcheck.h" + #include "WCheck.h" #include "video.h" #include "vobject_blitters.h" #include "faces.h" - #include "utilities.h" - #include "overhead.h" - #include "gap.h" + #include "Utilities.h" + #include "Overhead.h" + #include "GAP.H" #include "Soldier Profile.h" #include "Sound Control.h" - #include "teamturns.h" - #include "soldier macros.h" - #include "dialogue control.h" - #include "font control.h" + #include "TeamTurns.h" + #include "Soldier macros.h" + #include "Dialogue Control.h" + #include "Font Control.h" #include "Assignments.h" - #include "Random.h" + #include "random.h" #include "line.h" #include "GameSettings.h" - #include "squads.h" - #include "interface.h" + #include "Squads.h" + #include "Interface.h" #include "Quests.h" - #include "animation control.h" - #include "drugs and alcohol.h" + #include "Animation Control.h" + #include "Drugs And Alcohol.h" #include "Interface Items.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Map Screen Interface.h" // HEADROCK HAM 3.2: Added two includes so that a function can read values of the Gun Range/hospital location #include "Campaign Types.h" diff --git a/Tactical/Food.cpp b/Tactical/Food.cpp index 872a4958..70bbb298 100644 --- a/Tactical/Food.cpp +++ b/Tactical/Food.cpp @@ -1,13 +1,13 @@ #include #include "sgp.h" - #include "soldier profile.h" + #include "Soldier Profile.h" #include "Food.h" - #include "items.h" - #include "morale.h" - #include "points.h" + #include "Items.h" + #include "Morale.h" + #include "Points.h" #include "message.h" #include "GameSettings.h" // SANDRO - had to add this, dammit! - #include "Random.h" + #include "random.h" #include "Text.h" #include "Interface.h" #include "Dialogue Control.h" diff --git a/Tactical/GAP.cpp b/Tactical/GAP.cpp index 5478734a..efb7271e 100644 --- a/Tactical/GAP.cpp +++ b/Tactical/GAP.cpp @@ -1,8 +1,8 @@ #include "builddefines.h" - #include "debug.h" + #include "DEBUG.H" #include "types.h" //#include "mssw.h" - #include "gap.h" + #include "GAP.H" #include "Sound Control.h" #include "soundman.h" #include diff --git a/Tactical/Handle Doors.cpp b/Tactical/Handle Doors.cpp index ba62ff48..dd018bd5 100644 --- a/Tactical/Handle Doors.cpp +++ b/Tactical/Handle Doors.cpp @@ -7,17 +7,17 @@ #include "renderworld.h" #include "structure.h" #include "Animation Control.h" - #include "points.h" + #include "Points.h" #include "opplist.h" - #include "overhead.h" - #include "tile animation.h" + #include "Overhead.h" + #include "Tile Animation.h" #include "Interactive Tiles.h" - #include "handle doors.h" + #include "Handle Doors.h" #include "Sound Control.h" - #include "interface.h" - #include "keys.h" + #include "Interface.h" + #include "Keys.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "random.h" #include "SkillCheck.h" #include "Dialogue Control.h" diff --git a/Tactical/Handle Items.cpp b/Tactical/Handle Items.cpp index b7d9414b..90bfba9f 100644 --- a/Tactical/Handle Items.cpp +++ b/Tactical/Handle Items.cpp @@ -1,66 +1,66 @@ #include "connect.h" - #include "items.h" + #include "Items.h" #include "Action Items.h" #include "handle Items.h" - #include "overhead.h" - #include "weapons.h" - #include "points.h" + #include "Overhead.h" + #include "Weapons.h" + #include "Points.h" #include "tiledef.h" #include "worlddef.h" #include "worldman.h" - #include "interface.h" + #include "Interface.h" #include "renderworld.h" #include "Animation Control.h" - #include "font control.h" - #include "render dirty.h" + #include "Font Control.h" + #include "Render Dirty.h" #include "World items.h" - #include "text.h" + #include "Text.h" #include "Timer Control.h" - #include "wcheck.h" - #include "interface items.h" + #include "WCheck.h" + #include "Interface Items.h" #include "physics.h" - #include "soldier profile.h" - #include "interface dialogue.h" - #include "quests.h" + #include "Soldier Profile.h" + #include "interface Dialogue.h" + #include "Quests.h" #include "message.h" - #include "isometric utils.h" - #include "los.h" - #include "dialogue control.h" + #include "Isometric Utils.h" + #include "LOS.h" + #include "Dialogue Control.h" #include "ai.h" - #include "soldier macros.h" - #include "interface panels.h" + #include "Soldier macros.h" + #include "Interface Panels.h" #include "Strategic Town Loyalty.h" - #include "soldier functions.h" + #include "Soldier Functions.h" #include "Map Screen Helicopter.h" - #include "pathai.h" + #include "PATHAI.H" #include "fov.h" #include "MessageBoxScreen.h" - #include "explosion control.h" + #include "Explosion Control.h" #include "SkillCheck.h" #include "Campaign.h" - #include "Random.h" - #include "structure wrap.h" - #include "interactive tiles.h" + #include "random.h" + #include "Structure Wrap.h" + #include "Interactive Tiles.h" #include "SaveLoadMap.h" #include "ShopKeeper Interface.h" #include "Arms Dealer Init.h" - #include "soldier add.h" + #include "Soldier Add.h" #include "Sound Control.h" - #include "squads.h" - #include "rotting corpses.h" - #include "soldier ani.h" - #include "Opplist.h" + #include "Squads.h" + #include "Rotting Corpses.h" + #include "Soldier Ani.h" + #include "opplist.h" #include "qarray.h" - #include "render fun.h" + #include "Render Fun.h" #include "Map Information.h" #include "GameSettings.h" - #include "end game.h" - #include "interface control.h" + #include "End Game.h" + #include "Interface Control.h" #include "Map Screen Interface Map Inventory.h" // added by SANDRO #include "Morale.h" // added by Flugente - #include "drugs and alcohol.h" + #include "Drugs And Alcohol.h" #include "Food.h" // added by sevenfm - this is needed for _keydown(SHIFT) to work #include "english.h" diff --git a/Tactical/Handle UI Plan.cpp b/Tactical/Handle UI Plan.cpp index fbaac284..6dc32608 100644 --- a/Tactical/Handle UI Plan.cpp +++ b/Tactical/Handle UI Plan.cpp @@ -1,15 +1,15 @@ #include "Handle UI Plan.h" - #include "overhead.h" + #include "Overhead.h" #include "Isometric Utils.h" - #include "pathai.h" + #include "PATHAI.H" #include "Handle UI.h" - #include "points.h" - #include "weapons.h" + #include "Points.h" + #include "Weapons.h" #include "renderworld.h" #include "Animation Control.h" #include "message.h" - #include "soldier create.h" - #include "interface.h" + #include "Soldier Create.h" + #include "Interface.h" UINT8 gubNumUIPlannedMoves = 0; SOLDIERTYPE *gpUIPlannedSoldier = NULL; diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 75733b2b..2c24e53b 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -3,77 +3,77 @@ #include #include #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "math.h" #include "jascreens.h" -#include "pathai.h" +#include "PATHAI.H" #include "Soldier Control.h" #include "Animation Control.h" #include "Animation Data.h" #include "Event Pump.h" #include "Timer Control.h" #include "mousesystem.h" -#include "cursors.h" +#include "Cursors.h" #include "Handle UI.h" #include "Isometric Utils.h" #include "input.h" -#include "overhead.h" +#include "Overhead.h" #include "Sys Globals.h" #include "screenids.h" -#include "interface.h" -#include "cursor control.h" -#include "points.h" +#include "Interface.h" +#include "Cursor Control.h" +#include "Points.h" #include "Interactive Tiles.h" -#include "interface cursors.h" +#include "Interface Cursors.h" #include "opplist.h" #include "worldman.h" -#include "weapons.h" +#include "Weapons.h" #include "renderworld.h" #include "structure.h" -#include "interface panels.h" -#include "weapons.h" +#include "Interface Panels.h" +#include "Weapons.h" #include "Handle items.h" -#include "UI cursors.h" -#include "Handle UI plan.h" -#include "Message.h" -#include "Render fun.h" -#include "interface items.h" +#include "UI Cursors.h" +#include "Handle UI Plan.h" +#include "message.h" +#include "Render Fun.h" +#include "Interface Items.h" #include "physics.h" #include "Soldier Profile.h" #include "strategicmap.h" -#include "soldier profile.h" -#include "soldier create.h" -#include "soldier add.h" -#include "interface dialogue.h" -#include "soldier macros.h" -#include "soldier functions.h" +#include "Soldier Profile.h" +#include "Soldier Create.h" +#include "Soldier Add.h" +#include "interface Dialogue.h" +#include "Soldier macros.h" +#include "Soldier Functions.h" #include "Assignments.h" -#include "squads.h" +#include "Squads.h" #include "Strategic Pathing.h" -#include "strategic movement.h" +#include "Strategic Movement.h" #include "strategic.h" -#include "exit grids.h" -#include "structure wrap.h" -#include "soldier add.h" -#include "Random.h" +#include "Exit Grids.h" +#include "Structure Wrap.h" +#include "Soldier Add.h" +#include "random.h" #include "english.h" -#include "Random.h" +#include "random.h" #include "english.h" -#include "vehicles.h" -#include "messageboxscreen.h" -#include "text.h" -#include "dialogue control.h" +#include "Vehicles.h" +#include "MessageBoxScreen.h" +#include "Text.h" +#include "Dialogue Control.h" #include "line.h" #include "GameSettings.h" -#include "los.h" +#include "LOS.h" #include "Campaign Types.h" #include "Queen Command.h" #include "Options Screen.h" #include "SaveLoadGame.h" -#include "Spread Burst.h" +#include "Spread burst.h" #include "ai.h" #include "Game Clock.h" -#include "civ quotes.h" +#include "Civ Quotes.h" #include "Militia Control.h" #include "qarray.h" #include "environment.h" @@ -82,7 +82,7 @@ #include "DisplayCover.h" #include "english.h" // sevenfm: this is needed for _keydown(SHIFT) to work -#include "teamturns.h" +#include "TeamTurns.h" #include "Options Screen.h" #include "SaveLoadScreen.h" #include "Map Screen Interface.h" // added by Flugente for SquadNames diff --git a/Tactical/Interface Control.cpp b/Tactical/Interface Control.cpp index 343be7a7..a34e89b6 100644 --- a/Tactical/Interface Control.cpp +++ b/Tactical/Interface Control.cpp @@ -6,43 +6,43 @@ #include "himage.h" #include "vobject.h" #include "sysutil.h" - #include "overhead.h" + #include "Overhead.h" #include "mousesystem.h" #include "Button System.h" - #include "interface.h" + #include "Interface.h" #include "vsurface.h" #include "input.h" #include "Handle UI.h" #include "Animation Control.h" #include "Animation Data.h" #include "renderworld.h" - #include "cursors.h" - #include "radar screen.h" + #include "Cursors.h" + #include "Radar Screen.h" #include "worldman.h" #include "Font Control.h" - #include "render dirty.h" - #include "utilities.h" - #include "interface cursors.h" + #include "Render Dirty.h" + #include "Utilities.h" + #include "Interface Cursors.h" #include "lighting.h" #include "Interface Panels.h" - #include "pathai.h" + #include "PATHAI.H" #include "vobject_blitters.h" #include "faces.h" #include "Handle UI Plan.h" - #include "interface control.h" - #include "interface items.h" - #include "interface dialogue.h" - #include "interactive tiles.h" + #include "Interface Control.h" + #include "Interface Items.h" + #include "interface Dialogue.h" + #include "Interactive Tiles.h" #include "Game Clock.h" #include "Strategic Exit GUI.h" #include "PopUpBox.h" #include "Assignments.h" - #include "spread burst.h" - #include "squads.h" + #include "Spread burst.h" + #include "Squads.h" #include "line.h" #include "Militia Control.h" #include "Map Screen Interface.h" - #include "civ quotes.h" + #include "Civ Quotes.h" #include "GameSettings.h" #include "Explosion Control.h" // added by Flugente diff --git a/Tactical/Interface Cursors.cpp b/Tactical/Interface Cursors.cpp index aaae395b..4573e139 100644 --- a/Tactical/Interface Cursors.cpp +++ b/Tactical/Interface Cursors.cpp @@ -5,16 +5,16 @@ #include "vsurface.h" #include "input.h" #include "Handle UI.h" - #include "cursors.h" + #include "Cursors.h" #include "worlddef.h" #include "worldman.h" #include "Interface Cursors.h" - #include "interface.h" - #include "Isometric utils.h" - #include "cursors.h" - #include "sys globals.h" - #include "overhead.h" - #include "interface items.h" + #include "Interface.h" + #include "Isometric Utils.h" + #include "Cursors.h" + #include "Sys Globals.h" + #include "Overhead.h" + #include "Interface Items.h" #include "GameSettings.h" #define DISPLAY_AP_INDEX MOCKFLOOR1 diff --git a/Tactical/Interface Dialogue.cpp b/Tactical/Interface Dialogue.cpp index d9cc75fd..19e575a5 100644 --- a/Tactical/Interface Dialogue.cpp +++ b/Tactical/Interface Dialogue.cpp @@ -3,57 +3,57 @@ #include "sgp.h" #include "Encrypted File.h" #include "faces.h" - #include "wcheck.h" - #include "soldier profile.h" - #include "wordwrap.h" + #include "WCheck.h" + #include "Soldier Profile.h" + #include "WordWrap.h" #include "sysutil.h" #include "vobject_blitters.h" - #include "interface dialogue.h" - #include "font control.h" - #include "dialogue control.h" + #include "interface Dialogue.h" + #include "Font Control.h" + #include "Dialogue Control.h" #include "renderworld.h" - #include "npc.h" - #include "interface dialogue.h" - #include "merctextbox.h" + #include "NPC.h" + #include "interface Dialogue.h" + #include "MercTextBox.h" #include "message.h" - #include "items.h" - #include "text.h" - #include "overhead.h" - #include "assignments.h" + #include "Items.h" + #include "Text.h" + #include "Overhead.h" + #include "Assignments.h" #include "strategic.h" #include "strategicmap.h" #include "gamescreen.h" #include "ai.h" - #include "aiinternals.h" - #include "interactive tiles.h" - #include "soldier profile.h" - #include "interface panels.h" - #include "quests.h" - #include "squads.h" - #include "game event hook.h" - #include "game clock.h" + #include "AIInternals.h" + #include "Interactive Tiles.h" + #include "Soldier Profile.h" + #include "Interface Panels.h" + #include "Quests.h" + #include "Squads.h" + #include "Game Event Hook.h" + #include "Game Clock.h" #include "MessageBoxScreen.h" #include "Tactical Save.h" - #include "interface control.h" - #include "cursors.h" - #include "fade screen.h" + #include "Interface Control.h" + #include "Cursors.h" + #include "Fade Screen.h" #include "gameloop.h" #include "finances.h" - #include "saveloadmap.h" + #include "SaveLoadMap.h" #include "Arms Dealer Init.h" #include "ShopKeeper Interface.h" #include "Strategic Town Loyalty.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "GameSettings.h" #include "Strategic Mines.h" #include "Boxing.h" #include "Items.h" - #include "WorldMan.h" + #include "worldman.h" #include "Render Fun.h" // including this for Strategic AI.h #include "Strategic Movement.h" #include "Strategic AI.h" - #include "Soldier create.h" + #include "Soldier Create.h" #include "SkillCheck.h" #include "Sound Control.h" #include "opplist.h" @@ -66,7 +66,7 @@ #include "Queen Command.h" #include "Campaign.h" #include "BobbyRMailOrder.h" - #include "end game.h" + #include "End Game.h" #include "Map Screen Helicopter.h" #include "Cheats.h" #include "Overhead.h" diff --git a/Tactical/Interface Enhanced.cpp b/Tactical/Interface Enhanced.cpp index 85b1d188..22cfe29e 100644 --- a/Tactical/Interface Enhanced.cpp +++ b/Tactical/Interface Enhanced.cpp @@ -6,50 +6,50 @@ #include "himage.h" #include "vobject.h" #include "sysutil.h" - #include "overhead.h" + #include "Overhead.h" #include "mousesystem.h" #include "Button System.h" - #include "interface.h" + #include "Interface.h" #include "vsurface.h" - #include "wcheck.h" + #include "WCheck.h" #include "input.h" #include "Handle UI.h" #include "renderworld.h" #include "Font Control.h" - #include "utilities.h" + #include "Utilities.h" #include "Interface Panels.h" #include "Animation Control.h" #include "Soldier Control.h" - #include "weapons.h" + #include "Weapons.h" #include "lighting.h" #include "faces.h" #include "mapscreen.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "Interface Items.h" #include "Font Control.h" #include "Cursor Control.h" - #include "interface utils.h" - #include "interface items.h" - #include "wordwrap.h" + #include "Interface Utils.h" + #include "Interface Items.h" + #include "WordWrap.h" #include "vobject_blitters.h" #include "world items.h" - #include "points.h" + #include "Points.h" #include "physics.h" - #include "handle ui.h" + #include "Handle UI.h" #include "ShopKeeper Interface.h" #include "english.h" - #include "keys.h" - #include "Strategicmap.h" - #include "soldier macros.h" - #include "squads.h" + #include "Keys.h" + #include "strategicmap.h" + #include "Soldier macros.h" + #include "Squads.h" #include "MessageBoxScreen.h" #include "GameSettings.h" #include "Map Screen Interface Map Inventory.h" #include "Quests.h" #include "Map Screen Interface.h" #include "Campaign Types.h" - #include "los.h" + #include "LOS.h" #include "Map Screen Interface Map.h" #include "Food.h" // added by Flugente diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index 62dc9fa9..561bcee3 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -8,54 +8,54 @@ #include "himage.h" #include "vobject.h" #include "sysutil.h" - #include "overhead.h" + #include "Overhead.h" #include "mousesystem.h" #include "Button System.h" - #include "interface.h" + #include "Interface.h" #include "vsurface.h" - #include "wcheck.h" + #include "WCheck.h" #include "input.h" #include "Handle UI.h" #include "renderworld.h" - #include "sys globals.h" - #include "cursors.h" - #include "radar screen.h" + #include "Sys Globals.h" + #include "Cursors.h" + #include "Radar Screen.h" #include "Font Control.h" - #include "render dirty.h" - #include "utilities.h" + #include "Render Dirty.h" + #include "Utilities.h" #include "Interface Panels.h" #include "Animation Control.h" #include "Soldier Control.h" - #include "pathai.h" - #include "weapons.h" + #include "PATHAI.H" + #include "Weapons.h" #include "lighting.h" #include "faces.h" #include "mapscreen.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "Interface Items.h" #include "Font Control.h" #include "Cursor Control.h" - #include "interface cursors.h" - #include "interface utils.h" - #include "interface items.h" - #include "wordwrap.h" - #include "interface control.h" + #include "Interface Cursors.h" + #include "Interface Utils.h" + #include "Interface Items.h" + #include "WordWrap.h" + #include "Interface Control.h" #include "vobject_blitters.h" #include "world items.h" - #include "points.h" + #include "Points.h" #include "physics.h" #include "finances.h" - #include "ui cursors.h" - #include "handle ui.h" + #include "UI Cursors.h" + #include "Handle UI.h" #include "ShopKeeper Interface.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "english.h" - #include "keys.h" - #include "Strategicmap.h" - #include "soldier macros.h" - #include "game clock.h" - #include "squads.h" + #include "Keys.h" + #include "strategicmap.h" + #include "Soldier macros.h" + #include "Game Clock.h" + #include "Squads.h" #include "MessageBoxScreen.h" #include "GameSettings.h" #include "Map Screen Interface Map Inventory.h" @@ -63,7 +63,7 @@ #include "Map Screen Interface.h" #include "Campaign Types.h" #include "opplist.h" - #include "los.h" + #include "LOS.h" #include "Map Screen Interface Map.h" #include "Interface Enhanced.h" #include "InterfaceItemImages.h" diff --git a/Tactical/Interface Items.h b/Tactical/Interface Items.h index 607890ff..48953969 100644 --- a/Tactical/Interface Items.h +++ b/Tactical/Interface Items.h @@ -1,7 +1,7 @@ #ifndef __INTERFACE_ITEMS_H #define __INTERFACE_ITEMS_H -#include "items.h" +#include "Items.h" #include "Handle Items.h" #include "popup_class.h" diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index 5eb07868..e3f4c0c3 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -6,42 +6,42 @@ #include "himage.h" #include "vobject.h" #include "sysutil.h" - #include "overhead.h" + #include "Overhead.h" #include "mousesystem.h" #include "Button System.h" - #include "interface.h" + #include "Interface.h" #include "vsurface.h" - #include "wcheck.h" + #include "WCheck.h" #include "input.h" #include "Handle UI.h" #include "renderworld.h" - #include "cursors.h" - #include "radar screen.h" + #include "Cursors.h" + #include "Radar Screen.h" #include "Font Control.h" - #include "render dirty.h" - #include "utilities.h" + #include "Render Dirty.h" + #include "Utilities.h" #include "Sound Control.h" #include "Interface Panels.h" #include "Animation Control.h" #include "Soldier Control.h" - #include "pathai.h" - #include "weapons.h" + #include "PATHAI.H" + #include "Weapons.h" #include "lighting.h" #include "faces.h" #include "mapscreen.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "Interface Items.h" - #include "interface control.h" - #include "interface utils.h" + #include "Interface Control.h" + #include "Interface Utils.h" #include "Game Clock.h" #include "mapscreen.h" - #include "Soldier Macros.h" + #include "Soldier macros.h" #include "strategicmap.h" - #include "soldier functions.h" + #include "Soldier Functions.h" #include "gamescreen.h" #include "Assignments.h" - #include "points.h" + #include "Points.h" #include "Squads.h" #include "strategic.h" #include "Map Screen Interface Map.h" @@ -50,21 +50,21 @@ #include "Options Screen.h" #include "ShopKeeper Interface.h" #include "english.h" - #include "keys.h" + #include "Keys.h" #include "Soldier Add.h" - #include "vehicles.h" - #include "gamesettings.h" - #include "dialogue control.h" + #include "Vehicles.h" + #include "GameSettings.h" + #include "Dialogue Control.h" #include "Items.h" - #include "drugs and alcohol.h" - #include "los.h" + #include "Drugs And Alcohol.h" + #include "LOS.h" #include "opplist.h" #include "vobject_blitters.h" - #include "Finances.h" + #include "finances.h" #include "LaptopSave.h" #include "Cursor Control.h" #include "MessageBoxScreen.h" - #include "wordwrap.h" + #include "WordWrap.h" #include "Boxing.h" #include "personnel.h" // HEADROCK HAM 3.6: This is required for Stat Progress Bars diff --git a/Tactical/Interface Utils.cpp b/Tactical/Interface Utils.cpp index 73519abc..a37f4522 100644 --- a/Tactical/Interface Utils.cpp +++ b/Tactical/Interface Utils.cpp @@ -3,13 +3,13 @@ #include "sgp.h" #include "himage.h" #include "vobject.h" - #include "interface utils.h" - #include "render dirty.h" - #include "interface.h" + #include "Interface Utils.h" + #include "Render Dirty.h" + #include "Interface.h" #include "sysutil.h" #include "faces.h" - #include "render dirty.h" - #include "weapons.h" + #include "Render Dirty.h" + #include "Weapons.h" #include "Overhead.h" #include "Soldier macros.h" #include "line.h" diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 9d0c27db..64881ccc 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -7,56 +7,56 @@ #include "himage.h" #include "vobject.h" #include "sysutil.h" - #include "overhead.h" + #include "Overhead.h" #include "mousesystem.h" #include "Button System.h" - #include "interface.h" + #include "Interface.h" #include "vsurface.h" - #include "wcheck.h" + #include "WCheck.h" #include "input.h" #include "Handle UI.h" #include "Animation Control.h" #include "Animation Data.h" #include "renderworld.h" - #include "sys globals.h" - #include "cursors.h" - #include "radar screen.h" + #include "Sys Globals.h" + #include "Cursors.h" + #include "Radar Screen.h" #include "worldman.h" #include "Font Control.h" - #include "render dirty.h" - #include "utilities.h" - #include "interface cursors.h" + #include "Render Dirty.h" + #include "Utilities.h" + #include "Interface Cursors.h" #include "Sound Control.h" #include "lighting.h" #include "Interface Panels.h" - #include "pathai.h" + #include "PATHAI.H" #include "vobject_blitters.h" #include "faces.h" #include "Handle UI Plan.h" - #include "interface control.h" - #include "interface items.h" - #include "soldier profile.h" + #include "Interface Control.h" + #include "Interface Items.h" + #include "Soldier Profile.h" #include "MercTextBox.h" - #include "soldier functions.h" - #include "cursor control.h" - #include "handle doors.h" - #include "keys.h" - #include "text.h" - #include "points.h" - #include "soldier macros.h" - #include "game clock.h" + #include "Soldier Functions.h" + #include "Cursor Control.h" + #include "Handle Doors.h" + #include "Keys.h" + #include "Text.h" + #include "Points.h" + #include "Soldier macros.h" + #include "Game Clock.h" #include "physics.h" #include "Map Screen Interface Map.h" #include "line.h" #include "Vehicles.h" - #include "messageboxscreen.h" - #include "gamesettings.h" + #include "MessageBoxScreen.h" + #include "GameSettings.h" #include "Squads.h" #include "message.h" #include "strategicmap.h" #include "Queen Command.h" // HEADROCK HAM 4: Included for new CTH indicator - #include "weapons.h" + #include "Weapons.h" #include "Map Screen Interface.h" // added by Flugente for SquadNames #include "environment.h" #include "SkillCheck.h" // added by Flugente diff --git a/Tactical/Interface.h b/Tactical/Interface.h index 18f4bd33..ea13f36b 100644 --- a/Tactical/Interface.h +++ b/Tactical/Interface.h @@ -1,7 +1,7 @@ #ifndef _INTERFACE_H #define _INTERFACE_H -#include "handle UI.h" +#include "Handle UI.h" #include "mousesystem.h" #include "structure.h" #include "Assignments.h" // added by Flugente for the stat-enums diff --git a/Tactical/InterfaceItemImages.cpp b/Tactical/InterfaceItemImages.cpp index 2bed22b9..679eed22 100644 --- a/Tactical/InterfaceItemImages.cpp +++ b/Tactical/InterfaceItemImages.cpp @@ -2,7 +2,7 @@ #include "DEBUG.H" #include "vobject.h" -#include "utilities.h" +#include "Utilities.h" #include "GameSettings.h" #include diff --git a/Tactical/InterfaceItemImages.h b/Tactical/InterfaceItemImages.h index 635a3105..2c6eb395 100644 --- a/Tactical/InterfaceItemImages.h +++ b/Tactical/InterfaceItemImages.h @@ -1,7 +1,7 @@ #ifndef _ITERFACEITEMIMAGES_H_ #define _ITERFACEITEMIMAGES_H_ -#include "Types.h" +#include "types.h" #include #include #include diff --git a/Tactical/Inventory Choosing.cpp b/Tactical/Inventory Choosing.cpp index 72bfa796..060f9d22 100644 --- a/Tactical/Inventory Choosing.cpp +++ b/Tactical/Inventory Choosing.cpp @@ -1,8 +1,8 @@ #include #include "Inventory Choosing.h" - #include "animation data.h" + #include "Animation Data.h" #include "Items.h" - #include "Random.h" + #include "random.h" #include "Weapons.h" #include "Strategic Status.h" #include "Campaign.h" diff --git a/Tactical/Item Types.cpp b/Tactical/Item Types.cpp index b80888d0..5a4fed34 100644 --- a/Tactical/Item Types.cpp +++ b/Tactical/Item Types.cpp @@ -1,13 +1,13 @@ #include "Item Types.h" -#include "Debug.h" +#include "DEBUG.H" #include "Items.h" #include "GameSettings.h" #include "screenids.h" #include "Action Items.h" // added by Flugente for the ACTION_ITEM_BLOW_UP value -#include "Random.h" // added by Flugente -#include "Message.h" // added by BOB for missing LBE info messages -#include "overhead.h" // added by BOB for missing LBE info messages +#include "random.h" // added by Flugente +#include "message.h" // added by BOB for missing LBE info messages +#include "Overhead.h" // added by BOB for missing LBE info messages #include "Map Screen Interface.h" // added by BOB for missing LBE info messages diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 61f51e32..74dd2e79 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -1,28 +1,28 @@ - #include "items.h" + #include "Items.h" #include "Action Items.h" - #include "weapons.h" + #include "Weapons.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Handle UI.h" #include "Animation Control.h" - #include "points.h" + #include "Points.h" #include "Sound Control.h" #include "Isometric Utils.h" #include "Animation Data.h" - #include "Random.h" + #include "random.h" #include "Campaign.h" - #include "interface.h" - #include "interface panels.h" - #include "explosion control.h" + #include "Interface.h" + #include "Interface Panels.h" + #include "Explosion Control.h" #include "Keys.h" #include "faces.h" - #include "wcheck.h" - #include "soldier profile.h" + #include "WCheck.h" + #include "Soldier Profile.h" #include "SkillCheck.h" - #include "los.h" + #include "LOS.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "fov.h" #include "MessageBoxScreen.h" @@ -41,16 +41,16 @@ #include "Soldier macros.h" #include "Smell.h" #include "lighting.h" - #include "utilities.h" + #include "Utilities.h" #include "english.h" - #include "debug control.h" + #include "Debug Control.h" #include "math.h" // THE_BOB : added for pocket popup definitions #include #include "popup_definition.h" - #include "drugs and alcohol.h" + #include "Drugs And Alcohol.h" #include "Food.h" #include "opplist.h" #include "Sys Globals.h"//dnl ch74 201013 diff --git a/Tactical/Ja25_Tactical.cpp b/Tactical/Ja25_Tactical.cpp index 28ee41e2..e77b35f2 100644 --- a/Tactical/Ja25_Tactical.cpp +++ b/Tactical/Ja25_Tactical.cpp @@ -1,21 +1,21 @@ - #include "items.h" - #include "weapons.h" + #include "Items.h" + #include "Weapons.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Handle UI.h" #include "Animation Control.h" #include "Isometric Utils.h" #include "Animation Data.h" - #include "Random.h" + #include "random.h" #include "Campaign.h" - #include "interface.h" + #include "Interface.h" #include "Keys.h" - #include "soldier profile.h" + #include "Soldier Profile.h" #include "SkillCheck.h" - #include "los.h" + #include "LOS.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "MessageBoxScreen.h" @@ -30,9 +30,9 @@ #include "Soldier macros.h" #include "Smell.h" #include "lighting.h" - #include "utilities.h" + #include "Utilities.h" #include "english.h" - #include "debug control.h" + #include "Debug Control.h" #ifdef JA2UB #include "worldman.h" diff --git a/Tactical/Keys.cpp b/Tactical/Keys.cpp index b8dc66e4..0c489d7a 100644 --- a/Tactical/Keys.cpp +++ b/Tactical/Keys.cpp @@ -5,35 +5,35 @@ #include "types.h" #include "Keys.h" - #include "debug.h" + #include "DEBUG.H" #include "Smoothing Utils.h" #include "SkillCheck.h" #include "opplist.h" - #include "items.h" - #include "weapons.h" + #include "Items.h" + #include "Weapons.h" #include "ai.h" #include "message.h" - #include "text.h" - #include "explosion control.h" - #include "isometric utils.h" - #include "StrategicMap.h" + #include "Text.h" + #include "Explosion Control.h" + #include "Isometric Utils.h" + #include "strategicmap.h" #include "Tactical Save.h" #include "Campaign Types.h" - #include "los.h" + #include "LOS.h" #include "opplist.h" - #include "tiledat.h" - #include "overhead.h" + #include "TileDat.h" + #include "Overhead.h" #include "structure.h" #include "renderworld.h" #include "worldman.h" - #include "wcheck.h" + #include "WCheck.h" #include "random.h" #include "worlddef.h" - #include "campaign.h" + #include "Campaign.h" #include "Sound Control.h" #include "Interface.h" #include "Game Clock.h" - #include "handle doors.h" + #include "Handle Doors.h" #include "Map Screen Interface.h" #include "GameSettings.h" // added by SANDRO #include "Dialogue Control.h" // added by Flugente diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 6d674b55..2821976f 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -4,41 +4,41 @@ #include #include -#include "wcheck.h" +#include "WCheck.h" #include "Isometric Utils.h" -#include "debug.h" -#include "los.h" -#include "animation control.h" -#include "Random.h" -//#include "soldier control.h" +#include "DEBUG.H" +#include "LOS.h" +#include "Animation Control.h" +#include "random.h" +//#include "Soldier Control.h" #include "Event Pump.h" -#include "overhead.h" -#include "weapons.h" +#include "Overhead.h" +#include "Weapons.h" #include "opplist.h" -#include "bullets.h" +#include "Bullets.h" #include "lighting.h" #include "phys math.h" -#include "items.h" +#include "Items.h" #include "Soldier Profile.h" #include "worldman.h" -#include "rotting corpses.h" +#include "Rotting Corpses.h" #include "GameSettings.h" -#include "keys.h" +#include "Keys.h" #include "message.h" #include "Structure Wrap.h" -#include "campaign.h" +#include "Campaign.h" #include "environment.h" -#include "Pathai.h" +#include "PATHAI.H" #include "Soldier macros.h" #include "strategicmap.h" #include "Interface.h" -#include "points.h" +#include "Points.h" #include "Smell.h" #include "Text.h" #include "Quests.h" -#include "items.h" +#include "Items.h" #include "Item Types.h" #include "Vehicles.h" #include "fresh_header.h" diff --git a/Tactical/LogicalBodyTypes/AbstractXMLLoader.h b/Tactical/LogicalBodyTypes/AbstractXMLLoader.h index 20749ba0..e96f666d 100644 --- a/Tactical/LogicalBodyTypes/AbstractXMLLoader.h +++ b/Tactical/LogicalBodyTypes/AbstractXMLLoader.h @@ -6,7 +6,7 @@ #include #include #include "expat.h" -#include "Types.h" +#include "types.h" #include "XML.h" #include "TopicIDs.h" #include "TopicOps.h" diff --git a/Tactical/LogicalBodyTypes/PaletteTable.h b/Tactical/LogicalBodyTypes/PaletteTable.h index 0c2141e8..e8eef780 100644 --- a/Tactical/LogicalBodyTypes/PaletteTable.h +++ b/Tactical/LogicalBodyTypes/PaletteTable.h @@ -3,7 +3,7 @@ #ifndef _LBT_PALETTETABLE__H_ #define _LBT_PALETTETABLE__H_ -#include "soldier control.h" +#include "Soldier Control.h" #include "Utilities.h" #include "lighting.h" diff --git a/Tactical/Map Information.cpp b/Tactical/Map Information.cpp index 0ff75813..c1457d70 100644 --- a/Tactical/Map Information.cpp +++ b/Tactical/Map Information.cpp @@ -1,9 +1,9 @@ #include - #include "fileMan.h" + #include "FileMan.h" #include "types.h" #include "Map Information.h" #include "Soldier Init List.h" - #include "Random.h" + #include "random.h" #include "worlddef.h" #include "renderworld.h" #include "EditorMercs.h" @@ -12,7 +12,7 @@ #include "Animation Data.h" #include "Road Smoothing.h" #include "message.h" - #include "weapons.h" + #include "Weapons.h" #include "environment.h" #include "lighting.h" #include "Animated ProgressBar.h" diff --git a/Tactical/Merc Entering.cpp b/Tactical/Merc Entering.cpp index eacb0f7c..003052e2 100644 --- a/Tactical/Merc Entering.cpp +++ b/Tactical/Merc Entering.cpp @@ -2,35 +2,35 @@ #include #include #include "stdlib.h" - #include "debug.h" - //#include "soldier control.h" + #include "DEBUG.H" + //#include "Soldier Control.h" // HEADROCK HAM 3.5: Strange that this wasn't included. #include "GameSettings.h" - #include "weapons.h" + #include "Weapons.h" #include "handle items.h" #include "worlddef.h" - #include "rotting corpses.h" - #include "tile cache.h" - #include "isometric utils.h" - #include "animation control.h" - #include "utilities.h" - #include "game clock.h" - #include "soldier create.h" + #include "Rotting Corpses.h" + #include "Tile Cache.h" + #include "Isometric Utils.h" + #include "Animation Control.h" + #include "Utilities.h" + #include "Game Clock.h" + #include "Soldier Create.h" #include "renderworld.h" - #include "tile animation.h" + #include "Tile Animation.h" #include "merc entering.h" #include "Sound Control.h" #include "strategic.h" #include "strategicmap.h" #include "Handle UI.h" - #include "squads.h" + #include "Squads.h" #include "english.h" - #include "cursor control.h" + #include "Cursor Control.h" #include "Merc Hiring.h" #include "Font Control.h" #include "message.h" #include "Text.h" - #include "strategic turns.h" + #include "Strategic Turns.h" #include "ai.h" #include "Dialogue Control.h" #include "Music Control.h" diff --git a/Tactical/Merc Hiring.cpp b/Tactical/Merc Hiring.cpp index faa73287..154b7351 100644 --- a/Tactical/Merc Hiring.cpp +++ b/Tactical/Merc Hiring.cpp @@ -2,7 +2,7 @@ #include #include #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "math.h" #include "worlddef.h" #include "renderworld.h" @@ -13,25 +13,25 @@ #include "Isometric Utils.h" #include "Event Pump.h" #include "Render Fun.h" - #include "interface.h" + #include "Interface.h" #include "sysutil.h" #include "FileMan.h" - #include "Random.h" + #include "random.h" #include "ai.h" #include "Interactive Tiles.h" #include "english.h" - #include "overhead.h" + #include "Overhead.h" #include "Soldier Profile.h" #include "Game Clock.h" - #include "soldier create.h" + #include "Soldier Create.h" #include "Merc Hiring.h" #include "Game Event Hook.h" #include "message.h" #include "strategicmap.h" #include "strategic.h" - #include "items.h" + #include "Items.h" #include "Soldier Add.h" - #include "History.h" + #include "history.h" #include "Squads.h" #include "Strategic Merc Handler.h" #include "Dialogue Control.h" @@ -39,7 +39,7 @@ #include "Map Screen Interface Map.h" #include "screenids.h" #include "jascreens.h" - #include "text.h" + #include "Text.h" #include "Merc Contract.h" #include "LaptopSave.h" #include "personnel.h" diff --git a/Tactical/Militia Control.cpp b/Tactical/Militia Control.cpp index 935d7852..52a2ea57 100644 --- a/Tactical/Militia Control.cpp +++ b/Tactical/Militia Control.cpp @@ -9,20 +9,20 @@ #include "Map Screen Interface.h" #include "Queen Command.h" #include "strategic.h" - #include "popupbox.h" - #include "interface control.h" + #include "PopUpBox.h" + #include "Interface Control.h" #include "Map Screen Interface Map.h" #include "renderworld.h" #include "Text.h" - #include "utilities.h" + #include "Utilities.h" #include "Interface.h" #include "GameSettings.h" - #include "Input.h" + #include "input.h" #include "opplist.h" - #include "los.h" + #include "LOS.h" #include "Items.h" #include "Animation Control.h" - #include "points.h" + #include "Points.h" #include "Campaign.h" #include "ai.h" #include "Isometric Utils.h" diff --git a/Tactical/Militia Control.h b/Tactical/Militia Control.h index b309e288..0e055a57 100644 --- a/Tactical/Militia Control.h +++ b/Tactical/Militia Control.h @@ -1,7 +1,7 @@ #ifndef __MILITIA_CONTROL_H #define __MILITIA_CONTROL_H -#include "Types.h" +#include "types.h" #include "Soldier Control.h" #include "mousesystem.h" #include "Strategic Movement.h" diff --git a/Tactical/Minigame.cpp b/Tactical/Minigame.cpp index b87b3b1a..fc2282ee 100644 --- a/Tactical/Minigame.cpp +++ b/Tactical/Minigame.cpp @@ -13,7 +13,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "Cursors.h" -#include "Line.h" +#include "line.h" #include "Insurance Text.h" #include "Encrypted File.h" #include "Text.h" @@ -32,20 +32,20 @@ #include "himage.h" #include "vobject.h" #include "vobject_blitters.h" -#include "wcheck.h" +#include "WCheck.h" #include "input.h" -#include "font.h" +#include "Font.h" #include "timer.h" #include "mousesystem.h" #include #include #include "Timer Control.h" #include "Sys Globals.h" -#include "interface.h" -#include "utilities.h" -#include "render dirty.h" -#include "cursor control.h" -#include "utilities.h" +#include "Interface.h" +#include "Utilities.h" +#include "Render Dirty.h" +#include "Cursor Control.h" +#include "Utilities.h" #include "english.h" #include "WordWrap.h" #include "gamescreen.h" diff --git a/Tactical/Morale.cpp b/Tactical/Morale.cpp index 0783a3f4..bd8c6fe9 100644 --- a/Tactical/Morale.cpp +++ b/Tactical/Morale.cpp @@ -2,16 +2,16 @@ #include "Morale.h" #include "Overhead.h" #include "Soldier Profile.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "Map Screen Interface.h" #include "message.h" - #include "assignments.h" + #include "Assignments.h" #include "Strategic Movement.h" #include "Strategic Status.h" #include "SkillCheck.h" - #include "drugs and alcohol.h" - #include "StrategicMap.h" - #include "Debug.h" + #include "Drugs And Alcohol.h" + #include "strategicmap.h" + #include "DEBUG.H" #include "Squads.h" #include "ai.h" #include "Campaign.h" @@ -33,7 +33,7 @@ #include "connect.h" #include "fresh_header.h" -#include "Random.h" +#include "random.h" #include "Merc Contract.h" diff --git a/Tactical/Morale.h b/Tactical/Morale.h index c423faa3..ecf8d40f 100644 --- a/Tactical/Morale.h +++ b/Tactical/Morale.h @@ -1,7 +1,7 @@ #ifndef _MORALE_H #define _MORALE_H -#include "Types.h" +#include "types.h" #include "Soldier Control.h" //#define DEFAULT_MORALE 50 diff --git a/Tactical/Overhead Types.h b/Tactical/Overhead Types.h index 9a349c5f..abe6f5e4 100644 --- a/Tactical/Overhead Types.h +++ b/Tactical/Overhead Types.h @@ -2,7 +2,7 @@ #define __OVERHEAD_TYPES_H // GLOBAL HEADER FOR DATA, TYPES FOR TACTICAL ENGINE -#include "Types.h" +#include "types.h" #define REFINE_AIM_1 0 #define REFINE_AIM_MID1 1 diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index ad349607..1e54041a 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -2,9 +2,9 @@ #include #include #include -#include "wcheck.h" +#include "WCheck.h" #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "math.h" #include "worlddef.h" #include "worldman.h" @@ -19,30 +19,30 @@ #include "Render Fun.h" #include "Render Dirty.h" #include "mousesystem.h" -#include "interface.h" +#include "Interface.h" #include "sysutil.h" #include "FileMan.h" -#include "points.h" -#include "Random.h" +#include "Points.h" +#include "random.h" #include "ai.h" #include "Interactive Tiles.h" -#include "soldier ani.h" +#include "Soldier Ani.h" #include "english.h" -#include "overhead.h" +#include "Overhead.h" #include "opplist.h" #include "Sound Control.h" #include "Font Control.h" #include "lighting.h" -#include "pathai.h" +#include "PATHAI.H" #include "screenids.h" -#include "weapons.h" -#include "rotting corpses.h" +#include "Weapons.h" +#include "Rotting Corpses.h" #include "lighting.h" #include "Handle UI Plan.h" #include "structure.h" -#include "interface panels.h" +#include "Interface Panels.h" #include "message.h" -#include "items.h" +#include "Items.h" #include "Soldier Profile.h" #include "fov.h" #include "Soldier macros.h" @@ -51,60 +51,60 @@ #include "Networking.h" #include "NetworkEvent.h" #endif -#include "structure wrap.h" -#include "tile animation.h" +#include "Structure Wrap.h" +#include "Tile Animation.h" #include "Strategic Merc Handler.h" -#include "strategic turns.h" +#include "Strategic Turns.h" #include "Squads.h" #include "Morale.h" #include "Campaign.h" -#include "music control.h" +#include "Music Control.h" #include "faces.h" -#include "dialogue control.h" +#include "Dialogue Control.h" #include "Queen Command.h" #include "Quests.h" #include "NPC.h" #include "strategicmap.h" -#include "soldier profile.h" -#include "soldier functions.h" -#include "auto bandage.h" +#include "Soldier Profile.h" +#include "Soldier Functions.h" +#include "Auto Bandage.h" #include "Game Event Hook.h" #include "Explosion Control.h" #include "SkillCheck.h" #include "World Items.h" -#include "smell.h" +#include "Smell.h" #include "Player Command.h" #include "GameSettings.h" -#include "messageboxscreen.h" +#include "MessageBoxScreen.h" #include "Game Clock.h" #include "Strategic Town Loyalty.h" #include "Strategic Mines.h" -#include "interface items.h" -#include "text.h" -#include "keys.h" +#include "Interface Items.h" +#include "Text.h" +#include "Keys.h" #include "Boxing.h" #include "Town Militia.h" -#include "meanwhile.h" +#include "Meanwhile.h" #include "Map Screen Helicopter.h" -#include "interface control.h" -#include "exit grids.h" +#include "Interface Control.h" +#include "Exit Grids.h" #include "jascreens.h" #include "strategic.h" #include "arms dealer init.h" -#include "interface utils.h" +#include "Interface Utils.h" #include "Air Raid.h" -#include "civ quotes.h" -#include "drugs and alcohol.h" +#include "Civ Quotes.h" +#include "Drugs And Alcohol.h" #include "history.h" -#include "los.h" -#include "interface dialogue.h" +#include "LOS.h" +#include "interface Dialogue.h" #include "Strategic AI.h" -#include "end game.h" +#include "End Game.h" #include "Strategic Status.h" #include "PreBattle Interface.h" #include "Militia Control.h" #include "Lua Interpreter.h" -#include "bullets.h" +#include "Bullets.h" #include "Inventory Choosing.h" // added by Flugente for TakeMilitiaEquipmentfromSector() #include "CampaignStats.h" // added by Flugente #include "DynamicDialogue.h" // added by Flugente for HandleDynamicOpinions() diff --git a/Tactical/Overhead.h b/Tactical/Overhead.h index 16c42a6f..9c0fa095 100644 --- a/Tactical/Overhead.h +++ b/Tactical/Overhead.h @@ -5,7 +5,7 @@ #include #include "Soldier Control.h" #include -#include "soldier find.h" +#include "Soldier Find.h" #include "Campaign Types.h" // added by Flugente for SECTORINFO and UNDERGROUND_SECTORINFO #define ADD_SOLDIER_NO_PROFILE_ID 200 diff --git a/Tactical/PATHAI.H b/Tactical/PATHAI.H index cf80a125..53c00255 100644 --- a/Tactical/PATHAI.H +++ b/Tactical/PATHAI.H @@ -8,7 +8,7 @@ #ifndef _PATHAI_H #define _PATHAI_H -#include "isometric utils.h" +#include "Isometric Utils.h" namespace ASTAR { #include "BinaryHeap.hpp" diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 02a8067d..54c83a16 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -11,14 +11,14 @@ #include #include #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "MemMan.h" #include "Overhead Types.h" #include "Animation Cache.h" #include "Animation Data.h" #include "Animation Control.h" - #include "interface.h" + #include "Interface.h" #include #include "input.h" @@ -26,18 +26,18 @@ #include "worlddef.h" #include "worldman.h" // #include "renderworld.h" - #include "pathai.h" + #include "PATHAI.H" #include "Points.h" #include "ai.h" - #include "Random.h" + #include "random.h" #include "message.h" - #include "structure wrap.h" - #include "keys.h" - #include "gamesettings.h" + #include "Structure Wrap.h" + #include "Keys.h" + #include "GameSettings.h" #include "Buildings.h" - #include "soldier profile.h" // added by SANDRO + #include "Soldier Profile.h" // added by SANDRO #include "Soldier macros.h" - #include "AIinternals.h" + #include "AIInternals.h" #include "Rotting Corpses.h" #include "Meanwhile.h" #include "connect.h" @@ -50,7 +50,7 @@ class SOLDIERTYPE; #include "BinaryHeap.hpp" #include "opplist.h" -#include "weapons.h" +#include "Weapons.h" extern BOOLEAN gubWorldTileInLight[MAX_ALLOWED_WORLD_MAX]; extern BOOLEAN gubIsCorpseThere[MAX_ALLOWED_WORLD_MAX]; extern INT32 gubMerkCanSeeThisTile[MAX_ALLOWED_WORLD_MAX]; diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 927425f9..42d8cc46 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -1,30 +1,30 @@ #include "sgp.h" #include "worlddef.h" - #include "points.h" - #include "overhead.h" - #include "Font control.h" - #include "interface.h" - #include "Isometric utils.h" - #include "pathai.h" - #include "interface.h" + #include "Points.h" + #include "Overhead.h" + #include "Font Control.h" + #include "Interface.h" + #include "Isometric Utils.h" + #include "PATHAI.H" + #include "Interface.h" #include "message.h" #include "Animation Control.h" #include "Weapons.h" - #include "structure wrap.h" - #include "dialogue control.h" - #include "items.h" + #include "Structure Wrap.h" + #include "Dialogue Control.h" + #include "Items.h" #include "rt time defines.h" #include "ai.h" - #include "handle ui.h" - #include "text.h" + #include "Handle UI.h" + #include "Text.h" #include "SkillCheck.h" - #include "wcheck.h" + #include "WCheck.h" #include "Soldier Profile.h" #include "Soldier macros.h" - #include "Random.h" + #include "random.h" #include "Campaign.h" - #include "drugs and alcohol.h" + #include "Drugs And Alcohol.h" #include "GameSettings.h" #include "worldman.h" #include "math.h" diff --git a/Tactical/Rain.cpp b/Tactical/Rain.cpp index fbb80d34..ad18bc12 100644 --- a/Tactical/Rain.cpp +++ b/Tactical/Rain.cpp @@ -1,43 +1,43 @@ #include "types.h" - //#include "soldier control.h" - #include "overhead.h" - #include "animation control.h" + //#include "Soldier Control.h" + #include "Overhead.h" + #include "Animation Control.h" #include "timer.h" - #include "event pump.h" + #include "Event Pump.h" // #include "Sound Control.h" - #include "interface.h" - #include "Font Control.H" + #include "Interface.h" + #include "Font Control.h" #include "ai.h" - #include "interface.h" + #include "Interface.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "TeamTurns.h" #include "Smell.h" #include "Soldier Functions.h" - #include "cursors.h" + #include "Cursors.h" #include "Queen Command.h" #include "lighting.h" #include "environment.h" - #include "dialogue control.h" - #include "Soldier Profile Type.h" - #include "air raid.h" + #include "Dialogue Control.h" + #include "soldier profile type.h" + #include "Air Raid.h" #include "SkillCheck.h" #include "AIInternals.h" #include "AIList.h" #ifdef DEBUG_INTERRUPTS - #include "debug.h" + #include "DEBUG.H" #endif - #include "render dirty.h" + #include "Render Dirty.h" #include "GameSettings.h" #include "screenids.h" #include "vsurface.h" #include "math.h" - #include "merctextbox.h" - #include "Video.h" + #include "MercTextBox.h" + #include "video.h" #include "local.h" #include "line.h" #include "overhead map.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" #include "Rain.h" diff --git a/Tactical/RandomMerc.cpp b/Tactical/RandomMerc.cpp index 0e0a2413..4c1448c2 100644 --- a/Tactical/RandomMerc.cpp +++ b/Tactical/RandomMerc.cpp @@ -1,12 +1,12 @@ #include #include #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "math.h" #include "worlddef.h" #include "renderworld.h" - #include "Random.h" + #include "random.h" #include "Campaign.h" #include "XML.h" diff --git a/Tactical/Real Time Input.cpp b/Tactical/Real Time Input.cpp index f62e77de..1560b738 100644 --- a/Tactical/Real Time Input.cpp +++ b/Tactical/Real Time Input.cpp @@ -1,10 +1,10 @@ #include #include #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "math.h" #include "jascreens.h" -#include "pathai.h" +#include "PATHAI.H" //#include "Soldier Control.h" #include "Animation Control.h" #include "Animation Data.h" @@ -13,28 +13,28 @@ #include "Handle UI.h" #include "Isometric Utils.h" #include "input.h" -#include "overhead.h" +#include "Overhead.h" #include "Sys Globals.h" #include "screenids.h" -#include "interface.h" -#include "cursor control.h" +#include "Interface.h" +#include "Cursor Control.h" #include "Interactive Tiles.h" -#include "spread burst.h" +#include "Spread burst.h" #include "world items.h" -#include "interface items.h" +#include "Interface Items.h" #include "physics.h" -#include "ui cursors.h" +#include "UI Cursors.h" #include "strategicmap.h" -#include "soldier profile.h" -#include "soldier create.h" -#include "soldier add.h" -#include "dialogue control.h" -#include "interface dialogue.h" -#include "interactive tiles.h" -#include "messageboxscreen.h" +#include "Soldier Profile.h" +#include "Soldier Create.h" +#include "Soldier Add.h" +#include "Dialogue Control.h" +#include "interface Dialogue.h" +#include "Interactive Tiles.h" +#include "MessageBoxScreen.h" #include "gameloop.h" -#include "spread burst.h" -#include "explosion control.h" +#include "Spread burst.h" +#include "Explosion Control.h" #include "message.h" #include "Strategic Exit GUI.h" #include "Assignments.h" @@ -42,18 +42,18 @@ #include "renderworld.h" #include "GameSettings.h" #include "english.h" -#include "text.h" -#include "soldier macros.h" -#include "render dirty.h" +#include "Text.h" +#include "Soldier macros.h" +#include "Render Dirty.h" #include "Militia Control.h" -#include "render dirty.h" +#include "Render Dirty.h" #include "Militia Control.h" ///***dddd #include "Squads.h" #include "Interface Panels.h" -#include "Soldier functions.h" +#include "Soldier Functions.h" #include "SaveLoadMap.h" -#include "worlddat.h" //for gtileset +#include "WorldDat.h" //for gtileset #include "Debug Control.h" //for livelog #include "SkillMenu.h" // sevenfm: need this for TraitsMenu diff --git a/Tactical/Rotting Corpses.cpp b/Tactical/Rotting Corpses.cpp index 64707e3f..fb77052d 100644 --- a/Tactical/Rotting Corpses.cpp +++ b/Tactical/Rotting Corpses.cpp @@ -1,36 +1,36 @@ #include "builddefines.h" #include #include - #include "wcheck.h" + #include "WCheck.h" #include "stdlib.h" - #include "debug.h" - //#include "soldier control.h" - #include "weapons.h" + #include "DEBUG.H" + //#include "Soldier Control.h" + #include "Weapons.h" #include "handle items.h" #include "worlddef.h" #include "worldman.h" - #include "rotting corpses.h" - #include "tile cache.h" - #include "isometric utils.h" - #include "animation control.h" - #include "utilities.h" - #include "game clock.h" - #include "soldier create.h" + #include "Rotting Corpses.h" + #include "Tile Cache.h" + #include "Isometric Utils.h" + #include "Animation Control.h" + #include "Utilities.h" + #include "Game Clock.h" + #include "Soldier Create.h" #include "renderworld.h" - #include "soldier add.h" + #include "Soldier Add.h" #include "strategicmap.h" - #include "los.h" + #include "LOS.h" #include "opplist.h" #include "structure.h" #include "message.h" #include "Sound Control.h" - #include "pathai.h" - #include "Random.h" - #include "dialogue control.h" - #include "items.h" - #include "smell.h" + #include "PATHAI.H" + #include "random.h" + #include "Dialogue Control.h" + #include "Items.h" + #include "Smell.h" #include "World Items.h" - #include "explosion control.h" + #include "Explosion Control.h" #include "GameSettings.h" #include "Interface Items.h" #include "Soldier Profile.h" @@ -42,7 +42,7 @@ #include "Interface.h" #include "Music Control.h" #include "Campaign Types.h" - #include "text.h" // added by Flugente + #include "Text.h" // added by Flugente #include "Vehicles.h" // added by silversurfer #include "ai.h" // added by Flugente #include "PreBattle Interface.h" // added by Flugente diff --git a/Tactical/Rotting Corpses.h b/Tactical/Rotting Corpses.h index af65bcbc..dc0c0c27 100644 --- a/Tactical/Rotting Corpses.h +++ b/Tactical/Rotting Corpses.h @@ -1,7 +1,7 @@ #ifndef _ROTTING_CORPSES_H #define _ROTTING_CORPSES_H -#include "tile animation.h" +#include "Tile Animation.h" #define NUM_CORPSE_SHADES 17 #define CORPSE_WARNING_MAX 5 diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index b58d61bb..d940af9b 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -1,4 +1,4 @@ - #include "Types.h" + #include "types.h" #include "ShopKeeper Interface.h" #include "Utilities.h" #include "Game Clock.h" @@ -10,43 +10,43 @@ #include "Interface Control.h" #include "Overhead.h" #include "Cursors.h" - #include "SysUtil.h" + #include "sysutil.h" #include "Interface Panels.h" #include "Radar Screen.h" #include "Interface Items.h" #include "Interface Utils.h" - #include "VObject_Blitters.h" - #include "Finances.h" + #include "vobject_blitters.h" + #include "finances.h" #include "Text.h" #include "Cursor Control.h" - #include "Input.h" + #include "input.h" #include "Arms Dealer Init.h" #include "english.h" #include "Soldier Add.h" - #include "Faces.h" + #include "faces.h" #include "Dialogue Control.h" #include "ShopKeeper Quotes.h" #include "GameSettings.h" #include "MercTextBox.h" - #include "Random.h" + #include "random.h" #include "Squads.h" #include "Soldier Profile.h" - #include "Message.h" - #include "Personnel.h" + #include "message.h" + #include "personnel.h" #include "LaptopSave.h" #include "Quests.h" #include "Weapons.h" #include "MessageBoxScreen.h" - #include "LINE.H" - #include "Drugs and Alcohol.h" + #include "line.h" + #include "Drugs And Alcohol.h" #include "Map Screen Interface.h" #include "Soldier macros.h" - #include "armsdealerinvinit.h" + #include "ArmsDealerInvInit.h" #include "opplist.h" - #include "los.h" + #include "LOS.h" #include "NPC.h" #include "Soldier Create.h" - #include "PATHAI.h" + #include "PATHAI.H" #include "Points.h" #include "InterfaceItemImages.h" #include "Encyclopedia_new.h" @@ -64,7 +64,7 @@ #include "ub_config.h" #endif -#include "BuildDefines.h" +#include "builddefines.h" #include //////////////////////////////////////////// diff --git a/Tactical/SkillCheck.cpp b/Tactical/SkillCheck.cpp index cff7ad4e..28b35b6a 100644 --- a/Tactical/SkillCheck.cpp +++ b/Tactical/SkillCheck.cpp @@ -1,13 +1,13 @@ #include "SkillCheck.h" #include "Soldier Profile.h" - #include "Random.h" + #include "random.h" #include "Items.h" #include "Dialogue Control.h" #include "Overhead.h" #include "Soldier macros.h" #include "Isometric Utils.h" #include "Morale.h" - #include "drugs and alcohol.h" + #include "Drugs And Alcohol.h" #include "strategicmap.h" // added by SANDRO #include "GameSettings.h" diff --git a/Tactical/SkillMenu.cpp b/Tactical/SkillMenu.cpp index bb11f167..93bfb503 100644 --- a/Tactical/SkillMenu.cpp +++ b/Tactical/SkillMenu.cpp @@ -4,7 +4,7 @@ */ #include "SkillMenu.h" -#include "Soldier Profile Type.h" +#include "soldier profile type.h" #include "Overhead.h" #include "Text.h" #include "Isometric Utils.h" diff --git a/Tactical/Soldier Add.cpp b/Tactical/Soldier Add.cpp index 67b0e79d..71689197 100644 --- a/Tactical/Soldier Add.cpp +++ b/Tactical/Soldier Add.cpp @@ -1,22 +1,22 @@ #include "sgp.h" - #include "overhead.h" - #include "overhead types.h" - #include "isometric utils.h" - #include "interface panels.h" - #include "soldier macros.h" + #include "Overhead.h" + #include "Overhead Types.h" + #include "Isometric Utils.h" + #include "Interface Panels.h" + #include "Soldier macros.h" #include "strategicmap.h" #include "strategic.h" - #include "animation control.h" - #include "soldier create.h" + #include "Animation Control.h" + #include "Soldier Create.h" #include "Soldier Init List.h" - #include "soldier add.h" + #include "Soldier Add.h" #include "Map Information.h" #include "fov.h" - #include "pathai.h" - #include "Random.h" + #include "PATHAI.H" + #include "random.h" #include "Render Fun.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Exit Grids.h" #include "Interface.h" // added by Flugente for zBackground #include "renderworld.h" // added by Flugente @@ -31,8 +31,8 @@ #endif #include "GameSettings.h" // ary-05/05/2009 : add forced turn mode -#include "text.h" // : add forced turn mode -#include "font control.h" // : add forced turn mode +#include "Text.h" // : add forced turn mode +#include "Font Control.h" // : add forced turn mode #include "message.h" // : add forced turn mode #include "connect.h" //forward declarations of common classes to eliminate includes diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 662bc460..f294f9da 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -1,61 +1,61 @@ #include #include #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "MemMan.h" #include "Overhead Types.h" #include "Soldier Control.h" // I need this here - SANDRO #include "Animation Cache.h" #include "Animation Data.h" #include "Animation Control.h" -#include "weapons.h" -#include "soldier ani.h" -#include "Random.h" +#include "Weapons.h" +#include "Soldier Ani.h" +#include "random.h" #include "video.h" #include "vobject_blitters.h" #include "Sound Control.h" -#include "isometric utils.h" +#include "Isometric Utils.h" #include "Handle UI.h" #include "Event Pump.h" #include "opplist.h" #include "lighting.h" #include "ai.h" #include "renderworld.h" -#include "interactive tiles.h" -#include "points.h" +#include "Interactive Tiles.h" +#include "Points.h" #include "message.h" #include "world items.h" #include "physics.h" -#include "soldier create.h" -#include "dialogue control.h" -#include "soldier functions.h" -#include "rotting corpses.h" +#include "Soldier Create.h" +#include "Dialogue Control.h" +#include "Soldier Functions.h" +#include "Rotting Corpses.h" #include "merc entering.h" -#include "soldier add.h" -#include "soldier profile.h" -#include "soldier functions.h" -#include "interface.h" +#include "Soldier Add.h" +#include "Soldier Profile.h" +#include "Soldier Functions.h" +#include "Interface.h" #include "qarray.h" -#include "soldier macros.h" +#include "Soldier macros.h" #include "Strategic Town Loyalty.h" #include "Squads.h" #include "worldman.h" -#include "structure wrap.h" -#include "pathai.h" +#include "Structure Wrap.h" +#include "PATHAI.H" #include "pits.h" -#include "text.h" -#include "npc.h" -#include "meanwhile.h" +#include "Text.h" +#include "NPC.h" +#include "Meanwhile.h" #include "Explosion Control.h" #include "fov.h" -#include "campaign.h" -#include "los.h" +#include "Campaign.h" +#include "LOS.h" #include "GameSettings.h" #include "Boxing.h" -#include "drugs and alcohol.h" +#include "Drugs And Alcohol.h" #include "Smell.h" #include "GameSettings.h" -#include "interface dialogue.h" +#include "interface Dialogue.h" #include "Strategic Status.h" #include "Food.h" #include "CampaignStats.h" // added by Flugente diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index f9bdabce..5efcf821 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -2,10 +2,10 @@ #include #include #include -#include "wcheck.h" +#include "WCheck.h" #include "Render Fun.h" #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "MemMan.h" #include "Overhead Types.h" //#include "Soldier Control.h" @@ -14,28 +14,28 @@ #include "Animation Control.h" #define _USE_MATH_DEFINES // for C #include -#include "pathai.h" -#include "Random.h" +#include "PATHAI.H" +#include "random.h" #include "worldman.h" #include "Isometric Utils.h" #include "renderworld.h" #include "video.h" -#include "points.h" +#include "Points.h" #include "Sound Control.h" -#include "weapons.h" +#include "Weapons.h" #include "vobject_blitters.h" #include "Handle UI.h" -#include "soldier ani.h" -#include "Event pump.h" +#include "Soldier Ani.h" +#include "Event Pump.h" #include "opplist.h" #include "ai.h" -#include "interface.h" +#include "Interface.h" #include "lighting.h" #include "faces.h" #include "Soldier Profile.h" -#include "gap.h" -#include "campaign.h" -#include "soldier macros.h" +#include "GAP.H" +#include "Campaign.h" +#include "Soldier macros.h" #include "english.h" #include "Squads.h" @@ -43,37 +43,37 @@ #include "Networking.h" #include "NetworkEvent.h" #endif -#include "structure wrap.h" -#include "items.h" -#include "Soundman.h" -#include "utilities.h" -#include "Strategic.h" +#include "Structure Wrap.h" +#include "Items.h" +#include "soundman.h" +#include "Utilities.h" +#include "strategic.h" #include "soldier tile.h" #include "Smell.h" #include "Keys.h" -#include "dialogue control.h" -#include "soldier functions.h" +#include "Dialogue Control.h" +#include "Soldier Functions.h" #include "rt time defines.h" #include "Exit Grids.h" #include "Quests.h" #include "message.h" #include "NPC.h" #include "SkillCheck.h" -#include "handle doors.h" -#include "interface dialogue.h" -#include "smokeeffects.h" +#include "Handle Doors.h" +#include "interface Dialogue.h" +#include "SmokeEffects.h" #include "GameSettings.h" -#include "tile animation.h" +#include "Tile Animation.h" #include "ShopKeeper Interface.h" -#include "vehicles.h" -#include "rotting corpses.h" +#include "Vehicles.h" +#include "Rotting Corpses.h" #include "Interface Control.h" #include "strategicmap.h" -#include "morale.h" -#include "meanwhile.h" -#include "drugs and alcohol.h" +#include "Morale.h" +#include "Meanwhile.h" +#include "Drugs And Alcohol.h" #include "SkillCheck.h" -#include "boxing.h" +#include "Boxing.h" #include "overhead map.h" #include "Map Information.h" #include "environment.h" @@ -84,7 +84,7 @@ #include "Strategic Merc Handler.h" #include "Campaign Types.h" #include "Strategic Status.h" -#include "civ quotes.h" +#include "Civ Quotes.h" #include "Strategic Pathing.h" #include "Debug Control.h" #include "LOS.h" // added by SANDRO @@ -120,7 +120,7 @@ #include "Tactical Save.h" // added by Flugente for AddItemsToUnLoadedSector() #include "LightEffects.h" // added by Flugente for CreatePersonalLight() #include "DynamicDialogue.h" // added by Flugente for HandleDynamicOpinions() -#include "strategic town loyalty.h" // added by Flugente for gTownLoyalty +#include "Strategic Town Loyalty.h" // added by Flugente for gTownLoyalty #include "Rebel Command.h" //forward declarations of common classes to eliminate includes diff --git a/Tactical/Soldier Create.cpp b/Tactical/Soldier Create.cpp index 202d1dc6..706f5590 100644 --- a/Tactical/Soldier Create.cpp +++ b/Tactical/Soldier Create.cpp @@ -1,16 +1,16 @@ #include "sgp.h" #include "Soldier Create.h" - #include "overhead.h" - #include "wcheck.h" - #include "soldier profile.h" - #include "animation control.h" - #include "animation data.h" + #include "Overhead.h" + #include "WCheck.h" + #include "Soldier Profile.h" + #include "Animation Control.h" + #include "Animation Data.h" #include "Sound Control.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "faces.h" - #include "isometric utils.h" - #include "items.h" - #include "weapons.h" + #include "Isometric Utils.h" + #include "Items.h" + #include "Weapons.h" #include "opplist.h" #include "random.h" #include "Assignments.h" @@ -18,7 +18,7 @@ #include "Smell.h" #include "Squads.h" #include "Interface Panels.h" - #include "Strategicmap.h" + #include "strategicmap.h" #include "Inventory Choosing.h" #include "Queen Command.h" #include "Soldier Add.h" @@ -27,9 +27,9 @@ #include "Sys Globals.h" #include "Scheduling.h" #include "Rotting Corpses.h" - #include "vehicles.h" - #include "handle ui.h" - #include "text.h" + #include "Vehicles.h" + #include "Handle UI.h" + #include "Text.h" #include "Campaign.h" #include "GameSettings.h" #include "PreBattle Interface.h" diff --git a/Tactical/Soldier Create.h b/Tactical/Soldier Create.h index 06398454..dcf458ed 100644 --- a/Tactical/Soldier Create.h +++ b/Tactical/Soldier Create.h @@ -6,7 +6,7 @@ #include "vobject.h" #include "Overhead Types.h" //#include "Item Types.h" -#include "soldier control.h" +#include "Soldier Control.h" #include #include diff --git a/Tactical/Soldier Find.cpp b/Tactical/Soldier Find.cpp index c45b35c0..34736ccc 100644 --- a/Tactical/Soldier Find.cpp +++ b/Tactical/Soldier Find.cpp @@ -1,7 +1,7 @@ #include #include #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "math.h" #include "worlddef.h" #include "worldman.h" @@ -14,32 +14,32 @@ #include "Event Pump.h" #include "Render Fun.h" #include "mousesystem.h" - #include "interface.h" + #include "Interface.h" #include "sysutil.h" #include "FileMan.h" - #include "Random.h" + #include "random.h" #include "ai.h" #include "Interactive Tiles.h" #include "english.h" - #include "overhead.h" + #include "Overhead.h" //#include "Sound Control.h" #include "lighting.h" - #include "pathai.h" + #include "PATHAI.H" #include "screenids.h" - #include "weapons.h" + #include "Weapons.h" #include "lighting.h" #include "Handle UI Plan.h" #include "structure.h" #include "message.h" - #include "items.h" + #include "Items.h" #include "Soldier Profile.h" #include "fov.h" #include "Soldier macros.h" #include "soldier tile.h" - #include "soldier find.h" + #include "Soldier Find.h" #include "Vehicles.h" #include "GameSettings.h" - #include "ui cursors.h" + #include "UI Cursors.h" BOOLEAN IsGridNoInScreenRect( INT32 sGridNo, SGPRect *pRect ); diff --git a/Tactical/Soldier Functions.h b/Tactical/Soldier Functions.h index a48fb12a..e78601c8 100644 --- a/Tactical/Soldier Functions.h +++ b/Tactical/Soldier Functions.h @@ -1,7 +1,7 @@ #ifndef _SOLDIER_FUNCTIONS_H #define _SOLDIER_FUNCTIONS_H -#include "soldier control.h" +#include "Soldier Control.h" void ContinueMercMovement( SOLDIERTYPE *pSoldier ); diff --git a/Tactical/Soldier Init List.cpp b/Tactical/Soldier Init List.cpp index 85b2e5cf..15d4121c 100644 --- a/Tactical/Soldier Init List.cpp +++ b/Tactical/Soldier Init List.cpp @@ -5,20 +5,20 @@ #include "types.h" #include "strategicmap.h" -#include "overhead.h" -#include "isometric utils.h" +#include "Overhead.h" +#include "Isometric Utils.h" -#include "soldier add.h" -#include "soldier create.h" +#include "Soldier Add.h" +#include "Soldier Create.h" #include "Soldier Init List.h" -#include "debug.h" -#include "Random.h" -#include "items.h" +#include "DEBUG.H" +#include "random.h" +#include "Items.h" #include "GameSettings.h" #include "Map Information.h" -#include "soldier profile.h" +#include "Soldier Profile.h" #include "Sys Globals.h" #include "EditorMercs.h" #include "Animation Data.h" @@ -27,7 +27,7 @@ #include "Sound Control.h" #include "Quests.h" #include "Render Fun.h" -#include "meanwhile.h" +#include "Meanwhile.h" #include "Map Screen Interface Map.h" #include "mapscreen.h" #include "Debug Control.h" diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index ee38c12c..6dc342a4 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -1,7 +1,7 @@ #include #include #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "math.h" #include "worlddef.h" #include "renderworld.h" @@ -12,32 +12,32 @@ #include "Isometric Utils.h" #include "Event Pump.h" #include "Render Fun.h" - #include "interface.h" + #include "Interface.h" #include "sysutil.h" #include "FileMan.h" - #include "Random.h" + #include "random.h" #include "ai.h" #include "Interactive Tiles.h" - #include "soldier ani.h" + #include "Soldier Ani.h" #include "english.h" - #include "overhead.h" + #include "Overhead.h" #include "Soldier Profile.h" #include "Game Clock.h" - #include "assignments.h" + #include "Assignments.h" #include "Dialogue Control.h" - #include "soldier create.h" - #include "soldier add.h" + #include "Soldier Create.h" + #include "Soldier Add.h" #include "opplist.h" - #include "weapons.h" + #include "Weapons.h" #include "Strategic Town Loyalty.h" - #include "squads.h" + #include "Squads.h" #include "Tactical Save.h" #include "Quests.h" #include "aim.h" - #include "Interface Dialogue.h" + #include "interface Dialogue.h" #include "GameSettings.h" #include "strategic town reputation.h" - #include "interface utils.h" + #include "Interface Utils.h" #include "Game Event Hook.h" #include "Map Information.h" #include "history.h" @@ -46,7 +46,7 @@ #include "Player Command.h" #include "strategic.h" #include "strategicmap.h" // added by SANDRO - #include "drugs and alcohol.h" // added by Flugente + #include "Drugs And Alcohol.h" // added by Flugente #include "Campaign.h" #include "LuaInitNPCs.h" // added by Flugente diff --git a/Tactical/Soldier Profile.h b/Tactical/Soldier Profile.h index 39e0860e..2382003e 100644 --- a/Tactical/Soldier Profile.h +++ b/Tactical/Soldier Profile.h @@ -2,7 +2,7 @@ #define __SOLDER_PROFILE_H #include "Soldier Control.h" -#include "Soldier Profile Type.h" +#include "soldier profile type.h" #include "Merc Hiring.h" typedef struct diff --git a/Tactical/Soldier Tile.cpp b/Tactical/Soldier Tile.cpp index 6b994eac..f4de60f0 100644 --- a/Tactical/Soldier Tile.cpp +++ b/Tactical/Soldier Tile.cpp @@ -3,29 +3,29 @@ #include #include "Render Fun.h" #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "MemMan.h" #include "Overhead Types.h" #include "Animation Cache.h" #include "Animation Data.h" #include "Animation Control.h" - #include "pathai.h" - #include "Random.h" + #include "PATHAI.H" + #include "random.h" #include "worldman.h" #include "Isometric Utils.h" #include "renderworld.h" #include "video.h" - #include "points.h" + #include "Points.h" // #include "Sound Control.h" #include "lighting.h" - #include "weapons.h" + #include "Weapons.h" #include "vobject_blitters.h" #include "Handle UI.h" - #include "Event pump.h" + #include "Event Pump.h" #include "opplist.h" #include "ai.h" - #include "interface.h" + #include "Interface.h" #include "lighting.h" #include "faces.h" #include "Soldier Profile.h" @@ -35,10 +35,10 @@ #include "NetworkEvent.h" #endif - #include "items.h" - #include "Soundman.h" + #include "Items.h" + #include "soundman.h" #include "soldier tile.h" - #include "soldier add.h" + #include "Soldier Add.h" #include "fov.h" #include "Font Control.h" #include "message.h" diff --git a/Tactical/Soldier macros.h b/Tactical/Soldier macros.h index a436a3cd..4707cb99 100644 --- a/Tactical/Soldier macros.h +++ b/Tactical/Soldier macros.h @@ -2,9 +2,9 @@ #define SOLDIER_MACROS_H // MACROS FOR EASIER SOLDIER CONTROL -#include "teamturns.h" -#include "soldier profile.h" -#include "assignments.h" +#include "TeamTurns.h" +#include "Soldier Profile.h" +#include "Assignments.h" #include "Animation Data.h" // MACROS diff --git a/Tactical/SoldierTooltips.cpp b/Tactical/SoldierTooltips.cpp index 731bb636..f441dc74 100644 --- a/Tactical/SoldierTooltips.cpp +++ b/Tactical/SoldierTooltips.cpp @@ -1,7 +1,7 @@ -#include "Types.h" -#include "Windows.h" +#include "types.h" +#include "windows.h" //#include "Soldier Control.h" -#include "Input.h" +#include "input.h" #include "english.h" #include "Isometric Utils.h" #include "GameSettings.h" @@ -10,14 +10,14 @@ #include "Text.h" #include "lighting.h" #include "Interface.h" -#include "weapons.h" +#include "Weapons.h" #include "renderworld.h" #include "Font Control.h" -#include "font.h" +#include "Font.h" #include "local.h" #include "vsurface.h" #include "line.h" -#include "los.h" +#include "LOS.h" // added by SANDRO #include "SkillCheck.h" #include "soldier profile type.h" @@ -28,8 +28,8 @@ #include "AIInternals.h" #include "opplist.h" #include "Map Screen Interface.h" -#include "cheats.h" -#include "Drugs and Alcohol.h" +#include "Cheats.h" +#include "Drugs And Alcohol.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; diff --git a/Tactical/Spread Burst.cpp b/Tactical/Spread Burst.cpp index 1f8ae857..4362859c 100644 --- a/Tactical/Spread Burst.cpp +++ b/Tactical/Spread Burst.cpp @@ -1,17 +1,17 @@ #include #include #include "stdlib.h" - #include "debug.h" - //#include "soldier control.h" - #include "weapons.h" - #include "cursor control.h" - #include "soldier find.h" - #include "isometric utils.h" + #include "DEBUG.H" + //#include "Soldier Control.h" + #include "Weapons.h" + #include "Cursor Control.h" + #include "Soldier Find.h" + #include "Isometric Utils.h" #include "renderworld.h" - #include "render dirty.h" - #include "interface.h" - #include "spread burst.h" - #include "points.h" + #include "Render Dirty.h" + #include "Interface.h" + #include "Spread burst.h" + #include "Points.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; diff --git a/Tactical/Squads.cpp b/Tactical/Squads.cpp index a7dda1b1..8b1de4e1 100644 --- a/Tactical/Squads.cpp +++ b/Tactical/Squads.cpp @@ -1,16 +1,16 @@ - #include "Types.h" + #include "types.h" #include "Squads.h" #include "Strategic Pathing.h" - #include "Strategicmap.h" - #include "Faces.h" + #include "strategicmap.h" + #include "faces.h" #include "Strategic Movement.h" #include "Assignments.h" - #include "OverHead.h" + #include "Overhead.h" #include "Interface.h" #include "Vehicles.h" #include "Map Screen Helicopter.h" #include "Soldier Profile.h" - #include "Debug.h" + #include "DEBUG.H" #include "jascreens.h" #include "screenids.h" #include "Soldier macros.h" diff --git a/Tactical/Strategic Exit GUI.cpp b/Tactical/Strategic Exit GUI.cpp index 18dcb08f..b09acb0f 100644 --- a/Tactical/Strategic Exit GUI.cpp +++ b/Tactical/Strategic Exit GUI.cpp @@ -8,17 +8,17 @@ #include "Game Clock.h" #include "sysutil.h" #include "Font Control.h" - #include "text.h" + #include "Text.h" #include "PopUpBox.h" #include "Cursors.h" #include "Strategic Exit GUI.h" #include "MercTextBox.h" #include "renderworld.h" - #include "overhead.h" - #include "cursor control.h" + #include "Overhead.h" + #include "Cursor Control.h" #include "input.h" #include "english.h" - #include "text.h" + #include "Text.h" #include "Strategic Movement.h" #include "Squads.h" #include "Assignments.h" diff --git a/Tactical/Structure Wrap.cpp b/Tactical/Structure Wrap.cpp index 3a388897..2973b640 100644 --- a/Tactical/Structure Wrap.cpp +++ b/Tactical/Structure Wrap.cpp @@ -1,14 +1,14 @@ #include - #include "debug.h" + #include "DEBUG.H" #include "worlddef.h" #include "worldman.h" - #include "structure wrap.h" - #include "isometric utils.h" + #include "Structure Wrap.h" + #include "Isometric Utils.h" #include "worldman.h" - #include "overhead.h" + #include "Overhead.h" #include "renderworld.h" #include "strategicmap.h" - #include "rotting corpses.h" + #include "Rotting Corpses.h" #include "WorldDat.h" // added by Flugente extern BOOLEAN DoesSAMExistHere( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, INT32 sGridNo ); diff --git a/Tactical/Tactical Save.cpp b/Tactical/Tactical Save.cpp index 7352422f..1cfacd97 100644 --- a/Tactical/Tactical Save.cpp +++ b/Tactical/Tactical Save.cpp @@ -1,33 +1,33 @@ - #include "Types.h" + #include "types.h" #include "MemMan.h" #include "message.h" #include "Items.h" #include "Handle Items.h" - #include "StrategicMap.h" + #include "strategicmap.h" #include "Tactical Save.h" #include #include "Campaign Types.h" #include "SaveLoadGame.h" - #include "WorldDef.h" - #include "rotting corpses.h" - #include "OverHead.h" + #include "worlddef.h" + #include "Rotting Corpses.h" + #include "Overhead.h" #include "Keys.h" #include "Soldier Create.h" #include "Soldier Profile.h" #include "Isometric Utils.h" #include "Soldier Add.h" - #include "Npc.h" - #include "Ai.h" + #include "NPC.h" + #include "ai.h" #include "Game Clock.h" #include "Animation Control.h" #include "Map Information.h" #include "SaveLoadMap.h" - #include "debug.h" - #include "Random.h" - #include "quests.h" + #include "DEBUG.H" + #include "random.h" + #include "Quests.h" #include "Animated ProgressBar.h" #include "Text.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "Enemy Soldier Save.h" #include "SmokeEffects.h" #include "LightEffects.h" diff --git a/Tactical/Tactical Save.h b/Tactical/Tactical Save.h index 6f60237a..0dfafcfd 100644 --- a/Tactical/Tactical Save.h +++ b/Tactical/Tactical Save.h @@ -3,10 +3,10 @@ #include "World Items.h" -#include "WorldDef.h" -#include "rotting corpses.h" +#include "worlddef.h" +#include "Rotting Corpses.h" -#include "Soldier Profile Type.h" +#include "soldier profile type.h" #define MAPS_DIR "Temp\\" diff --git a/Tactical/Tactical Turns.cpp b/Tactical/Tactical Turns.cpp index 9816d8a7..5cb5c9d5 100644 --- a/Tactical/Tactical Turns.cpp +++ b/Tactical/Tactical Turns.cpp @@ -2,27 +2,27 @@ #include "Game Clock.h" #include "Font Control.h" #include "Timer Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Game Clock.h" #include "message.h" #include "worlddef.h" - #include "rotting corpses.h" - #include "soldier create.h" - #include "soldier add.h" - #include "isometric utils.h" - #include "animation data.h" - #include "animation control.h" + #include "Rotting Corpses.h" + #include "Soldier Create.h" + #include "Soldier Add.h" + #include "Isometric Utils.h" + #include "Animation Data.h" + #include "Animation Control.h" #include "Tactical Turns.h" - #include "smell.h" + #include "Smell.h" #include "opplist.h" #include "Queen Command.h" - #include "dialogue control.h" - #include "smokeeffects.h" - #include "lighteffects.h" - #include "campaign.h" + #include "Dialogue Control.h" + #include "SmokeEffects.h" + #include "LightEffects.h" + #include "Campaign.h" #include "Soldier macros.h" #include "strategicmap.h" - #include "Random.h" + #include "random.h" #include "Explosion Control.h" #include "Dialogue Control.h" // added by Flugente diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index ddf9e443..28a372f3 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -1,47 +1,47 @@ #include "types.h" - #include "overhead.h" - #include "animation control.h" - #include "points.h" + #include "Overhead.h" + #include "Animation Control.h" + #include "Points.h" #include "opplist.h" #include "timer.h" - #include "event pump.h" + #include "Event Pump.h" #include "Sound Control.h" - #include "interface.h" + #include "Interface.h" #include "Isometric Utils.h" - #include "Font Control.H" + #include "Font Control.h" #include "ai.h" - #include "interface.h" + #include "Interface.h" #include "message.h" - #include "text.h" + #include "Text.h" #include "TeamTurns.h" #include "Smell.h" - #include "game clock.h" + #include "Game Clock.h" #include "Soldier Functions.h" - #include "cursors.h" + #include "Cursors.h" #include "Queen Command.h" - #include "Pathai.h" + #include "PATHAI.H" #include "lighting.h" #include "environment.h" #include "Explosion Control.h" - #include "dialogue control.h" - #include "Soldier Profile Type.h" + #include "Dialogue Control.h" + #include "soldier profile type.h" #include "SmokeEffects.h" - #include "lighteffects.h" - #include "air raid.h" - #include "meanwhile.h" + #include "LightEffects.h" + #include "Air Raid.h" + #include "Meanwhile.h" #include "SkillCheck.h" #include "AIInternals.h" #include "AIList.h" #ifdef DEBUG_INTERRUPTS - #include "debug.h" + #include "DEBUG.H" #endif #include "renderworld.h" - #include "rotting corpses.h" + #include "Rotting Corpses.h" #include "Squads.h" #include "Soldier macros.h" #include "Soldier Profile.h" #include "NPC.h" - #include "drugs and alcohol.h" // added by Flugente + #include "Drugs And Alcohol.h" // added by Flugente #ifdef JA2UB #include "Ja25_Tactical.h" diff --git a/Tactical/Turn Based Input.cpp b/Tactical/Turn Based Input.cpp index 13f5666f..0bd3c26d 100644 --- a/Tactical/Turn Based Input.cpp +++ b/Tactical/Turn Based Input.cpp @@ -2,10 +2,10 @@ #include #include #include "stdlib.h" -#include "debug.h" +#include "DEBUG.H" #include "math.h" #include "jascreens.h" -#include "pathai.h" +#include "PATHAI.H" #include "Animation Control.h" #include "Animation Data.h" #include "Event Pump.h" @@ -13,22 +13,22 @@ #include "Handle UI.h" #include "Isometric Utils.h" #include "input.h" -#include "overhead.h" +#include "Overhead.h" #include "Sys Globals.h" #include "screenids.h" -#include "interface.h" -#include "cursor control.h" -#include "points.h" +#include "Interface.h" +#include "Cursor Control.h" +#include "Points.h" #include "Interactive Tiles.h" -#include "interface cursors.h" -#include "weapons.h" +#include "Interface Cursors.h" +#include "Weapons.h" #include "lighting.h" -#include "sound control.h" +#include "Sound Control.h" #include "environment.h" #include "Music Control.h" #include "ai.h" #include "renderworld.h" -#include "font control.h" +#include "Font Control.h" #include "worldman.h" #include "Handle UI Plan.h" #include "message.h" @@ -39,39 +39,39 @@ #include "overhead map.h" #include "world items.h" #include "Game Clock.h" -#include "interface items.h" +#include "Interface Items.h" #include "physics.h" -#include "ui cursors.h" +#include "UI Cursors.h" #include "worldman.h" #include "strategicmap.h" -#include "soldier profile.h" -#include "soldier create.h" -#include "soldier add.h" -#include "dialogue control.h" -#include "interface dialogue.h" +#include "Soldier Profile.h" +#include "Soldier Create.h" +#include "Soldier Add.h" +#include "Dialogue Control.h" +#include "interface Dialogue.h" #include "opplist.h" -#include "interactive tiles.h" -#include "messageboxscreen.h" +#include "Interactive Tiles.h" +#include "MessageBoxScreen.h" #include "gameloop.h" -#include "spread burst.h" -#include "explosion control.h" +#include "Spread burst.h" +#include "Explosion Control.h" #include "QuestDebug.h" -#include "assignments.h" -#include "EditScreen.h" +#include "Assignments.h" +#include "editscreen.h" #include "SaveLoadGame.h" -#include "los.h" +#include "LOS.h" #include "Exit Grids.h" #include "Strategic Exit GUI.h" -#include "auto bandage.h" +#include "Auto Bandage.h" #include "Options Screen.h" -#include "squads.h" -#include "interface panels.h" +#include "Squads.h" +#include "Interface Panels.h" #include "soldier tile.h" -#include "Soldier functions.h" +#include "Soldier Functions.h" #include "Game Events.h" #include "english.h" -#include "Random.h" +#include "random.h" #include "Assignments.h" #include "Map Screen Interface.h" #include "renderworld.h" @@ -80,16 +80,16 @@ #include "Arms Dealer Init.h" #include "ShopKeeper Interface.h" #include "GameSettings.h" -#include "vehicles.h" +#include "Vehicles.h" #include "SaveLoadScreen.h" -#include "Air raid.h" -#include "meanwhile.h" -#include "text.h" +#include "Air Raid.h" +#include "Meanwhile.h" +#include "Text.h" #include "Inventory Choosing.h" -#include "soldier macros.h" +#include "Soldier macros.h" #include "HelpScreen.h" -#include "cheats.h" -#include "displaycover.h" +#include "Cheats.h" +#include "DisplayCover.h" #include "Tactical Save.h" #include "history.h" #include "Queen Command.h" diff --git a/Tactical/UI Cursors.cpp b/Tactical/UI Cursors.cpp index 142aff02..91a1f360 100644 --- a/Tactical/UI Cursors.cpp +++ b/Tactical/UI Cursors.cpp @@ -1,33 +1,33 @@ - #include "items.h" - #include "weapons.h" + #include "Items.h" + #include "Weapons.h" #include "Interface Cursors.h" - #include "overhead.h" + #include "Overhead.h" #include "Handle UI.h" #include "Animation Control.h" - #include "points.h" + #include "Points.h" #include "Sound Control.h" - #include "Sys globals.h" + #include "Sys Globals.h" #include "Isometric Utils.h" #include "Animation Data.h" #include "worldman.h" - #include "ui cursors.h" - #include "los.h" + #include "UI Cursors.h" + #include "LOS.h" #include "renderworld.h" - #include "interface.h" - #include "ui cursors.h" - #include "cursors.h" - #include "cursor control.h" - #include "structure wrap.h" + #include "Interface.h" + #include "UI Cursors.h" + #include "Cursors.h" + #include "Cursor Control.h" + #include "Structure Wrap.h" #include "physics.h" - #include "soldier macros.h" - #include "text.h" - #include "spread burst.h" + #include "Soldier macros.h" + #include "Text.h" + #include "Spread burst.h" #include "GameSettings.h" #include "Interactive Tiles.h" #include "PATHAI.H" #include "SkillCheck.h" // added by SANDRO - #include "message.H" //ddd + #include "message.h" //ddd #include "english.h" // added by Flugente //forward declarations of common classes to eliminate includes diff --git a/Tactical/VehicleMenu.cpp b/Tactical/VehicleMenu.cpp index ca4d704a..5cca5bd8 100644 --- a/Tactical/VehicleMenu.cpp +++ b/Tactical/VehicleMenu.cpp @@ -1,16 +1,16 @@ // anv: totally not a copy of SkillMenu.cpp #include "VehicleMenu.h" -#include "Soldier Profile Type.h" +#include "soldier profile type.h" #include "Overhead.h" #include "Text.h" #include "Isometric Utils.h" #include "DisplayCover.h" #include "worldman.h" #include "Vehicles.h" -#include "soldier macros.h" +#include "Soldier macros.h" #include "Soldier Add.h" -#include "PATHAI.h" +#include "PATHAI.H" #include "Points.h" #include "Handle UI.h" #include "Squads.h" diff --git a/Tactical/Vehicles.cpp b/Tactical/Vehicles.cpp index d954d75a..467aa217 100644 --- a/Tactical/Vehicles.cpp +++ b/Tactical/Vehicles.cpp @@ -1,28 +1,28 @@ #include "Vehicles.h" - #include "String.h" + #include "string.h" #include "Strategic Pathing.h" #include "Assignments.h" #include "Strategic Movement.h" #include "Squads.h" #include "Map Screen Helicopter.h" #include "Game Clock.h" - #include "overhead.h" - #include "soldier profile.h" + #include "Overhead.h" + #include "Soldier Profile.h" #include "Sound Control.h" #include "soundman.h" - #include "soldier add.h" - #include "interface panels.h" + #include "Soldier Add.h" + #include "Interface Panels.h" #include "strategic.h" #include "worlddef.h" #include "Isometric Utils.h" #include "Mapscreen.h" #include "message.h" - #include "interface.h" - #include "Random.h" - #include "text.h" - #include "explosion control.h" - #include "soldier create.h" - #include "animation control.h" + #include "Interface.h" + #include "random.h" + #include "Text.h" + #include "Explosion Control.h" + #include "Soldier Create.h" + #include "Animation Control.h" #include "strategicmap.h" #include "Interface Control.h" #include "Campaign Types.h" @@ -33,7 +33,7 @@ #include "Tactical Save.h" #include "Soldier macros.h" #include "opplist.h" - #include "Soldier ani.h" + #include "Soldier Ani.h" #include "GameSettings.h" #include "Queen Command.h" diff --git a/Tactical/Vehicles.h b/Tactical/Vehicles.h index 571fa98e..456e54df 100644 --- a/Tactical/Vehicles.h +++ b/Tactical/Vehicles.h @@ -1,7 +1,7 @@ #ifndef _VEHICLES_H #define _VEHICLES_H -#include "Types.h" +#include "types.h" #include "Soldier Control.h" #include "Strategic Movement.h" diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 77e7e0a3..0acc9a29 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -1,40 +1,40 @@ #include "sgp.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "Sound Control.h" #include "Cheats.h" - #include "overhead.h" + #include "Overhead.h" #include "Event Pump.h" - #include "weapons.h" + #include "Weapons.h" #include "Animation Control.h" #include "Handle UI.h" #include "Isometric Utils.h" #include "worldman.h" #include "math.h" - #include "points.h" + #include "Points.h" #include "ai.h" - #include "los.h" + #include "LOS.h" #include "renderworld.h" #include "opplist.h" - #include "interface.h" + #include "Interface.h" #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" + #include "Campaign.h" + #include "Items.h" + #include "Text.h" #include "Soldier Profile.h" - #include "tile animation.h" + #include "Tile Animation.h" #include "Dialogue Control.h" #include "SkillCheck.h" #include "Render Fun.h" - #include "explosion control.h" + #include "Explosion Control.h" #include "Quests.h" - #include "Physics.h" - #include "Random.h" + #include "physics.h" + #include "random.h" #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" - #include "meanwhile.h" + #include "Bullets.h" + #include "Morale.h" + #include "Meanwhile.h" #include "SkillCheck.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" @@ -50,7 +50,7 @@ #include "CampaignStats.h" // added by Flugente #include "environment.h" // added by silversurfer // sevenfm - #include "buildings.h" // SameBuilding + #include "Buildings.h" // SameBuilding //forward declarations of common classes to eliminate includes class OBJECTTYPE; diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index d6eb1c8f..ade73087 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -1,17 +1,17 @@ - #include "items.h" + #include "Items.h" #include "handle Items.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "tiledef.h" #include "worlddef.h" - #include "interface.h" + #include "Interface.h" #include "renderworld.h" #include "Animation Control.h" - #include "font control.h" + #include "Font Control.h" #include "World items.h" - #include "debug.h" - #include "Isometric utils.h" - #include "sys globals.h" + #include "DEBUG.H" + #include "Isometric Utils.h" + #include "Sys Globals.h" #include "Tactical Save.h" #include "strategicmap.h" #include "Campaign Types.h" @@ -22,7 +22,7 @@ #include "Quests.h" #include "Soldier Profile.h" #include "message.h" - #include "map screen interface map inventory.h" // added by Flugente + #include "Map Screen Interface Map Inventory.h" // added by Flugente #include "connect.h" #ifdef JA2EDITOR//dnl ch84 290114 #include "Item Statistics.h" diff --git a/Tactical/World Items.h b/Tactical/World Items.h index 524b67b8..fa57ec59 100644 --- a/Tactical/World Items.h +++ b/Tactical/World Items.h @@ -1,7 +1,7 @@ #ifndef __WORLD_ITEMS #define __WORLD_ITEMS -#include "items.h" +#include "Items.h" #include "FileMan.h" diff --git a/Tactical/XML.h b/Tactical/XML.h index d1ab96b9..277a8bd0 100644 --- a/Tactical/XML.h +++ b/Tactical/XML.h @@ -2,7 +2,7 @@ #define __XML_H #include "expat.h" -#include "armsdealerinvinit.h" +#include "ArmsDealerInvInit.h" #include "EnemyItemDrops.h" #include "Loading Screen.h" #include "faces.h" diff --git a/Tactical/XML_AmmoStrings.cpp b/Tactical/XML_AmmoStrings.cpp index 65ea633b..16069ccd 100644 --- a/Tactical/XML_AmmoStrings.cpp +++ b/Tactical/XML_AmmoStrings.cpp @@ -1,7 +1,7 @@ #include "sgp.h" - #include "overhead types.h" - #include "overhead.h" - #include "text.h" + #include "Overhead Types.h" + #include "Overhead.h" + #include "Text.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_AmmoTypes.cpp b/Tactical/XML_AmmoTypes.cpp index 04dfa754..22442b70 100644 --- a/Tactical/XML_AmmoTypes.cpp +++ b/Tactical/XML_AmmoTypes.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "weapons.h" - #include "overhead.h" + #include "Weapons.h" + #include "Overhead.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Armour.cpp b/Tactical/XML_Armour.cpp index 316b517a..ae4abab8 100644 --- a/Tactical/XML_Armour.cpp +++ b/Tactical/XML_Armour.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "weapons.h" - #include "overhead.h" + #include "Weapons.h" + #include "Overhead.h" #include "GameSettings.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_AttachmentInfo.cpp b/Tactical/XML_AttachmentInfo.cpp index 7bd8a0bf..35f1bd3d 100644 --- a/Tactical/XML_AttachmentInfo.cpp +++ b/Tactical/XML_AttachmentInfo.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_AttachmentSlots.cpp b/Tactical/XML_AttachmentSlots.cpp index 80e76a49..d68ac1bc 100644 --- a/Tactical/XML_AttachmentSlots.cpp +++ b/Tactical/XML_AttachmentSlots.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Attachments.cpp b/Tactical/XML_Attachments.cpp index fdb28fc9..e38f2c74 100644 --- a/Tactical/XML_Attachments.cpp +++ b/Tactical/XML_Attachments.cpp @@ -1,9 +1,9 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "XML.h" struct diff --git a/Tactical/XML_BurstSounds.cpp b/Tactical/XML_BurstSounds.cpp index 8e140deb..d1d91f68 100644 --- a/Tactical/XML_BurstSounds.cpp +++ b/Tactical/XML_BurstSounds.cpp @@ -1,34 +1,34 @@ #include "sgp.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "Sound Control.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Event Pump.h" - #include "weapons.h" + #include "Weapons.h" #include "Animation Control.h" #include "Handle UI.h" #include "Isometric Utils.h" #include "math.h" #include "ai.h" - #include "los.h" + #include "LOS.h" #include "renderworld.h" - #include "interface.h" + #include "Interface.h" #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" + #include "Campaign.h" + #include "Items.h" + #include "Text.h" #include "Soldier Profile.h" #include "Dialogue Control.h" #include "SkillCheck.h" - #include "explosion control.h" + #include "Explosion Control.h" #include "Quests.h" - #include "Physics.h" - #include "Random.h" + #include "physics.h" + #include "random.h" #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" + #include "Bullets.h" + #include "Morale.h" #include "SkillCheck.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_Clothes.cpp b/Tactical/XML_Clothes.cpp index 319aa9a3..0541a899 100644 --- a/Tactical/XML_Clothes.cpp +++ b/Tactical/XML_Clothes.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_ComboMergeInfo.cpp b/Tactical/XML_ComboMergeInfo.cpp index 52e4d7b2..8184398b 100644 --- a/Tactical/XML_ComboMergeInfo.cpp +++ b/Tactical/XML_ComboMergeInfo.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_CompatibleFaceItems.cpp b/Tactical/XML_CompatibleFaceItems.cpp index 195749fc..be38b1f9 100644 --- a/Tactical/XML_CompatibleFaceItems.cpp +++ b/Tactical/XML_CompatibleFaceItems.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Disease.cpp b/Tactical/XML_Disease.cpp index a64f75a1..e446f1f1 100644 --- a/Tactical/XML_Disease.cpp +++ b/Tactical/XML_Disease.cpp @@ -1,5 +1,5 @@ #include "sgp.h" -#include "overhead.h" +#include "Overhead.h" #include "Disease.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_Drugs.cpp b/Tactical/XML_Drugs.cpp index 2f59756a..dbc6f76f 100644 --- a/Tactical/XML_Drugs.cpp +++ b/Tactical/XML_Drugs.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Drugs And Alcohol.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_EnemyAmmoDrops.cpp b/Tactical/XML_EnemyAmmoDrops.cpp index 7642dd9b..31eaa617 100644 --- a/Tactical/XML_EnemyAmmoDrops.cpp +++ b/Tactical/XML_EnemyAmmoDrops.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_EnemyArmourDrops.cpp b/Tactical/XML_EnemyArmourDrops.cpp index 0e5fc490..b34c25d1 100644 --- a/Tactical/XML_EnemyArmourDrops.cpp +++ b/Tactical/XML_EnemyArmourDrops.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_EnemyExplosiveDrops.cpp b/Tactical/XML_EnemyExplosiveDrops.cpp index 206ffd8c..609e8000 100644 --- a/Tactical/XML_EnemyExplosiveDrops.cpp +++ b/Tactical/XML_EnemyExplosiveDrops.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_EnemyItemChoice.cpp b/Tactical/XML_EnemyItemChoice.cpp index df4ed87d..2fa46fd8 100644 --- a/Tactical/XML_EnemyItemChoice.cpp +++ b/Tactical/XML_EnemyItemChoice.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_EnemyMiscDrops.cpp b/Tactical/XML_EnemyMiscDrops.cpp index b9fff0d8..5ed4b494 100644 --- a/Tactical/XML_EnemyMiscDrops.cpp +++ b/Tactical/XML_EnemyMiscDrops.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_EnemyWeaponChoice.cpp b/Tactical/XML_EnemyWeaponChoice.cpp index 241b4d0a..636d85b9 100644 --- a/Tactical/XML_EnemyWeaponChoice.cpp +++ b/Tactical/XML_EnemyWeaponChoice.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_EnemyWeaponDrops.cpp b/Tactical/XML_EnemyWeaponDrops.cpp index 1ac0d6ad..0c591582 100644 --- a/Tactical/XML_EnemyWeaponDrops.cpp +++ b/Tactical/XML_EnemyWeaponDrops.cpp @@ -1,31 +1,31 @@ #include "sgp.h" - #include "overhead types.h" - #include "overhead.h" + #include "Overhead Types.h" + #include "Overhead.h" #include "Event Pump.h" - #include "weapons.h" + #include "Weapons.h" #include "Animation Control.h" #include "Handle UI.h" #include "Isometric Utils.h" #include "math.h" #include "ai.h" - #include "los.h" + #include "LOS.h" #include "renderworld.h" - #include "interface.h" + #include "Interface.h" #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" + #include "Campaign.h" + #include "Items.h" + #include "Text.h" #include "Soldier Profile.h" #include "Dialogue Control.h" #include "SkillCheck.h" #include "Quests.h" - #include "Physics.h" - #include "Random.h" + #include "physics.h" + #include "random.h" #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" + #include "Bullets.h" + #include "Morale.h" #include "SkillCheck.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_Explosive.cpp b/Tactical/XML_Explosive.cpp index eed42225..b64ccc03 100644 --- a/Tactical/XML_Explosive.cpp +++ b/Tactical/XML_Explosive.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Food.cpp b/Tactical/XML_Food.cpp index fac80524..4840810e 100644 --- a/Tactical/XML_Food.cpp +++ b/Tactical/XML_Food.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Food.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_FoodOpinions.cpp b/Tactical/XML_FoodOpinions.cpp index 8846743b..7c602e47 100644 --- a/Tactical/XML_FoodOpinions.cpp +++ b/Tactical/XML_FoodOpinions.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Food.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_IMPItemChoices.cpp b/Tactical/XML_IMPItemChoices.cpp index fe639f17..f5f79c9e 100644 --- a/Tactical/XML_IMPItemChoices.cpp +++ b/Tactical/XML_IMPItemChoices.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_IncompatibleAttachments.cpp b/Tactical/XML_IncompatibleAttachments.cpp index 65103d78..b73fe408 100644 --- a/Tactical/XML_IncompatibleAttachments.cpp +++ b/Tactical/XML_IncompatibleAttachments.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_InteractiveTiles.cpp b/Tactical/XML_InteractiveTiles.cpp index e7145446..665d43ec 100644 --- a/Tactical/XML_InteractiveTiles.cpp +++ b/Tactical/XML_InteractiveTiles.cpp @@ -6,7 +6,7 @@ #include "sgp.h" #include "Debug Control.h" #include "expat.h" -#include "gamesettings.h" +#include "GameSettings.h" #include "XML.h" #include "FileMan.h" #include "Handle Items.h" diff --git a/Tactical/XML_ItemAdjustments.cpp b/Tactical/XML_ItemAdjustments.cpp index 82ba287a..d528a304 100644 --- a/Tactical/XML_ItemAdjustments.cpp +++ b/Tactical/XML_ItemAdjustments.cpp @@ -1,9 +1,9 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "XML.h" #include "Item Types.h" diff --git a/Tactical/XML_LBEPocket.cpp b/Tactical/XML_LBEPocket.cpp index e4a6cadc..7810eedb 100644 --- a/Tactical/XML_LBEPocket.cpp +++ b/Tactical/XML_LBEPocket.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Launchable.cpp b/Tactical/XML_Launchable.cpp index 26994d2d..40e7c6b9 100644 --- a/Tactical/XML_Launchable.cpp +++ b/Tactical/XML_Launchable.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_LoadBearingEquipment.cpp b/Tactical/XML_LoadBearingEquipment.cpp index f89cb67b..e9135dd2 100644 --- a/Tactical/XML_LoadBearingEquipment.cpp +++ b/Tactical/XML_LoadBearingEquipment.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Magazine.cpp b/Tactical/XML_Magazine.cpp index 5c989920..f2215eb2 100644 --- a/Tactical/XML_Magazine.cpp +++ b/Tactical/XML_Magazine.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_MercStartingGear.cpp b/Tactical/XML_MercStartingGear.cpp index 1713ea75..69ce78e6 100644 --- a/Tactical/XML_MercStartingGear.cpp +++ b/Tactical/XML_MercStartingGear.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Merchants.cpp b/Tactical/XML_Merchants.cpp index b43c32b4..f1c72ce0 100644 --- a/Tactical/XML_Merchants.cpp +++ b/Tactical/XML_Merchants.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Arms Dealer Init.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_Merge.cpp b/Tactical/XML_Merge.cpp index eee7b404..f06064c8 100644 --- a/Tactical/XML_Merge.cpp +++ b/Tactical/XML_Merge.cpp @@ -1,9 +1,9 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "XML.h" struct diff --git a/Tactical/XML_NewFaceGear.cpp b/Tactical/XML_NewFaceGear.cpp index b941e746..4bde7a05 100644 --- a/Tactical/XML_NewFaceGear.cpp +++ b/Tactical/XML_NewFaceGear.cpp @@ -3,7 +3,7 @@ #include "expat.h" #include "XML.h" #include "Interface.h" - #include "Faces.h" + #include "faces.h" struct { diff --git a/Tactical/XML_Opinions.cpp b/Tactical/XML_Opinions.cpp index a82c5fda..9571b7f3 100644 --- a/Tactical/XML_Opinions.cpp +++ b/Tactical/XML_Opinions.cpp @@ -13,7 +13,7 @@ #include "sgp.h" #include "Debug Control.h" #include "expat.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "XML.h" #include "Soldier Profile.h" diff --git a/Tactical/XML_Profiles.cpp b/Tactical/XML_Profiles.cpp index 380fffb1..adce87e4 100644 --- a/Tactical/XML_Profiles.cpp +++ b/Tactical/XML_Profiles.cpp @@ -13,7 +13,7 @@ #include "sgp.h" #include "Debug Control.h" #include "expat.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "XML.h" #include "Soldier Profile.h" #include "Soldier Profile.h" diff --git a/Tactical/XML_RandomItem.cpp b/Tactical/XML_RandomItem.cpp index 335d1096..554d74c6 100644 --- a/Tactical/XML_RandomItem.cpp +++ b/Tactical/XML_RandomItem.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_RandomStats.cpp b/Tactical/XML_RandomStats.cpp index c9489e97..73ee1838 100644 --- a/Tactical/XML_RandomStats.cpp +++ b/Tactical/XML_RandomStats.cpp @@ -6,7 +6,7 @@ #include "soldier profile type.h" #include "Soldier Profile.h" -#include "Random.h" +#include "random.h" struct { diff --git a/Tactical/XML_SectorLoadscreens.cpp b/Tactical/XML_SectorLoadscreens.cpp index 99a11c1b..ed2c1818 100644 --- a/Tactical/XML_SectorLoadscreens.cpp +++ b/Tactical/XML_SectorLoadscreens.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_SpreadPatterns.cpp b/Tactical/XML_SpreadPatterns.cpp index 5d5732aa..7a7f91a2 100644 --- a/Tactical/XML_SpreadPatterns.cpp +++ b/Tactical/XML_SpreadPatterns.cpp @@ -1,34 +1,34 @@ //zilpin: pellet spread patterns externalized in XML #include "sgp.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Event Pump.h" - #include "weapons.h" + #include "Weapons.h" #include "Animation Control.h" #include "Handle UI.h" #include "Isometric Utils.h" #include "math.h" #include "ai.h" - #include "los.h" + #include "LOS.h" #include "renderworld.h" - #include "interface.h" + #include "Interface.h" #include "message.h" - #include "campaign.h" - #include "items.h" - #include "weapons.h" - #include "text.h" + #include "Campaign.h" + #include "Items.h" + #include "Weapons.h" + #include "Text.h" #include "Soldier Profile.h" #include "Dialogue Control.h" #include "SkillCheck.h" #include "Quests.h" - #include "Physics.h" - #include "Random.h" + #include "physics.h" + #include "random.h" #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" + #include "Bullets.h" + #include "Morale.h" #include "SkillCheck.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_StructureConstruct.cpp b/Tactical/XML_StructureConstruct.cpp index 4a8b3188..99584be6 100644 --- a/Tactical/XML_StructureConstruct.cpp +++ b/Tactical/XML_StructureConstruct.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Handle Items.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_StructureDeconstruct.cpp b/Tactical/XML_StructureDeconstruct.cpp index d1128481..7c974d00 100644 --- a/Tactical/XML_StructureDeconstruct.cpp +++ b/Tactical/XML_StructureDeconstruct.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "overhead.h" + #include "Overhead.h" #include "Handle Items.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_Structure_Move.cpp b/Tactical/XML_Structure_Move.cpp index 9d06e558..0a7d6bcd 100644 --- a/Tactical/XML_Structure_Move.cpp +++ b/Tactical/XML_Structure_Move.cpp @@ -1,5 +1,5 @@ #include "sgp.h" -#include "overhead.h" +#include "Overhead.h" #include "Handle Items.h" #include "Debug Control.h" #include "expat.h" diff --git a/Tactical/XML_TonyInventory.cpp b/Tactical/XML_TonyInventory.cpp index 60336809..565a4a5c 100644 --- a/Tactical/XML_TonyInventory.cpp +++ b/Tactical/XML_TonyInventory.cpp @@ -1,6 +1,6 @@ #include "sgp.h" - #include "overhead.h" - #include "weapons.h" + #include "Overhead.h" + #include "Weapons.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" diff --git a/Tactical/XML_Vehicles.cpp b/Tactical/XML_Vehicles.cpp index 73236aec..e40c6d81 100644 --- a/Tactical/XML_Vehicles.cpp +++ b/Tactical/XML_Vehicles.cpp @@ -1,9 +1,9 @@ - #include "sgp.h" - #include "Debug Control.h" - #include "expat.h" - #include "XML.h" - #include "Interface.h" - #include "Vehicles.h" +#include "sgp.h" +#include "Debug Control.h" +#include "expat.h" +#include "XML.h" +#include "Interface.h" +#include "Vehicles.h" struct { diff --git a/Tactical/bullets.cpp b/Tactical/bullets.cpp index 3d1e62a3..9ee2d929 100644 --- a/Tactical/bullets.cpp +++ b/Tactical/bullets.cpp @@ -7,15 +7,15 @@ #include "renderworld.h" #include "vsurface.h" #include "sysutil.h" - #include "wcheck.h" + #include "WCheck.h" #include "video.h" #include "vobject_blitters.h" #include "faces.h" - #include "utilities.h" - #include "overhead.h" + #include "Utilities.h" + #include "Overhead.h" #include "Soldier Profile.h" #include "Bullets.h" - #include "los.h" + #include "LOS.h" #include "worldman.h" #include "random.h" #include "GameSettings.h" diff --git a/Tactical/faces.h b/Tactical/faces.h index 3e374974..aa496ff5 100644 --- a/Tactical/faces.h +++ b/Tactical/faces.h @@ -5,7 +5,7 @@ #define ANGRY 2 #define SURPRISED 3 -#include "soldier control.h" +#include "Soldier Control.h" #include "soldier profile type.h" // Defines diff --git a/Tactical/fov.cpp b/Tactical/fov.cpp index 7aa7bdba..3291992f 100644 --- a/Tactical/fov.cpp +++ b/Tactical/fov.cpp @@ -1,26 +1,26 @@ #include "sgp.h" #include "Isometric Utils.h" #include "worlddef.h" - #include "render fun.h" + #include "Render Fun.h" #include "renderworld.h" - #include "dialogue control.h" - #include "structure wrap.h" - #include "font control.h" - #include "pathai.h" - #include "overhead.h" - #include "smell.h" + #include "Dialogue Control.h" + #include "Structure Wrap.h" + #include "Font Control.h" + #include "PATHAI.H" + #include "Overhead.h" + #include "Smell.h" #include "fov.h" - #include "rotting corpses.h" - #include "keys.h" + #include "Rotting Corpses.h" + #include "Keys.h" #include "english.h" - #include "Random.h" + #include "random.h" #include "input.h" - #include "exit grids.h" + #include "Exit Grids.h" #include "environment.h" #include "worldman.h" #include "Fog Of War.h" - #include "Strategicmap.h" - #include "boxing.h" + #include "strategicmap.h" + #include "Boxing.h" #include "opplist.h" #include "lighting.h" #include "Soldier macros.h" diff --git a/Tactical/fov.h b/Tactical/fov.h index 82b57eff..017af2a8 100644 --- a/Tactical/fov.h +++ b/Tactical/fov.h @@ -1,7 +1,7 @@ #ifndef __FOV_H #define __FOV_H -#include "overhead.h" +#include "Overhead.h" void RevealRoofsAndItems(SOLDIERTYPE *pSoldier, UINT32 itemsToo, BOOLEAN fShowLocators, UINT8 ubLevel, BOOLEAN fForce ); diff --git a/Tactical/interface Dialogue.h b/Tactical/interface Dialogue.h index 9ca78408..ea1e0059 100644 --- a/Tactical/interface Dialogue.h +++ b/Tactical/interface Dialogue.h @@ -3,7 +3,7 @@ #include "mousesystem.h" -#include "npc.h" +#include "NPC.h" extern UINT8 gubSrcSoldierProfile; diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 2b8c8cc0..d0e85f9c 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -1,48 +1,48 @@ #include "sgp.h" //#include "ai.h" #include "Isometric Utils.h" - #include "overhead.h" + #include "Overhead.h" #include "math.h" #include "Event Pump.h" #include "random.h" #include "Overhead Types.h" #include "opplist.h" #include "ai.h" - #include "font control.h" - #include "Animation COntrol.h" - #include "los.h" + #include "Font Control.h" + #include "Animation Control.h" + #include "LOS.h" #include "fov.h" - #include "dialogue control.h" + #include "Dialogue Control.h" #include "lighting.h" #include "environment.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" #include "message.h" - #include "soldier profile.h" + #include "Soldier Profile.h" #include "TeamTurns.h" - #include "interactive tiles.h" - #include "render fun.h" + #include "Interactive Tiles.h" + #include "Render Fun.h" #include "Text.h" - #include "timer control.h" - #include "soldier macros.h" - #include "soldier functions.h" - #include "handle ui.h" + #include "Timer Control.h" + #include "Soldier macros.h" + #include "Soldier Functions.h" + #include "Handle UI.h" #include "Queen Command.h" - #include "keys.h" + #include "Keys.h" #include "Campaign.h" #include "Soldier Init List.h" - #include "music control.h" + #include "Music Control.h" #include "Soldier Profile.h" - #include "Strategicmap.h" + #include "strategicmap.h" #include "Quests.h" - #include "meanwhile.h" - #include "WorldMan.h" + #include "Meanwhile.h" + #include "worldman.h" #include "SkillCheck.h" #include "GameSettings.h" #include "Smell.h" #include "Game Clock.h" - #include "civ quotes.h" + #include "Civ Quotes.h" #include "Sound Control.h" - #include "drugs and alcohol.h" + #include "Drugs And Alcohol.h" #include "Interface.h" #include "Explosion Control.h"//dnl ch40 200909 #include "Vehicles.h" diff --git a/Tactical/soldier profile type.h b/Tactical/soldier profile type.h index e57155ee..5e699edd 100644 --- a/Tactical/soldier profile type.h +++ b/Tactical/soldier profile type.h @@ -1,7 +1,7 @@ #ifndef __SOLDER_PROFILE_TYPE_H #define __SOLDER_PROFILE_TYPE_H -#include "overhead types.h" +#include "Overhead Types.h" #include "Soldier Control.h" #include "mapscreen.h" diff --git a/Tactical/soldier tile.h b/Tactical/soldier tile.h index e20e3232..53d514f1 100644 --- a/Tactical/soldier tile.h +++ b/Tactical/soldier tile.h @@ -1,7 +1,7 @@ #ifndef __SOLDIER_TILE_H #define __SOLDIER_TILE_H -#include "soldier control.h" +#include "Soldier Control.h" #define MOVE_TILE_CLEAR 1 #define MOVE_TILE_TEMP_BLOCKED -1 diff --git a/TacticalAI/AIList.cpp b/TacticalAI/AIList.cpp index fef94af5..e237b992 100644 --- a/TacticalAI/AIList.cpp +++ b/TacticalAI/AIList.cpp @@ -12,7 +12,7 @@ #include "AIList.h" #include "Overhead.h" - #include "debug.h" + #include "DEBUG.H" #include "AIInternals.h" #include "ai.h" #include "opplist.h" diff --git a/TacticalAI/AIList.h b/TacticalAI/AIList.h index d67bfc6d..9d3471cc 100644 --- a/TacticalAI/AIList.h +++ b/TacticalAI/AIList.h @@ -1,4 +1,4 @@ -#include "Types.h" +#include "types.h" typedef struct AILIST { diff --git a/TacticalAI/AIMain.cpp b/TacticalAI/AIMain.cpp index ce032d07..5bdc0624 100644 --- a/TacticalAI/AIMain.cpp +++ b/TacticalAI/AIMain.cpp @@ -1,25 +1,25 @@ #include "sgp.h" #include "ai.h" #include "Isometric Utils.h" -#include "overhead.h" +#include "Overhead.h" #include "math.h" #include "Event Pump.h" #include "Soldier Control.h" #include "Overhead Types.h" #include "opplist.h" -#include "animation control.h" -#include "font control.h" -#include "interface.h" +#include "Animation Control.h" +#include "Font Control.h" +#include "Interface.h" #include "screenids.h" #include "worldman.h" -#include "pathai.h" -#include "points.h" -#include "weapons.h" -#include "items.h" +#include "PATHAI.H" +#include "Points.h" +#include "Weapons.h" +#include "Items.h" #include "Handle Items.h" #include "AIInternals.h" -#include "animation data.h" -#include "los.h" +#include "Animation Data.h" +#include "LOS.h" #include "message.h" #include "TeamTurns.h" #include "NPC.h" @@ -30,7 +30,7 @@ #include "Soldier Create.h" #include "Explosion Control.h" #include "Interactive Tiles.h" -#include "interface dialogue.h" +#include "interface Dialogue.h" #include "Vehicles.h" #include "renderworld.h" #include "AIList.h" @@ -39,13 +39,13 @@ #include "physics.h" #include "GameSettings.h" #include "Debug Control.h" -#include "interface panels.h" +#include "Interface Panels.h" #include "Sound Control.h" -#include "civ quotes.h" +#include "Civ Quotes.h" #include "Quests.h" #include "Campaign Types.h" #include "Queen Command.h" -#include "points.h" +#include "Points.h" #include "Soldier Functions.h" // added by SANDRO #include "Text.h" // sevenfm #include "english.h" // sevenfm: for ESC key diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index e0f53ecc..a7a3821a 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -2,13 +2,13 @@ #include "Weapons.h" #include "opplist.h" #include "Points.h" - #include "PathAI.h" - #include "WorldMan.h" + #include "PATHAI.H" + #include "worldman.h" #include "AIInternals.h" #include "Items.h" #include "message.h" - #include "los.h" - #include "assignments.h" + #include "LOS.h" + #include "Assignments.h" #include "Soldier Functions.h" #include "Points.h" #include "GameSettings.h" @@ -23,7 +23,7 @@ #include "Vehicles.h" // added by silversurfer #include "Game Clock.h" // sevenfm #include "Rotting Corpses.h" // sevenfm - #include "wcheck.h" // sevenfm + #include "WCheck.h" // sevenfm #include "SmokeEffects.h" // sevenfm #include "GameInitOptionsScreen.h" diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index cfea4a61..7e2e6fd9 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -3,11 +3,11 @@ #include "opplist.h" #include "AIInternals.h" #include "LOS.h" -#include "Physics.h" +#include "physics.h" #include "Items.h" #include "Weapons.h" -#include "Spread Burst.h" -#include "overhead.h" +#include "Spread burst.h" +#include "Overhead.h" #include "SkillCheck.h" #include "Soldier Profile.h" #include "Isometric Utils.h" diff --git a/TacticalAI/CreatureDecideAction.cpp b/TacticalAI/CreatureDecideAction.cpp index 94fa1e18..ca0f3688 100644 --- a/TacticalAI/CreatureDecideAction.cpp +++ b/TacticalAI/CreatureDecideAction.cpp @@ -1,11 +1,11 @@ #include "types.h" - //#include "soldier control.h" + //#include "Soldier Control.h" #include "ai.h" #include "AIInternals.h" #include "opplist.h" #include "Items.h" #include "Rotting Corpses.h" - #include "soldier add.h" + #include "Soldier Add.h" //forward declarations of common classes to eliminate includes class OBJECTTYPE; diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index 624ccb40..5f6216ea 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -1,32 +1,32 @@ #include "ai.h" #include "AIInternals.h" -#include "Isometric utils.h" +#include "Isometric Utils.h" #include "Points.h" -#include "overhead.h" +#include "Overhead.h" #include "opplist.h" -#include "items.h" +#include "Items.h" #include "Weapons.h" #include "NPC.h" #include "Soldier Functions.h" #include "worldman.h" #include "Scheduling.h" -#include "Message.h" +#include "message.h" #include "Structure Wrap.h" #include "Keys.h" -#include "pathai.h" +#include "PATHAI.H" #include "Render Fun.h" #include "Boxing.h" // #include "Air Raid.h" #include "Soldier Profile.h" #include "soldier profile type.h" #include "Soldier macros.h" -#include "los.h" +#include "LOS.h" #include "Buildings.h" #include "strategicmap.h" #include "Quests.h" #include "Map Screen Interface Map.h" -#include "soldier ani.h" -#include "rotting corpses.h" +#include "Soldier Ani.h" +#include "Rotting Corpses.h" #include "GameSettings.h" #include "Dialogue Control.h" #include "connect.h" diff --git a/TacticalAI/FindLocations.cpp b/TacticalAI/FindLocations.cpp index 3c9ab556..ac2634fc 100644 --- a/TacticalAI/FindLocations.cpp +++ b/TacticalAI/FindLocations.cpp @@ -2,11 +2,11 @@ #include "Isometric Utils.h" #include "ai.h" #include "AIInternals.h" - #include "los.h" + #include "LOS.h" #include "Weapons.h" - #include "Opplist.h" - #include "pathai.h" - #include "items.h" + #include "opplist.h" + #include "PATHAI.H" + #include "Items.h" #include "World Items.h" #include "Points.h" #include "message.h" @@ -26,7 +26,7 @@ #include "Buildings.h" #include "GameSettings.h" #include "Soldier Profile.h" - #include "rotting corpses.h" // sevenfm + #include "Rotting Corpses.h" // sevenfm //////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/TacticalAI/Knowledge.cpp b/TacticalAI/Knowledge.cpp index c6e93a1f..12077332 100644 --- a/TacticalAI/Knowledge.cpp +++ b/TacticalAI/Knowledge.cpp @@ -2,7 +2,7 @@ #include "AIInternals.h" #include "opplist.h" #include "Soldier Profile.h" - #include "los.h" + #include "LOS.h" #include "NPC.h" #include "Quests.h" #include "Render Fun.h" diff --git a/TacticalAI/Medical.cpp b/TacticalAI/Medical.cpp index 41b89672..d54bc0c7 100644 --- a/TacticalAI/Medical.cpp +++ b/TacticalAI/Medical.cpp @@ -4,10 +4,10 @@ #include "ai.h" #include "AIInternals.h" #include "Animation Control.h" - #include "pathai.h" - #include "overhead.h" - #include "items.h" - #include "Message.h" + #include "PATHAI.H" + #include "Overhead.h" + #include "Items.h" + #include "message.h" #include "Buildings.h" #include "worldman.h" #include "Assignments.h" diff --git a/TacticalAI/Movement.cpp b/TacticalAI/Movement.cpp index 5bc4b0a9..a1137120 100644 --- a/TacticalAI/Movement.cpp +++ b/TacticalAI/Movement.cpp @@ -1,10 +1,10 @@ #include "ai.h" #include "AIInternals.h" #include "Isometric Utils.h" - #include "overhead.h" + #include "Overhead.h" #include "worldman.h" - #include "pathai.h" - //#include "points.h" + #include "PATHAI.H" + //#include "Points.h" #include "message.h" #include "Smell.h" #include "mapscreen.h" diff --git a/TacticalAI/NPC.cpp b/TacticalAI/NPC.cpp index 84702a01..eab9cb7a 100644 --- a/TacticalAI/NPC.cpp +++ b/TacticalAI/NPC.cpp @@ -1,28 +1,28 @@ #include "types.h" - #include "wcheck.h" - #include "overhead.h" + #include "WCheck.h" + #include "Overhead.h" #include "ai.h" #include "Soldier Profile.h" #include "NPC.h" #include "Isometric Utils.h" #include "Quests.h" - #include "interface dialogue.h" + #include "interface Dialogue.h" #include "Game Clock.h" #include "FileMan.h" - #include "Random.h" - #include "items.h" - #include "interface.h" + #include "random.h" + #include "Items.h" + #include "Interface.h" #include "Assignments.h" - #include "soldier macros.h" - #include "dialogue control.h" + #include "Soldier macros.h" + #include "Dialogue Control.h" #include "Strategic Town Loyalty.h" #include "message.h" #include "Timer Control.h" #include "Soldier Add.h" - #include "Soldier Tile.h" + #include "soldier tile.h" #include "Weapons.h" - #include "meanwhile.h" + #include "Meanwhile.h" #ifdef JA2TESTVERSION #include "Quest Debug System.h" diff --git a/TacticalAI/PanicButtons.cpp b/TacticalAI/PanicButtons.cpp index 03c54f3f..5aa40f8a 100644 --- a/TacticalAI/PanicButtons.cpp +++ b/TacticalAI/PanicButtons.cpp @@ -1,7 +1,7 @@ #include "AIInternals.h" #include "ai.h" - #include "pathai.h" - #include "items.h" + #include "PATHAI.H" + #include "Items.h" #include "World Items.h" #include "strategicmap.h" #include "Map Screen Interface Map.h" diff --git a/TacticalAI/QuestDebug.cpp b/TacticalAI/QuestDebug.cpp index 046991f3..799e68d2 100644 --- a/TacticalAI/QuestDebug.cpp +++ b/TacticalAI/QuestDebug.cpp @@ -2,8 +2,8 @@ #include "QuestDebug.h" #include "stdarg.h" #include "stdio.h" - #include "Debug.h" - #include "Message.h" + #include "DEBUG.H" + #include "message.h" #define QUEST_DEBUG_FILE "QuestDebug.txt" diff --git a/TacticalAI/Realtime.cpp b/TacticalAI/Realtime.cpp index 0ec6254f..3f18bdc2 100644 --- a/TacticalAI/Realtime.cpp +++ b/TacticalAI/Realtime.cpp @@ -1,12 +1,12 @@ #include "ai.h" #include "AIInternals.h" - #include "Isometric utils.h" - #include "overhead.h" - #include "soldier add.h" - #include "Soldier Profile Type.h" + #include "Isometric Utils.h" + #include "Overhead.h" + #include "Soldier Add.h" + #include "soldier profile type.h" #include "Items.h" #include "Weapons.h" - #include "Soldier Macros.h" + #include "Soldier macros.h" #include "Soldier Profile.h" #include "NPC.h" #include "Render Fun.h" diff --git a/TacticalAI/ZombieDecideAction.cpp b/TacticalAI/ZombieDecideAction.cpp index 16c7f321..a2dd3275 100644 --- a/TacticalAI/ZombieDecideAction.cpp +++ b/TacticalAI/ZombieDecideAction.cpp @@ -1,32 +1,32 @@ #include "ai.h" #include "AIInternals.h" -#include "Isometric utils.h" +#include "Isometric Utils.h" #include "Points.h" -#include "overhead.h" +#include "Overhead.h" #include "opplist.h" -#include "items.h" +#include "Items.h" #include "Weapons.h" #include "NPC.h" #include "Soldier Functions.h" #include "worldman.h" #include "Scheduling.h" -#include "Message.h" +#include "message.h" #include "Structure Wrap.h" #include "Keys.h" -#include "pathai.h" +#include "PATHAI.H" #include "Render Fun.h" #include "Boxing.h" // #include "Air Raid.h" #include "Soldier Profile.h" #include "soldier profile type.h" #include "Soldier macros.h" -#include "los.h" +#include "LOS.h" #include "Buildings.h" #include "strategicmap.h" #include "Quests.h" #include "Map Screen Interface Map.h" -#include "soldier ani.h" -#include "rotting corpses.h" +#include "Soldier Ani.h" +#include "Rotting Corpses.h" #include "GameSettings.h" #include "Dialogue Control.h" #include "connect.h" diff --git a/TileEngine/Ambient Control.cpp b/TileEngine/Ambient Control.cpp index cf42114a..85d559d4 100644 --- a/TileEngine/Ambient Control.cpp +++ b/TileEngine/Ambient Control.cpp @@ -4,13 +4,13 @@ #include "Sound Control.h" #include "Game Events.h" #include "lighting.h" - #include "Random.h" + #include "random.h" // sevenfm #include "SmokeEffects.h" #include "Overhead.h" #include "Strategic Movement.h" #include "Game Clock.h" - #include "strategic mines.h" + #include "Strategic Mines.h" AMBIENTDATA_STRUCT gAmbData[ MAX_AMBIENT_SOUNDS ]; INT16 gsNumAmbData = 0; diff --git a/TileEngine/Ambient Control.h b/TileEngine/Ambient Control.h index 01035d22..90997d51 100644 --- a/TileEngine/Ambient Control.h +++ b/TileEngine/Ambient Control.h @@ -3,7 +3,7 @@ #include "sgp.h" -#include "Ambient types.h" +#include "Ambient Types.h" BOOLEAN LoadAmbientControlFile( UINT8 ubAmbientID ); diff --git a/TileEngine/Buildings.cpp b/TileEngine/Buildings.cpp index dfcaa7c8..feb3264a 100644 --- a/TileEngine/Buildings.cpp +++ b/TileEngine/Buildings.cpp @@ -1,6 +1,6 @@ - #include "Types.h" + #include "types.h" #include "Buildings.h" - #include "Pathai.h" + #include "PATHAI.H" #include "Structure Wrap.h" #include "Render Fun.h" #include "worldman.h" diff --git a/TileEngine/Exit Grids.cpp b/TileEngine/Exit Grids.cpp index 036b48d5..78feb292 100644 --- a/TileEngine/Exit Grids.cpp +++ b/TileEngine/Exit Grids.cpp @@ -1,12 +1,12 @@ - #include "debug.h" + #include "DEBUG.H" #include "worlddef.h" #include "worldman.h" #include "Exit Grids.h" #include "Editor Undo.h" - #include "StrategicMap.h" + #include "strategicmap.h" #include "Strategic Movement.h" #include "message.h" - #include "pathai.h" + #include "PATHAI.H" #include "Animation Control.h" #include "Sys Globals.h" #include "SaveLoadMap.h" diff --git a/TileEngine/Exit Grids.h b/TileEngine/Exit Grids.h index 0b8a4362..4e13524a 100644 --- a/TileEngine/Exit Grids.h +++ b/TileEngine/Exit Grids.h @@ -1,7 +1,7 @@ #ifndef __EXIT_GRIDS_H #define __EXIT_GRIDS_H -#include "Worlddef.h" +#include "worlddef.h" //dnl ch42 250909 typedef struct diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index d1281de3..abd00f0e 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -1,43 +1,43 @@ #include "builddefines.h" -#include "debug.h" -#include "weapons.h" +#include "DEBUG.H" +#include "Weapons.h" #include "worldman.h" -#include "game clock.h" +#include "Game Clock.h" #include "renderworld.h" -#include "explosion control.h" -#include "sound control.h" -#include "structure wrap.h" -#include "interactive tiles.h" +#include "Explosion Control.h" +#include "Sound Control.h" +#include "Structure Wrap.h" +#include "Interactive Tiles.h" #include "SaveLoadMap.h" -#include "Message.h" -#include "Random.h" -#include "smokeeffects.h" -#include "pathai.h" +#include "message.h" +#include "random.h" +#include "SmokeEffects.h" +#include "PATHAI.H" #include "strategic.h" #include "Action Items.h" -#include "Interface Dialogue.h" +#include "interface Dialogue.h" #include "LightEffects.h" -#include "AI.h" -#include "Soldier tile.h" +#include "ai.h" +#include "soldier tile.h" #include "Render Fun.h" -#include "Opplist.h" -#include "smell.h" -#include "end game.h" +#include "opplist.h" +#include "Smell.h" +#include "End Game.h" #include "Buildings.h" #include "fov.h" #include "Map Information.h" #include "Soldier Functions.h"//dnl ch40 200909 #include "Text.h" // added by SANDRO -#include "campaign.h" // yet another one added +#include "Campaign.h" // yet another one added #include "CampaignStats.h" // added by Flugente #include "Points.h" // added by Flugente #include "Interface Control.h" // added by Flugente for DrawExplosionWarning(...) #include "SkillMenu.h" -#include "Soldier Macros.h" +#include "Soldier macros.h" #include "connect.h" -#include "debug control.h" +#include "Debug Control.h" #include "LuaInitNPCs.h" #include "Luaglobal.h" diff --git a/TileEngine/Interactive Tiles.cpp b/TileEngine/Interactive Tiles.cpp index 550df2ae..02741379 100644 --- a/TileEngine/Interactive Tiles.cpp +++ b/TileEngine/Interactive Tiles.cpp @@ -4,13 +4,13 @@ #include "renderworld.h" #include "Sound Control.h" #include "Interactive Tiles.h" - #include "interface cursors.h" + #include "Interface Cursors.h" #include "worldman.h" - #include "points.h" - #include "structure wrap.h" - #include "tile animation.h" - #include "tile cache.h" - #include "handle doors.h" + #include "Points.h" + #include "Structure Wrap.h" + #include "Tile Animation.h" + #include "Tile Cache.h" + #include "Handle Doors.h" #include "Dialogue Control.h" #include "english.h" #include "NPC.h" diff --git a/TileEngine/Isometric Utils.cpp b/TileEngine/Isometric Utils.cpp index 51d8a986..bde2e369 100644 --- a/TileEngine/Isometric Utils.cpp +++ b/TileEngine/Isometric Utils.cpp @@ -1,14 +1,14 @@ - #include "debug.h" + #include "DEBUG.H" #include "renderworld.h" - #include "interface.h" + #include "Interface.h" #include "worldman.h" #include "Structure Wrap.h" - #include "sys globals.h" - #include "overhead.h" - #include "Random.h" - #include "Pathai.h" + #include "Sys Globals.h" + #include "Overhead.h" + #include "random.h" + #include "PATHAI.H" #include "Map Information.h" -#include "meanwhile.h" +#include "Meanwhile.h" #include "strategicmap.h" UINT32 guiForceRefreshMousePositionCalculation = 0; diff --git a/TileEngine/LightEffects.cpp b/TileEngine/LightEffects.cpp index dcbb1574..339d44d2 100644 --- a/TileEngine/LightEffects.cpp +++ b/TileEngine/LightEffects.cpp @@ -1,9 +1,9 @@ #include "builddefines.h" - #include "debug.h" - #include "animation control.h" - #include "lighteffects.h" - #include "isometric utils.h" + #include "DEBUG.H" + #include "Animation Control.h" + #include "LightEffects.h" + #include "Isometric Utils.h" #include "lighting.h" #include "Game Clock.h" #include "opplist.h" diff --git a/TileEngine/Map Edgepoints.cpp b/TileEngine/Map Edgepoints.cpp index 42106638..ef365584 100644 --- a/TileEngine/Map Edgepoints.cpp +++ b/TileEngine/Map Edgepoints.cpp @@ -1,11 +1,11 @@ //#include // added by Flugente #include "Map Edgepoints.h" - #include "pathai.h" + #include "PATHAI.H" #include "ai.h" #include "Map Information.h" - #include "debug.h" - #include "Random.h" + #include "DEBUG.H" + #include "random.h" #include "Animation Control.h" #include "Render Fun.h" #include "strategicmap.h" diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index 12877324..b59f6c67 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -6,8 +6,8 @@ #include "line.h" #include "renderworld.h" #include "lighting.h" - #include "wcheck.h" - #include "render dirty.h" + #include "WCheck.h" + #include "Render Dirty.h" #include "overhead map.h" #include "Squads.h" #include "Text.h" diff --git a/TileEngine/Render Dirty.cpp b/TileEngine/Render Dirty.cpp index 8fb82dad..0b7be536 100644 --- a/TileEngine/Render Dirty.cpp +++ b/TileEngine/Render Dirty.cpp @@ -6,7 +6,7 @@ #include "vobject_blitters.h" #ifdef JA2BETAVERSION -#include "Message.h" +#include "message.h" #endif // Forward Declarations diff --git a/TileEngine/Render Fun.cpp b/TileEngine/Render Fun.cpp index e2ecd20c..b265f8ed 100644 --- a/TileEngine/Render Fun.cpp +++ b/TileEngine/Render Fun.cpp @@ -1,13 +1,13 @@ #include "Render Fun.h" #include "sysutil.h" - #include "debug.h" + #include "DEBUG.H" #include "worldman.h" #include "Isometric Utils.h" #include "renderworld.h" #include "fov.h" #include "Fog Of War.h" - #include "dialogue control.h" - #include "Random.h" + #include "Dialogue Control.h" + #include "random.h" // Room Information //UINT8 gubWorldRoomInfo[ WORLD_MAX ]; diff --git a/TileEngine/SaveLoadMap.cpp b/TileEngine/SaveLoadMap.cpp index 3ca80d74..0a26d77b 100644 --- a/TileEngine/SaveLoadMap.cpp +++ b/TileEngine/SaveLoadMap.cpp @@ -1,18 +1,18 @@ - #include "Types.h" + #include "types.h" #include "SaveLoadMap.h" - #include "OverHead.h" + #include "Overhead.h" #include "FileMan.h" #include "Tactical Save.h" - #include "Debug.h" - #include "WorldMan.h" - #include "StrategicMap.h" + #include "DEBUG.H" + #include "worldman.h" + #include "strategicmap.h" #include "Campaign Types.h" - #include "RenderWorld.h" + #include "renderworld.h" #include "Render Fun.h" #include "fov.h" - #include "WorldDef.h" + #include "worlddef.h" #include "Exit Grids.h" - #include "Message.h" + #include "message.h" #include "GameSettings.h" #include "Smell.h" diff --git a/TileEngine/SaveLoadMap.h b/TileEngine/SaveLoadMap.h index ff48d158..9e019c27 100644 --- a/TileEngine/SaveLoadMap.h +++ b/TileEngine/SaveLoadMap.h @@ -1,7 +1,7 @@ #ifndef _SAVELOADMAP__H_ #define _SAVELOADMAP__H_ -#include "WorldDef.h" +#include "worlddef.h" #include "Exit Grids.h" //Used for the ubType in the MODIFY_MAP struct diff --git a/TileEngine/Shade Table Util.cpp b/TileEngine/Shade Table Util.cpp index b2345f4f..6827c3c7 100644 --- a/TileEngine/Shade Table Util.cpp +++ b/TileEngine/Shade Table Util.cpp @@ -6,7 +6,7 @@ #include "Shade Table Util.h" #include "video.h" #include "WorldDat.h" - #include "Fileman.h" + #include "FileMan.h" #include diff --git a/TileEngine/Smell.cpp b/TileEngine/Smell.cpp index 45f75140..2d7d7621 100644 --- a/TileEngine/Smell.cpp +++ b/TileEngine/Smell.cpp @@ -1,16 +1,16 @@ #include "worlddef.h" - #include "Random.h" + #include "random.h" #include "Smell.h" #include "worldman.h" #include "renderworld.h" #include "SaveLoadMap.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "message.h" - #include "Isometric utils.h" + #include "Isometric Utils.h" #include "Map Information.h" #include "Game Clock.h" #include "Overhead.h" - #include "debug control.h" + #include "Debug Control.h" /* * Smell & Blood system diff --git a/TileEngine/Smell.h b/TileEngine/Smell.h index c4bbfb34..1e16571e 100644 --- a/TileEngine/Smell.h +++ b/TileEngine/Smell.h @@ -1,4 +1,4 @@ -#include "soldier control.h" +#include "Soldier Control.h" #define HUMAN 0 #define CREATURE_ON_FLOOR 0x01 diff --git a/TileEngine/SmokeEffects.cpp b/TileEngine/SmokeEffects.cpp index 4e202318..2f3de897 100644 --- a/TileEngine/SmokeEffects.cpp +++ b/TileEngine/SmokeEffects.cpp @@ -3,20 +3,20 @@ #include #include #include "stdlib.h" - #include "debug.h" - #include "weapons.h" + #include "DEBUG.H" + #include "Weapons.h" #include "handle items.h" #include "worlddef.h" #include "worldman.h" - #include "animation control.h" - #include "tile animation.h" + #include "Animation Control.h" + #include "Tile Animation.h" #include "handle items.h" - #include "smokeeffects.h" + #include "SmokeEffects.h" #include "message.h" - #include "isometric utils.h" + #include "Isometric Utils.h" #include "renderworld.h" - #include "explosion control.h" - #include "Random.h" + #include "Explosion Control.h" + #include "random.h" #include "Game Clock.h" #include "opplist.h" #include "Campaign Types.h" @@ -27,7 +27,7 @@ #include "Render Fun.h" #include "SaveLoadGame.h" -#include "debug control.h" +#include "Debug Control.h" #include "connect.h" diff --git a/TileEngine/Tactical Placement GUI.cpp b/TileEngine/Tactical Placement GUI.cpp index 7b6c1daa..d4c85236 100644 --- a/TileEngine/Tactical Placement GUI.cpp +++ b/TileEngine/Tactical Placement GUI.cpp @@ -4,17 +4,17 @@ //sgp #include "english.h" - #include "debug.h" + #include "DEBUG.H" #include "video.h" #include "vobject_blitters.h" #include "line.h" //ja2 #include "Tactical Placement GUI.h" - #include "Overhead Map.h" + #include "overhead map.h" #include "strategicmap.h" #include "Interface.h" - #include "overhead.h" + #include "Overhead.h" #include "Render Dirty.h" #include "sysutil.h" #include "PreBattle Interface.h" @@ -24,10 +24,10 @@ #include "message.h" #include "Map Information.h" #include "Soldier Add.h" - #include "cursors.h" + #include "Cursors.h" #include "Cursor Control.h" #include "MessageBoxScreen.h" - #include "text.h" + #include "Text.h" #include "WordWrap.h" #include "Game Clock.h" #include "Isometric Utils.h" diff --git a/TileEngine/Tile Animation.cpp b/TileEngine/Tile Animation.cpp index 266bd856..339c7770 100644 --- a/TileEngine/Tile Animation.cpp +++ b/TileEngine/Tile Animation.cpp @@ -1,16 +1,16 @@ #include "worlddef.h" -#include "tile animation.h" -#include "debug.h" +#include "Tile Animation.h" +#include "DEBUG.H" #include "worldman.h" #include "lighting.h" #include "renderworld.h" -#include "overhead.h" +#include "Overhead.h" #include "ai.h" #include "Sound Control.h" -#include "tile cache.h" -#include "explosion control.h" +#include "Tile Cache.h" +#include "Explosion Control.h" #include "Keys.h" -#include "bullets.h" +#include "Bullets.h" #include "LightEffects.h" #include "SmokeEffects.h" diff --git a/TileEngine/Tile Cache.cpp b/TileEngine/Tile Cache.cpp index ae94e395..ee8f4dd5 100644 --- a/TileEngine/Tile Cache.cpp +++ b/TileEngine/Tile Cache.cpp @@ -1,11 +1,11 @@ #include "builddefines.h" - #include "debug.h" + #include "DEBUG.H" #include "Debug Control.h" - #include "tile surface.h" - #include "tile cache.h" + #include "Tile Surface.h" + #include "Tile Cache.h" #ifdef JA2TESTVERSION - #include "sys globals.h" + #include "Sys Globals.h" #endif UINT32 guiNumTileCacheStructs = 0; diff --git a/TileEngine/Tile Surface.cpp b/TileEngine/Tile Surface.cpp index 9f14fcec..4cbb2062 100644 --- a/TileEngine/Tile Surface.cpp +++ b/TileEngine/Tile Surface.cpp @@ -1,7 +1,7 @@ #include "builddefines.h" - #include "debug.h" - #include "sys globals.h" + #include "DEBUG.H" + #include "Sys Globals.h" #include "XML.h" diff --git a/TileEngine/WorldDat.cpp b/TileEngine/WorldDat.cpp index 92b1b204..e1290a2d 100644 --- a/TileEngine/WorldDat.cpp +++ b/TileEngine/WorldDat.cpp @@ -1,9 +1,9 @@ #include "builddefines.h" - #include "worlddat.h" - #include "sys globals.h" - #include "tile surface.h" - #include "Debug.h" + #include "WorldDat.h" + #include "Sys Globals.h" + #include "Tile Surface.h" + #include "DEBUG.H" #include #include diff --git a/TileEngine/WorldDat.h b/TileEngine/WorldDat.h index 5d020aa2..dfb0ed7c 100644 --- a/TileEngine/WorldDat.h +++ b/TileEngine/WorldDat.h @@ -2,7 +2,7 @@ #define WORLD_DAT_H #include "types.h" -#include "tiledat.h" +#include "TileDat.h" #include "World Tileset Enums.h" typedef void (*TILESET_CALLBACK)( void ); diff --git a/TileEngine/XML_ExplosionData.cpp b/TileEngine/XML_ExplosionData.cpp index 5d3218df..d0203215 100644 --- a/TileEngine/XML_ExplosionData.cpp +++ b/TileEngine/XML_ExplosionData.cpp @@ -3,8 +3,8 @@ #include #include - #include "explosion control.h" - #include "Debug.h" + #include "Explosion Control.h" + #include "DEBUG.H" #include "FileMan.h" #include "Debug Control.h" diff --git a/TileEngine/environment.cpp b/TileEngine/environment.cpp index ad04fdc9..a4cb9540 100644 --- a/TileEngine/environment.cpp +++ b/TileEngine/environment.cpp @@ -2,13 +2,13 @@ #include "environment.h" #include "renderworld.h" #include "Sound Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Game Clock.h" #include "Ambient Control.h" #include "Game Events.h" #include "message.h" #include "opplist.h" - #include "Random.h" + #include "random.h" #include "Points.h" // added by Flugente #include "Campaign.h" // added by Flugente #include "Isometric Utils.h" // added by Flugente diff --git a/TileEngine/lighting.cpp b/TileEngine/lighting.cpp index f7652598..edb1b6c5 100644 --- a/TileEngine/lighting.cpp +++ b/TileEngine/lighting.cpp @@ -19,14 +19,14 @@ #include "worlddef.h" #include "renderworld.h" #include "sysutil.h" - #include "debug.h" - #include "wcheck.h" + #include "DEBUG.H" + #include "WCheck.h" #include "Animation Control.h" #include "Sys Globals.h" #include "lighting.h" - #include "structure wrap.h" + #include "Structure Wrap.h" #include "Shade Table Util.h" - #include "rotting corpses.h" + #include "Rotting Corpses.h" #include "PATHAI.H" #define LVL1_L1_PER (50) diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index b2f7e8e7..58ca53fc 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -1,21 +1,21 @@ #include "builddefines.h" #include "sysutil.h" - #include "utilities.h" + #include "Utilities.h" #include "renderworld.h" #include "vobject_blitters.h" #include "overhead map.h" - #include "interface control.h" - #include "overhead.h" - #include "radar screen.h" - #include "cursors.h" + #include "Interface Control.h" + #include "Overhead.h" + #include "Radar Screen.h" + #include "Cursors.h" #include "Sys Globals.h" - #include "render dirty.h" + #include "Render Dirty.h" #include "Game Clock.h" - #include "interface panels.h" + #include "Interface Panels.h" #include "english.h" #include "line.h" - #include "map information.h" + #include "Map Information.h" #include "Tactical Placement GUI.h" #include "Interactive Tiles.h" #include "gameloop.h" diff --git a/TileEngine/physics.cpp b/TileEngine/physics.cpp index 138e4b09..3d0c699a 100644 --- a/TileEngine/physics.cpp +++ b/TileEngine/physics.cpp @@ -1,20 +1,20 @@ #include "builddefines.h" #include "physics.h" - #include "wcheck.h" - #include "isometric utils.h" + #include "WCheck.h" + #include "Isometric Utils.h" #include "worldman.h" #include "Sound Control.h" - #include "interface.h" - #include "interface items.h" - #include "explosion control.h" + #include "Interface.h" + #include "Interface Items.h" + #include "Explosion Control.h" #include "Debug Control.h" #include "message.h" - #include "structure wrap.h" - #include "animation control.h" - #include "text.h" - #include "Random.h" - #include "lighteffects.h" + #include "Structure Wrap.h" + #include "Animation Control.h" + #include "Text.h" + #include "random.h" + #include "LightEffects.h" #include "opplist.h" #include "Buildings.h" #include "Dialogue Control.h" // added by Flugente diff --git a/TileEngine/pits.cpp b/TileEngine/pits.cpp index 59478dc6..9ce43311 100644 --- a/TileEngine/pits.cpp +++ b/TileEngine/pits.cpp @@ -8,7 +8,7 @@ #include "strategicmap.h" #include "Isometric Utils.h" #include "Sound Control.h" - #include "animation control.h" + #include "Animation Control.h" #include "strategic.h" #include "Action Items.h" diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index ce88dc76..3655e409 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -7,17 +7,17 @@ #include "renderworld.h" #include "sysutil.h" #include "vobject_blitters.h" - #include "debug.h" - #include "wcheck.h" + #include "DEBUG.H" + #include "WCheck.h" #include "worldman.h" #include "Radar Screen.h" #include "Render Dirty.h" #include "ai.h" - #include "render fun.h" - #include "interactive tiles.h" - #include "tile cache.h" - #include "English.h" - #include "interface control.h" + #include "Render Fun.h" + #include "Interactive Tiles.h" + #include "Tile Cache.h" + #include "english.h" + #include "Interface Control.h" #include "Sound Control.h" #include "LogicalBodyTypes/Layers.h" #include "LogicalBodyTypes/BodyTypeDB.h" diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index 296d0859..445e5ec3 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1,7 +1,7 @@ #include #include "types.h" - #include "wcheck.h" - #include "debug.h" + #include "WCheck.h" + #include "DEBUG.H" #include "FileMan.h" #include "MemMan.h" #include "structure.h" @@ -9,12 +9,12 @@ #include "worlddef.h" #include "worldman.h" - #include "interface.h" + #include "Interface.h" - #include "isometric utils.h" - #include "font.h" - #include "font control.h" - #include "los.h" + #include "Isometric Utils.h" + #include "Font.h" + #include "Font Control.h" + #include "LOS.h" #include "lighting.h" #include "Smell.h" @@ -29,12 +29,12 @@ #include "Editor Undo.h" //for access to AddToUndoList( iMapIndex ) #endif - #include "explosion control.h" + #include "Explosion Control.h" #include "Sound Control.h" #include "Buildings.h" - #include "Random.h" + #include "random.h" #include "Tile Animation.h" #include "Explosion Control.h" // added by Flugente diff --git a/TileEngine/structure.h b/TileEngine/structure.h index a5bf6bd5..69148ab9 100644 --- a/TileEngine/structure.h +++ b/TileEngine/structure.h @@ -3,7 +3,7 @@ #include "Structure Internals.h" #include "tiledef.h" -#include "overhead types.h" +#include "Overhead Types.h" #define NOTHING_BLOCKING 0 #define BLOCKING_REDUCE_RANGE 1 diff --git a/TileEngine/sysutil.cpp b/TileEngine/sysutil.cpp index e3090125..d49c8916 100644 --- a/TileEngine/sysutil.cpp +++ b/TileEngine/sysutil.cpp @@ -1,5 +1,5 @@ #include "sgp.h" - #include "wcheck.h" + #include "WCheck.h" #include "sysutil.h" UINT32 guiBOTTOMPANEL = 0; diff --git a/TileEngine/sysutil.h b/TileEngine/sysutil.h index 5b460d63..eeaba608 100644 --- a/TileEngine/sysutil.h +++ b/TileEngine/sysutil.h @@ -1,9 +1,9 @@ #ifndef __SYSTEM_UTILS #define __SYSTEM_UTILS -#include "font.h" +#include "Font.h" #include "Isometric Utils.h" -#include "interface.h" +#include "Interface.h" // Global variables for video objects extern UINT32 guiBOTTOMPANEL; diff --git a/TileEngine/tiledef.cpp b/TileEngine/tiledef.cpp index 26ca0d4c..1820cb03 100644 --- a/TileEngine/tiledef.cpp +++ b/TileEngine/tiledef.cpp @@ -1,11 +1,11 @@ #include "tiledef.h" #include "worlddef.h" - #include "wcheck.h" - #include "debug.h" + #include "WCheck.h" + #include "DEBUG.H" #include "worldman.h" #include "edit_sys.h" - #include "pathai.h" - #include "tile surface.h" + #include "PATHAI.H" + #include "Tile Surface.h" #include "Tactical Save.h" //#include "editscreen.h" diff --git a/TileEngine/worlddef.cpp b/TileEngine/worlddef.cpp index a1fc4b44..36c85844 100644 --- a/TileEngine/worlddef.cpp +++ b/TileEngine/worlddef.cpp @@ -1,26 +1,26 @@ #include "builddefines.h" #include "worlddef.h" - #include "worlddat.h" - #include "wcheck.h" - #include "debug.h" + #include "WorldDat.h" + #include "WCheck.h" + #include "DEBUG.H" #include "worldman.h" - #include "sys globals.h" + #include "Sys Globals.h" #include "Render Fun.h" #include "lighting.h" #include "Interactive Tiles.h" - #include "utilities.h" - #include "overhead.h" + #include "Utilities.h" + #include "Overhead.h" #include "opplist.h" #include "renderworld.h" #include "Radar Screen.h" #include "Exit Grids.h" - #include "tile surface.h" - #include "rotting corpses.h" + #include "Tile Surface.h" + #include "Rotting Corpses.h" #include "Keys.h" #include "Map Information.h" #include "Animated ProgressBar.h" - #include "pathai.h" + #include "PATHAI.H" #include "EditorBuildings.h" #include "Map Edgepoints.h" #include "Shade Table Util.h" @@ -34,13 +34,13 @@ #include "overhead map.h" #include "SmokeEffects.h" #include "LightEffects.h" - #include "meanwhile.h" + #include "Meanwhile.h" #include "LoadScreen.h"//dnl ch30 150909 #include "Interface Cursors.h" #include "Simple Render Utils.h"//dnl ch54 111009 #include "Interface.h" ///ddd - #include "gamesettings.h" + #include "GameSettings.h" #include "editscreen.h" #include "Editor Taskbar Utils.h" diff --git a/TileEngine/worldman.cpp b/TileEngine/worldman.cpp index 6f869e30..ca2c44b4 100644 --- a/TileEngine/worldman.cpp +++ b/TileEngine/worldman.cpp @@ -1,13 +1,13 @@ #include "worlddef.h" #include "worldman.h" - #include "wcheck.h" - #include "debug.h" + #include "WCheck.h" + #include "DEBUG.H" #include "lighting.h" #include "renderworld.h" #include "ai.h" - #include "animation control.h" + #include "Animation Control.h" #include "message.h" - #include "tile cache.h" + #include "Tile Cache.h" #include "SaveLoadMap.h" #include "random.h" // sevenfm diff --git a/Utils/Animated ProgressBar.cpp b/Utils/Animated ProgressBar.cpp index 5cdfa0ab..97de4a38 100644 --- a/Utils/Animated ProgressBar.cpp +++ b/Utils/Animated ProgressBar.cpp @@ -1,18 +1,18 @@ #include "types.h" #include "Animated ProgressBar.h" #include "MemMan.h" - #include "debug.h" + #include "DEBUG.H" #include "Font Control.h" #include "vsurface.h" #include "video.h" #include "Render Dirty.h" - #include "music control.h" + #include "Music Control.h" #include "Timer Control.h" #include "sysutil.h" #include "random.h" #include "math.h" #include "WordWrap.h" - #include "Message.h" + #include "message.h" #include "Text.h" #include "Loading Screen.h" diff --git a/Utils/Cinematics Bink.cpp b/Utils/Cinematics Bink.cpp index 4393c13b..a6eecf20 100644 --- a/Utils/Cinematics Bink.cpp +++ b/Utils/Cinematics Bink.cpp @@ -1,4 +1,4 @@ -#include "Types.h" +#include "types.h" #include #include #include @@ -8,15 +8,15 @@ #include #include -#include "Debug.h" +#include "DEBUG.H" #include "FileMan.h" -#include "smack.h" -#include "DDraw.h" -#include "mss.h" +#include "SMACK.H" +#include "ddraw.h" +#include "Mss.h" #include "DirectX Common.h" #include "DirectDraw Calls.h" -#include "SoundMan.h" -#include "Video.h" +#include "soundman.h" +#include "video.h" #include "Cinematics Bink.h" diff --git a/Utils/Cinematics.cpp b/Utils/Cinematics.cpp index 5e810cbd..579152bf 100644 --- a/Utils/Cinematics.cpp +++ b/Utils/Cinematics.cpp @@ -11,7 +11,7 @@ //---------------------------------------------------------------------------------- //#include "LocalCodeAll.h" -#include "Types.h" +#include "types.h" #include #include #include @@ -23,7 +23,7 @@ #include "DEBUG.H" #include "FileMan.h" -#include "smack.h" +#include "SMACK.H" #include "ddraw.h" #include "DirectX Common.h" #include "DirectDraw Calls.h" diff --git a/Utils/Cinematics.h b/Utils/Cinematics.h index 52be5601..5aebbfbd 100644 --- a/Utils/Cinematics.h +++ b/Utils/Cinematics.h @@ -1,7 +1,7 @@ #ifndef _CINEMATICS_H_ #define _CINEMATICS_H_ -#include "smack.h" +#include "SMACK.H" struct SMKFLIC { diff --git a/Utils/Cursors.cpp b/Utils/Cursors.cpp index 2338d366..e6639e96 100644 --- a/Utils/Cursors.cpp +++ b/Utils/Cursors.cpp @@ -1,15 +1,15 @@ #include "builddefines.h" #include #include "sgp.h" - #include "cursors.h" + #include "Cursors.h" #include "Timer Control.h" #include "jascreens.h" - #include "font.h" + #include "Font.h" #include "Font Control.h" #include "Sys Globals.h" #include "Handle UI.h" - #include "interface.h" - #include "overhead.h" + #include "Interface.h" + #include "Overhead.h" #include "Cursor Control.h" #include "Sound Control.h" // HEADROCK HAM B2.6: included this here to allow toggling the CTH bars. diff --git a/Utils/Encrypted File.cpp b/Utils/Encrypted File.cpp index 20fba544..edeeade0 100644 --- a/Utils/Encrypted File.cpp +++ b/Utils/Encrypted File.cpp @@ -1,9 +1,9 @@ #include "Encrypted File.h" #include "FileMan.h" - #include "Debug.h" + #include "DEBUG.H" // anv: for selecting random line -#include "Random.h" +#include "random.h" // anv: loading random line from the file BOOLEAN LoadEncryptedDataFromFileRandomLine(STR pFileName, STR16 pDestString, UINT32 uiSeekAmount) diff --git a/Utils/Event Pump.cpp b/Utils/Event Pump.cpp index 74576ef5..f955a9d6 100644 --- a/Utils/Event Pump.cpp +++ b/Utils/Event Pump.cpp @@ -1,12 +1,12 @@ #include #include #include "sgp.h" -#include "wcheck.h" +#include "WCheck.h" #include "Event Pump.h" #include "Timer.h" #include "Sound Control.h" #include "Overhead.h" -#include "weapons.h" +#include "Weapons.h" #include "Animation Control.h" #include "opplist.h" #include "Tactical Save.h" diff --git a/Utils/Font Control.cpp b/Utils/Font Control.cpp index efb10ba5..5c652b23 100644 --- a/Utils/Font Control.cpp +++ b/Utils/Font Control.cpp @@ -3,7 +3,7 @@ #include "sgp.h" #include "himage.h" #include "vsurface.h" - #include "wcheck.h" + #include "WCheck.h" #include "Font Control.h" #include diff --git a/Utils/Font Control.h b/Utils/Font Control.h index db5856cd..45ff67f4 100644 --- a/Utils/Font Control.h +++ b/Utils/Font Control.h @@ -2,7 +2,7 @@ #define __FONT_CONTROL_H #include "builddefines.h" -#include "font.h" +#include "Font.h" extern BOOLEAN gfUseWinFonts; extern INT32 giCurWinFont; diff --git a/Utils/INIReader.cpp b/Utils/INIReader.cpp index d238ddb0..284ec7aa 100644 --- a/Utils/INIReader.cpp +++ b/Utils/INIReader.cpp @@ -1,7 +1,7 @@ #include "builddefines.h" -#include "IniReader.h" +#include "INIReader.h" #include "FileMan.h" -#include "debug.h" +#include "DEBUG.H" #include "Font Control.h" #include "message.h" #include diff --git a/Utils/INIReader.h b/Utils/INIReader.h index 11595a1e..1454d8b9 100644 --- a/Utils/INIReader.h +++ b/Utils/INIReader.h @@ -2,8 +2,8 @@ #define INIREADER_H #define NOMINMAX #include -#include -#include +#include +#include #include #include diff --git a/Utils/KeyMap.cpp b/Utils/KeyMap.cpp index 5f040276..a116c9e3 100644 --- a/Utils/KeyMap.cpp +++ b/Utils/KeyMap.cpp @@ -1,6 +1,6 @@ #include "KeyMap.h" #include -#include "text.h" +#include "Text.h" static Str8EnumLookupType gKeyTable[] = { diff --git a/Utils/KeyMap.h b/Utils/KeyMap.h index 9b9a6d7e..6aac83d2 100644 --- a/Utils/KeyMap.h +++ b/Utils/KeyMap.h @@ -1,4 +1,4 @@ -#include +#include extern int ParseKeyString(const STR value); extern BOOLEAN IsKeyPressed(int value); diff --git a/Utils/MapUtility.cpp b/Utils/MapUtility.cpp index baf030a8..84259a8f 100644 --- a/Utils/MapUtility.cpp +++ b/Utils/MapUtility.cpp @@ -2,21 +2,21 @@ #ifdef JA2EDITOR #include "Screens.h" -#include "Maputility.h" +#include "maputility.h" #include "worlddef.h" -#include "overhead.h" -#include "fileman.h" -#include "loadscreen.h" +#include "Overhead.h" +#include "FileMan.h" +#include "LoadScreen.h" #include "overhead map.h" -#include "radar screen.h" +#include "Radar Screen.h" #include "vobject_blitters.h" -#include "sticonvert.h" -#include "font control.h" -#include "worlddat.h" +#include "STIConvert.h" +#include "Font Control.h" +#include "WorldDat.h" #include "english.h" -#include "map information.h" +#include "Map Information.h" #include "line.h" -#include "quantize wrap.h" +#include "Quantize Wrap.h" //dnl ch77 131113 #include "Editor Taskbar Utils.h" #include "Text Input.h" diff --git a/Utils/MercTextBox.cpp b/Utils/MercTextBox.cpp index 39537615..e8dda94e 100644 --- a/Utils/MercTextBox.cpp +++ b/Utils/MercTextBox.cpp @@ -5,7 +5,7 @@ #include "Utilities.h" #include "WordWrap.h" #include "vobject_blitters.h" - #include "Message.h" + #include "message.h" #define TEXT_POPUP_WINDOW_TEXT_OFFSET_X 8 diff --git a/Utils/MercTextBox.h b/Utils/MercTextBox.h index 72bf1808..8ed90859 100644 --- a/Utils/MercTextBox.h +++ b/Utils/MercTextBox.h @@ -1,7 +1,7 @@ #ifndef __MERCTEXTBOX_H_ #define __MERCTEXTBOX_H_ -#include "Types.h" +#include "types.h" #define MERC_POPUP_PREPARE_FLAGS_TRANS_BACK 0x00000001 diff --git a/Utils/Multilingual Text Code Generator.cpp b/Utils/Multilingual Text Code Generator.cpp index 2bdfcb2a..c3eb26d3 100644 --- a/Utils/Multilingual Text Code Generator.cpp +++ b/Utils/Multilingual Text Code Generator.cpp @@ -32,8 +32,8 @@ CREATED: Feb 16, 1999 #include "builddefines.h" #include #include "types.h" -#include "debug.h" -#include "Fileman.h" +#include "DEBUG.H" +#include "FileMan.h" //Currently in JA2's _EnglishText, these tokens make up all of the //format specifiers that are actually used. Feel free to add more, diff --git a/Utils/Music Control.cpp b/Utils/Music Control.cpp index 1030cd3d..335300fc 100644 --- a/Utils/Music Control.cpp +++ b/Utils/Music Control.cpp @@ -1,10 +1,10 @@ #include "types.h" #include "Music Control.h" #include "soundman.h" - #include "Random.h" + #include "random.h" #include "jascreens.h" - #include "overhead.h" - #include "timer control.h" + #include "Overhead.h" + #include "Timer Control.h" #include "strategicmap.h" #include "Overhead Types.h" diff --git a/Utils/STIConvert.cpp b/Utils/STIConvert.cpp index 09018200..caf3b0c9 100644 --- a/Utils/STIConvert.cpp +++ b/Utils/STIConvert.cpp @@ -3,14 +3,14 @@ #include #include #include "types.h" - #include "compression.h" - #include "debug.h" - #include "fileman.h" + #include "Compression.h" + #include "DEBUG.H" + #include "FileMan.h" #include "imgfmt.h" #include "himage.h" #include "pcx.h" #include "impTGA.h" - #include "wcheck.h" + #include "WCheck.h" //CONVERT_TO_16_BIT BOOLEAN ConvertToETRLE( UINT8 ** ppDest, UINT32 * puiDestLen, UINT8 ** ppSubImageBuffer, UINT16 * pusNumberOfSubImages, UINT8 * p8BPPBuffer, UINT16 usWidth, UINT16 usHeight, UINT32 fFlags ); diff --git a/Utils/Slider.cpp b/Utils/Slider.cpp index 5b7383b8..be3f0702 100644 --- a/Utils/Slider.cpp +++ b/Utils/Slider.cpp @@ -1,11 +1,11 @@ - #include "Types.h" + #include "types.h" #include "WordWrap.h" #include "Render Dirty.h" #include "Utilities.h" #include "WCheck.h" #include "Slider.h" - #include "SysUtil.h" - #include "Line.h" + #include "sysutil.h" + #include "line.h" diff --git a/Utils/Sound Control.cpp b/Utils/Sound Control.cpp index 3c8472f8..83ac23e1 100644 --- a/Utils/Sound Control.cpp +++ b/Utils/Sound Control.cpp @@ -3,8 +3,8 @@ #include "sgp.h" #include "Sound Control.h" #include "soundman.h" - #include "overhead.h" - #include "isometric utils.h" + #include "Overhead.h" + #include "Isometric Utils.h" #include "renderworld.h" #include "GameSettings.h" #include "math.h" diff --git a/Utils/Text Input.cpp b/Utils/Text Input.cpp index 7f403388..75aff20e 100644 --- a/Utils/Text Input.cpp +++ b/Utils/Text Input.cpp @@ -4,12 +4,12 @@ #include #include #include "input.h" - #include "font.h" + #include "Font.h" #include "english.h" #include "vsurface.h" #include "video.h" - #include "debug.h" - #include "cursors.h" + #include "DEBUG.H" + #include "Cursors.h" #include "Text Input.h" #include "Timer Control.h" #include "vobject_blitters.h" diff --git a/Utils/Text Utils.cpp b/Utils/Text Utils.cpp index 757a20c7..5ae5ac51 100644 --- a/Utils/Text Utils.cpp +++ b/Utils/Text Utils.cpp @@ -1,5 +1,5 @@ - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "GameSettings.h" // sevenfm #include diff --git a/Utils/Timer Control.cpp b/Utils/Timer Control.cpp index ae6ee36c..c38ad656 100644 --- a/Utils/Timer Control.cpp +++ b/Utils/Timer Control.cpp @@ -2,14 +2,14 @@ #include #include #include "stdlib.h" - #include "debug.h" + #include "DEBUG.H" #include "Timer Control.h" - #include "overhead.h" + #include "Overhead.h" #include "handle items.h" #include "worlddef.h" #include "renderworld.h" - #include "interface control.h" - #include "keymap.h" + #include "Interface Control.h" + #include "KeyMap.h" #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN diff --git a/Utils/Utilities.cpp b/Utils/Utilities.cpp index f8ed4476..9e04efc6 100644 --- a/Utils/Utilities.cpp +++ b/Utils/Utilities.cpp @@ -1,16 +1,16 @@ #include "types.h" #include - #include + #include #include "sgp.h" #include "time.h" #include "vobject.h" #include "FileMan.h" #include "Utilities.h" #include "Font Control.h" - #include "overhead.h" - #include "overhead types.h" - #include "wcheck.h" - #include "sys globals.h" + #include "Overhead.h" + #include "Overhead Types.h" + #include "WCheck.h" + #include "Sys Globals.h" extern BOOLEAN GetCDromDriveLetter( STR8 pString ); diff --git a/Utils/Utilities.h b/Utils/Utilities.h index d0d5dda0..933e84b2 100644 --- a/Utils/Utilities.h +++ b/Utils/Utilities.h @@ -1,7 +1,7 @@ #ifndef _UTILITIES_H_ #define _UTILITIES_H_ -#include "Overhead types.h" +#include "Overhead Types.h" #include "sgp.h" diff --git a/Utils/Utils All.h b/Utils/Utils All.h index 3b6750c6..ba28efd7 100644 --- a/Utils/Utils All.h +++ b/Utils/Utils All.h @@ -6,22 +6,22 @@ #include "types.h" #include "Animated ProgressBar.h" #include "MemMan.h" -#include "debug.h" +#include "DEBUG.H" #include "Font Control.h" #include "vsurface.h" #include "video.h" #include "Render Dirty.h" -#include "music control.h" +#include "Music Control.h" #include #include "sgp.h" -#include "cursors.h" +#include "Cursors.h" #include "Timer Control.h" #include "jascreens.h" -#include "font.h" +#include "Font.h" #include "Sys Globals.h" #include "Handle UI.h" -#include "interface.h" -#include "overhead.h" +#include "Interface.h" +#include "Overhead.h" #include "Cursor Control.h" #include "Debug Control.h" #include "stdio.h" @@ -30,64 +30,64 @@ #include #include #include -#include "wcheck.h" +#include "WCheck.h" #include "Event Manager.h" #include "Event Pump.h" #include "Timer.h" #include "Soldier Control.h" #include "Sound Control.h" -#include "weapons.h" +#include "Weapons.h" #include "Animation Control.h" #include "opplist.h" #include "himage.h" #include "vsurface_private.h" -#include "text.h" +#include "Text.h" #include "Screens.h" -#include "Maputility.h" +#include "maputility.h" #include "worlddef.h" -#include "loadscreen.h" +#include "LoadScreen.h" #include "overhead map.h" -#include "radar screen.h" +#include "Radar Screen.h" #include "vobject_blitters.h" -#include "sticonvert.h" -#include "worlddat.h" +#include "STIConvert.h" +#include "WorldDat.h" #include "english.h" -#include "map information.h" +#include "Map Information.h" #include "line.h" #include "MercTextBox.h" #include "renderworld.h" #include "Utilities.h" #include "WordWrap.h" -#include "Message.h" +#include "message.h" #include #include "mbstring.h" #include "local.h" #include "Map Screen Interface Bottom.h" -#include "Soundman.h" -#include "BuildDefines.h" +#include "soundman.h" +#include "builddefines.h" #include "Dialogue Control.h" #include "Multi Language Graphic Utils.h" -#include "Random.h" +#include "random.h" #include "gamescreen.h" #include "Creature Spreading.h" #include "strategicmap.h" -#include "fade screen.h" +#include "Fade Screen.h" #include "PopUpBox.h" #include "sysutil.h" #include "phys math.h" -#include "Types.h" +#include "types.h" #include "WordWrap.h" #include "Render Dirty.h" #include "Utilities.h" #include "Cursors.h" #include "WCheck.h" #include "Slider.h" -#include "SysUtil.h" -#include "Line.h" -#include "isometric utils.h" +#include "sysutil.h" +#include "line.h" +#include "Isometric Utils.h" #include #include -#include "compression.h" +#include "Compression.h" #include "imgfmt.h" #include "pcx.h" #include "impTGA.h" @@ -98,8 +98,8 @@ #include "handle items.h" #include "time.h" #include "vobject.h" -#include "overhead types.h" -#include "tactical save.h" +#include "Overhead Types.h" +#include "Tactical Save.h" #include "KeyMap.h" //#include diff --git a/Utils/Win Util.cpp b/Utils/Win Util.cpp index 78f6df82..65d8f7b7 100644 --- a/Utils/Win Util.cpp +++ b/Utils/Win Util.cpp @@ -4,7 +4,7 @@ #include #include #include "dsutil.h" -#include "debug.h" +#include "DEBUG.H" #include "sgp.h" diff --git a/Utils/WordWrap.cpp b/Utils/WordWrap.cpp index b0e8e432..bd750d0d 100644 --- a/Utils/WordWrap.cpp +++ b/Utils/WordWrap.cpp @@ -2,7 +2,7 @@ #include "sgp.h" #include "Render Dirty.h" #include "Font Control.h" - #include "Stdio.h" + #include "stdio.h" #include "WinFont.h" #include diff --git a/Utils/XMLAccess.cpp b/Utils/XMLAccess.cpp index 44d44484..6d9ce690 100644 --- a/Utils/XMLAccess.cpp +++ b/Utils/XMLAccess.cpp @@ -1,4 +1,4 @@ -#include "Types.h" +#include "types.h" #define WEAPONSFILENAME "TABLEDATA\\Weapons.dat" #define MAX_CHAR_DATA_LENGTH 500 diff --git a/Utils/XMLProperties.cpp b/Utils/XMLProperties.cpp index b75f3b92..8001b4e0 100644 --- a/Utils/XMLProperties.cpp +++ b/Utils/XMLProperties.cpp @@ -8,7 +8,7 @@ #include "XML_Parser.h" #include "XMLWriter.h" -#include "Debug.h" +#include "DEBUG.H" vfs::PropertyContainer::TagMap::TagMap() { diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 52f14ece..d8eae129 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -1,37 +1,37 @@ #include "sgp.h" - #include "overhead types.h" + #include "Overhead Types.h" #include "Soldier Control.h" - #include "overhead.h" + #include "Overhead.h" #include "Event Pump.h" - #include "weapons.h" + #include "Weapons.h" #include "Animation Control.h" #include "Handle UI.h" #include "Isometric Utils.h" #include "math.h" #include "ai.h" - #include "los.h" + #include "LOS.h" #include "renderworld.h" - #include "interface.h" + #include "Interface.h" #include "message.h" - #include "campaign.h" - #include "items.h" - #include "text.h" + #include "Campaign.h" + #include "Items.h" + #include "Text.h" #include "Soldier Profile.h" #include "Dialogue Control.h" #include "SkillCheck.h" #include "Quests.h" - #include "Physics.h" - #include "Random.h" + #include "physics.h" + #include "random.h" #include "Vehicles.h" - #include "bullets.h" - #include "morale.h" + #include "Bullets.h" + #include "Morale.h" #include "SkillCheck.h" - #include "gamesettings.h" + #include "GameSettings.h" #include "SaveLoadMap.h" #include "Debug Control.h" #include "expat.h" #include "XML.h" - #include "utilities.h" + #include "Utilities.h" #include "store inventory.h" // Flugente: in order not to loop over MAXITEMS items if we only have a few thousand, remember the actual number of items in the xml diff --git a/Utils/XML_Language.h b/Utils/XML_Language.h index a039faa6..5c26ab35 100644 --- a/Utils/XML_Language.h +++ b/Utils/XML_Language.h @@ -1,7 +1,7 @@ #ifndef __XML_LANGUAGE_H #define __XML_LANGUAGE_H -#include "Types.h" +#include "types.h" #define MAX_MESSAGE_NAMES_CHARS 400 diff --git a/Utils/XML_SenderNameList.h b/Utils/XML_SenderNameList.h index 3cca54e1..fae15a81 100644 --- a/Utils/XML_SenderNameList.h +++ b/Utils/XML_SenderNameList.h @@ -1,7 +1,7 @@ #ifndef _XML_SENDERNAMELIST_H #define _XML_SENDERNAMELIST_H -#include "Types.h" +#include "types.h" #define MAX_SENDER_NAMES_CHARS 128 diff --git a/Utils/message.cpp b/Utils/message.cpp index 4b09a0b9..0b73c461 100644 --- a/Utils/message.cpp +++ b/Utils/message.cpp @@ -1,21 +1,21 @@ #include "sgp.h" - #include "font.h" + #include "Font.h" #include "types.h" #include "Font Control.h" #include "message.h" #include "memory.h" #include "mbstring.h" #include "Timer Control.h" - #include "render dirty.h" + #include "Render Dirty.h" #include "renderworld.h" #include "local.h" - #include "interface.h" + #include "Interface.h" #include "mapscreen.h" #include "Map Screen Interface Bottom.h" #include "WordWrap.h" #include "Sound Control.h" - #include "Soundman.h" - #include "BuildDefines.h" + #include "soundman.h" + #include "builddefines.h" #include "Dialogue Control.h" #include #include "Game Clock.h" diff --git a/Utils/message.h b/Utils/message.h index 360a764d..d071fae6 100644 --- a/Utils/message.h +++ b/Utils/message.h @@ -2,10 +2,10 @@ #define __MESSAGE_H //#include "sgp.h" -#include "font.h" +#include "Font.h" #include "Font Control.h" #include "types.h" -#include "Fileman.h" +#include "FileMan.h" struct stringstruct{ diff --git a/Utils/popup_class.cpp b/Utils/popup_class.cpp index fec319e9..bb360724 100644 --- a/Utils/popup_class.cpp +++ b/Utils/popup_class.cpp @@ -1,12 +1,12 @@ #include "Map Screen Interface.h" - #include "popupbox.h" - #include "interface control.h" + #include "PopUpBox.h" + #include "Interface Control.h" #include "renderworld.h" #include "Text.h" - #include "utilities.h" + #include "Utilities.h" #include "Interface.h" #include "GameSettings.h" - #include "Input.h" + #include "input.h" #include "Console.h" #include "lwstring.h" diff --git a/ext/VFS/ext/7z/CMakeLists.txt b/ext/VFS/ext/7z/CMakeLists.txt index caa436e3..483d435d 100644 --- a/ext/VFS/ext/7z/CMakeLists.txt +++ b/ext/VFS/ext/7z/CMakeLists.txt @@ -26,7 +26,7 @@ set(INCLUDE_7z src/LzmaLib.h src/Ppmd.h src/Sha256.h - src/Types.h + src/types.h # src/Xz.h # src/XzEnc.h src/7zAlloc.h diff --git a/ext/VFS/ext/7z/doc/lzma.txt b/ext/VFS/ext/7z/doc/lzma.txt index 9d3cef00..b287726d 100644 --- a/ext/VFS/ext/7z/doc/lzma.txt +++ b/ext/VFS/ext/7z/doc/lzma.txt @@ -76,7 +76,7 @@ C/ - C files LzmaDec.* - LZMA decoding LzmaEnc.* - LZMA encoding LzmaLib.* - LZMA Library for DLL calling - Types.h - Basic types for another .c files + types.h - Basic types for another .c files Threads.* - The code for multithreading. LzmaLib - LZMA Library (.DLL for Windows) diff --git a/ext/VFS/ext/7z/src/7zBuf.h b/ext/VFS/ext/7z/src/7zBuf.h index 88ff0c2f..a1124eb9 100644 --- a/ext/VFS/ext/7z/src/7zBuf.h +++ b/ext/VFS/ext/7z/src/7zBuf.h @@ -4,7 +4,7 @@ #ifndef __7Z_BUF_H #define __7Z_BUF_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/7zCrc.h b/ext/VFS/ext/7z/src/7zCrc.h index 4a1ec38c..ddf22795 100644 --- a/ext/VFS/ext/7z/src/7zCrc.h +++ b/ext/VFS/ext/7z/src/7zCrc.h @@ -4,7 +4,7 @@ #ifndef __7Z_CRC_H #define __7Z_CRC_H -#include "Types.h" +#include "types.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/7zFile.h b/ext/VFS/ext/7z/src/7zFile.h index 5d857879..496a3715 100644 --- a/ext/VFS/ext/7z/src/7zFile.h +++ b/ext/VFS/ext/7z/src/7zFile.h @@ -14,7 +14,7 @@ #include #endif -#include "Types.h" +#include "types.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/7zStream.c b/ext/VFS/ext/7z/src/7zStream.c index f0959fb0..5c84216f 100644 --- a/ext/VFS/ext/7z/src/7zStream.c +++ b/ext/VFS/ext/7z/src/7zStream.c @@ -3,7 +3,7 @@ #include -#include "Types.h" +#include "types.h" SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType) { diff --git a/ext/VFS/ext/7z/src/Bcj2.h b/ext/VFS/ext/7z/src/Bcj2.h index d9d857bc..6a87a279 100644 --- a/ext/VFS/ext/7z/src/Bcj2.h +++ b/ext/VFS/ext/7z/src/Bcj2.h @@ -4,7 +4,7 @@ #ifndef __BCJ2_H #define __BCJ2_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/Bra.h b/ext/VFS/ext/7z/src/Bra.h index 9c91e332..f6fbde63 100644 --- a/ext/VFS/ext/7z/src/Bra.h +++ b/ext/VFS/ext/7z/src/Bra.h @@ -4,7 +4,7 @@ #ifndef __BRA_H #define __BRA_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/CpuArch.h b/ext/VFS/ext/7z/src/CpuArch.h index 1cd7c29c..10d4dfc9 100644 --- a/ext/VFS/ext/7z/src/CpuArch.h +++ b/ext/VFS/ext/7z/src/CpuArch.h @@ -4,7 +4,7 @@ #ifndef __CPU_ARCH_H #define __CPU_ARCH_H -#include "Types.h" +#include "types.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/Delta.h b/ext/VFS/ext/7z/src/Delta.h index 776cd455..cf72817b 100644 --- a/ext/VFS/ext/7z/src/Delta.h +++ b/ext/VFS/ext/7z/src/Delta.h @@ -4,7 +4,7 @@ #ifndef __DELTA_H #define __DELTA_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/LzFind.h b/ext/VFS/ext/7z/src/LzFind.h index 7ebdfa44..d1b5f34a 100644 --- a/ext/VFS/ext/7z/src/LzFind.h +++ b/ext/VFS/ext/7z/src/LzFind.h @@ -4,7 +4,7 @@ #ifndef __LZ_FIND_H #define __LZ_FIND_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/Lzma86.h b/ext/VFS/ext/7z/src/Lzma86.h index 6425bb8f..7bc0b74a 100644 --- a/ext/VFS/ext/7z/src/Lzma86.h +++ b/ext/VFS/ext/7z/src/Lzma86.h @@ -4,7 +4,7 @@ #ifndef __LZMA86_H #define __LZMA86_H -#include "Types.h" +#include "types.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/LzmaDec.h b/ext/VFS/ext/7z/src/LzmaDec.h index 6741a644..dcb146f5 100644 --- a/ext/VFS/ext/7z/src/LzmaDec.h +++ b/ext/VFS/ext/7z/src/LzmaDec.h @@ -4,7 +4,7 @@ #ifndef __LZMA_DEC_H #define __LZMA_DEC_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/LzmaEnc.h b/ext/VFS/ext/7z/src/LzmaEnc.h index 7573ba01..b50a953d 100644 --- a/ext/VFS/ext/7z/src/LzmaEnc.h +++ b/ext/VFS/ext/7z/src/LzmaEnc.h @@ -4,7 +4,7 @@ #ifndef __LZMA_ENC_H #define __LZMA_ENC_H -#include "Types.h" +#include "types.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/LzmaLib.h b/ext/VFS/ext/7z/src/LzmaLib.h index 55e1e114..0dff2b60 100644 --- a/ext/VFS/ext/7z/src/LzmaLib.h +++ b/ext/VFS/ext/7z/src/LzmaLib.h @@ -4,7 +4,7 @@ #ifndef __LZMA_LIB_H #define __LZMA_LIB_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/Ppmd.h b/ext/VFS/ext/7z/src/Ppmd.h index d62df4d3..42d17284 100644 --- a/ext/VFS/ext/7z/src/Ppmd.h +++ b/ext/VFS/ext/7z/src/Ppmd.h @@ -5,7 +5,7 @@ This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */ #ifndef __PPMD_H #define __PPMD_H -#include "Types.h" +#include "types.h" #include "CpuArch.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/Sha256.h b/ext/VFS/ext/7z/src/Sha256.h index 26d1e3af..8b7121e8 100644 --- a/ext/VFS/ext/7z/src/Sha256.h +++ b/ext/VFS/ext/7z/src/Sha256.h @@ -4,7 +4,7 @@ #ifndef __CRYPTO_SHA256_H #define __CRYPTO_SHA256_H -#include "Types.h" +#include "types.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/Threads.h b/ext/VFS/ext/7z/src/Threads.h index 6a7afa82..9ff25dad 100644 --- a/ext/VFS/ext/7z/src/Threads.h +++ b/ext/VFS/ext/7z/src/Threads.h @@ -4,7 +4,7 @@ #ifndef __7Z_THREADS_H #define __7Z_THREADS_H -#include "Types.h" +#include "types.h" #ifdef __cplusplus extern "C" { diff --git a/ext/VFS/ext/7z/src/XzCrc64.h b/ext/VFS/ext/7z/src/XzCrc64.h index 05d0d09c..0444f5ea 100644 --- a/ext/VFS/ext/7z/src/XzCrc64.h +++ b/ext/VFS/ext/7z/src/XzCrc64.h @@ -6,7 +6,7 @@ #include -#include "Types.h" +#include "types.h" EXTERN_C_BEGIN diff --git a/ext/VFS/ext/7z/src/Types.h b/ext/VFS/ext/7z/src/types.h similarity index 95% rename from ext/VFS/ext/7z/src/Types.h rename to ext/VFS/ext/7z/src/types.h index f193ce2f..53c6a948 100644 --- a/ext/VFS/ext/7z/src/Types.h +++ b/ext/VFS/ext/7z/src/types.h @@ -1,4 +1,4 @@ -/* Types.h -- Basic types +/* types.h -- Basic types 2010-10-09 : Igor Pavlov : Public domain */ #ifndef __7Z_TYPES_H diff --git a/ext/VFS/include/vfs/Tools/vfs_hp_timer.h b/ext/VFS/include/vfs/Tools/vfs_hp_timer.h index dd198cf5..6272ebbd 100644 --- a/ext/VFS/include/vfs/Tools/vfs_hp_timer.h +++ b/ext/VFS/include/vfs/Tools/vfs_hp_timer.h @@ -27,7 +27,7 @@ #include #ifdef WIN32 - #include + #include #elif __linux__ #include #endif diff --git a/ext/export/src/export/jsd/structure.cpp b/ext/export/src/export/jsd/structure.cpp index 7f234e4f..e93bf047 100644 --- a/ext/export/src/export/jsd/structure.cpp +++ b/ext/export/src/export/jsd/structure.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include diff --git a/ext/export/src/export/sti/Image.h b/ext/export/src/export/sti/Image.h index 9a207295..8de3ddd0 100644 --- a/ext/export/src/export/sti/Image.h +++ b/ext/export/src/export/sti/Image.h @@ -1,7 +1,7 @@ #ifndef _IMAGE_H_ #define _IMAGE_H_ -#include "Types.h" +#include "types.h" #include "himage.h" #include diff --git a/ext/export/src/export/sti/STCI_lib.cpp b/ext/export/src/export/sti/STCI_lib.cpp index 0b82d716..16a79489 100644 --- a/ext/export/src/export/sti/STCI_lib.cpp +++ b/ext/export/src/export/sti/STCI_lib.cpp @@ -4,7 +4,7 @@ #include "imgfmt.h" #include "himage.h" -#include "Types.h" +#include "types.h" #include #include #include diff --git a/ext/export/src/export/sti/STCI_lib.h b/ext/export/src/export/sti/STCI_lib.h index df6ac1ad..c4afc856 100644 --- a/ext/export/src/export/sti/STCI_lib.h +++ b/ext/export/src/export/sti/STCI_lib.h @@ -1,4 +1,4 @@ -#include "Types.h" +#include "types.h" #include "himage.h" #include diff --git a/ext/export/src/export/sti/stci_image_utils.h b/ext/export/src/export/sti/stci_image_utils.h index 258baec7..09092153 100644 --- a/ext/export/src/export/sti/stci_image_utils.h +++ b/ext/export/src/export/sti/stci_image_utils.h @@ -1,7 +1,7 @@ #ifndef _STCI_IMAGE_UTILS_H_ #define _STCI_IMAGE_UTILS_H_ -#include "Types.h" +#include "types.h" #include "himage.h" #include #include diff --git a/ext/export/src/ja2/imgfmt.h b/ext/export/src/ja2/imgfmt.h index e88f7eaf..82ed3429 100644 --- a/ext/export/src/ja2/imgfmt.h +++ b/ext/export/src/ja2/imgfmt.h @@ -8,7 +8,7 @@ // * SubRectInfo's (usNumberOfRects > 0, size = usNumberOfSubRects * sizeof(SubRectInfo) ), uncompressed // * Bytes of image data, possibly compressed -#include "Types.h" +#include "types.h" #define STCI_ID_STRING "STCI" #define STCI_ID_LEN 4 diff --git a/ext/export/src/ja2/Types.h b/ext/export/src/ja2/types.h similarity index 100% rename from ext/export/src/ja2/Types.h rename to ext/export/src/ja2/types.h diff --git a/i18n/ExportStrings.cpp b/i18n/ExportStrings.cpp index b79841b9..c390cb17 100644 --- a/i18n/ExportStrings.cpp +++ b/i18n/ExportStrings.cpp @@ -3,12 +3,12 @@ #include "Map Screen Interface.h" #include "personnel.h" #include "soldier profile type.h" -#include "interface.h" +#include "Interface.h" #include "Keys.h" #include "Merc Contract.h" #include "Campaign Types.h" -#include "Finances.h" -#include "Laptop.h" +#include "finances.h" +#include "laptop.h" #include #include @@ -68,7 +68,7 @@ namespace Loc } #include "Assignments.h" -#include "History.h" +#include "history.h" template void ExportSection(vfs::PropertyContainer& props, const vfs::String::char_t* section_name, T* strings, int min, int max) diff --git a/i18n/Multi Language Graphic Utils.cpp b/i18n/Multi Language Graphic Utils.cpp index af383bd7..2530e505 100644 --- a/i18n/Multi Language Graphic Utils.cpp +++ b/i18n/Multi Language Graphic Utils.cpp @@ -1,7 +1,7 @@ #include "builddefines.h" #include "stdio.h" -#include "Windows.h" -#include "Types.h" +#include "windows.h" +#include "types.h" #include "Multi Language Graphic Utils.h" //SB diff --git a/i18n/_ChineseText.cpp b/i18n/_ChineseText.cpp index fa9f7f99..64e7f38f 100644 --- a/i18n/_ChineseText.cpp +++ b/i18n/_ChineseText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("CHINESE") #if defined( CHINESE ) - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/_DutchText.cpp b/i18n/_DutchText.cpp index c2413fac..123fe21d 100644 --- a/i18n/_DutchText.cpp +++ b/i18n/_DutchText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("DUTCH") #if defined( DUTCH ) - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/_EnglishText.cpp b/i18n/_EnglishText.cpp index 00cee405..022d8012 100644 --- a/i18n/_EnglishText.cpp +++ b/i18n/_EnglishText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("ENGLISH") #if defined( ENGLISH ) - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/_FrenchText.cpp b/i18n/_FrenchText.cpp index cc9980cb..0b0bfa83 100644 --- a/i18n/_FrenchText.cpp +++ b/i18n/_FrenchText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("FRENCH") #ifdef FRENCH - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/_GermanText.cpp b/i18n/_GermanText.cpp index cba8f6e5..04b449d0 100644 --- a/i18n/_GermanText.cpp +++ b/i18n/_GermanText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("GERMAN") #ifdef GERMAN - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/_ItalianText.cpp b/i18n/_ItalianText.cpp index c9e9dd39..a5e2b340 100644 --- a/i18n/_ItalianText.cpp +++ b/i18n/_ItalianText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("ITALIAN") #if defined( ITALIAN ) - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/_Ja25ChineseText.cpp b/i18n/_Ja25ChineseText.cpp index 1bfcf23e..94e28304 100644 --- a/i18n/_Ja25ChineseText.cpp +++ b/i18n/_Ja25ChineseText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("CHINESE") #ifdef CHINESE - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_Ja25DutchText.cpp b/i18n/_Ja25DutchText.cpp index 396f8ac5..33b81428 100644 --- a/i18n/_Ja25DutchText.cpp +++ b/i18n/_Ja25DutchText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("DUTCH") #ifdef DUTCH - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_Ja25EnglishText.cpp b/i18n/_Ja25EnglishText.cpp index 70a0c7e2..aaae4773 100644 --- a/i18n/_Ja25EnglishText.cpp +++ b/i18n/_Ja25EnglishText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("ENGLISH") #ifdef ENGLISH - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_Ja25FrenchText.cpp b/i18n/_Ja25FrenchText.cpp index 17f9fa2a..630fc5fe 100644 --- a/i18n/_Ja25FrenchText.cpp +++ b/i18n/_Ja25FrenchText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("FRENCH") #ifdef FRENCH - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_Ja25GermanText.cpp b/i18n/_Ja25GermanText.cpp index 663aba59..c8c97c16 100644 --- a/i18n/_Ja25GermanText.cpp +++ b/i18n/_Ja25GermanText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("GERMAN") #ifdef GERMAN - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_Ja25ItalianText.cpp b/i18n/_Ja25ItalianText.cpp index 06d7f298..1ffa7c5c 100644 --- a/i18n/_Ja25ItalianText.cpp +++ b/i18n/_Ja25ItalianText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("ITALIAN") #ifdef ITALIAN - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_Ja25PolishText.cpp b/i18n/_Ja25PolishText.cpp index f7835402..1034b458 100644 --- a/i18n/_Ja25PolishText.cpp +++ b/i18n/_Ja25PolishText.cpp @@ -3,8 +3,8 @@ //#pragma setlocale("POLISH") #ifdef POLISH - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_Ja25RussianText.cpp b/i18n/_Ja25RussianText.cpp index 77e48edd..fc037607 100644 --- a/i18n/_Ja25RussianText.cpp +++ b/i18n/_Ja25RussianText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("RUSSIAN") #ifdef RUSSIAN - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #endif //suppress : warning LNK4221: no public symbols found; archive member will be inaccessible diff --git a/i18n/_PolishText.cpp b/i18n/_PolishText.cpp index a395a803..028a6ce6 100644 --- a/i18n/_PolishText.cpp +++ b/i18n/_PolishText.cpp @@ -3,8 +3,8 @@ //#pragma setlocale("POLISH") #if defined( POLISH ) - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/_RussianText.cpp b/i18n/_RussianText.cpp index b5bdf85d..3b0a21c7 100644 --- a/i18n/_RussianText.cpp +++ b/i18n/_RussianText.cpp @@ -2,8 +2,8 @@ //#pragma setlocale("RUSSIAN") #if defined( RUSSIAN ) - #include "text.h" - #include "Fileman.h" + #include "Text.h" + #include "FileMan.h" #include "Scheduling.h" #include "EditorMercs.h" #include "Item Statistics.h" diff --git a/i18n/include/Text.h b/i18n/include/Text.h index 12584904..d9bb16b0 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -1,7 +1,7 @@ #ifndef __TEXT_H #define __TEXT_H -#include "items.h" +#include "Items.h" #include "types.h" #include "mapscreen.h" #include "XML_Language.h" diff --git a/i18n/include/language.hpp b/i18n/include/language.hpp index bd895bcc..c310e6fd 100644 --- a/i18n/include/language.hpp +++ b/i18n/include/language.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace i18n { enum class Lang diff --git a/lua/Lua Interpreter.h b/lua/Lua Interpreter.h index 8be61dfe..bef02328 100644 --- a/lua/Lua Interpreter.h +++ b/lua/Lua Interpreter.h @@ -7,7 +7,7 @@ extern "C" { #include "lualib.h" } -#include "Types.h" +#include "types.h" typedef struct { STR8 name; diff --git a/lua/lua.cpp b/lua/lua.cpp index 4bd4b181..b3d1cb32 100644 --- a/lua/lua.cpp +++ b/lua/lua.cpp @@ -2,7 +2,7 @@ #include #include #include "Lua Interpreter.h" -#include +#include #include "MemMan.h" lua_State *L; diff --git a/lua/lua_class_interface.cpp b/lua/lua_class_interface.cpp index b9f950b9..4979561c 100644 --- a/lua/lua_class_interface.cpp +++ b/lua/lua_class_interface.cpp @@ -1,6 +1,6 @@ #include "lua_class_interface.h" -#include +#include #define ARRAY_INDEX " idx" // The space is intentional to make this an out-of-band field diff --git a/lua/lua_state.cpp b/lua/lua_state.cpp index 2b11e1b7..f2c7b34d 100644 --- a/lua/lua_state.cpp +++ b/lua/lua_state.cpp @@ -1,5 +1,5 @@ #include "lua_state.h" -#include +#include #include "sgp_logger.h" #include diff --git a/lua/lwstring.cpp b/lua/lwstring.cpp index 83cb1a24..2e25f384 100644 --- a/lua/lwstring.cpp +++ b/lua/lwstring.cpp @@ -1,5 +1,5 @@ #include "builddefines.h" -#include +#include #include "MemMan.h" diff --git a/lua/lwstring.h b/lua/lwstring.h index 306e3fda..be3ba5b9 100644 --- a/lua/lwstring.h +++ b/lua/lwstring.h @@ -15,7 +15,7 @@ extern "C" { #include } -#include "Types.h" +#include "types.h" typedef struct { int len; diff --git a/sgp/Button System.cpp b/sgp/Button System.cpp index 9ccc6bc3..81308e21 100644 --- a/sgp/Button System.cpp +++ b/sgp/Button System.cpp @@ -8,9 +8,9 @@ #include #include #include - #include "debug.h" + #include "DEBUG.H" #include "input.h" - #include "memman.h" + #include "MemMan.h" #include "english.h" #include "vobject.h" #include "vobject_blitters.h" @@ -24,7 +24,7 @@ #ifdef _JA2_RENDER_DIRTY #include "Font Control.h" #include "Render Dirty.h" - #include "utilities.h" + #include "Utilities.h" #endif #include diff --git a/sgp/Compression.cpp b/sgp/Compression.cpp index b9922aae..7de1d562 100644 --- a/sgp/Compression.cpp +++ b/sgp/Compression.cpp @@ -1,5 +1,5 @@ #include "MemMan.h" - #include "debug.h" + #include "DEBUG.H" #include "zlib.h" diff --git a/sgp/Cursor Control.h b/sgp/Cursor Control.h index bd3404ca..43553d70 100644 --- a/sgp/Cursor Control.h +++ b/sgp/Cursor Control.h @@ -1,12 +1,12 @@ #ifndef __CURSOR_DATABASE_ #define __CURSOR_DATABASE_ -#include "Types.h" +#include "types.h" #include "FileMan.h" -#include "VObject.h" -#include "VSurface.h" +#include "vobject.h" +#include "vsurface.h" -#include "Video.h" +#include "video.h" #ifdef __cplusplus extern "C" { diff --git a/sgp/DEBUG.H b/sgp/DEBUG.H index 1d0d0c3e..4339ff49 100644 --- a/sgp/DEBUG.H +++ b/sgp/DEBUG.H @@ -1,6 +1,6 @@ //************************************************************************** // -// Filename : debug.h +// Filename : DEBUG.H // // Purpose : prototypes for the debug manager // diff --git a/sgp/DEBUG.cpp b/sgp/DEBUG.cpp index 2aad673b..c7306245 100644 --- a/sgp/DEBUG.cpp +++ b/sgp/DEBUG.cpp @@ -28,7 +28,7 @@ #include #include #include - #include "debug.h" + #include "DEBUG.H" //Kris addition #include "screenids.h" @@ -39,7 +39,7 @@ // CJC added #ifndef _NO_DEBUG_TXT - #include "fileman.h" + #include "FileMan.h" #endif #include "GameSettings.h" #include "SaveLoadGame.h" diff --git a/sgp/DirectDraw Calls.cpp b/sgp/DirectDraw Calls.cpp index 99fa328f..4b5451ab 100644 --- a/sgp/DirectDraw Calls.cpp +++ b/sgp/DirectDraw Calls.cpp @@ -2,7 +2,7 @@ #include "DirectDraw Calls.h" #include - #include "debug.h" + #include "DEBUG.H" #include "vobject_blitters.h" // DirectDrawSurface2 Calls diff --git a/sgp/DirectX Common.cpp b/sgp/DirectX Common.cpp index 9c6daefb..403fbb30 100644 --- a/sgp/DirectX Common.cpp +++ b/sgp/DirectX Common.cpp @@ -6,7 +6,7 @@ #include #include "DirectX Common.h" #include - #include "debug.h" + #include "DEBUG.H" void DirectXZeroMem ( void* pMemory, int nSize ) { diff --git a/sgp/FileMan.cpp b/sgp/FileMan.cpp index 6ad5bcf5..c141ddf1 100644 --- a/sgp/FileMan.cpp +++ b/sgp/FileMan.cpp @@ -24,7 +24,7 @@ // Includes // //************************************************************************** - #include "Types.h" + #include "types.h" #include #include #include @@ -34,7 +34,7 @@ #include "windows.h" #include "FileMan.h" #include "MemMan.h" - #include "Debug.h" + #include "DEBUG.H" #include "LibraryDataBase.h" #include "io.h" #include "sgp_logger.h" diff --git a/sgp/FileMan.h b/sgp/FileMan.h index bc860fc8..251749b4 100644 --- a/sgp/FileMan.h +++ b/sgp/FileMan.h @@ -20,7 +20,7 @@ //************************************************************************** #include "types.h" -#include "Windows.h" +#include "windows.h" diff --git a/sgp/Font.cpp b/sgp/Font.cpp index d853c542..63b02569 100644 --- a/sgp/Font.cpp +++ b/sgp/Font.cpp @@ -8,10 +8,10 @@ #include #include "sgp.h" #include "pcx.h" - #include "memman.h" - #include "fileman.h" + #include "MemMan.h" + #include "FileMan.h" #include "Font.h" - #include "Debug.h" + #include "DEBUG.H" #include "video.h" diff --git a/sgp/Font.h b/sgp/Font.h index 16802d61..a48ff41b 100644 --- a/sgp/Font.h +++ b/sgp/Font.h @@ -1,7 +1,7 @@ #ifndef __FONT_H_ #define __FONT_H_ -#include "Types.h" +#include "types.h" #include "himage.h" #include "vobject.h" //#ifdef WINFONTS diff --git a/sgp/LibraryDataBase.cpp b/sgp/LibraryDataBase.cpp index dd5bd67e..acf75294 100644 --- a/sgp/LibraryDataBase.cpp +++ b/sgp/LibraryDataBase.cpp @@ -1,11 +1,11 @@ - #include "Types.h" + #include "types.h" #include "windows.h" #include "FileMan.h" #include "LibraryDataBase.h" #include "MemMan.h" #include "stdio.h" #include "WCheck.h" - #include "Debug.h" + #include "DEBUG.H" #include "video.h" diff --git a/sgp/LibraryDataBase.h b/sgp/LibraryDataBase.h index 86922d8a..06ba02fd 100644 --- a/sgp/LibraryDataBase.h +++ b/sgp/LibraryDataBase.h @@ -1,7 +1,7 @@ #ifndef _LIBRARY_DATABASE_H #define _LIBRARY_DATABASE_H -#include "Types.h" +#include "types.h" #include "windows.h" #include "FileMan.h" diff --git a/sgp/MemMan.cpp b/sgp/MemMan.cpp index caa545e8..06580b1c 100644 --- a/sgp/MemMan.cpp +++ b/sgp/MemMan.cpp @@ -24,7 +24,7 @@ #include #include #include "MemMan.h" - #include "Debug.h" + #include "DEBUG.H" #include #include "sgp_logger.h" #ifdef _DEBUG diff --git a/sgp/PCX.cpp b/sgp/PCX.cpp index 25eb2cb2..4954e97a 100644 --- a/sgp/PCX.cpp +++ b/sgp/PCX.cpp @@ -1,7 +1,7 @@ #include #include "pcx.h" - #include "memman.h" - #include "fileman.h" + #include "MemMan.h" + #include "FileMan.h" // Local typedefs diff --git a/sgp/Random.cpp b/sgp/Random.cpp index d78445dd..a413eae5 100644 --- a/sgp/Random.cpp +++ b/sgp/Random.cpp @@ -1,5 +1,5 @@ -#include "Random.h" -#include "debug control.h" +#include "random.h" +#include "Debug Control.h" extern bool is_client; extern bool is_server; diff --git a/sgp/SMACK.H b/sgp/SMACK.H index 2bb08aeb..ff9f7488 100644 --- a/sgp/SMACK.H +++ b/sgp/SMACK.H @@ -5,7 +5,7 @@ #ifndef __RADRES__ -#include "rad.h" +#include "RAD.H" RADDEFSTART diff --git a/sgp/STCI.cpp b/sgp/STCI.cpp index 7a117e57..9187cee3 100644 --- a/sgp/STCI.cpp +++ b/sgp/STCI.cpp @@ -3,8 +3,8 @@ #include "FileMan.h" #include "imgfmt.h" #include "himage.h" - #include "Types.h" - #include "Debug.h" + #include "types.h" + #include "DEBUG.H" #include "WCheck.h" BOOLEAN STCILoadRGB( HIMAGE hImage, UINT16 fContents, HWFILE hFile, STCIHeader * pHeader ); diff --git a/sgp/WinFont.cpp b/sgp/WinFont.cpp index 0760c928..8836519a 100644 --- a/sgp/WinFont.cpp +++ b/sgp/WinFont.cpp @@ -10,16 +10,16 @@ #include #include #include "sgp.h" -#include "memman.h" -#include "fileman.h" +#include "MemMan.h" +#include "FileMan.h" #include "Font.h" -#include "Debug.h" +#include "DEBUG.H" #include "vsurface.h" #include "vsurface_private.h" #include "DirectX Common.h" #include #include "winfont.h" -#include "font.h" +#include "Font.h" #include "Font Control.h" #include "GameSettings.h" #include diff --git a/sgp/himage.cpp b/sgp/himage.cpp index f2c84bdd..71582fca 100644 --- a/sgp/himage.cpp +++ b/sgp/himage.cpp @@ -3,14 +3,14 @@ #include #include "types.h" #include "string.h" - #include "debug.h" - #include "fileman.h" + #include "DEBUG.H" + #include "FileMan.h" #include "himage.h" #include "impTGA.h" #include "pcx.h" #include "STCI.h" #include "PngLoader.h" - #include "wcheck.h" + #include "WCheck.h" #include "Compression.h" #include "vobject.h" #include "vobject_blitters.h" diff --git a/sgp/imgfmt.h b/sgp/imgfmt.h index 6bdb6919..cfff1431 100644 --- a/sgp/imgfmt.h +++ b/sgp/imgfmt.h @@ -8,7 +8,7 @@ // * SubRectInfo's (usNumberOfRects > 0, size = usNumberOfSubRects * sizeof(SubRectInfo) ), uncompressed // * Bytes of image data, possibly compressed -#include "Types.h" +#include "types.h" #define STCI_ID_STRING "STCI" #define STCI_ID_LEN 4 diff --git a/sgp/impTGA.cpp b/sgp/impTGA.cpp index 8c4564c0..04b52dc6 100644 --- a/sgp/impTGA.cpp +++ b/sgp/impTGA.cpp @@ -17,12 +17,12 @@ //************************************************************************** #include "types.h" - #include "Fileman.h" - #include "memman.h" + #include "FileMan.h" + #include "MemMan.h" #include "WCheck.h" #include "himage.h" #include "string.h" - #include "debug.h" + #include "DEBUG.H" #include "video.h" #include "impTGA.h" diff --git a/sgp/input.cpp b/sgp/input.cpp index d3f51474..7b760e6d 100644 --- a/sgp/input.cpp +++ b/sgp/input.cpp @@ -11,9 +11,9 @@ #include #include #include - #include "debug.h" + #include "DEBUG.H" #include "input.h" - #include "memman.h" + #include "MemMan.h" #include "english.h" #include "video.h" #include "local.h" diff --git a/sgp/mousesystem.cpp b/sgp/mousesystem.cpp index a9fb22c2..f57129bf 100644 --- a/sgp/mousesystem.cpp +++ b/sgp/mousesystem.cpp @@ -15,14 +15,14 @@ #include #include #include - #include "debug.h" + #include "DEBUG.H" #include "input.h" - #include "memman.h" + #include "MemMan.h" #include "line.h" #include "video.h" #define BASE_REGION_FLAGS (MSYS_REGION_ENABLED | MSYS_SET_CURSOR) #ifdef _JA2_RENDER_DIRTY - #include "render dirty.h" + #include "Render Dirty.h" #include "Font Control.h" #endif #include "english.h" diff --git a/sgp/random.h b/sgp/random.h index 008c3c68..446fc8d3 100644 --- a/sgp/random.h +++ b/sgp/random.h @@ -3,8 +3,8 @@ #define BMP_RANDOM -#include "Types.h" -#include "Debug.h" +#include "types.h" +#include "DEBUG.H" #include "GameSettings.h" //IMPORTANT: Changing this define will invalidate the JA2 save. If this is necessary, please ifdef your own value. diff --git a/sgp/sgp.cpp b/sgp/sgp.cpp index 07518b0b..b501a0a1 100644 --- a/sgp/sgp.cpp +++ b/sgp/sgp.cpp @@ -7,17 +7,17 @@ #include #include "sgp.h" #include "vobject.h" - #include "font.h" + #include "Font.h" #include "local.h" - #include "Fileman.h" + #include "FileMan.h" #include "input.h" - #include "Random.h" + #include "random.h" #include "gameloop.h" #include "soundman.h" #include "JA2 Splash.h" #include "Timer Control.h" #include "LibraryDataBase.h" - #include "utilities.h" + #include "Utilities.h" #include "GameSettings.h" #include "input.h" @@ -51,7 +51,7 @@ #include "english.h" #include "wine.h" - #include "BuildDefines.h" + #include "builddefines.h" #include "Intro.h" #ifndef WIN32_LEAN_AND_MEAN diff --git a/sgp/sgp.h b/sgp/sgp.h index 138628da..2c01a0b5 100644 --- a/sgp/sgp.h +++ b/sgp/sgp.h @@ -4,7 +4,7 @@ #include "local.h" #include "types.h" #include "timer.h" -#include "debug.h" +#include "DEBUG.H" #include "video.h" diff --git a/sgp/sgp_logger.cpp b/sgp/sgp_logger.cpp index dc82bbde..6499adc9 100644 --- a/sgp/sgp_logger.cpp +++ b/sgp/sgp_logger.cpp @@ -1,8 +1,8 @@ #include "sgp_logger.h" -#include "Debug.h" +#include "DEBUG.H" #include "Font Control.h" -#include "Message.h" +#include "message.h" #include static inline void flush_screen(std::wstringstream& stream) diff --git a/sgp/shading.cpp b/sgp/shading.cpp index 32155139..19a46ff2 100644 --- a/sgp/shading.cpp +++ b/sgp/shading.cpp @@ -1,6 +1,6 @@ #include "DirectDraw Calls.h" #include - #include "debug.h" + #include "DEBUG.H" #include "video.h" #include "himage.h" #include "vobject.h" diff --git a/sgp/soundman.cpp b/sgp/soundman.cpp index 02d33d3e..663f5b87 100644 --- a/sgp/soundman.cpp +++ b/sgp/soundman.cpp @@ -11,7 +11,7 @@ #include #include "soundman.h" #include "FileMan.h" - #include "debug.h" + #include "DEBUG.H" #include "MemMan.h" #include "random.h" #include "fmod.h" diff --git a/sgp/Types.h b/sgp/types.h similarity index 100% rename from sgp/Types.h rename to sgp/types.h diff --git a/sgp/video.cpp b/sgp/video.cpp index f6ca2caf..bbd93c4b 100644 --- a/sgp/video.cpp +++ b/sgp/video.cpp @@ -1,16 +1,16 @@ #include "types.h" -#include "Video.h" +#include "video.h" #include "vobject_blitters.h" #include "sgp.h" #include #include #include "renderworld.h" #include "Render Dirty.h" -#include "fade screen.h" +#include "Fade Screen.h" #include "impTGA.h" -#include "timer control.h" -#include "Fileman.h" -#include "Input.h" +#include "Timer Control.h" +#include "FileMan.h" +#include "input.h" #include "GameSettings.h" #include "sgp_logger.h" @@ -18,8 +18,8 @@ #include #include -#include "Local.h" -#include "text.h" +#include "local.h" +#include "Text.h" #ifndef _MT diff --git a/sgp/video.h b/sgp/video.h index 02527b3a..16bd664f 100644 --- a/sgp/video.h +++ b/sgp/video.h @@ -5,11 +5,11 @@ #include #include -#include "Local.h" -#include "Debug.h" -#include "Types.h" +#include "local.h" +#include "DEBUG.H" +#include "types.h" #include "DirectDraw Calls.h" -#include "VSurface.h" +#include "vsurface.h" #define BUFFER_READY 0x00 #define BUFFER_BUSY 0x01 diff --git a/sgp/vobject.cpp b/sgp/vobject.cpp index 154c2c5d..1276bb0c 100644 --- a/sgp/vobject.cpp +++ b/sgp/vobject.cpp @@ -1,10 +1,10 @@ #include "DirectDraw Calls.h" #include -#include "debug.h" +#include "DEBUG.H" #include "video.h" #include "himage.h" #include "vobject.h" -#include "wcheck.h" +#include "WCheck.h" #include "vobject_blitters.h" #include "sgp.h" diff --git a/sgp/vobject_blitters.cpp b/sgp/vobject_blitters.cpp index 21225e64..6637db9e 100644 --- a/sgp/vobject_blitters.cpp +++ b/sgp/vobject_blitters.cpp @@ -1,10 +1,10 @@ #include "DirectDraw Calls.h" #include - #include "debug.h" + #include "DEBUG.H" #include "video.h" // JA2 #include "himage.h" #include "vobject.h" - #include "wcheck.h" + #include "WCheck.h" #include "vobject.h" #include "vobject_blitters.h" #include "shading.h" diff --git a/sgp/vsurface.cpp b/sgp/vsurface.cpp index 905cf893..07538126 100644 --- a/sgp/vsurface.cpp +++ b/sgp/vsurface.cpp @@ -1,12 +1,12 @@ #include "DirectDraw Calls.h" #include #include -#include "debug.h" +#include "DEBUG.H" #include "video.h" #include "himage.h" #include "vsurface.h" #include "vsurface_private.h" -#include "wcheck.h" +#include "WCheck.h" #include "vobject_blitters.h" extern void SetClippingRect(SGPRect *clip); diff --git a/sgp/ZCONF.H b/sgp/zconf.h similarity index 95% rename from sgp/ZCONF.H rename to sgp/zconf.h index 38df56c4..428f3905 100644 --- a/sgp/ZCONF.H +++ b/sgp/zconf.h @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* $Id: ZCONF.H,v 1.2 2004/03/16 02:00:39 digicrab Exp $ */ +/* $Id: zconf.h,v 1.2 2004/03/16 02:00:39 digicrab Exp $ */ #ifndef _ZCONF_H #define _ZCONF_H diff --git a/sgp/ZLIB.H b/sgp/zlib.h similarity index 100% rename from sgp/ZLIB.H rename to sgp/zlib.h From 3c44f133fdcd6748fc4795bd952852da89bca961 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sat, 23 Aug 2025 23:57:00 -0300 Subject: [PATCH 341/571] Actually fix NOTIFY_IF_SLEEP_FAILS for multiple mercs selected --- Strategic/Assignments.cpp | 15 ++------------- Strategic/mapscreen.cpp | 6 +++--- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index b548c20b..63eab1f4 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -18305,21 +18305,10 @@ BOOLEAN HandleSelectedMercsBeingPutAsleep( BOOLEAN fWakeUp, BOOLEAN fDisplayWarn } } - if( ubNumberOfSelectedSoldiers == 0 ) - { - return fSuccess; - } - - if( !fDisplayWarning ) { - return fSuccess; - } - - CHAR16 sString[ 128 ]; - swprintf( sString, fWakeUp ? pMapErrorString[ 27 ] : pMapErrorString[ 26 ] ); - if( gGameExternalOptions.fSleepDisplayFailNotification ) + if( ubNumberOfSelectedSoldiers && !fSuccess && fDisplayWarning ) { // inform player not everyone could be woke up or put to sleep - DoScreenIndependantMessageBox( sString, MSG_BOX_FLAG_OK, NULL); + DoScreenIndependantMessageBox(fWakeUp ? pMapErrorString[27] : pMapErrorString[26], MSG_BOX_FLAG_OK, NULL); } return( fSuccess ); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 2703c65a..054ce60a 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -11897,12 +11897,12 @@ void TeamListSleepRegionBtnCallBack( MOUSE_REGION *pRegion, INT32 iReason ) if( pSoldier->flags.fMercAsleep == TRUE ) { // try to wake him up - if( SetMercAwake( pSoldier, TRUE, FALSE ) ) + if( SetMercAwake( pSoldier, gGameExternalOptions.fSleepDisplayFailNotification, FALSE ) ) { // HEADROCK HAM B2.8: New feature wakes all trainees/trainers automatically HandleTrainingWakeSynchronize( pSoldier ); // propagate - HandleSelectedMercsBeingPutAsleep( TRUE, TRUE ); + HandleSelectedMercsBeingPutAsleep( TRUE, gGameExternalOptions.fSleepDisplayFailNotification); return; } else @@ -11919,7 +11919,7 @@ void TeamListSleepRegionBtnCallBack( MOUSE_REGION *pRegion, INT32 iReason ) // HEADROCK HAM B2.8: New feature sends all trainees/trainers to sleep automatically HandleTrainingSleepSynchronize( pSoldier ); // propagate - HandleSelectedMercsBeingPutAsleep( FALSE, TRUE ); + HandleSelectedMercsBeingPutAsleep( FALSE, gGameExternalOptions.fSleepDisplayFailNotification); return; } else From 1004ab6c8c5871fa52c0ac11697b074a56148011 Mon Sep 17 00:00:00 2001 From: Buscher Date: Sun, 24 Aug 2025 18:34:37 +0200 Subject: [PATCH 342/571] Added Right Click to time compression to fast forward a single hour --- Strategic/Game Clock.cpp | 6 ++++++ Strategic/Game Clock.h | 3 +++ Strategic/Hourly Update.cpp | 5 +++++ Strategic/Map Screen Interface Bottom.cpp | 21 +++++++++++++++++++++ i18n/_EnglishText.cpp | 2 +- 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Strategic/Game Clock.cpp b/Strategic/Game Clock.cpp index bb3d38c7..26310142 100644 --- a/Strategic/Game Clock.cpp +++ b/Strategic/Game Clock.cpp @@ -45,6 +45,9 @@ BOOLEAN fClockMouseRegionCreated = FALSE; BOOLEAN fTimeCompressHasOccured = FALSE; +// run time compression till next hour +bool stopTimeCompressionNextHour = false; + //This value represents the time that the sector was loaded. If you are in sector A9, and leave //the game clock at that moment will get saved into the temp file associated with it. The next time you //enter A9, this value will contain that time. Used for scheduling purposes. @@ -525,6 +528,9 @@ void SetGameTimeCompressionLevel( UINT32 uiCompressionRate ) { Assert( uiCompressionRate < NUM_TIME_COMPRESS_SPEEDS ); + if( uiCompressionRate == TIME_COMPRESS_X0 ) + stopTimeCompressionNextHour = false; + if( guiCurrentScreen == GAME_SCREEN ) { if( uiCompressionRate != TIME_COMPRESS_X1 ) diff --git a/Strategic/Game Clock.h b/Strategic/Game Clock.h index eed8b06e..62ee8e5b 100644 --- a/Strategic/Game Clock.h +++ b/Strategic/Game Clock.h @@ -109,6 +109,9 @@ extern INT32 giTimeCompressSpeeds[ NUM_TIME_COMPRESS_SPEEDS ]; // compress mode now in use extern INT32 giTimeCompressMode; +// run time compression till next hour +extern bool stopTimeCompressionNextHour; + enum { diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index 2d573827..e87e189e 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -86,6 +86,11 @@ CHAR16 zString[128]; if(is_networked) return; + if (stopTimeCompressionNextHour) + { + SetGameTimeCompressionLevel( TIME_COMPRESS_X0); + } + // hourly update of town loyalty HandleTownLoyalty(); diff --git a/Strategic/Map Screen Interface Bottom.cpp b/Strategic/Map Screen Interface Bottom.cpp index bb60945a..8bd67806 100644 --- a/Strategic/Map Screen Interface Bottom.cpp +++ b/Strategic/Map Screen Interface Bottom.cpp @@ -713,6 +713,27 @@ void BtnTimeCompressMoreMapScreenCallback( GUI_BUTTON *btn,INT32 reason ) { if ( CommonTimeCompressionChecks() == TRUE ) return; + + // redraw region + if( btn->uiFlags & MSYS_HAS_BACKRECT ) + { + fMapScreenBottomDirty = TRUE; + } + + btn->uiFlags|=(BUTTON_CLICKED_ON); + } + // Start time compression which stops at the next hour + // Button down removes the pop up/tooltip, Button up calls the functionality + else if(reason & MSYS_CALLBACK_REASON_RBUTTON_UP ) + { + if (btn->uiFlags & BUTTON_CLICKED_ON) + { + btn->uiFlags&=~(BUTTON_CLICKED_ON); + fMapScreenBottomDirty = TRUE; + + stopTimeCompressionNextHour = true; + SetGameTimeCompressionLevel( TIME_COMPRESS_60MINS ); + } } } diff --git a/i18n/_EnglishText.cpp b/i18n/_EnglishText.cpp index 022d8012..f567783d 100644 --- a/i18n/_EnglishText.cpp +++ b/i18n/_EnglishText.cpp @@ -4453,7 +4453,7 @@ STR16 pMapScreenBottomFastHelp[] = L"|Laptop", L"Tactical (|E|s|c)", L"|Options", - L"Time Compress (|+)", // time compress more + L"Time Compress (|+)\nRight Click to fast forward one hour", // time compress more L"Time Compress (|-)", // time compress less L"Previous Message (|U|p)\nPrevious Page (|P|g|U|p)", // previous message in scrollable list L"Next Message (|D|o|w|n)\nNext Page (|P|g|D|n)", // next message in the scrollable list From 272ba56fa14ee322771e81f41789be6f2a16edae Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sat, 30 Aug 2025 18:24:17 -0300 Subject: [PATCH 343/571] remove unused function --- Utils/Text Utils.cpp | 11 ----------- i18n/include/Text.h | 2 -- 2 files changed, 13 deletions(-) diff --git a/Utils/Text Utils.cpp b/Utils/Text Utils.cpp index 5ae5ac51..154ef003 100644 --- a/Utils/Text Utils.cpp +++ b/Utils/Text Utils.cpp @@ -388,17 +388,6 @@ void ParseCommandLine ( ++*numargs; } -inline std::string narrow(std::wstring const& text) -{ - std::locale const loc(""); - wchar_t const* from = text.c_str(); - std::size_t const len = text.size(); - std::vector buffer(len + 1); - std::use_facet >(loc).narrow(from, from + len, '_', &buffer[0]); - - return std::string(&buffer[0], &buffer[len]); -} - // convert UTF-8 string to wstring std::wstring utf8_to_wstring(const std::string& str) { diff --git a/i18n/include/Text.h b/i18n/include/Text.h index d9bb16b0..1e14d125 100644 --- a/i18n/include/Text.h +++ b/i18n/include/Text.h @@ -1803,8 +1803,6 @@ BOOLEAN LoadItemProsAndCons( UINT16 usIndex, STR16 pProsString, STR16 pConsStrin BOOLEAN LoadBRDesc(UINT16 ubIndex, STR16 pDescString ); BOOLEAN LoadBRName(UINT16 ubIndex, STR16 pNameString ); -// sevenfm -inline std::string narrow(std::wstring const& text); // convert UTF-8 string to wstring std::wstring utf8_to_wstring(const std::string& str); // convert wstring to UTF-8 string From 5d3cc7969f847dd85b68ea787e885102e68c72a4 Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sat, 30 Aug 2025 12:44:35 -0300 Subject: [PATCH 344/571] fix code that relies on transitive includes --- Multiplayer/connect.h | 1 + Utils/popup_class.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Multiplayer/connect.h b/Multiplayer/connect.h index f5eff451..d216fb30 100644 --- a/Multiplayer/connect.h +++ b/Multiplayer/connect.h @@ -6,6 +6,7 @@ #include "Event Pump.h" #include "Bullets.h" #include "builddefines.h" +#include "Strategic Movement.h" extern bool isOwnTeamWipedOut; diff --git a/Utils/popup_class.cpp b/Utils/popup_class.cpp index bb360724..b8a53b78 100644 --- a/Utils/popup_class.cpp +++ b/Utils/popup_class.cpp @@ -21,8 +21,8 @@ // functions and variable declarations for binding the class with C callbacks ////////////////////////////////////////////////////////////////// -vector gPopupRegionIndex; -vector gPopupIndex; +std::vector gPopupRegionIndex; +std::vector gPopupIndex; UINT32 gPopupRegionIndexCounter = 0; UINT32 gPopupIndexCounter = 0; UINT32 POPUP::nextid = 0; @@ -237,19 +237,19 @@ BOOLEAN POPUP_OPTION::forceRun() ////////////////////////////////////////////////////////////////// // constructor -POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION(new wstring(L"Unnamed subPopup"),NULL) //TODO: possible memmory leak! +POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION(new std::wstring(L"Unnamed subPopup"),NULL) //TODO: possible memmory leak! { this->parent = NULL; this->initSubPopup(); } -POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring* name) : POPUP_OPTION(name, NULL) +POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(std::wstring* name) : POPUP_OPTION(name, NULL) { this->parent = NULL; this->initSubPopup(); } -POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring* newName, const POPUP * parent) : POPUP_OPTION(newName, NULL) +POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(std::wstring* newName, const POPUP * parent) : POPUP_OPTION(newName, NULL) { this->parent = parent; this->initSubPopup(); @@ -342,7 +342,7 @@ static void unShadeOpenSubPopup( POPUP_SUB_POPUP_OPTION * opt ){ void POPUP_SUB_POPUP_OPTION::initSubPopup() { - this->subPopup = new POPUP( (CHAR*) wstring(this->name).c_str() ); + this->subPopup = new POPUP( (CHAR*) std::wstring(this->name).c_str() ); this->subPopup->setCallback(POPUP_CALLBACK_SHOW,new popupCallbackFunction( &shadeOpenSubPopup, this )); this->subPopup->setCallback(POPUP_CALLBACK_HIDE,new popupCallbackFunction( &unShadeOpenSubPopup, this )); @@ -563,7 +563,7 @@ void POPUP::setInitialValues(void) // setup functions -POPUP_OPTION * POPUP::addOption(wstring * name, popupCallback* action) +POPUP_OPTION * POPUP::addOption(std::wstring * name, popupCallback* action) { if (this->optionCount < POPUP_MAX_OPTIONS) { @@ -606,7 +606,7 @@ POPUP_OPTION * POPUP::getOption(UINT16 n) return NULL; } -POPUP * POPUP::addSubMenuOption(wstring * name) +POPUP * POPUP::addSubMenuOption(std::wstring * name) { if (this->subPopupOptionCount < POPUP_MAX_SUB_POPUPS) { From e5d25810f655e91892972498d32b085168f9fc3b Mon Sep 17 00:00:00 2001 From: "Marco Antonio J. Costa" Date: Sat, 30 Aug 2025 12:43:12 -0300 Subject: [PATCH 345/571] nuke console --- CMakeLists.txt | 2 - Console/CMakeLists.txt | 6 - Console/ComBSTROut.h | 81 -- Console/ComVariantOut.h | 109 -- Console/Console.cpp | 2876 --------------------------------------- Console/Console.h | 746 ---------- Console/Console.rc | 208 --- Console/Cursors.cpp | 769 ----------- Console/Cursors.h | 342 ----- Console/Dialogs.cpp | 134 -- Console/Dialogs.h | 64 - Console/FileStream.cpp | 259 ---- Console/FileStream.h | 107 -- Console/ReadMe.txt | 1200 ---------------- Console/console.ico | Bin 18902 -> 0 bytes Utils/popup_class.cpp | 1 - sgp/sgp.cpp | 16 - 17 files changed, 6920 deletions(-) delete mode 100644 Console/CMakeLists.txt delete mode 100644 Console/ComBSTROut.h delete mode 100644 Console/ComVariantOut.h delete mode 100644 Console/Console.cpp delete mode 100644 Console/Console.h delete mode 100644 Console/Console.rc delete mode 100644 Console/Cursors.cpp delete mode 100644 Console/Cursors.h delete mode 100644 Console/Dialogs.cpp delete mode 100644 Console/Dialogs.h delete mode 100644 Console/FileStream.cpp delete mode 100644 Console/FileStream.h delete mode 100644 Console/ReadMe.txt delete mode 100644 Console/console.ico diff --git a/CMakeLists.txt b/CMakeLists.txt index 4201e90f..fab983a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ include_directories( "${CMAKE_SOURCE_DIR}/Laptop" "${CMAKE_SOURCE_DIR}/Multiplayer" "${CMAKE_SOURCE_DIR}/Editor" - "${CMAKE_SOURCE_DIR}/Console" "${CMAKE_SOURCE_DIR}/i18n/include" ) @@ -88,7 +87,6 @@ wine # static libraries whose translation units rely on Application preprocessor definitions. set(Ja2_Libs - Console Editor Ja2 Laptop diff --git a/Console/CMakeLists.txt b/Console/CMakeLists.txt deleted file mode 100644 index 7c67cd0a..00000000 --- a/Console/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(ConsoleSrc -"${CMAKE_CURRENT_SOURCE_DIR}/Console.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Cursors.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/Dialogs.cpp" -"${CMAKE_CURRENT_SOURCE_DIR}/FileStream.cpp" -PARENT_SCOPE) diff --git a/Console/ComBSTROut.h b/Console/ComBSTROut.h deleted file mode 100644 index 598e5204..00000000 --- a/Console/ComBSTROut.h +++ /dev/null @@ -1,81 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - -#ifndef _COMBSTROUT_H_ -#define _COMBSTROUT_H_ - -///////////////////////////////////////////////////////////////////////////// -// CComBSTROut - a class that inherits from CComBSTR and adds Out() method -// that should be used instead of & operator for 'out' -// function parameters - -class CComBSTROut : public CComBSTR -{ -public: - - CComBSTROut() - { - } - /*explicit*/ CComBSTROut(int nSize) : CComBSTR(nSize) - { - } - /*explicit*/ CComBSTROut(int nSize, LPCOLESTR sz) : CComBSTR(nSize, sz) - { - } - /*explicit*/ CComBSTROut(LPCOLESTR pSrc) : CComBSTR(pSrc) - { - } - /*explicit*/ CComBSTROut(const CComBSTROut& src) : CComBSTR(src) - { - } - /*explicit*/ CComBSTROut(REFGUID src) : CComBSTR(src) - { - } - -#ifndef OLE2ANSI - CComBSTROut(LPCSTR pSrc) : CComBSTR(pSrc) - { - } - - CComBSTROut(int nSize, LPCSTR sz) : CComBSTR(nSize, sz) - { - } -#endif - - ~CComBSTROut() - { - CComBSTR::~CComBSTR(); - } - - BSTR* Out() - { - Empty(); - return &m_str; - } -}; - -///////////////////////////////////////////////////////////////////////////// - - -#endif // _COMBSTROUT_H_ diff --git a/Console/ComVariantOut.h b/Console/ComVariantOut.h deleted file mode 100644 index 1e52a866..00000000 --- a/Console/ComVariantOut.h +++ /dev/null @@ -1,109 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - -#ifndef _COMVARIANTOUT_H_ -#define _COMVARIANTOUT_H_ - -///////////////////////////////////////////////////////////////////////////// -// CComVariantOut - a class that inherits from CComVariant and adds Out() -// method that should be used instead of & operator for -// 'out' function parameters - -class CComVariantOut : public CComVariant -{ - -public: - CComVariantOut() - { - } - ~CComVariantOut() - { - CComVariant::~CComVariant(); - } - - CComVariantOut(const VARIANT& varSrc) : CComVariant(varSrc) - { - } - - CComVariantOut(const CComVariant& varSrc) : CComVariant(varSrc) - { - } - - CComVariantOut(BSTR bstrSrc) : CComVariant(bstrSrc) - { - } - CComVariantOut(LPCOLESTR lpszSrc) : CComVariant(lpszSrc) - { - } - -#ifndef OLE2ANSI - CComVariantOut(LPCSTR lpszSrc) : CComVariant(lpszSrc) - { - } -#endif - - CComVariantOut(bool bSrc) : CComVariant(bSrc) - { - } - - CComVariantOut(int nSrc) : CComVariant(nSrc) - { - } - CComVariantOut(BYTE nSrc) : CComVariant(nSrc) - { - } - CComVariantOut(short nSrc) : CComVariant(nSrc) - { - } - CComVariantOut(long nSrc, VARTYPE m_varSrc = VT_I4) : CComVariant(nSrc, m_varSrc) - { - } - CComVariantOut(float fltSrc) : CComVariant(fltSrc) - { - } - CComVariantOut(double dblSrc) : CComVariant(dblSrc) - { - } - CComVariantOut(CY cySrc) : CComVariant(cySrc) - { - } - CComVariantOut(IDispatch* pSrc) : CComVariant(pSrc) - { - } - CComVariantOut(IUnknown* pSrc) : CComVariant(pSrc) - { - } - -public: - VARIANT* Out() - { - Clear(); - return this; - } -}; - -///////////////////////////////////////////////////////////////////////////// - - -#endif // _COMVARIANTOUT_H_ diff --git a/Console/Console.cpp b/Console/Console.cpp deleted file mode 100644 index e7453938..00000000 --- a/Console/Console.cpp +++ /dev/null @@ -1,2876 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - -#ifdef UNICODE -#error "Unicode defined" -#endif - -///////////////////////////////////////////////////////////////////////////// -// Console.cpp - console class implementation -#include "builddefines.h" -#undef CINTERFACE - -//#include "stdafx.h" -//#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "resource.h" -#include "FileStream.h" -//#include "ComBSTROut.h" -//#include "ComVariantOut.h" -#include "Cursors.h" -#include "Dialogs.h" -#include "Console.h" - -#ifdef _DEBUG -//#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - - -extern HINSTANCE ghInstance; - -///////////////////////////////////////////////////////////////////////////// -// Console class - - -///////////////////////////////////////////////////////////////////////////// -// Console window class names -const TCHAR Console::m_szConsoleClass[] = _T("Console Main Command Window"); -const TCHAR Console::m_szHiddenParentClass[] = _T("Console Invisible Parent Window"); - - -///////////////////////////////////////////////////////////////////////////// -// win console window title -const tstring Console::m_strWinConsoleTitle(_T("Console Command Window")); - - -///////////////////////////////////////////////////////////////////////////// -// ctor/dtor - -Console::Console(LPCTSTR pszConfigFile, LPCTSTR pszShellCmdLine, LPCTSTR pszConsoleTitle, LPCTSTR pszReloadNewConfig) -: m_hWnd(NULL) -, m_bInitializing(TRUE) -, m_bReloading(FALSE) -, m_strConfigEditor(_T("notepad.exe")) -, m_strConfigEditorParams(_T("")) -, m_strShell(_T("")) -, m_strShellCmdLine(pszShellCmdLine) -, m_hwndInvisParent(NULL) -, m_hdcConsole(NULL) -, m_hdcWindow(NULL) -, m_hbmpConsole(NULL) -, m_hbmpConsoleOld(NULL) -, m_hbmpWindow(NULL) -, m_hbmpWindowOld(NULL) -, m_hBkBrush(NULL) -, m_dwMasterRepaintInt(500) -, m_dwChangeRepaintInt(50) -, m_strIconFilename(_T("")) -, m_hSmallIcon(NULL) -, m_hBigIcon(NULL) -, m_hPopupMenu(NULL) -, m_hSysMenu(NULL) -, m_hConfigFilesMenu(NULL) -, m_bPopupMenuDisabled(FALSE) -, m_strWindowTitleDefault(_tcslen(pszConsoleTitle) == 0 ? _T("console") : pszConsoleTitle) -, m_strWindowTitle(m_strWindowTitleDefault) -, m_strWindowTitleCurrent(m_strWindowTitleDefault) -, m_strFontName(_T("Courier New")) -, m_dwFontSize(10) -, m_bBold(FALSE) -, m_bItalic(FALSE) -, m_bUseFontColor(FALSE) -, m_crFontColor(RGB(0, 0, 0)) -, m_hFont(NULL) -, m_hFontOld(NULL) -, m_nX(0) -, m_nY(0) -, m_nInsideBorder(0) -, m_nWindowWidth(0) -, m_nWindowHeight(0) -, m_nXBorderSize(5) -, m_nYBorderSize(5) -, m_nCaptionSize(0) -, m_nClientWidth(0) -, m_nClientHeight(0) -, m_nCharHeight(0) -, m_nCharWidth(0) -, m_dwWindowBorder(BORDER_REGULAR) -, m_bShowScrollbar(TRUE) -, m_nScrollbarStyle(FSB_REGULAR_MODE) -, m_crScrollbarColor(::GetSysColor(COLOR_3DHILIGHT)) -, m_nScrollbarWidth(::GetSystemMetrics(SM_CXVSCROLL)) -, m_nScrollbarButtonHeight(::GetSystemMetrics(SM_CYVSCROLL)) -, m_nScrollbarThunmbHeight(::GetSystemMetrics(SM_CYVTHUMB)) -, m_dwTaskbarButton(TASKBAR_BUTTON_NORMAL) -, m_bMouseDragable(TRUE) -, m_nSnapDst(10) -, m_dwDocked(DOCK_NONE) -, m_dwOriginalZOrder(Z_ORDER_REGULAR) -, m_dwCurrentZOrder(Z_ORDER_REGULAR) -, m_dwTransparency(TRANSPARENCY_NONE) -, m_byAlpha(150) -, m_byInactiveAlpha(150) -, m_crBackground(RGB(0, 0, 0)) -, m_crConsoleBackground(RGB(0, 0, 0)) -, m_bTintSet(FALSE) -, m_byTintOpacity(50) -, m_byTintR(0) -, m_byTintG(0) -, m_byTintB(0) -, m_bBitmapBackground(FALSE) -, m_strBackgroundFile(_T("")) -, m_hdcBackground(NULL) -, m_hbmpBackground(NULL) -, m_hbmpBackgroundOld(NULL) -, m_dwBackgroundStyle(BACKGROUND_STYLE_RESIZE) -, m_bRelativeBackground(FALSE) -, m_bExtendBackground(FALSE) -, m_nBackgroundOffsetX(0) -, m_nBackgroundOffsetY(0) -, m_bHideWindow(FALSE) -, m_bHideConsole(TRUE) -, m_dwHideConsoleTimeout(0) -, m_bStartMinimized(FALSE) -, m_dwCursorStyle(CURSOR_STYLE_CONSOLE) -, m_crCursorColor(RGB(255, 255, 255)) -, m_bCursorVisible(TRUE) -, m_pCursor(NULL) -, m_hWndConsole(NULL) -, m_hStdOut(NULL) -, m_hStdOutFresh(NULL) -, m_hQuitEvent(NULL) -, m_hConsoleProcess(NULL) -, m_hMonitorThread(NULL) -, m_dwRows(50) -, m_dwColumns(80) -, m_dwBufferRows(500) -, m_bUseTextBuffer(TRUE) -, m_nTextSelection(TEXT_SELECTION_NONE) -, m_bCopyOnSelect(FALSE) -, m_bInverseShift(FALSE) -, m_hdcSelection(NULL) -, m_hbmpSelection(NULL) -, m_hbmpSelectionOld(NULL) -, m_hbrushSelection(::CreateSolidBrush(RGB(0xff, 0xff, 0xff))) -, m_pScreenBuffer(NULL) -, m_pScreenBufferNew(NULL) -, m_nTextColor(15) -, m_nTextBgColor(0) -{ - - - m_mouseCursorOffset.x = 0; - m_mouseCursorOffset.y = 0; - - m_coordSelOrigin.X = 0; - m_coordSelOrigin.Y = 0; - - ::ZeroMemory(&m_rectSelection, sizeof(RECT)); - - - ::ZeroMemory(&m_csbiCursor, sizeof(CONSOLE_SCREEN_BUFFER_INFO)); - ::ZeroMemory(&m_csbiConsole, sizeof(CONSOLE_SCREEN_BUFFER_INFO)); - - SetDefaultConsoleColors(); - - AllocateBuffer(); - - // Set the stdout and stderr to this window - HANDLE myOut; - ::CreatePipe( &m_hStdOut, &myOut, NULL, 0); - ::SetStdHandle( STD_OUTPUT_HANDLE, myOut); - ::SetStdHandle( STD_ERROR_HANDLE, myOut); - - int hConHandle = _open_osfhandle((long)myOut, _O_BINARY); //_O_WTEXT); - FILE *fp = _fdopen( hConHandle, "w" ); - *stdout = *fp; - *stderr = *fp; - setvbuf( stdout, NULL, _IONBF, 0 ); - - // create text monitor thread - DWORD dwThreadID; - m_hMonitorThread = ::CreateThread(NULL, 0, Console::MonitorThreadStatic, this, CREATE_SUSPENDED, &dwThreadID); - ::ResumeThread(m_hMonitorThread); -} - -Console::~Console() { - - delete[] m_pScreenBuffer; - delete[] m_pScreenBufferNew; - - if (m_hSmallIcon) ::DestroyIcon(m_hSmallIcon); - if (m_hBigIcon) ::DestroyIcon(m_hBigIcon); - -// ::CloseHandle(m_hConsoleProcess); -// ::CloseHandle(m_hQuitEvent); - - // shutdown console process -// ::CloseHandle(m_hStdOut); -// ::CloseHandle(m_hStdOutFresh); -// if (m_hWndConsole) ::SendMessage(m_hWndConsole, WM_CLOSE, 0, 0); -// ::FreeConsole(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Public methods - -///////////////////////////////////////////////////////////////////////////// -// creates and shows Console window - -BOOL Console::Create(HWND notify) { - - m_notifyhWnd = notify; - - if (m_hWnd) - { - ::ShowWindow( m_hWnd, SW_SHOW); - return TRUE; - } - - if (!GetOptions()) return FALSE; - - if (!RegisterWindowClasses()) return FALSE; - - if (!CreateConsoleWindow()) return FALSE; - - // create window DC - HDC hdcDesktop = ::GetDCEx(m_hWnd, NULL, 0); - m_hdcConsole = ::CreateCompatibleDC(hdcDesktop); - m_hdcWindow = ::CreateCompatibleDC(hdcDesktop); - ::ReleaseDC(m_hWnd, hdcDesktop); - - // create selection DC - m_hdcSelection = ::CreateCompatibleDC(m_hdcWindow); - - if (!SetupMenus()) return FALSE; - - CreateNewFont(); - CreateNewBrush(); - -// SetWindowTransparency(); - SetWindowIcons(); - - GetTextSize(); - GetBordersDimensions(); - CreateCursor(); - - // now we can start the monitor thread - StartShellProcess(); - - // set the long repaint timer - if (m_dwMasterRepaintInt) ::SetTimer(m_hWnd, TIMER_REPAINT_MASTER, m_dwMasterRepaintInt, NULL); - - m_bInitializing = FALSE; - - // register for files/folders drag-n-drop - ::DragAcceptFiles(m_hWnd, TRUE); - - RefreshScreenBuffer(); - ::CopyMemory(m_pScreenBuffer, m_pScreenBufferNew, sizeof(CHAR_INFO) * m_dwRows * m_dwColumns); - RepaintWindow(); - ::UpdateWindow(m_hWnd); - - if (m_bStartMinimized) { - if (m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL) { - m_bHideWindow = TRUE; - } else { - ::ShowWindow(m_hWnd, SW_MINIMIZE); - } - } else { - ::ShowWindow(m_hWnd, SW_SHOW); - } - - ::SetForegroundWindow(m_hWnd); - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Message handlers - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnDestroy() { - - if (!m_bInitializing) { - ::SetEvent(m_hQuitEvent); - ::WaitForSingleObject(m_hMonitorThread, 2000); - ::CloseHandle(m_hMonitorThread); - - // kill timers - ::KillTimer(m_hWnd, TIMER_REPAINT_CHANGE); - if (m_dwMasterRepaintInt) ::KillTimer(m_hWnd, TIMER_REPAINT_MASTER); - - DestroyCursor(); - - // cleanup graphics objects - if (m_hFontOld) ::SelectObject(m_hdcConsole, m_hFontOld); - if (m_hFont) ::DeleteObject(m_hFont); - - if (m_hBkBrush) ::DeleteObject(m_hBkBrush); - - if (m_hbmpConsoleOld) ::SelectObject(m_hdcConsole, m_hbmpConsoleOld); - if (m_hbmpConsole) ::DeleteObject(m_hbmpConsole); - - if (m_hbmpWindowOld) ::SelectObject(m_hdcWindow, m_hbmpWindowOld); - if (m_hbmpWindow) ::DeleteObject(m_hbmpWindow); - - if (m_hbmpBackgroundOld) ::SelectObject(m_hdcBackground, m_hbmpBackgroundOld); - if (m_hbmpBackground) ::DeleteObject(m_hbmpBackground); - if (m_hdcBackground) ::DeleteDC(m_hdcBackground); - - if (m_hbmpSelectionOld) ::SelectObject(m_hdcSelection, m_hbmpSelectionOld); - if (m_hbmpSelection)::DeleteObject(m_hbmpSelection); - if (m_hdcSelection) ::DeleteDC(m_hdcSelection); - - if (m_hbrushSelection) ::DeleteObject(m_hbrushSelection); - - ::DestroyMenu(m_hConfigFilesMenu); - ::DestroyMenu(m_hPopupMenu); - - SetTrayIcon(NIM_DELETE); - - ::DeleteDC(m_hdcConsole); - ::DeleteDC(m_hdcWindow); - ::PostQuitMessage(0); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnNcDestroy() { - if (!m_bInitializing) delete this; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnPaint() { - - PAINTSTRUCT paintStruct; - HDC hdc = ::BeginPaint(m_hWnd, &paintStruct); - - if (!m_nTextSelection) { - // if there's no selection, just blit console image - ::BitBlt( - hdc, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, - paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, - m_hdcConsole, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - SRCCOPY); - } else { - // there's a text selection, first compose the image in an off-screen - // buffer, and then blit it - ::BitBlt( - m_hdcWindow, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, - paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, - m_hdcConsole, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - SRCCOPY); - - ::BitBlt( - m_hdcWindow, - m_rectSelection.left, - m_rectSelection.top, - m_rectSelection.right - m_rectSelection.left, - m_rectSelection.bottom - m_rectSelection.top, - m_hdcSelection, - 0, - 0, - SRCINVERT); - ::BitBlt( - hdc, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - paintStruct.rcPaint.right - paintStruct.rcPaint.left + 1, - paintStruct.rcPaint.bottom - paintStruct.rcPaint.top + 1, - m_hdcWindow, - paintStruct.rcPaint.left, - paintStruct.rcPaint.top, - SRCCOPY); - } - - ::EndPaint(m_hWnd, &paintStruct); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnPaintTimer() { - - ::KillTimer(m_hWnd, TIMER_REPAINT_CHANGE); - RefreshStdOut(); - RefreshScreenBuffer(); - - if (GetChangeRate() > 15) { - ::CopyMemory(m_pScreenBuffer, m_pScreenBufferNew, sizeof(CHAR_INFO) * m_dwRows * m_dwColumns); - RepaintWindow(); - } else { - RepaintWindowChanges(); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnCursorTimer() { - if (m_pCursor) { - m_pCursor->PrepareNext(); - DrawCursor(); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnWindowPosChanging(WINDOWPOS* lpWndPos) { - - if (!(lpWndPos->flags & SWP_NOMOVE)) { - if (m_nSnapDst >= 0) { - // we'll snap Console window to the desktop edges - RECT rectDesktop; - - GetDesktopRect(rectDesktop); - - m_dwDocked = DOCK_NONE; - DWORD dwLeftRight = 0; - DWORD dwTopBottom = 0; - - // now, see if we're close to the edges - if (lpWndPos->x <= rectDesktop.left + m_nSnapDst) { - lpWndPos->x = rectDesktop.left; - dwLeftRight = 1; - } - - if (lpWndPos->x >= rectDesktop.right - m_nWindowWidth - m_nSnapDst) { - lpWndPos->x = rectDesktop.right - m_nWindowWidth; - dwLeftRight = 2; - } - - if (lpWndPos->y <= rectDesktop.top + m_nSnapDst) { - lpWndPos->y = rectDesktop.top; - dwTopBottom = 1; - } - - if (lpWndPos->y >= rectDesktop.bottom - m_nWindowHeight - m_nSnapDst) { - lpWndPos->y = rectDesktop.bottom - m_nWindowHeight; - dwTopBottom = 2; - } - - // now, see if the window is docked - if (dwLeftRight == 1) { - // left edge - if (dwTopBottom == 1) { - // top left - m_dwDocked = DOCK_TOP_LEFT; - } else if (dwTopBottom == 2) { - // bottom left - m_dwDocked = DOCK_BOTTOM_LEFT; - } - } else if (dwLeftRight == 2) { - // right edge - if (dwTopBottom == 1) { - // top right - m_dwDocked = DOCK_TOP_RIGHT; - } else if (dwTopBottom == 2) { - // bottom right - m_dwDocked = DOCK_BOTTOM_RIGHT; - } - } - } - - m_nX = lpWndPos->x; - m_nY = lpWndPos->y; - -// TRACE(_T("Win pos: %ix%i\n"), m_nX, m_nY); - - // we need to repaint for relative backgrounds -// if (m_bRelativeBackground && !m_bInitializing) RepaintWindow(); - } - - if (m_dwCurrentZOrder == Z_ORDER_ONBOTTOM) lpWndPos->hwndInsertAfter = HWND_BOTTOM; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnActivateApp(BOOL bActivate, DWORD dwFlags) { - - if (m_pCursor) { - m_pCursor->SetState(bActivate); - DrawCursor(); - } - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnVScroll(WPARAM wParam) { - -// TRACE(_T("VScroll\n")); - - int nCurrentPos = ::GetScrollPos(m_hWnd, SB_VERT); - int nDelta = 0; - - switch(LOWORD (wParam)) { - - case SB_PAGEUP: - nDelta = -5; - break; - - case SB_PAGEDOWN: - nDelta = 5; - break; - - case SB_LINEUP: - nDelta = -1; - break; - - case SB_LINEDOWN: - nDelta = 1; - break; - - case SB_THUMBTRACK: - nDelta = HIWORD(wParam) - nCurrentPos; - break; - - case SB_ENDSCROLL: - - return; - - default: - return; - } - - if ((nDelta = max(-nCurrentPos, min(nDelta, (int)(m_dwBufferRows-m_dwRows) - nCurrentPos))) != 0) { - - nCurrentPos += nDelta; - - SMALL_RECT sr; - sr.Top = (short) nCurrentPos; -// sr.Bottom = nDelta; - sr.Left = sr.Right = 0; - m_csbiConsole.srWindow = sr; -// ::SetConsoleWindowInfo(m_hStdOutFresh, FALSE, &sr); - - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS; - si.nPos = nCurrentPos; - ::FlatSB_SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE); - - // this seems to work/look much better than direct repainting... - ::SetTimer(m_hWnd, TIMER_REPAINT_CHANGE, m_dwChangeRepaintInt, NULL); - } - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnInputLangChangeRequest(WPARAM wParam, LPARAM lParam) { - ::PostMessage(m_hWndConsole, WM_INPUTLANGCHANGEREQUEST, wParam, lParam); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnLButtonDown(UINT uiFlags, POINTS points) { -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnLButtonUp(UINT uiFlags, POINTS points) { - - if ((m_nTextSelection == TEXT_SELECTION_SELECTED) || - // X Windows select/copy style - ((m_nTextSelection == TEXT_SELECTION_SELECTING) && (m_bCopyOnSelect))) { - - // if the user clicked inside the selection rectangle, copy data - if ((points.x >= m_rectSelection.left) && - (points.x <= m_rectSelection.right) && - (points.y >= m_rectSelection.top) && - (points.y <= m_rectSelection.bottom)) { - - CopyTextToClipboard(); - } - - if (m_bCopyOnSelect) ::ReleaseCapture(); - ClearSelection(); - - } else if (m_nTextSelection == TEXT_SELECTION_SELECTING) { - - if ((m_rectSelection.left == m_rectSelection.right) && - (m_rectSelection.top == m_rectSelection.bottom)) { - - m_nTextSelection = TEXT_SELECTION_NONE; - - } else { - m_nTextSelection = TEXT_SELECTION_SELECTED; - } - ::ReleaseCapture(); - - } else if (m_bMouseDragable) { - // end window drag - ::ReleaseCapture(); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnLButtonDblClick(UINT uiFlags, POINTS points) { - -// ToggleWindowOnTop(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnRButtonUp(UINT uiFlags, POINTS points) { - - if (uiFlags & MK_SHIFT) { - PasteClipoardText(); - } else { - - if (m_bPopupMenuDisabled) return; - - POINT point; - point.x = points.x; - point.y = points.y; - ::ClientToScreen(m_hWnd, &point); - - HMENU hPopup = ::GetSubMenu(m_hPopupMenu, 0); - - // show popup menu - ::TrackPopupMenu(hPopup, 0, point.x, point.y, 0, m_hWnd, NULL); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnMButtonDown(UINT uiFlags, POINTS points) { - - PasteClipoardText(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnMouseMove(UINT uiFlags, POINTS points) { - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnChar(WORD myChar) { - wchar_t text[16]; - - if (myChar == 8) - { - int l = Input.length(); - if (l > 0) - { - wchar_t last = Input[ l - 1]; - if (last == '\n') - { - return; - } - - text[0] = 8; - text[1] = L' '; - text[2] = 8; - text[3] = 0; - - Input.resize( l - 1); - } - else - { - return; - } - } - else if (myChar == '\r') - { - text[0] = '\n'; - text[1] = '\r'; - text[2] = 0; - Input += '\n'; - SendTextToConsole( text); - SendMessage( m_notifyhWnd, WM_INPUTREADY, 0, (LPARAM) &Input); - return; - } - else - { - text[0] = myChar; - text[1] = 0; - Input += text; - } - - SendTextToConsole( text); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnSetCursor(WORD wHitTest, WORD wMouseMessage) { - - if (wHitTest == HTBORDER) { - if (wMouseMessage == WM_LBUTTONDOWN) { - if (m_bMouseDragable) { - // start to drag window - RECT windowRect; - ::GetCursorPos(&m_mouseCursorOffset); - ::GetWindowRect(m_hWnd, &windowRect); - m_mouseCursorOffset.x -= windowRect.left; - m_mouseCursorOffset.y -= windowRect.top; - ::SetCapture(m_hWnd); - } - } else if (wMouseMessage == WM_LBUTTONUP) { - if (m_bMouseDragable) { - // end window drag - ::ReleaseCapture(); - } - } - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnInitMenuPopup(HMENU hMenu, UINT uiPos, BOOL bSysMenu) { - - if ((hMenu != ::GetSubMenu(m_hPopupMenu, 0)) && (hMenu != m_hSysMenu)) return; - - // update configuration files submenu - UpdateConfigFilesSubmenu(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnDropFiles(HDROP hDrop) { - - UINT uiFilesCount = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); - tstring strFilenames(_T("")); - - // concatenate all filenames - for (UINT i = 0; i < uiFilesCount; ++i) { - TCHAR szFilename[MAX_PATH]; - ::ZeroMemory(szFilename, sizeof(szFilename)); - - ::DragQueryFile(hDrop, i, szFilename, MAX_PATH); - - tstring strFilename(szFilename); - - // if there are spaces in the filename, put quotes around it - if (strFilename.find(_T(" ")) != tstring::npos) strFilename = tstring(_T("\"")) + strFilename + tstring(_T("\"")); - - if (i > 0) strFilenames += _T(" "); - strFilenames += strFilename; - - } - ::DragFinish(hDrop); - - // This function takes text, not file names -// SendTextToConsole(strFilenames.c_str()); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::OnCommand(WPARAM wParam, LPARAM lParam) -{ - if (HIWORD(wParam) == 0) { - // popup menu - return HandleMenuCommand(LOWORD(wParam)); - } - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::OnSysCommand(WPARAM wParam, LPARAM lParam) { - - return HandleMenuCommand(wParam); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::OnTrayNotify(WPARAM wParam, LPARAM lParam) { - - switch (lParam) { - case WM_RBUTTONUP: { - - if (m_bPopupMenuDisabled) return; - - POINT posCursor; - - ::GetCursorPos(&posCursor); - // show popup menu - ::SetForegroundWindow(m_hWnd); - ::TrackPopupMenu(::GetSubMenu(m_hPopupMenu, 0), 0, posCursor.x, posCursor.y, 0, m_hWnd, NULL); - ::PostMessage(m_hWnd, WM_NULL, 0, 0); - - return; - } - - case WM_LBUTTONDOWN: - m_bHideWindow = false; - ShowHideWindow(); - ::SetForegroundWindow(m_hWnd); - return; - - case WM_LBUTTONDBLCLK: - m_bHideWindow = !m_bHideWindow; - ShowHideWindow(); - ::SetForegroundWindow(m_hWnd); - return; - - default : return; - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::GetOptions() { - - return 1; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::RegisterWindowClasses() { - WNDCLASSEX wcx; - - // register the Console window class - ::ZeroMemory(&wcx, sizeof(WNDCLASSEX)); - wcx.cbSize = sizeof(wcx); - wcx.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS; - wcx.lpfnWndProc = Console::WindowProc; - wcx.cbClsExtra = 0; - wcx.cbWndExtra = sizeof(void*); - wcx.hInstance = ghInstance; - wcx.hIcon = ::LoadIcon(ghInstance, MAKEINTRESOURCE(IDI_ICON2)); - wcx.hCursor = ::LoadCursor(NULL, IDC_ARROW); - wcx.hbrBackground = ::CreateSolidBrush(RGB(0, 0, 0)); - wcx.lpszMenuName = NULL; - wcx.lpszClassName = Console::m_szConsoleClass; - wcx.hIconSm = NULL; - - if ((::RegisterClassEx(&wcx) == 0) && (::GetLastError() != ERROR_CLASS_ALREADY_EXISTS)) return FALSE; - - // register the hidden parent window class - ::ZeroMemory(&wcx, sizeof(WNDCLASSEX)); - wcx.cbSize = sizeof(wcx); - wcx.style = 0; - wcx.lpfnWndProc = ::DefWindowProc; - wcx.cbClsExtra = 0; - wcx.cbWndExtra = 0; - wcx.hInstance = ghInstance; - wcx.hIcon = NULL; - wcx.hCursor = ::LoadCursor(NULL, IDC_ARROW); - wcx.hbrBackground = NULL; - wcx.lpszMenuName = NULL; - wcx.lpszClassName = Console::m_szHiddenParentClass; - wcx.hIconSm = NULL; - - if ((::RegisterClassEx(&wcx) == 0) && (::GetLastError() != ERROR_CLASS_ALREADY_EXISTS)) return FALSE; - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::SetupMenus() { - - MENUITEMINFO mii; - - // setup popup menu - if ((m_hPopupMenu = ::LoadMenu(ghInstance, MAKEINTRESOURCE(IDR_POPUP_MENU))) == NULL) return FALSE; - if ((m_hConfigFilesMenu = ::CreateMenu()) == NULL) return FALSE; - - // add stuff to the system menu - TCHAR* arrMenuItems[] = {_T("&Copy"), _T("&Paste")}; - DWORD arrMenuTypes[] = {MFT_STRING, MFT_STRING}; - DWORD arrMenuIDs[] = { ID_COPY, ID_PASTE}; - - m_hSysMenu = ::GetSystemMenu(m_hWnd, FALSE); - - for (int i = 0; i < sizeof(arrMenuIDs)/sizeof(arrMenuIDs[0]); ++i) { - ::ZeroMemory(&mii, sizeof(MENUITEMINFO)); - mii.cbSize = sizeof(MENUITEMINFO); - mii.fMask = MIIM_TYPE | MIIM_ID; - mii.fType = arrMenuTypes[i]; - if (mii.fType == MFT_STRING) { - mii.wID = arrMenuIDs[i]; - mii.dwTypeData = arrMenuItems[i]; - mii.cch = _tcslen(arrMenuItems[i]); - } else { - mii.wID = 0; - } - ::InsertMenuItem(m_hSysMenu, SC_CLOSE, FALSE, &mii); - } - - // set config files menu as a submenu of "Select configuration file" item - // in the popup and system menus - ::ZeroMemory(&mii, sizeof(MENUITEMINFO)); - mii.cbSize = sizeof(MENUITEMINFO); - mii.fMask = MIIM_SUBMENU; - mii.hSubMenu = m_hConfigFilesMenu; - -// ::SetMenuItemInfo(m_hPopupMenu, ID_SEL_CONFIG_FILE, FALSE, &mii); -// ::SetMenuItemInfo(m_hSysMenu, ID_SEL_CONFIG_FILE, FALSE, &mii); - - // load the initial list (so the list can be used by external programs) - UpdateConfigFilesSubmenu(); - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::CreateConsoleWindow() { - - // create the window - DWORD dwWindowStyle = WS_VSCROLL; - if (m_dwTaskbarButton == TASKBAR_BUTTON_NORMAL) dwWindowStyle |= WS_MINIMIZEBOX; - - switch (m_dwWindowBorder) { - case BORDER_NONE : - dwWindowStyle |= WS_POPUPWINDOW & ~WS_BORDER; - break; - case BORDER_REGULAR : - dwWindowStyle |= WS_CAPTION|WS_SYSMENU; - break; - - case BORDER_THIN : - dwWindowStyle |= WS_POPUPWINDOW; - break; - - default: dwWindowStyle |= WS_POPUPWINDOW & ~WS_BORDER; - } - - // If the taskbar style is set to hide or tray, we create an invisible window - // to parent the main window to. This hides the taskbar button while allowing - // us to use the normal title bar. - if (m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL) { - if ((m_hwndInvisParent = ::CreateWindowEx( - WS_EX_TOOLWINDOW, - Console::m_szHiddenParentClass, - _T(""), - WS_POPUP, - 0, - 0, - 0, - 0, - NULL, - NULL, - ghInstance, - NULL)) == NULL) { - - return FALSE; - } - - // don't let the user minimize it if there's no way to restore it - if (m_dwTaskbarButton == TASKBAR_BUTTON_HIDE) dwWindowStyle &= ~WS_MINIMIZEBOX; - } - - - if ((m_hWnd = ::CreateWindowEx( - 0, //m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL ? WS_EX_TOOLWINDOW : 0, - Console::m_szConsoleClass, - m_strWindowTitle.c_str(), - dwWindowStyle, - ((m_nX == -1) || (m_nY == -1)) ? CW_USEDEFAULT : 0, - 0, - 0, - 0, - m_hwndInvisParent, - NULL, - ghInstance, - NULL)) == NULL) { - - return FALSE; - } - - ::SetWindowLongPtr( m_hWnd, GWLP_USERDATA, (LONG_PTR)this); - - if ((m_nX == -1) || (m_nY == -1)) { - RECT rectWindow; - - ::GetWindowRect(m_hWnd, &rectWindow); - m_nX = (int)rectWindow.left; - m_nY = (int)rectWindow.top; - } - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::CreateNewFont() { - - // create a new font - if (m_hFontOld) ::SelectObject(m_hdcConsole, m_hFontOld); - if (m_hFont) ::DeleteObject(m_hFont); - - m_hFont = ::CreateFont( - -MulDiv(m_dwFontSize, ::GetDeviceCaps(m_hdcConsole, LOGPIXELSY), 72), - 0, - 0, - 0, - m_bBold ? FW_BOLD : 0, - m_bItalic, - FALSE, - FALSE, - DEFAULT_CHARSET, - OUT_DEFAULT_PRECIS, - CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, - DEFAULT_PITCH, - m_strFontName.c_str()); - - m_hFontOld = (HFONT)::SelectObject(m_hdcConsole, m_hFont); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::CreateNewBrush() { - - // create a new background brush - if (m_hBkBrush) ::DeleteObject(m_hBkBrush); - m_hBkBrush = ::CreateSolidBrush(m_crBackground); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::CreateCursor() { - switch (m_dwCursorStyle) { - case CURSOR_STYLE_XTERM : - m_pCursor = (Cursor*)new XTermCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_BLOCK : - m_pCursor = (Cursor*)new BlockCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_NBBLOCK : - m_pCursor = (Cursor*)new NBBlockCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_PULSEBLOCK : - m_pCursor = (Cursor*)new PulseBlockCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_BAR : - m_pCursor = (Cursor*)new BarCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_CONSOLE : - m_pCursor = (Cursor*)new ConsoleCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_NBHLINE : - m_pCursor = (Cursor*)new NBHLineCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_HLINE : - m_pCursor = (Cursor*)new HLineCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_VLINE : - m_pCursor = (Cursor*)new VLineCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_RECT : - m_pCursor = (Cursor*)new RectCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_NBRECT : - m_pCursor = (Cursor*)new NBRectCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_PULSERECT : - m_pCursor = (Cursor*)new PulseRectCursor(m_hWnd, m_hdcConsole, m_crCursorColor); - break; - case CURSOR_STYLE_FADEBLOCK : - m_pCursor = (Cursor*)new FadeBlockCursor(m_hWnd, m_hdcConsole, m_crCursorColor, m_crBackground); - break; - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::CreateOffscreenBuffers() { - - HDC hdcDesktop = ::GetDCEx(m_hWnd, NULL, 0); - - // create new window bitmap - if (m_hbmpConsoleOld) ::SelectObject(m_hdcConsole, m_hbmpConsoleOld); - if (m_hbmpConsole) ::DeleteObject(m_hbmpConsole); - - m_hbmpConsole = ::CreateCompatibleBitmap(hdcDesktop, m_nClientWidth, m_nClientHeight); - m_hbmpConsoleOld = (HBITMAP)::SelectObject(m_hdcConsole, m_hbmpConsole); - - if (m_hbmpWindowOld) ::SelectObject(m_hdcWindow, m_hbmpWindowOld); - if (m_hbmpWindow) ::DeleteObject(m_hbmpWindow); - - m_hbmpWindow = ::CreateCompatibleBitmap(hdcDesktop, m_nClientWidth, m_nClientHeight); - m_hbmpWindowOld = (HBITMAP)::SelectObject(m_hdcWindow, m_hbmpWindow); - - // create selection bitmap - if (m_hbmpSelectionOld) ::SelectObject(m_hdcSelection, m_hbmpSelectionOld); - if (m_hbmpSelection) ::DeleteObject(m_hbmpSelection); - - m_hbmpSelection = ::CreateCompatibleBitmap(m_hdcWindow, m_nClientWidth, m_nClientHeight); - m_hbmpSelectionOld = (HBITMAP)::SelectObject(m_hdcSelection, m_hbmpSelection); - - RECT rect; - rect.left = 0; - rect.top = 0; - rect.right = m_nClientWidth; - rect.bottom = m_nClientHeight; - ::FillRect(m_hdcSelection, &rect, m_hbrushSelection); - - ::ReleaseDC(m_hWnd, hdcDesktop); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::GetTextSize() { - - TEXTMETRIC textMetric; - ::GetTextMetrics(m_hdcConsole, &textMetric); - - m_nCharHeight = textMetric.tmHeight; - - if (!(textMetric.tmPitchAndFamily & TMPF_FIXED_PITCH)) { - // fixed pitch font (TMPF_FIXED_PITCH is cleared!!!) - m_nCharWidth = textMetric.tmAveCharWidth; - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::GetBordersDimensions() { - - WINDOWINFO wndInfo; - TITLEBARINFO titlebarInfo; - - ::ZeroMemory(&wndInfo, sizeof(WINDOWINFO)); - ::ZeroMemory(&titlebarInfo, sizeof(TITLEBARINFO)); - - wndInfo.cbSize = sizeof(WINDOWINFO); - titlebarInfo.cbSize = sizeof(TITLEBARINFO); - - ::GetWindowInfo(m_hWnd, &wndInfo); - ::GetTitleBarInfo(m_hWnd, &titlebarInfo); - - m_nXBorderSize = wndInfo.cxWindowBorders; - m_nYBorderSize = wndInfo.cyWindowBorders; - m_nCaptionSize = (titlebarInfo.rgstate[0] & STATE_SYSTEM_INVISIBLE) ? 0 : titlebarInfo.rcTitleBar.bottom - titlebarInfo.rcTitleBar.top; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::CalcWindowSize() { - - m_nClientHeight = m_dwRows * m_nCharHeight + 2*m_nInsideBorder; - - if (m_nCharWidth > 0) { - // fixed pitch font - m_nClientWidth = m_dwColumns * m_nCharWidth + 2*m_nInsideBorder; - } else { - // variable pitch font - int nCharWidth; - ::GetCharWidth32(m_hdcConsole, _TCHAR('m'), _TCHAR('m'), &nCharWidth); - m_nClientWidth = m_dwColumns * nCharWidth; - } - - switch (m_dwWindowBorder) { - case BORDER_NONE : - m_nWindowHeight = m_nClientHeight; - m_nWindowWidth = m_nClientWidth; - break; - - case BORDER_REGULAR : { - - m_nWindowHeight = m_nClientHeight + m_nCaptionSize + 2*m_nYBorderSize; - m_nWindowWidth = m_nClientWidth + 2 * m_nXBorderSize; - - break; - } - - case BORDER_THIN : - - m_nWindowHeight = m_nClientHeight + 2*m_nYBorderSize; - m_nWindowWidth = m_nClientWidth + 2*m_nXBorderSize; - } - - if (m_bShowScrollbar) m_nWindowWidth += m_nScrollbarWidth; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::SetScrollbarStuff() { - - if (m_bUseTextBuffer) { - m_bShowScrollbar = m_dwBufferRows > m_dwRows; - } else { - m_bShowScrollbar = FALSE; - } - - // we don't call InitializeFlatSB due to some problems on Win2k, Windowblinds and new-style scrollbars - if (m_nScrollbarStyle != FSB_REGULAR_MODE) ::InitializeFlatSB(m_hWnd); - ::FlatSB_ShowScrollBar(m_hWnd, SB_VERT, m_bShowScrollbar); - ::FlatSB_SetScrollRange(m_hWnd, SB_VERT, 0, m_dwBufferRows-m_dwRows, FALSE); - - // set scrollbar properties - ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VSTYLE, m_nScrollbarStyle, FALSE); - ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_VBKGCOLOR, m_crScrollbarColor, FALSE); - ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_CXVSCROLL , m_nScrollbarWidth, FALSE); - ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_CYVSCROLL, m_nScrollbarButtonHeight, FALSE); - ::FlatSB_SetScrollProp(m_hWnd, WSB_PROP_CYVTHUMB, m_nScrollbarThunmbHeight, TRUE); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::SetDefaultConsoleColors() { - - m_arrConsoleColors[0] = 0x000000; - m_arrConsoleColors[1] = 0x800000; - m_arrConsoleColors[2] = 0x008000; - m_arrConsoleColors[3] = 0x808000; - m_arrConsoleColors[4] = 0x000080; - m_arrConsoleColors[5] = 0x800080; - m_arrConsoleColors[6] = 0x008080; - m_arrConsoleColors[7] = 0xC0C0C0; - m_arrConsoleColors[8] = 0x808080; - m_arrConsoleColors[9] = 0xFF0000; - m_arrConsoleColors[10] = 0x00FF00; - m_arrConsoleColors[11] = 0xFFFF00; - m_arrConsoleColors[12] = 0x0000FF; - m_arrConsoleColors[13] = 0xFF00FF; - m_arrConsoleColors[14] = 0x00FFFF; - m_arrConsoleColors[15] = 0xFFFFFF; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::SetWindowSizeAndPosition() { - - // set window position - DWORD dwScreenWidth = ::GetSystemMetrics(SM_CXSCREEN); - DWORD dwScreenHeight = ::GetSystemMetrics(SM_CYSCREEN); - DWORD dwTop = ::GetSystemMetrics(0); - DWORD dwLeft = ::GetSystemMetrics(0); - - switch (m_dwDocked) { - case DOCK_TOP_LEFT: - // top left - m_nX = dwLeft; - m_nY = dwTop; - break; - - case DOCK_TOP_RIGHT: - // top right - m_nX = dwScreenWidth - m_nWindowWidth; - m_nY = dwTop; - break; - - case DOCK_BOTTOM_RIGHT: - // bottom right - m_nX = dwScreenWidth - m_nWindowWidth; - m_nY = dwScreenHeight - m_nWindowHeight; - break; - - case DOCK_BOTTOM_LEFT: - // bottom left - m_nX = dwLeft; - m_nY = dwScreenHeight - m_nWindowHeight; - break; - } - - HWND hwndZ = 0; - switch (m_dwCurrentZOrder) { - case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break; - case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break; - case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; - default : return; - } - - ::SetWindowPos( - m_hWnd, - hwndZ, - m_nX, - m_nY, - m_nWindowWidth, - m_nWindowHeight, - 0); - - UpdateOnTopMenuItem(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::SetWindowIcons() { - - HICON hOldIcon = NULL; - - if (m_strIconFilename.length() > 0) { - - // custom icon, try loading it... - if ((m_hSmallIcon = (HICON)::LoadImage(NULL, m_strIconFilename.c_str(), IMAGE_ICON, 16, 16, LR_LOADFROMFILE)) != NULL) { - - // icon file exists, load and set the big icon as well - m_hBigIcon = (HICON)::LoadImage(NULL, m_strIconFilename.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE); - hOldIcon = (HICON)::SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)m_hBigIcon); - if (hOldIcon) ::DestroyIcon(hOldIcon); - - } else { - m_hSmallIcon = (HICON)::LoadImage(ghInstance, MAKEINTRESOURCE(IDI_ICON2), IMAGE_ICON, 16, 16, 0); - } - - } else { - m_hSmallIcon = (HICON)::LoadImage(ghInstance, MAKEINTRESOURCE(IDI_ICON2), IMAGE_ICON, 16, 16, 0); - } - - hOldIcon = (HICON)::SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)m_hSmallIcon); - if (hOldIcon) ::DestroyIcon(hOldIcon); - - SetTrayIcon(m_dwTaskbarButton == TASKBAR_BUTTON_TRAY ? NIM_ADD : NIM_DELETE); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::SetTrayIcon(DWORD dwMessage) { - - NOTIFYICONDATA tnd; - tstring strToolTip(m_strWindowTitle); - - tnd.cbSize = sizeof(NOTIFYICONDATA); - tnd.hWnd = m_hWnd; - tnd.uID = TRAY_ICON_ID; - tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; - tnd.uCallbackMessage = WM_TRAY_NOTIFY; - tnd.hIcon = m_hSmallIcon; - - if (strToolTip.length() > 63) { - strToolTip.resize(59); - strToolTip += _T(" ..."); -// DWORD dw = strToolTip.length(); - } - - _tcscpy(tnd.szTip, strToolTip.c_str()); - return ::Shell_NotifyIcon(dwMessage, &tnd); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::DestroyCursor() { - - if (m_pCursor) - { - delete m_pCursor; - m_pCursor = NULL; - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::EditConfigFile() { - - // prepare editor parameters - tstring strParams(m_strConfigEditorParams); - - if (strParams.length() == 0) { - // no params, just use the config file - strParams = m_strConfigFile; - } else { - tstring::size_type nPos = strParams.find(_T("%f")); - - if (nPos == tstring::npos) { - // no '%f' in editor params, concatenate config file name - strParams += _T(" "); - strParams += m_strConfigFile; - } else { - // replace '%f' with config file name - strParams = strParams.replace(nPos, 2, m_strConfigFile); - } - } - - // start editor - ::ShellExecute(NULL, NULL, m_strConfigEditor.c_str(), strParams.c_str(), NULL, SW_SHOWNORMAL); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::ReloadSettings() { - - m_bInitializing = TRUE; - m_bReloading = TRUE; - - // suspend console monitor thread - ::SuspendThread(m_hMonitorThread); - ::KillTimer(m_hWnd, TIMER_REPAINT_CHANGE); - if (m_dwMasterRepaintInt) ::KillTimer(m_hWnd, TIMER_REPAINT_MASTER); - - // hide Windows console - ::ShowWindow(m_hWndConsole, SW_HIDE); - - // destroy icons - SetTrayIcon(NIM_DELETE); - if (m_hSmallIcon) ::DestroyIcon(m_hSmallIcon); - if (m_hBigIcon) ::DestroyIcon(m_hBigIcon); - - // destroy cursor - DestroyCursor(); - - // destory menus - ::DestroyMenu(m_hConfigFilesMenu); - ::DestroyMenu(m_hPopupMenu); - - // uninitialize flat scrollbars - if (m_nScrollbarStyle != FSB_REGULAR_MODE) ::UninitializeFlatSB(m_hWnd); - - // destory window - ::DestroyWindow(m_hWnd); - if (m_hwndInvisParent) ::DestroyWindow(m_hwndInvisParent); - - // set default values - m_strShell = _T(""); - m_strConfigEditor = _T("notepad.exe"); - m_strConfigEditorParams = _T(""); - m_dwReloadNewConfig = m_dwReloadNewConfigDefault; - m_hwndInvisParent = NULL; - m_dwMasterRepaintInt = 500; - m_dwChangeRepaintInt = 50; - m_strIconFilename = _T(""); - m_hSmallIcon = NULL; - m_hBigIcon = NULL; - m_hPopupMenu = NULL; - m_hConfigFilesMenu = NULL; - m_bPopupMenuDisabled = FALSE; - m_strWindowTitle = m_strWindowTitleDefault; - m_strWindowTitleCurrent = m_strWindowTitleDefault; - m_strFontName = _T("Courier New"); - m_dwFontSize = 10; - m_bBold = FALSE; - m_bItalic = FALSE; - m_bUseFontColor = FALSE; - m_crFontColor = RGB(0, 0, 0); - m_nWindowWidth = 0; - m_nWindowHeight = 0; - m_nXBorderSize = 5; - m_nYBorderSize = 5; - m_nCaptionSize = 0; - m_nClientWidth = 0; - m_nClientHeight = 0; - m_nCharHeight = 0; - m_nCharWidth = 0; - m_dwWindowBorder = BORDER_REGULAR; - m_bShowScrollbar = TRUE; - m_nScrollbarStyle = FSB_REGULAR_MODE; - m_crScrollbarColor = ::GetSysColor(COLOR_3DHILIGHT); - m_nScrollbarWidth = ::GetSystemMetrics(SM_CXVSCROLL); - m_nScrollbarButtonHeight= ::GetSystemMetrics(SM_CYVSCROLL); - m_nScrollbarThunmbHeight= ::GetSystemMetrics(SM_CYVTHUMB); - m_dwTaskbarButton = TASKBAR_BUTTON_NORMAL; - m_bMouseDragable = TRUE; - m_nSnapDst = 10; - m_dwDocked = DOCK_NONE; - m_dwOriginalZOrder = Z_ORDER_REGULAR; - m_dwCurrentZOrder = Z_ORDER_REGULAR; - m_dwTransparency = TRANSPARENCY_NONE; - m_byAlpha = 150; - m_byInactiveAlpha = 150; - m_crBackground = RGB(0, 0, 0); - m_crConsoleBackground = RGB(0, 0, 0); - m_bTintSet = FALSE; - m_byTintOpacity = 50; - m_byTintR = 0; - m_byTintG = 0; - m_byTintB = 0; - m_bBitmapBackground = FALSE; - m_strBackgroundFile = _T(""); - m_dwBackgroundStyle = BACKGROUND_STYLE_RESIZE; - m_bRelativeBackground = FALSE; - m_bExtendBackground = FALSE; - m_bHideWindow = FALSE; - m_bHideConsole = TRUE; - m_dwCursorStyle = CURSOR_STYLE_CONSOLE; - m_bStartMinimized = FALSE; - m_crCursorColor = RGB(255, 255, 255); - m_bCursorVisible = TRUE; - m_dwRows = 50; - m_dwColumns = 80; - m_dwBufferRows = 500; - m_bUseTextBuffer = TRUE; - m_bCopyOnSelect = FALSE; - - m_nTextColor = 15; - m_nTextBgColor = 0; - - SetDefaultConsoleColors(); - - GetOptions(); - - CreateConsoleWindow(); - - SetupMenus(); - - CreateNewFont(); - CreateNewBrush(); - -// SetWindowTransparency(); - SetWindowIcons(); - - CreateCursor(); - - RefreshStdOut(); - GetTextSize(); - GetBordersDimensions(); - InitConsoleWndSize(m_dwColumns); - ResizeConsoleWindow(); -// ShowHideConsole(); - - m_bInitializing = FALSE; - m_bReloading = FALSE; - - RefreshScreenBuffer(); - ::CopyMemory(m_pScreenBuffer, m_pScreenBufferNew, sizeof(CHAR_INFO) * m_dwRows * m_dwColumns); - RepaintWindow(); - - if (m_dwMasterRepaintInt) ::SetTimer(m_hWnd, TIMER_REPAINT_MASTER, m_dwMasterRepaintInt, NULL); - - if (m_bStartMinimized) { - if (m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL) { - m_bHideWindow = TRUE; - } else { - ::ShowWindow(m_hWnd, SW_MINIMIZE); - } - } else { - ::ShowWindow(m_hWnd, SW_SHOW); - } - - ::SetForegroundWindow(m_hWnd); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::StartShellProcess() { - - - // this is a little hack needed to support columns greater than standard 80 - RefreshStdOut(); - InitConsoleWndSize(80); - ResizeConsoleWindow(); - - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::RefreshStdOut() { -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::RefreshScreenBuffer() { - // if we're initializing, do nothing - if (m_bInitializing) return; - -// ::GetConsoleScreenBufferInfo(m_hStdOutFresh, &m_csbiConsole); - - SCROLLINFO si; - si.cbSize = sizeof(si); - si.fMask = SIF_POS; - si.nPos = (int)m_csbiConsole.srWindow.Top; - ::FlatSB_SetScrollInfo(m_hWnd, SB_VERT, &si, TRUE); - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::InitConsoleWndSize(DWORD dwColumns) { - - if (m_nTextSelection) ClearSelection(); - - // get max console size -// COORD coordMaxSize; -// coordMaxSize = ::GetLargestConsoleWindowSize(m_hStdOutFresh); - - // calc max window size - RECT rectDesktop; - GetDesktopRect(rectDesktop); - - DWORD dwMaxColumns = (rectDesktop.right - rectDesktop.left - 2*m_nInsideBorder - 2*m_nXBorderSize - m_nScrollbarWidth)/m_nCharWidth; - DWORD dwMaxRows = (rectDesktop.bottom - rectDesktop.top - 2*m_nInsideBorder - m_nYBorderSize - m_nCaptionSize)/m_nCharHeight; - -// if (m_dwColumns == 0) m_dwColumns = coordMaxSize.X < dwMaxColumns ? coordMaxSize.X : dwMaxColumns; -// if (m_dwRows == 0) m_dwRows = coordMaxSize.Y < dwMaxRows ? coordMaxSize.Y : dwMaxRows; - if (m_dwColumns == 0) m_dwColumns = dwMaxColumns; - if (m_dwRows == 0) m_dwRows = dwMaxRows; - if (m_dwBufferRows < m_dwRows) m_dwBufferRows = m_dwRows; - - COORD coordConsoleSize; - coordConsoleSize.X = (SHORT)dwColumns; - coordConsoleSize.Y = (SHORT)m_dwBufferRows; - - SMALL_RECT srConsoleRect; - srConsoleRect.Top = srConsoleRect.Left =0; -// srConsoleRect.Right = dwColumns - 1; -// srConsoleRect.Bottom= m_dwRows - 1; - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::ResizeConsoleWindow() { - - m_bInitializing = TRUE; - - if (m_nTextSelection) ClearSelection(); - -// CONSOLE_SCREEN_BUFFER_INFO csbi; -// ::GetConsoleScreenBufferInfo(m_hStdOutFresh, &csbi); - - // in case buffer rows increased since last resize, and we're not using text buffer - if (!m_bUseTextBuffer) m_dwBufferRows = m_dwRows; - - COORD coordBuffersSize; - coordBuffersSize.X = (SHORT)m_dwColumns; - coordBuffersSize.Y = (SHORT)m_dwBufferRows; - - SMALL_RECT srConsoleRect; - srConsoleRect.Top = srConsoleRect.Left =0; -// srConsoleRect.Right = m_dwColumns - 1; -// srConsoleRect.Bottom= m_dwRows - 1; - - - SetScrollbarStuff(); - CalcWindowSize(); - SetWindowSizeAndPosition(); - CreateOffscreenBuffers(); - -// if (m_bBitmapBackground) CreateBackgroundBitmap(); -} - -void Console::AllocateBuffer() -{ - // resize screen buffer - delete[] m_pScreenBuffer; - m_pScreenBuffer = new CHAR_INFO[m_dwRows * m_dwColumns]; - m_pScreenBufferNew = new CHAR_INFO[m_dwBufferRows * m_dwColumns]; - ::ZeroMemory( m_pScreenBufferNew, m_dwBufferRows * m_dwColumns * sizeof(CHAR_INFO)); - - m_bInitializing = FALSE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::RepaintWindow() { - - RECT rect; - rect.top = 0; - rect.left = 0; - rect.bottom = m_nClientHeight; - rect.right = m_nClientWidth; - - ::FillRect(m_hdcConsole, &rect, m_hBkBrush); -// } - - DWORD dwX = m_nInsideBorder; - DWORD dwY = m_nInsideBorder; - DWORD dwOffset = m_csbiConsole.srWindow.Top * m_dwColumns; - - WORD attrBG; - - // stuff used for caching - int nBkMode = TRANSPARENT; - COLORREF crBkColor = RGB(0, 0, 0); - COLORREF crTxtColor = RGB(0, 0, 0); - -// int nNewBkMode = TRANSPARENT; -// COLORREF crNewBkColor = RGB(0, 0, 0); -// COLORREF crNewTxtColor = RGB(0, 0, 0); - - bool bTextOut = false; - - wstring strText(L""); - - memcpy(m_pScreenBuffer, m_pScreenBufferNew + dwOffset, sizeof(CHAR_INFO)*m_dwRows * m_dwColumns); - dwOffset = 0; - - if (m_nCharWidth > 0) { - // fixed pitch font - for (DWORD i = 0; i < m_dwRows; ++i) { - - dwX = m_nInsideBorder; - dwY = i*m_nCharHeight + m_nInsideBorder; - - nBkMode = TRANSPARENT; - crBkColor = RGB(0, 0, 0); - crTxtColor = RGB(0, 0, 0); - - bTextOut = false; - - attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; - - // here we decide how to paint text over the backgound - if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { - ::SetBkMode(m_hdcConsole, TRANSPARENT); - nBkMode = TRANSPARENT; - } else { - ::SetBkMode(m_hdcConsole, OPAQUE); - nBkMode = OPAQUE; - ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); - crBkColor = m_arrConsoleColors[attrBG]; - } - - ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]); - crTxtColor = m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]; - - strText = m_pScreenBuffer[dwOffset].Char.UnicodeChar; - ++dwOffset; - - for (DWORD j = 1; j < m_dwColumns; ++j) { - - attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; - - if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { - if (nBkMode != TRANSPARENT) { - nBkMode = TRANSPARENT; - bTextOut = true; - } - } else { - if (nBkMode != OPAQUE) { - nBkMode = OPAQUE; - bTextOut = true; - } - if (crBkColor != m_arrConsoleColors[attrBG]) { - crBkColor = m_arrConsoleColors[attrBG]; - bTextOut = true; - } - } - - if (crTxtColor != (m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF])) { - crTxtColor = m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]; - bTextOut = true; - } - - if (bTextOut) { - - ::TextOutW(m_hdcConsole, dwX, dwY, strText.c_str(), strText.length()); - dwX += strText.length() * m_nCharWidth; - - ::SetBkMode(m_hdcConsole, nBkMode); - ::SetBkColor(m_hdcConsole, crBkColor); - ::SetTextColor(m_hdcConsole, crTxtColor); - - strText = m_pScreenBuffer[dwOffset].Char.UnicodeChar; - - } else { - strText += m_pScreenBuffer[dwOffset].Char.UnicodeChar; - } - - ++dwOffset; - } - - if (strText.length() > 0) { - ::TextOutW(m_hdcConsole, dwX, dwY, strText.c_str(), strText.length()); - } - } - - } else { - - // variable pitch font - for (DWORD i = 0; i < m_dwRows; ++i) { - - dwX = m_nInsideBorder; - dwY = i*m_nCharHeight + m_nInsideBorder; - - for (DWORD j = 0; j < m_dwColumns; ++j) { - - attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; - - // here we decide how to paint text over the backgound - if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { - ::SetBkMode(m_hdcConsole, TRANSPARENT); - } else { - ::SetBkMode(m_hdcConsole, OPAQUE); - ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); - } - - ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]); - ::TextOutW(m_hdcConsole, dwX, dwY, &(m_pScreenBuffer[dwOffset].Char.UnicodeChar), 1); - int nWidth; - ::GetCharWidth32(m_hdcConsole, m_pScreenBuffer[dwOffset].Char.UnicodeChar, m_pScreenBuffer[dwOffset].Char.UnicodeChar, &nWidth); - dwX += nWidth; - ++dwOffset; - } - } - } - - if (m_pCursor) DrawCursor(TRUE); - - ::InvalidateRect(m_hWnd, NULL, FALSE); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::RepaintWindowChanges() { - - DWORD dwX = m_nInsideBorder; - DWORD dwY = m_nInsideBorder; - DWORD dwDestOffset = 0; - DWORD dwSrcOffset = m_csbiConsole.srWindow.Top * m_dwColumns; - - WORD attrBG; - - if (m_nCharWidth > 0) { - - // fixed pitch font - for (DWORD i = 0; i < m_dwRows; ++i) { - - dwX = m_nInsideBorder; - dwY = i*m_nCharHeight + m_nInsideBorder; - - for (DWORD j = 0; j < m_dwColumns; ++j) { - - if (memcmp(&(m_pScreenBuffer[dwDestOffset]), &(m_pScreenBufferNew[dwSrcOffset]), sizeof(CHAR_INFO))) { - - memcpy(&(m_pScreenBuffer[dwDestOffset]), &(m_pScreenBufferNew[dwSrcOffset]), sizeof(CHAR_INFO)); - - RECT rect; - rect.top = dwY; - rect.left = dwX; - rect.bottom = dwY + m_nCharHeight; - rect.right = dwX + m_nCharWidth; - - ::FillRect(m_hdcConsole, &rect, m_hBkBrush); -// } - - - attrBG = m_pScreenBuffer[dwDestOffset].Attributes >> 4; - - // here we decide how to paint text over the backgound - if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { - ::SetBkMode(m_hdcConsole, TRANSPARENT); - } else { - ::SetBkMode(m_hdcConsole, OPAQUE); - ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); - } - - ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwDestOffset].Attributes & 0xF]); - ::TextOutW(m_hdcConsole, dwX, dwY, &(m_pScreenBuffer[dwDestOffset].Char.UnicodeChar), 1); - - ::InvalidateRect(m_hWnd, &rect, FALSE); - } - - dwX += m_nCharWidth; - ++dwDestOffset; - ++dwSrcOffset; - } - } - - } else { - - // variable pitch font - if (memcmp(m_pScreenBuffer, m_pScreenBufferNew + dwDestOffset, sizeof(CHAR_INFO)*m_dwRows * m_dwColumns)) { - memcpy(m_pScreenBuffer, m_pScreenBufferNew + dwDestOffset, sizeof(CHAR_INFO)*m_dwRows * m_dwColumns); - - RECT rect; - rect.top = 0; - rect.left = 0; - rect.bottom = m_nClientHeight; - rect.right = m_nClientWidth; - - ::FillRect(m_hdcConsole, &rect, m_hBkBrush); -// } - - for (DWORD i = 0; i < m_dwRows; ++i) { - - dwX = m_nInsideBorder; - dwY = i*m_nCharHeight + m_nInsideBorder; - - for (DWORD j = 0; j < m_dwColumns; ++j) { - - attrBG = m_pScreenBuffer[dwDestOffset].Attributes >> 4; - - // here we decide how to paint text over the backgound - if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { - ::SetBkMode(m_hdcConsole, TRANSPARENT); - } else { - ::SetBkMode(m_hdcConsole, OPAQUE); - ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); - } - - ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwDestOffset].Attributes & 0xF]); - ::TextOutW(m_hdcConsole, dwX, dwY, &(m_pScreenBuffer[dwDestOffset].Char.UnicodeChar), 1); - int nWidth; - ::GetCharWidth32(m_hdcConsole, m_pScreenBuffer[dwDestOffset].Char.UnicodeChar, m_pScreenBuffer[dwDestOffset].Char.UnicodeChar, &nWidth); - dwX += nWidth; - ++dwDestOffset; - } - } - - ::InvalidateRect(m_hWnd, NULL, FALSE); - } - } - - if (m_pCursor) DrawCursor(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::DrawCursor(BOOL bOnlyCursor) { - - // first, erase old cursor image if needed - if (!bOnlyCursor && m_bCursorVisible) { - RECT rectCursorOld; - DrawCursorBackground(rectCursorOld); - ::InvalidateRect(m_hWnd, &rectCursorOld, FALSE); - } - - - // ... and draw it - if (m_bCursorVisible) { - - RECT rectCursor; - if (!bOnlyCursor) { - DrawCursorBackground(rectCursor); - } else { - GetCursorRect(rectCursor); - } - m_pCursor->Draw(&rectCursor); - ::InvalidateRect(m_hWnd, &rectCursor, FALSE); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -inline void Console::GetCursorRect(RECT& rectCursor) { - - ::ZeroMemory(&rectCursor, sizeof(RECT)); - - if (m_nCharWidth > 0) { - // fixed pitch - - rectCursor.left = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nInsideBorder; - rectCursor.top = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nInsideBorder; - rectCursor.right = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nCharWidth + m_nInsideBorder; - rectCursor.bottom = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nCharHeight + m_nInsideBorder; - - } else { - - // variable pitch, we do a little joggling here :-) - RECT rectLine; - int nLastCharWidth; - std::unique_ptr pszLine(new wchar_t[m_csbiCursor.dwCursorPosition.X + 2]); - ::ZeroMemory(pszLine.get(), (m_csbiCursor.dwCursorPosition.X + 2)*sizeof(wchar_t)); - - for (short i = 0; i <= m_csbiCursor.dwCursorPosition.X; ++i) pszLine.get()[i] = m_pScreenBuffer[m_csbiCursor.dwCursorPosition.Y * m_dwColumns + i].Char.UnicodeChar; - - rectLine.left = rectLine.right = 0; - rectLine.top = rectLine.bottom = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight; - - ::DrawTextW( - m_hdcConsole, - pszLine.get(), - -1, - &rectLine, - DT_CALCRECT); - - if (!::GetCharWidth32( - m_hdcConsole, - pszLine.get()[m_csbiCursor.dwCursorPosition.X], - pszLine.get()[m_csbiCursor.dwCursorPosition.X], - &nLastCharWidth)) { - - return; - } - - rectCursor.left = rectLine.right - (DWORD)nLastCharWidth + m_nInsideBorder; - rectCursor.top = rectLine.top + m_nInsideBorder; - rectCursor.right = rectLine.right + m_nInsideBorder; - rectCursor.bottom = rectLine.bottom + m_nInsideBorder; - } - - rectCursor.top -= m_csbiConsole.srWindow.Top * m_nCharHeight; - rectCursor.bottom -= m_csbiConsole.srWindow.Top * m_nCharHeight; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -inline void Console::DrawCursorBackground(RECT& rectCursor) { - - GetCursorRect(rectCursor); - - if (m_csbiCursor.dwCursorPosition.Y < m_csbiConsole.srWindow.Top || - m_csbiCursor.dwCursorPosition.Y >= m_csbiConsole.srWindow.Top + (SHORT) m_dwRows) { - return; - } - - DWORD dwOffset = (m_csbiCursor.dwCursorPosition.Y-m_csbiConsole.srWindow.Top)*m_dwColumns + m_csbiCursor.dwCursorPosition.X; - WORD attrBG = m_pScreenBuffer[dwOffset].Attributes >> 4; - - // here we decide how to paint text over the backgound - - if (m_arrConsoleColors[attrBG] == m_crConsoleBackground) { - ::SetBkMode(m_hdcConsole, TRANSPARENT); - } else { - ::SetBkMode(m_hdcConsole, OPAQUE); - ::SetBkColor(m_hdcConsole, m_arrConsoleColors[attrBG]); - } - - ::SetTextColor(m_hdcConsole, m_bUseFontColor ? m_crFontColor : m_arrConsoleColors[m_pScreenBuffer[dwOffset].Attributes & 0xF]); - - ::FillRect(m_hdcConsole, &rectCursor, m_hBkBrush); -// } - - ::TextOutW( - m_hdcConsole, - rectCursor.left, - rectCursor.top, - &(m_pScreenBuffer[dwOffset].Char.UnicodeChar), - 1); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::ClearSelection() { - - m_nTextSelection = TEXT_SELECTION_NONE; - m_coordSelOrigin.X = 0; - m_coordSelOrigin.Y = 0; - ::ZeroMemory(&m_rectSelection, sizeof(RECT)); - - RepaintWindow(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -DWORD Console::GetChangeRate() { - - DWORD dwCount = m_dwRows * m_dwColumns; - DWORD dwChangedPositions = 0; - - for (DWORD i = 0; i < dwCount; ++i) { - if (m_pScreenBuffer[i].Char.UnicodeChar != m_pScreenBufferNew[i].Char.UnicodeChar) ++dwChangedPositions; - } - - return dwChangedPositions*100/dwCount; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::ShowHideWindow() { - ::ShowWindowAsync(m_hWnd, m_bHideWindow ? SW_HIDE : SW_SHOW); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::ShowHideConsole() { - ::ShowWindow(m_hWndConsole, m_bHideConsole ? SW_HIDE : SW_SHOWNORMAL); - if (!m_bHideConsole) ::SetForegroundWindow(m_hWndConsole); - UpdateHideConsoleMenuItem(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::ToggleWindowOnTop() { - - if (m_dwCurrentZOrder == m_dwOriginalZOrder) { - m_dwCurrentZOrder = Z_ORDER_ONTOP; - } else { - m_dwCurrentZOrder = m_dwOriginalZOrder; - } - - HWND hwndZ = 0; - switch (m_dwCurrentZOrder) { - case Z_ORDER_REGULAR : hwndZ = HWND_NOTOPMOST; break; - case Z_ORDER_ONTOP : hwndZ = HWND_TOPMOST; break; - case Z_ORDER_ONBOTTOM : hwndZ = HWND_BOTTOM; break; - default : return; - } - - ::SetWindowPos( - m_hWnd, - hwndZ, - 0, - 0, - 0, - 0, - SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); - - UpdateOnTopMenuItem(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL Console::HandleMenuCommand(DWORD dwID) { - - // check if it's one of the main menu commands - switch (dwID) { - -/* - case ID_SHOW_README_FILE: - ShowReadmeFile(); - return FALSE; - - case ID_ABOUT: - About(); - return FALSE; -*/ - - case ID_COPY: - CopyTextToClipboard(); - return FALSE; - - case ID_PASTE: - PasteClipoardText(); - return FALSE; - - - case ID_EXIT_CONSOLE: - ::SendMessage(m_hWnd, WM_CLOSE, 0, 0); - return FALSE; - - case SC_MINIMIZE: - if (m_dwTaskbarButton > TASKBAR_BUTTON_NORMAL) { - m_bHideWindow = !m_bHideWindow; - ShowHideWindow(); - ::SetForegroundWindow(m_hWnd); - return FALSE; - } - return TRUE; - } - - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::UpdateOnTopMenuItem() { - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::UpdateHideConsoleMenuItem() { - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::UpdateConfigFilesSubmenu() { - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::CopyTextToClipboard() { - - int nSelX = (m_rectSelection.left - m_nInsideBorder)/m_nCharWidth; - int nSelY = (m_rectSelection.top - m_nInsideBorder)/m_nCharHeight; - int nSelColumns = (m_rectSelection.right-m_rectSelection.left)/m_nCharWidth; - int nSelRows = (m_rectSelection.bottom-m_rectSelection.top)/m_nCharHeight; - - // nothing selected, just return - if ((nSelColumns == 0) || (nSelRows == 0)) { - ClearSelection(); - return; - } - - if (!::OpenClipboard(m_hWnd)) { - ClearSelection(); - return; - } - - ::EmptyClipboard(); - - HGLOBAL hglbData = ::GlobalAlloc(GMEM_MOVEABLE, (nSelColumns+2)*nSelRows*sizeof(TCHAR)); - if (hglbData == NULL) { - ::CloseClipboard(); - ClearSelection(); - return; - } - - // lock the handle and copy the text to the buffer. - wchar_t* pszData = (wchar_t*)::GlobalLock(hglbData); - - if (pszData) - { - int i; - for (i = 0; i < nSelRows; ++i) { - for (int j = 0; j < nSelColumns; ++j) { - pszData[i*(nSelColumns+2) + j] = m_pScreenBuffer[(nSelY+i)*m_dwColumns + nSelX + j].Char.UnicodeChar; - } - // at the end of each row we put \r\n (except for the last one where we put \0) - pszData[i*(nSelColumns+2) + nSelColumns] = _TCHAR('\r'); - pszData[i*(nSelColumns+2) + nSelColumns + 1] = _TCHAR('\n'); - } - pszData[(i-1)*(nSelColumns+2) + nSelColumns] = _TCHAR('\x0'); - } - - ::GlobalUnlock(hglbData); - - if (::SetClipboardData(CF_UNICODETEXT, hglbData) == NULL) { - // we need to global-free data only if copying failed - } - ::CloseClipboard(); - // !!! No call to GlobalFree here. Next app that uses clipboard will call EmptyClipboard to free the data - - ClearSelection(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::PasteClipoardText() { - - if (!IsClipboardFormatAvailable(CF_UNICODETEXT)) return; - - - if (::OpenClipboard(m_hWnd)) { - HANDLE hData = ::GetClipboardData(CF_UNICODETEXT); - - SendTextToConsole((wchar_t*)::GlobalLock(hData)); - - ::GlobalUnlock(hData); - ::CloseClipboard(); - } - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::ShowReadmeFile() { - - // prepare editor parameters - tstring strParams(m_strConfigEditorParams); - - if (strParams.length() == 0) { - // no params, just use the readme file - strParams = m_strReadmeFile; - } else { - tstring::size_type nPos = strParams.find(_T("%f")); - - if (nPos == tstring::npos) { - // no '%f' in editor params, concatenate readme file name - strParams += _T(" "); - strParams += m_strReadmeFile; - } else { - // replace '%f' with readme file name - strParams = strParams.replace(nPos, 2, m_strReadmeFile); - } - } - - ::ShellExecute(NULL, NULL, m_strConfigEditor.c_str(), strParams.c_str(), NULL, SW_SHOWNORMAL); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// About - shows an about dialog - -void Console::About() -{ - CAboutDlg dlg(m_hWnd); - - dlg.DoModal(); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::SendTextToConsole(const wchar_t *pszText) -{ - - if (!pszText || (wcslen(pszText) == 0)) return; - - BOOL c_state = FALSE; - if (m_pCursor) - { - c_state = (m_pCursor != NULL && m_pCursor->GetState()); - m_pCursor->SetState(FALSE); - DrawCursor(); - } - - int idx = m_csbiCursor.dwCursorPosition.X + m_csbiCursor.dwCursorPosition.Y * m_dwColumns; - - RECT rectInval; - int cursorX; - int cursorY; - WORD attr = (WORD)(m_nTextColor + (m_nTextBgColor << 4)); - - cursorX = m_csbiCursor.dwCursorPosition.X * m_nCharWidth + m_nInsideBorder; - cursorY = m_csbiCursor.dwCursorPosition.Y * m_nCharHeight + m_nInsideBorder; - rectInval.left = cursorX; - rectInval.top = cursorY; - rectInval.right = cursorX; - rectInval.bottom = cursorY + m_nCharHeight; - - for (; *pszText; pszText++) { - int charWidth; - ::GetCharWidth32( m_hdcConsole, *pszText, *pszText, &charWidth); - if (cursorX + m_nCharWidth > rectInval.right) { - rectInval.right = cursorX + m_nCharWidth; - } - if (cursorX < rectInval.left) { - rectInval.left = cursorX; - } - if (cursorY + m_nCharHeight > rectInval.bottom) { - rectInval.bottom = cursorY + m_nCharHeight; - } - if (cursorY < rectInval.top) { - rectInval.top = cursorY; - } - - if (*pszText == 8) { - if (m_csbiCursor.dwCursorPosition.X) { - m_csbiCursor.dwCursorPosition.X--; - cursorX -= m_nCharWidth; - idx--; - } else if (m_csbiCursor.dwCursorPosition.Y) { - if (m_csbiCursor.dwCursorPosition.Y == m_csbiConsole.srWindow.Top) { - OnVScroll( SB_LINEUP); - } - m_csbiCursor.dwCursorPosition.Y--; - m_csbiCursor.dwCursorPosition.X = (SHORT)m_dwColumns - 1; - cursorX = m_nCharWidth * m_csbiCursor.dwCursorPosition.X; - idx--; - } - } else if (*pszText != '\n' && - *pszText != '\r') { - m_pScreenBufferNew[ idx].Attributes = attr; - m_pScreenBufferNew[ idx].Char.UnicodeChar = *pszText; - idx++; - cursorX += m_nCharWidth; - m_csbiCursor.dwCursorPosition.X++; - } - - if (m_csbiCursor.dwCursorPosition.X >= (SHORT) m_dwColumns || *pszText == '\r' || *pszText == '\n' ) { - m_csbiCursor.dwCursorPosition.X = 0; - cursorX = m_nInsideBorder; - if (*pszText != '\r') { - m_csbiCursor.dwCursorPosition.Y++; - if (m_csbiCursor.dwCursorPosition.Y >= (SHORT)m_dwBufferRows) { - m_csbiCursor.dwCursorPosition.Y--; - idx = m_csbiCursor.dwCursorPosition.X + m_csbiCursor.dwCursorPosition.Y * m_dwColumns; - ::CopyMemory( m_pScreenBufferNew, m_pScreenBufferNew + m_dwColumns, idx * sizeof( CHAR_INFO)); - ::ZeroMemory( m_pScreenBufferNew + idx, m_dwColumns * sizeof( CHAR_INFO)); - } else if (m_csbiCursor.dwCursorPosition.Y == m_csbiConsole.srWindow.Top + (SHORT)m_dwRows) { - OnVScroll( SB_LINEDOWN); - } else { - cursorY += m_nCharHeight; - } - } - idx = m_csbiCursor.dwCursorPosition.X + m_csbiCursor.dwCursorPosition.Y * m_dwColumns; - } - } - - ::InvalidateRect( m_hWnd, &rectInval, TRUE); - ::SetTimer(m_hWnd, TIMER_REPAINT_CHANGE, m_dwChangeRepaintInt, NULL); - - if (m_pCursor) - { - m_pCursor->SetState(c_state); - } - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -tstring Console::GetFullFilename(const tstring& strFilename) { - - TCHAR szFilePath[MAX_PATH]; - TCHAR* pszFilename; - - ::ZeroMemory(szFilePath, sizeof(szFilePath)); - ::GetFullPathName(strFilename.c_str(), MAX_PATH, szFilePath, &pszFilename); - - return tstring(szFilePath); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void Console::GetDesktopRect(RECT& rectDesktop) { - -// if (g_bWin2000) { - POINT pt; - if (::GetCursorPos(&pt)) { - MONITORINFO monitorInfo; - monitorInfo.cbSize = sizeof(MONITORINFO); - if (GetMonitorInfo(MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST), &monitorInfo)) { - rectDesktop = monitorInfo.rcWork; - } - - } else { - rectDesktop.left = ::GetSystemMetrics(SM_XVIRTUALSCREEN); - rectDesktop.top = ::GetSystemMetrics(SM_YVIRTUALSCREEN); - rectDesktop.right = rectDesktop.left + ::GetSystemMetrics(SM_CXVIRTUALSCREEN); - rectDesktop.bottom = rectDesktop.top + ::GetSystemMetrics(SM_CYVIRTUALSCREEN); - } - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -LRESULT CALLBACK Console::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - - Console *myself = (Console*) ::GetWindowLongPtr( hwnd, GWLP_USERDATA ); - - switch (uMsg) { - case WM_CREATE: - return 0; - - case WM_PAINT: - // paint the window - myself->OnPaint(); - return 0; - - case WM_ERASEBKGND: - return -1; - - case WM_SIZE: - // set the size and position of the window - return 0; - - case WM_CLOSE: -// ::DestroyWindow(myself->m_hWnd); - // Probably want to just hide the window if the X is hit. That way it can continue - // to update on script output - ShowWindow( hwnd, FALSE); - return 0; - - case WM_DESTROY: - myself->OnDestroy(); - return 0; - - case WM_NCDESTROY: - myself->OnNcDestroy(); - return 0; - - case WM_LBUTTONDOWN: - myself->OnLButtonDown((UINT)wParam, MAKEPOINTS(lParam)); - return 0; - - case WM_LBUTTONUP: - myself->OnLButtonUp((UINT)wParam, MAKEPOINTS(lParam)); - return 0; - - case WM_LBUTTONDBLCLK: - myself->OnLButtonDblClick((UINT)wParam, MAKEPOINTS(lParam)); - return 0; - - case WM_RBUTTONUP: - myself->OnRButtonUp((UINT)wParam, MAKEPOINTS(lParam)); - return 0; - - case WM_MBUTTONDOWN: - myself->OnMButtonDown((UINT)wParam, MAKEPOINTS(lParam)); - return 0; - - case WM_MOUSEMOVE: - myself->OnMouseMove((UINT)wParam, MAKEPOINTS(lParam)); - return 0; - - case WM_SETCURSOR: - myself->OnSetCursor(LOWORD(lParam), HIWORD(lParam)); - ::DefWindowProc(myself->m_hWnd, uMsg, wParam, lParam); - return 0; - - case WM_INITMENUPOPUP: - myself->OnInitMenuPopup((HMENU)wParam, LOWORD(lParam), (BOOL)HIWORD(lParam)); - return 0; - - case WM_DROPFILES: - myself->OnDropFiles((HDROP)wParam); - return 0; - - case WM_WINDOWPOSCHANGING: - myself->OnWindowPosChanging((LPWINDOWPOS)lParam); - return 0; - - case WM_ACTIVATEAPP: - myself->OnActivateApp((BOOL)wParam, (DWORD)lParam); - return 0; - - - case WM_CHAR: - myself->OnChar( (WORD) wParam); - break; - - case WM_KEYDOWN: - case WM_KEYUP: -// case WM_MOUSEWHEEL: -// ::PostMessage(myself->m_hWndConsole, uMsg, wParam, lParam); - return 0; - - - case WM_VSCROLL: - myself->OnVScroll(wParam); - return 0; - - case WM_TIMER: - switch (wParam) { - case TIMER_REPAINT_CHANGE: - case TIMER_REPAINT_MASTER: - myself->OnPaintTimer(); - return 0; - - case CURSOR_TIMER: - myself->OnCursorTimer(); - return 0; - - - default: - return 1; - } - - case WM_COMMAND: - if (myself->OnCommand(wParam, lParam)) { - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); - } else { - return 0; - } - - case WM_SYSCOMMAND: - if (myself->OnSysCommand(wParam, lParam)) { - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); - } else { - return 0; - } - - case WM_TRAY_NOTIFY: - myself->OnTrayNotify(wParam, lParam); - return 0; - -// case WM_SETTINGCHANGE: -// -// myself->OnWallpaperChanged((TCHAR*)lParam); -// return ::DefWindowProc(hwnd, uMsg, wParam, lParam); - - case WM_INPUTLANGCHANGEREQUEST: - myself->OnInputLangChangeRequest(wParam, lParam); - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); - - // process other messages - default: - return ::DefWindowProc(hwnd, uMsg, wParam, lParam); - } - return 0; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// MonitorThread - shell activities monitor - -DWORD WINAPI Console::MonitorThreadStatic(LPVOID lpParam) { - return ((Console*)lpParam)->MonitorThread(); -} - -DWORD Console::MonitorThread() { - -// HANDLE arrHandles[] = {m_hConsoleProcess, m_hQuitEvent, m_hStdOut}; -// HANDLE arrHandles[] = { m_hStdOut}; - - for (;;) { // Infinite loop - AddOutput(); - ::SetTimer(m_hWnd, TIMER_REPAINT_CHANGE, m_dwChangeRepaintInt, NULL); - // we sleep here for a while, to prevent 'flooding' of m_hStdOut events - ::Sleep(m_dwChangeRepaintInt); - ::ResetEvent(m_hStdOut); -// } - } - -// return 0; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -void Console::AddOutput() { - DWORD bytesRead; - char buf[801]; - wchar_t wbuf[801]; - - ::ReadFile( m_hStdOut, buf, sizeof(buf)/sizeof(wchar_t)-1, &bytesRead, NULL); - if (bytesRead == 0) { - return; - } - buf[bytesRead] = 0; - MultiByteToWideChar( CP_UTF8, 0, buf, -1, wbuf, sizeof(wbuf)/sizeof(wbuf[0])); - SendTextToConsole( wbuf); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -BOOL WINAPI Console::CtrlHandler(DWORD dwCtrlType) { - if ((dwCtrlType == CTRL_C_EVENT) || (dwCtrlType == CTRL_BREAK_EVENT)) { - return TRUE; - } else { - return FALSE; - } -} - -///////////////////////////////////////////////////////////////////////////// - - diff --git a/Console/Console.h b/Console/Console.h deleted file mode 100644 index cd79e628..00000000 --- a/Console/Console.h +++ /dev/null @@ -1,746 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Console.h - console class declaration - -#pragma once - -#include -#include - -using namespace std; - -//#include "include/FreeImagePlus.h" - -typedef basic_string tstring; - -#define WM_INPUTREADY WM_USER + 1 - -// tray icon message -#define WM_TRAY_NOTIFY WM_USER + 0x123 - -#define TRAY_ICON_ID 1 - -// timer #defines -#define TIMER_REPAINT_CHANGE 42 // timer that is started after there - // were some changes in the console - -#define TIMER_REPAINT_MASTER 43 // master timer (needed to repaint - // for some DOS programs, can be - // disabled for lower CPU usage) - -#define TIMER_SHOW_HIDE_CONSOLE 100 // used to hide console window when - // starting shell process after a - // defined period of time (some - // shells, like 4NT need console - // window visible during startup for - // all init options to work properly - -// transparency #defines -#define TRANSPARENCY_NONE 0 -#define TRANSPARENCY_ALPHA 1 -#define TRANSPARENCY_COLORKEY 2 -#define TRANSPARENCY_FAKE 3 - -// cusror style #defines -#define CURSOR_STYLE_NONE 0 -#define CURSOR_STYLE_XTERM 1 -#define CURSOR_STYLE_BLOCK 2 -#define CURSOR_STYLE_NBBLOCK 3 -#define CURSOR_STYLE_PULSEBLOCK 4 -#define CURSOR_STYLE_BAR 5 -#define CURSOR_STYLE_CONSOLE 6 -#define CURSOR_STYLE_NBHLINE 7 -#define CURSOR_STYLE_HLINE 8 -#define CURSOR_STYLE_VLINE 9 -#define CURSOR_STYLE_RECT 10 -#define CURSOR_STYLE_NBRECT 11 -#define CURSOR_STYLE_PULSERECT 12 -#define CURSOR_STYLE_FADEBLOCK 13 - -// docking #defines -#define DOCK_NONE 0 -#define DOCK_TOP_LEFT 1 -#define DOCK_TOP_RIGHT 2 -#define DOCK_BOTTOM_RIGHT 3 -#define DOCK_BOTTOM_LEFT 4 - -// Z-order #defines -#define Z_ORDER_REGULAR 0 -#define Z_ORDER_ONTOP 1 -#define Z_ORDER_ONBOTTOM 2 - -// window border defines -#define BORDER_NONE 0 -#define BORDER_REGULAR 1 -#define BORDER_THIN 2 - -// window background style -#define BACKGROUND_STYLE_RESIZE 0 -#define BACKGROUND_STYLE_CENTER 1 -#define BACKGROUND_STYLE_TILE 2 - -// taskbar button defines -#define TASKBAR_BUTTON_NORMAL 0 -#define TASKBAR_BUTTON_HIDE 1 -#define TASKBAR_BUTTON_TRAY 2 - -// new configuration auto-reload defines -#define RELOAD_NEW_CONFIG_PROMPT 0 -#define RELOAD_NEW_CONFIG_YES 1 -#define RELOAD_NEW_CONFIG_NO 2 - -#define TEXT_SELECTION_NONE 0 -#define TEXT_SELECTION_SELECTING 1 -#define TEXT_SELECTION_SELECTED 2 - - -///////////////////////////////////////////////////////////////////////////// -// Console class - -class Console { - public: // ctor/dtor - - Console(LPCTSTR szConfigFile, LPCTSTR szShellCmdLine, LPCTSTR szConsoleTitle, LPCTSTR pszReloadNewConfig); - ~Console(); - - public: - - // creates and shows Console window - BOOL Create(HWND notify); - - private: - - //////////////////// - // message handlers - //////////////////// - - //////////////////////////////// - // windows destruction messages - - // destroys GDI stuff and posts a quit message - void OnDestroy(); - // deletes Console object - void OnNcDestroy(); - - - ///////////////////// - // painting messages - - // handles painting from off-screen buffers - void OnPaint(); - - // handles master and 'change' timers - void OnPaintTimer(); - - // handles cursor timer (for animated cursors) - void OnCursorTimer(); - - - ///////////////////////// - // window state messages - - // handles window position changes (for snapping to desktop edges) - void OnWindowPosChanging(WINDOWPOS* lpWndPos); - - // handles activation message (used for setting alpha transparency and cursor states) - void OnActivateApp(BOOL bActivate, DWORD dwFlags); - - // handles vertical scrolling - void OnVScroll(WPARAM wParam); - - // handles keyboard layout change, posts the same message to the windows console window - void OnInputLangChangeRequest(WPARAM wParam, LPARAM lParam); - - - ////////////////// - // mouse messages - - // handles text selection start and window mouse drag start - void OnLButtonDown(UINT uiFlags, POINTS points); - - // handles text selection end, window mouse drag end and text copy - void OnLButtonUp(UINT uiFlags, POINTS points); - - // toggles always on top flag - void OnLButtonDblClick(UINT uiFlags, POINTS points); - - // pops up the Console menu - void OnRButtonUp(UINT uiFlags, POINTS points); - - // pastes text from clipboard - void OnMButtonDown(UINT uiFlags, POINTS points); - - // handles mouse movement for text selection and window mouse drag - void OnMouseMove(UINT uiFlags, POINTS points); - - // handles start/stop mouse drag for window border - void OnSetCursor(WORD wHitTest, WORD wMouseMessage); - - // handles text input - void OnChar(WORD mychar); - - wstring Input; - - ////////////////// - // other messages - - // called before the Console menu or system menu pops up - // (populates config files submenu with filenames) - void OnInitMenuPopup(HMENU hMenu, UINT uiPos, BOOL bSysMenu); - - // handles drag-n-dropped filenames - void OnDropFiles(HDROP hDrop); - - // handles commands from the Console popup menu - BOOL OnCommand(WPARAM wParam, LPARAM lParam); - - // handles commands from the system popup menu - BOOL OnSysCommand(WPARAM wParam, LPARAM lParam); - - // handles tray icon messages - void OnTrayNotify(WPARAM wParam, LPARAM lParam); - - // handles WM_SETTINGCHANGE (we handle only wallpaper changes here) -// void OnWallpaperChanged(const TCHAR* pszFilename); - - - private: - - /////////////////////////////////////////// - // Console window creation/setup functions - /////////////////////////////////////////// - - // gets Console options - BOOL GetOptions(); - - // registers Console window classes - BOOL RegisterWindowClasses(); - - // adds stuff to system and popup menus - BOOL SetupMenus(); - - // creates Console window - BOOL CreateConsoleWindow(); - - // creates new Console font - void CreateNewFont(); - - // creates new background brush - void CreateNewBrush(); - - // creates the cursor - void CreateCursor(); - - // creates offscreen painting buffers - void CreateOffscreenBuffers(); - - // creates background bitmap - void CreateBackgroundBitmap(); - - // called by the ::EnumDisplayMonitors to create background for each display -// static BOOL CALLBACK BackgroundEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); - - // gets character width and height - void GetTextSize(); - - // gets window borders (X, Y and caption sizes) - void GetBordersDimensions(); - - // calculates window and client area sizes - void CalcWindowSize(); - - // sets up window transparency (alpha, color key, fake) -// void SetWindowTransparency(); - - // sets scrollbar stuff - void SetScrollbarStuff(); - - // sets default console colors - void SetDefaultConsoleColors(); - - // sets window size and position - void SetWindowSizeAndPosition(); - - // sets Console's big, small and tray icons - void SetWindowIcons(); - - // sets up traybar icon - BOOL SetTrayIcon(DWORD dwMessage); - - // destroys Console cursor - void DestroyCursor(); - - // opens the configuration file in a text editor - void EditConfigFile(); - - // reloads Console settings - void ReloadSettings(); - - - ///////////////////////////// - // windows console functions - ///////////////////////////// - - // allocates the console and starts the command shell - BOOL StartShellProcess(); - - // refreshes m_hStdOutFresh handle - void RefreshStdOut(); - - // gets a fresh console output - void RefreshScreenBuffer(); - - // sets initial windows console size - void InitConsoleWndSize(DWORD dwColumns); - - // resizes the windows console - void ResizeConsoleWindow(); - - // Allocates the screen buffer - void AllocateBuffer(); - - - ////////////////////// - // painting functions - ////////////////////// - - // repaints the memory hdc - void RepaintWindow(); - - // repaints the memory hdc (paint only changes) - void RepaintWindowChanges(); - - // draws the cursor - void DrawCursor(BOOL bOnlyCursor = FALSE); - - // two helper functions for DrawCursor method - - // returns cursor rectangle - inline void GetCursorRect(RECT& rectCursor); - // draws cursor background and returns the cursor rectangle - inline void DrawCursorBackground(RECT& rectCursor); - - // clears text selection - void ClearSelection(); - - // returns the console text change rate since the last painting - // (using this value we decide whether to repaint entire window - // or just the changes) - DWORD GetChangeRate(); - - - ////////////////////////// - // window state functions - ////////////////////////// - - // shows/hides Console window - void ShowHideWindow(); - - // shows/hides windows console window - void ShowHideConsole(); - - // shows/hides windows console window after a timeout (used during - // shell startup) - void ShowHideConsoleTimeout(); - - // toggles 'always on top' status - void ToggleWindowOnTop(); - - - ////////////////// - // menu functions - ////////////////// - - // called by OnCommand and OnSysCommand to handle menu commands - BOOL HandleMenuCommand(DWORD dwID); - - // updates popup and system menus for 'always on top' status - void UpdateOnTopMenuItem(); - - // updates popup and system menus for 'hide console' status - void UpdateHideConsoleMenuItem(); - - // updates configuration files submenu - void UpdateConfigFilesSubmenu(); - - - /////////////////////// - // clipboard functions - /////////////////////// - - // copies selected text to the clipboard - void CopyTextToClipboard(); - - // pastes text from the clipboard - void PasteClipoardText(); - - ////////////////// - // misc functions - ////////////////// - - // shows Readme.txt file - void ShowReadmeFile(); - - // shows about dialog - void About(); - - // sends text to the windows console - void SendTextToConsole(const wchar_t *pszText); - - // returns the full filename - tstring GetFullFilename(const tstring& strFilename); - - // gets a desktop rectangle - void GetDesktopRect(RECT& rectDesktop); - - // Pulls the text from the stdout or stderr handle (both are the same) and sends it to the console - void AddOutput(); - - - /////////////////////// - // 'gearbox' functions - /////////////////////// - - // Console window procedure - static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - - // shell activities monitor - static DWORD WINAPI MonitorThreadStatic(LPVOID lpParam); - DWORD MonitorThread(); - - // CTRL+C, CTRL+BREAK handler - static BOOL WINAPI CtrlHandler(DWORD dwCtrlType); - - - public: // public data - - // Console window handle - HWND m_hWnd; - - HWND m_notifyhWnd; - - // console colors - COLORREF m_arrConsoleColors[16]; - - private: // private data - - // readem filename - tstring m_strReadmeFile; - - BOOL m_bInitializing; - BOOL m_bReloading; - - tstring m_strConfigFile; - tstring m_strConfigEditor; - tstring m_strConfigEditorParams; - - // one of the RELOAD_NEW_CONFIG_* constants - // - specifies relaod behaviour when a new configuration is selected - // (auto reload, don't reload, ask user) - DWORD m_dwReloadNewConfigDefault; - DWORD m_dwReloadNewConfig; - - tstring m_strShell; - tstring m_strShellCmdLine; - - // handle to invisible window - used for hiding the taskbar button in tray and 'hidden' modes - HWND m_hwndInvisParent; - - // memory device context that holds console output image - HDC m_hdcConsole; - // memory device context for an off-screen window buffer (used to - // compose an image from m_hdcConsole and m_hdcSelection if text - // selection is active) - HDC m_hdcWindow; - - // a bitmap used for drawing in the console memory DC - HBITMAP m_hbmpConsole; - HBITMAP m_hbmpConsoleOld; - - // a bitmap used for drawing in the window memory DC - HBITMAP m_hbmpWindow; - HBITMAP m_hbmpWindowOld; - - // brush for painting background - HBRUSH m_hBkBrush; - - // master repaint timer interval (runs independent of changes in the - // console) - DWORD m_dwMasterRepaintInt; - - // change repaint timer interval (when a change occurs, repainting - // will be postponed for this interval) - DWORD m_dwChangeRepaintInt; - - // icon filename - tstring m_strIconFilename; - // program icons - HICON m_hSmallIcon; - HICON m_hBigIcon; - - // popup menu - HMENU m_hPopupMenu; - - // system (taskbar button) menu - HMENU m_hSysMenu; - - // submenu for the XML (config) files - HMENU m_hConfigFilesMenu; - - // set to TRUE if the popup menu is disabled - BOOL m_bPopupMenuDisabled; - - // Console window title variables - // holds the default console title ("console" or the one passed in the cmdline param) - tstring m_strWindowTitleDefault; - // holds the window title (default title, or the one from the config file) - tstring m_strWindowTitle; - // holds the current window title - tstring m_strWindowTitleCurrent; - - // font data - tstring m_strFontName; - DWORD m_dwFontSize; - BOOL m_bBold; - BOOL m_bItalic; - BOOL m_bUseFontColor; - COLORREF m_crFontColor; - HFONT m_hFont; - HFONT m_hFontOld; - - // window X and Y positions - int m_nX; - int m_nY; - - // client area inside border (gives a more 'relaxed' look to windows) - int m_nInsideBorder; - - // window width and height - int m_nWindowWidth; - int m_nWindowHeight; - - // window border sizes - int m_nXBorderSize; - int m_nYBorderSize; - int m_nCaptionSize; - - // client area widht/height - int m_nClientWidth; - int m_nClientHeight; - - // char height and width (used in window repainting) - // Note: width is used only for fixed-pitch fonts to speed up - // repainting - int m_nCharHeight; - int m_nCharWidth; - - // window border type - // 0 - none - // 1 - regular window - // 2 - 1-pixel thin border - DWORD m_dwWindowBorder; - - // scrollbar stuff - BOOL m_bShowScrollbar; - int m_nScrollbarStyle; - COLORREF m_crScrollbarColor; - int m_nScrollbarWidth; - int m_nScrollbarButtonHeight; - int m_nScrollbarThunmbHeight; - - // what to do with the taskbar button - // if the taskbar button is hidden, or placed in the traybar, you - // can't ALT-TAB to console (take care when using with color key - // transparency :-) - // 0 - nothing - // 1 - hide it - // 2 - put icon to traybar - DWORD m_dwTaskbarButton; - - // set to TRUE if the window can be dragged by left-click hold - BOOL m_bMouseDragable; - - // snap distance - int m_nSnapDst; - - // window docking position - // 0 - no dock - // 1 - top left - // 2 - top right - // 3 - bottom right - // 4 - bottom left - DWORD m_dwDocked; - - // window Z-ordering - // 0 - regular - // 1 - always on top - // 2 - always on bottom - DWORD m_dwOriginalZOrder; - DWORD m_dwCurrentZOrder; - - // Win2000/XP transparency - // 0 - none - // 1 - alpha blending - // 2 - colorkey - // 3 - fake transparency - DWORD m_dwTransparency; - - // alpha value for alpha blending (Win2000 and later only!) - BYTE m_byAlpha; - - // alpha value for inactive window - BYTE m_byInactiveAlpha; - - COLORREF m_crBackground; - COLORREF m_crConsoleBackground; - - // this is used for tinting background images and fake transparencies - BOOL m_bTintSet; - BYTE m_byTintOpacity; - BYTE m_byTintR; - BYTE m_byTintG; - BYTE m_byTintB; - - // used when background is an image - BOOL m_bBitmapBackground; - tstring m_strBackgroundFile; - HDC m_hdcBackground; - HBITMAP m_hbmpBackground; - HBITMAP m_hbmpBackgroundOld; - - // background attributes - - // one of BACKGROUND_STYLE_ #defines - DWORD m_dwBackgroundStyle; - // set to true for relative background - BOOL m_bRelativeBackground; - // set to true to extend the background to all monitors - BOOL m_bExtendBackground; - - // offsets used for multiple monitors and relative backgrounds (fake transparency, too) - int m_nBackgroundOffsetX; - int m_nBackgroundOffsetY; - - // used for showing/hiding main window - BOOL m_bHideWindow; - // set to TRUE when the real console is hidden - BOOL m_bHideConsole; - - // timeout used when hiding console window for the first time (some - // shells need console window visible during startup) - DWORD m_dwHideConsoleTimeout; - - // if set to TRUE, Console will be started minimized - BOOL m_bStartMinimized; - - - // cursor style - // 0 - none - // 1 - XTerm - // 2 - block cursor - // 3 - bar cursor - // 4 - console cursor - // 5 - horizontal line - // 6 - vertical line - // 7 - pulse rect - // 8 - fading block - DWORD m_dwCursorStyle; - - COLORREF m_crCursorColor; - - // console screen buffer info for cursor - CONSOLE_SCREEN_BUFFER_INFO m_csbiCursor; - - // wether console cursor is visible or not - BOOL m_bCursorVisible; - - class Cursor* m_pCursor; - - // mouse cursor offset within the window (used for moving the window) - POINT m_mouseCursorOffset; - - ///////////////////// - // console stuff - - // console window handle - HWND m_hWndConsole; - - // console screen buffer info for console repainting - CONSOLE_SCREEN_BUFFER_INFO m_csbiConsole; - - // console stdouts - HANDLE m_hStdOut; - HANDLE m_hStdOutFresh; - - // set when quitting the application - HANDLE m_hQuitEvent; - - // set by monitor thread when detects console process exit - HANDLE m_hConsoleProcess; - - // handle to monitor thread - HANDLE m_hMonitorThread; - - // console rows & columns - DWORD m_dwRows; - DWORD m_dwColumns; - DWORD m_dwBufferRows; - BOOL m_bUseTextBuffer; - - // set to one of TEXT_SELECTION_ #defines - int m_nTextSelection; - - // X Windows style copy-on-select - BOOL m_bCopyOnSelect; - - // Inverse the shift behaviour for selecting and dragging - BOOL m_bInverseShift; - - COORD m_coordSelOrigin; - RECT m_rectSelection; - HDC m_hdcSelection; - HBITMAP m_hbmpSelection; - HBITMAP m_hbmpSelectionOld; - HBRUSH m_hbrushSelection; - - CHAR_INFO* m_pScreenBuffer; - CHAR_INFO* m_pScreenBufferNew; - - DWORD m_nTextColor; - DWORD m_nTextBgColor; - - // Console window class names - static const TCHAR m_szConsoleClass[]; - static const TCHAR m_szHiddenParentClass[]; - - // win console window title - static const tstring m_strWinConsoleTitle; -}; - - - -///////////////////////////////////////////////////////////////////////////// diff --git a/Console/Console.rc b/Console/Console.rc deleted file mode 100644 index 67ea1487..00000000 --- a/Console/Console.rc +++ /dev/null @@ -1,208 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "res\resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -#define IDC_STATIC 00 -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "windows.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1250) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUT DIALOG DISCARDABLE 0, 0, 146, 87 -STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | - WS_CAPTION | WS_SYSMENU -CAPTION "About Console" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,48,66,50,14 - LTEXT "Console v1.5",IDC_STATIC,51,11,42,8 - LTEXT "Copyright© 2001-2005 Marko Bozikovic",IDC_STATIC,9,30, - 127,8 - LTEXT "bozho@kset.org",IDC_STATIC,46,45,53,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_ABOUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 139 - TOPMARGIN, 7 - BOTTOMMARGIN, 80 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Neutral (Default) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD) -#ifdef _WIN32 -LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT -#pragma code_page(1250) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -//IDI_ICON2 ICON DISCARDABLE "Console.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_POPUP_MENU MENU DISCARDABLE -BEGIN - POPUP " " - BEGIN -// MENUITEM "Read&me", ID_SHOW_README_FILE - MENUITEM "&About Console", ID_ABOUT - MENUITEM SEPARATOR - MENUITEM "&Copy", ID_COPY - MENUITEM "&Paste", ID_PASTE - MENUITEM SEPARATOR -// MENUITEM "Always on &top", ID_TOGGLE_ONTOP -// MENUITEM "&Hide console", ID_HIDE_CONSOLE -// MENUITEM SEPARATOR -// MENUITEM "&Select configuration file", ID_SEL_CONFIG_FILE -// MENUITEM "&Edit configuration file", ID_EDIT_CONFIG_FILE -// MENUITEM "&Reload settings", ID_RELOAD_SETTINGS -// MENUITEM SEPARATOR - MENUITEM "E&xit", ID_EXIT_CONSOLE - END -END - -#endif // Neutral (Default) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Croatian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HRV) -#ifdef _WIN32 -LANGUAGE LANG_CROATIAN, SUBLANG_DEFAULT -#pragma code_page(1250) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,0,351 - PRODUCTVERSION 1,5,0,351 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Comments", "A cool console window :-)\0" - VALUE "CompanyName", "Ingenuity Unlimited Ltd.\0" - VALUE "FileDescription", "Console\0" - VALUE "FileVersion", "1.5, Build 351 2005.09.22\0" - VALUE "InternalName", "Console\0" - VALUE "LegalCopyright", "Copyright © 2001-2004 Marko Bozikovic\0" - VALUE "LegalTrademarks", "Copyright © 2001-2004 Marko Bozikovic\0" - VALUE "OriginalFilename", "Console.exe\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Console\0" - VALUE "ProductVersion", "1.5.00.351\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -#endif // !_MAC - -#endif // Croatian resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Console/Cursors.cpp b/Console/Cursors.cpp deleted file mode 100644 index 88b9087c..00000000 --- a/Console/Cursors.cpp +++ /dev/null @@ -1,769 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Cursors.h - cursor classes - -//#include "stdafx.h" -#include -#include -#include "Cursors.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - - -///////////////////////////////////////////////////////////////////////////// -// XTermCursor - -XTermCursor::XTermCursor(HWND hwndConsole, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndConsole, hdcWindow, crCursorColor) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -, m_hInactiveBrush(::CreateSolidBrush(crCursorColor)) -{ -} - -XTermCursor::~XTermCursor() { - - ::DeleteObject(m_hActiveBrush); - ::DeleteObject(m_hInactiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void XTermCursor::Draw(LPRECT pRect) { - - if (m_bActive) { - ::FillRect(m_hdcWindow, pRect, m_hActiveBrush); - } else { - ::FrameRect(m_hdcWindow, pRect, m_hInactiveBrush); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void XTermCursor::PrepareNext() { - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// BlockCursor - -BlockCursor::BlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -, m_bVisible(TRUE) -{ - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL); -} - -BlockCursor::~BlockCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - ::DeleteObject(m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void BlockCursor::Draw(LPRECT pRect) { - - if (m_bActive && m_bVisible) { - - ::FillRect(m_hdcWindow, pRect, m_hActiveBrush); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void BlockCursor::PrepareNext() { - - m_bVisible = !m_bVisible; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// NBBlockCursor - -NBBlockCursor::NBBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -{ -} - -NBBlockCursor::~NBBlockCursor() { - - ::DeleteObject(m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void NBBlockCursor::Draw(LPRECT pRect) { - - ::FillRect(m_hdcWindow, pRect, m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void NBBlockCursor::PrepareNext() { -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// PulseBlockCursor - -PulseBlockCursor::PulseBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -, m_nSize(0) -, m_nMaxSize(0) -, m_nStep(0) -{ - ::ZeroMemory(&m_rect, sizeof(RECT)); - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL); -} - -PulseBlockCursor::~PulseBlockCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - ::DeleteObject(m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void PulseBlockCursor::Draw(LPRECT pRect) { - - // this is called only once, to set the size of the cursor - if (m_nMaxSize == 0) { - if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) { - m_nMaxSize = (pRect->right - pRect->left) >> 1; - } else { - m_nMaxSize = (pRect->bottom - pRect->top) >> 1; - } - } - - if (m_bActive) { - RECT rect; - ::CopyMemory(&rect, pRect, sizeof(RECT)); - rect.left += m_nSize; - rect.top += m_nSize; - rect.right -= m_nSize; - rect.bottom -= m_nSize; - ::FillRect(m_hdcWindow, &rect, m_hActiveBrush); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void PulseBlockCursor::PrepareNext() { - - if (m_nSize == 0) { - m_nStep = 1; - } else if (m_nSize == m_nMaxSize) { - m_nStep = -1; - } - - m_nSize += m_nStep; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// BarCursor - -BarCursor::BarCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor)) -, m_bVisible(TRUE) -{ - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL); -} - -BarCursor::~BarCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - - ::DeleteObject(m_hPen); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void BarCursor::Draw(LPRECT pRect) { - - if (m_bActive && m_bVisible) { - HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen); - ::MoveToEx(m_hdcWindow, pRect->left, pRect->top, NULL); - ::LineTo(m_hdcWindow, pRect->left, pRect->bottom); - ::SelectObject(m_hdcWindow, hOldPen); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void BarCursor::PrepareNext() { - - m_bVisible = !m_bVisible; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// ConsoleCursor - -ConsoleCursor::ConsoleCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hStdOut(::CreateFile(_T("CONOUT$"), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0)) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -, m_bVisible(TRUE) -{ - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL); -} - -ConsoleCursor::~ConsoleCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - ::DeleteObject(m_hActiveBrush); - ::CloseHandle(m_hStdOut); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void ConsoleCursor::Draw(LPRECT pRect) { - - RECT rect; - - ::CopyMemory(&rect, pRect, sizeof(RECT)); - - if (m_bActive && m_bVisible) { - - rect.top += (rect.bottom - rect.top) * 80 / 100; - - ::FillRect(m_hdcWindow, &rect, m_hActiveBrush); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void ConsoleCursor::PrepareNext() { - - m_bVisible = !m_bVisible; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// NBHLineCursor - -NBHLineCursor::NBHLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor)) -{ -} - -NBHLineCursor::~NBHLineCursor() { - - ::DeleteObject(m_hPen); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void NBHLineCursor::Draw(LPRECT pRect) { - - HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen); - ::MoveToEx(m_hdcWindow, pRect->left, pRect->bottom-1, NULL); - ::LineTo(m_hdcWindow, pRect->right, pRect->bottom-1); - ::SelectObject(m_hdcWindow, hOldPen); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void NBHLineCursor::PrepareNext() { - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// HLineCursor - -HLineCursor::HLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor)) -, m_nSize(0) -, m_nPosition(0) -, m_nStep(0) -{ - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL); -} - -HLineCursor::~HLineCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - - ::DeleteObject(m_hPen); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void HLineCursor::Draw(LPRECT pRect) { - - // this is called only once, to set the size of the cursor - if (m_nSize != (pRect->bottom - pRect->top - 1)) { - m_nSize = pRect->bottom - pRect->top - 1; - m_nPosition = 0; - m_nStep = 1; - } - - if (m_bActive) { - HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen); - ::MoveToEx(m_hdcWindow, pRect->left, pRect->top + m_nPosition, NULL); - ::LineTo(m_hdcWindow, pRect->right, pRect->top + m_nPosition); - ::SelectObject(m_hdcWindow, hOldPen); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void HLineCursor::PrepareNext() { - - if (m_nPosition == 0) { - m_nStep = 1; - } else if (m_nPosition == m_nSize) { - m_nStep = -1; - } - - m_nPosition += m_nStep; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// VLineCursor - -VLineCursor::VLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hPen(::CreatePen(PS_SOLID, 1, crCursorColor)) -, m_nSize(0) -, m_nPosition(0) -, m_nStep(0) -{ - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL); -} - -VLineCursor::~VLineCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - - ::DeleteObject(m_hPen); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void VLineCursor::Draw(LPRECT pRect) { - - // this is called only once, to set the size of the cursor - if (m_nSize != (pRect->right - pRect->left - 1)) { - m_nSize = pRect->right - pRect->left - 1; - m_nPosition = 0; - m_nStep = 1; - } - - if (m_bActive) { - HPEN hOldPen = (HPEN)::SelectObject(m_hdcWindow, m_hPen); - ::MoveToEx(m_hdcWindow, pRect->left + m_nPosition, pRect->top, NULL); - ::LineTo(m_hdcWindow, pRect->left + m_nPosition, pRect->bottom); - ::SelectObject(m_hdcWindow, hOldPen); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void VLineCursor::PrepareNext() { - - if (m_nPosition == 0) { - m_nStep = 1; - } else if (m_nPosition == m_nSize) { - m_nStep = -1; - } - - m_nPosition += m_nStep; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// RectCursor - -RectCursor::RectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -, m_bVisible(TRUE) -{ - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 750, NULL); -} - -RectCursor::~RectCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - ::DeleteObject(m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void RectCursor::Draw(LPRECT pRect) { - - if (m_bActive && m_bVisible) { - - ::FrameRect(m_hdcWindow, pRect, m_hActiveBrush); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void RectCursor::PrepareNext() { - - m_bVisible = !m_bVisible; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// NBRectCursor - -NBRectCursor::NBRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -{ -} - -NBRectCursor::~NBRectCursor() { - - ::DeleteObject(m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void NBRectCursor::Draw(LPRECT pRect) { - - ::FrameRect(m_hdcWindow, pRect, m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void NBRectCursor::PrepareNext() { -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// PulseRectCursor - -PulseRectCursor::PulseRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_hActiveBrush(::CreateSolidBrush(crCursorColor)) -, m_nSize(0) -, m_nMaxSize(0) -, m_nStep(0) -{ - ::ZeroMemory(&m_rect, sizeof(RECT)); - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 100, NULL); -} - -PulseRectCursor::~PulseRectCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - ::DeleteObject(m_hActiveBrush); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void PulseRectCursor::Draw(LPRECT pRect) { - - // this is called only once, to set the size of the cursor - if (m_nMaxSize == 0) { - if ((pRect->right - pRect->left) < (pRect->bottom - pRect->top)) { - m_nMaxSize = (pRect->right - pRect->left) >> 1; - } else { - m_nMaxSize = (pRect->bottom - pRect->top) >> 1; - } - } - - if (m_bActive) { - RECT rect; - ::CopyMemory(&rect, pRect, sizeof(RECT)); - rect.left += m_nSize; - rect.top += m_nSize; - rect.right -= m_nSize; - rect.bottom -= m_nSize; - ::FrameRect(m_hdcWindow, &rect, m_hActiveBrush); - } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void PulseRectCursor::PrepareNext() { - - if (m_nSize == 0) { - m_nStep = 1; - } else if (m_nSize == m_nMaxSize) { - m_nStep = -1; - } - - m_nSize += m_nStep; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// FadeBlockCursor - -FadeBlockCursor::FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor, COLORREF crBkColor) -: Cursor(hwndParent, hdcWindow, crCursorColor) -, m_crCursorColor(crCursorColor) -, m_nStep(1) -, m_crBkColor(crBkColor) -, m_nIndex(0) -, m_hUser32(NULL) -, m_hMemDC(NULL) -{ - m_uiTimer = ::SetTimer(hwndParent, CURSOR_TIMER, 35, NULL); - - FakeBlend(); -// } -} - -FadeBlockCursor::~FadeBlockCursor() { - - if (m_uiTimer) ::KillTimer(m_hwndParent, m_uiTimer); - -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void FadeBlockCursor::Draw(LPRECT pRect) { - - - HBRUSH hBrush = ::CreateSolidBrush(m_arrColors[m_nIndex]); - ::FillRect(m_hdcWindow, pRect, hBrush); - ::DeleteObject(hBrush); -// } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// - -void FadeBlockCursor::PrepareNext() { - if (m_nIndex == 0) { - m_nStep = 1; - } else if (m_nIndex == (FADE_STEPS)) { - m_nStep = -1; - } - m_nIndex += m_nStep; -// } -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// This function is used to create a fake blending for WinNT (uuseful only -// for solid background, though) - -void FadeBlockCursor::FakeBlend() { - - int nDeltaR = ((GetRValue(m_crCursorColor) - GetRValue(m_crBkColor)) << 8) / FADE_STEPS; - int nDeltaG = ((GetGValue(m_crCursorColor) - GetGValue(m_crBkColor)) << 8) / FADE_STEPS; - int nDeltaB = ((GetBValue(m_crCursorColor) - GetBValue(m_crBkColor)) << 8) / FADE_STEPS; - - for (int i = 0; i < FADE_STEPS; ++i) { - m_arrColors[i] = RGB(GetRValue(m_crCursorColor) - (nDeltaR*i >> 8), GetGValue(m_crCursorColor) - (nDeltaG*i >> 8), GetBValue(m_crCursorColor) - (nDeltaB*i >> 8)); - } - - m_arrColors[FADE_STEPS] = m_crBkColor; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - diff --git a/Console/Cursors.h b/Console/Cursors.h deleted file mode 100644 index 3a1f4c17..00000000 --- a/Console/Cursors.h +++ /dev/null @@ -1,342 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Cursors.h - cursor classes - -#pragma once - -#define CURSOR_TIMER 45 - -extern BOOL g_bWin2000; - -///////////////////////////////////////////////////////////////////////////// -// A base class for all the cursors - -class Cursor { - public: - Cursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor) - : m_hwndParent(hwndParent) - , m_hdcWindow(hdcWindow) - , m_crCursorColor(crCursorColor) - , m_bActive(TRUE) - , m_uiTimer(0) - {}; - - virtual ~Cursor(){}; - - void SetState(BOOL bActive) {m_bActive = bActive;}; - BOOL GetState() { return m_bActive; } - - // used to draw current frame of the cursor - virtual void Draw(LPRECT pRect) = 0; - // used to prepare the next frame of cursor animation - virtual void PrepareNext() = 0; - - protected: - - HWND m_hwndParent; - HDC m_hdcWindow; - COLORREF m_crCursorColor; - - BOOL m_bActive; - UINT m_uiTimer; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// XTermCursor - -class XTermCursor : public Cursor { - public: - XTermCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~XTermCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HBRUSH m_hActiveBrush; - HBRUSH m_hInactiveBrush; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// BlockCursor - -class BlockCursor : public Cursor { - public: - BlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~BlockCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HBRUSH m_hActiveBrush; - BOOL m_bVisible; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// NBBlockCursor - -class NBBlockCursor : public Cursor { - public: - NBBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~NBBlockCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HBRUSH m_hActiveBrush; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// PulseBlockCursor - -class PulseBlockCursor : public Cursor { - public: - PulseBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~PulseBlockCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HBRUSH m_hActiveBrush; - RECT m_rect; - int m_nSize; - int m_nMaxSize; - int m_nStep; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// BarCursor - -class BarCursor : public Cursor { - public: - BarCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~BarCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HPEN m_hPen; - BOOL m_bVisible; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// ConsoleCursor - -class ConsoleCursor : public Cursor { - public: - ConsoleCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~ConsoleCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HANDLE m_hStdOut; - HBRUSH m_hActiveBrush; - BOOL m_bVisible; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// NBHLineCursor - -class NBHLineCursor : public Cursor { -public: - NBHLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~NBHLineCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - -private: - HPEN m_hPen; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// HLineCursor - -class HLineCursor : public Cursor { - public: - HLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~HLineCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HPEN m_hPen; - int m_nSize; - int m_nPosition; - int m_nStep; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// VLineCursor - -class VLineCursor : public Cursor { - public: - VLineCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~VLineCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HPEN m_hPen; - int m_nSize; - int m_nPosition; - int m_nStep; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// RectCursor - -class RectCursor : public Cursor { - public: - RectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~RectCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HBRUSH m_hActiveBrush; - BOOL m_bVisible; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// NBRectCursor - -class NBRectCursor : public Cursor { - public: - NBRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~NBRectCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HBRUSH m_hActiveBrush; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// PulseRectCursor - -class PulseRectCursor : public Cursor { - public: - PulseRectCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor); - ~PulseRectCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - HBRUSH m_hActiveBrush; - RECT m_rect; - int m_nSize; - int m_nMaxSize; - int m_nStep; -}; - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// FadeBlockCursor - -#define FADE_STEPS 20 -#define ALPHA_STEP 12 - -#define BLEND_BMP_WIDTH 10 -#define BLEND_BMP_HEIGHT 20 - -class FadeBlockCursor : public Cursor { - public: - FadeBlockCursor(HWND hwndParent, HDC hdcWindow, COLORREF crCursorColor, COLORREF crBkColor); - ~FadeBlockCursor(); - - void Draw(LPRECT pRect); - void PrepareNext(); - - private: - - void FakeBlend(); - - COLORREF m_crCursorColor; - int m_nStep; - - // used under WinNT 4.0 - COLORREF m_crBkColor; - COLORREF m_arrColors[FADE_STEPS+1]; - int m_nIndex; - - // these are used under Win2000 only - HMODULE m_hUser32; - BLENDFUNCTION m_bfn; - HDC m_hMemDC; -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/Console/Dialogs.cpp b/Console/Dialogs.cpp deleted file mode 100644 index 18574e04..00000000 --- a/Console/Dialogs.cpp +++ /dev/null @@ -1,134 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Dialogs.h - dialog classes -// -// About dialog class, etc... - -//#include "stdafx.h" -#include - -#include "resource.h" -#include "Console.h" -#include "Dialogs.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -extern HINSTANCE ghInstance; - -///////////////////////////////////////////////////////////////////////////// -// About dialog class - -///////////////////////////////////////////////////////////////////////////// -// Ctor/Dtor - -CAboutDlg::CAboutDlg(HWND hwndParent) - : m_hWndParent(hwndParent) -{ -} - - -CAboutDlg::~CAboutDlg() -{ -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// public methods - -///////////////////////////////////////////////////////////////////////////// -// DoModal - shows About dialog - -BOOL CAboutDlg::DoModal() -{ - ::DialogBox( - ghInstance, - MAKEINTRESOURCE(IDD_ABOUT), - m_hWndParent, - CAboutDlg::DialogProc); - - return TRUE; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// message handlers - - -///////////////////////////////////////////////////////////////////////////// -// DialogProc - dialog window procedure - -int CALLBACK CAboutDlg::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - switch (uMsg) { - case WM_INITDIALOG: - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - case IDCANCEL: - if (HIWORD(wParam) == BN_CLICKED) { - ::EndDialog(hwndDlg, MB_OK); - return TRUE; - } - break; - } - } - - return 0; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - - - - - - - - - - - - - - - diff --git a/Console/Dialogs.h b/Console/Dialogs.h deleted file mode 100644 index 54cafb05..00000000 --- a/Console/Dialogs.h +++ /dev/null @@ -1,64 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Dialogs.h - dialog classes -// -// About dialog class, etc... - -#pragma once - -///////////////////////////////////////////////////////////////////////////// -// About dialog class - -class CAboutDlg { - public: - CAboutDlg(HWND hwndParent); - ~CAboutDlg(); - - // public methods - public: - - // shows About dialog - BOOL DoModal(); - - // public data - public: - // parent window handle - HWND m_hWndParent; - - // private methods - private: - ///////////////////////// - // message handlers - - // dialog window procedure - static int CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ); - - // private data - private: -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/Console/FileStream.cpp b/Console/FileStream.cpp deleted file mode 100644 index 2e56aedd..00000000 --- a/Console/FileStream.cpp +++ /dev/null @@ -1,259 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// FileStream.cpp - implementation of IStream interface on any file -// (not strictly COM, I'm faking it here a bit :-) -// - -#undef CINTERFACE -#include "builddefines.h" - -//#include "stdafx.h" -//#include -#include -#include -#include "FileStream.h" - -//#ifdef _DEBUG -//#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -//#endif - -///////////////////////////////////////////////////////////////////////////// -// CreateFileStream - opens/creates a file and returns an IStream interface - -HRESULT CreateFileStream( - LPCTSTR lpFileName, // file name - DWORD dwDesiredAccess, // access mode - DWORD dwShareMode, // share mode - LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD - DWORD dwCreationDisposition, // how to create - DWORD dwFlagsAndAttributes, // file attributes - HANDLE hTemplateFile, // handle to template file - IStream** ppStream // pointer to IStream interface -) -{ - - HANDLE hFile = ::CreateFile( - lpFileName, - dwDesiredAccess, - dwShareMode, - lpSecurityAttributes, - dwCreationDisposition, - dwFlagsAndAttributes, - hTemplateFile); - - if (hFile == INVALID_HANDLE_VALUE) { -// DWORD a = ::GetLastError(); - ppStream = NULL; - return E_FAIL; - } - - FileStream* pFileStream = new FileStream(hFile); - - return pFileStream->QueryInterface(IID_IStream, (void**)ppStream); -} - -///////////////////////////////////////////////////////////////////////////// - - - -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// FileStream class - -///////////////////////////////////////////////////////////////////////////// -// ctor/dtor - -FileStream::FileStream(HANDLE hFile) - : m_lRefCount(0) - , m_hFile(hFile) -{ -} - -FileStream::~FileStream() -{ - if (m_hFile) ::CloseHandle(m_hFile); -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// IStream methods - -///////////////////////////////////////////////////////////////////////////// -// Read - reads a specified number of bytes from the stream object into memory -// starting at the current seek pointer - -STDMETHODIMP FileStream::Read(void *pv, ULONG cb, ULONG *pcbRead) -{ - if (!::ReadFile(m_hFile, pv, cb, pcbRead, NULL)) return S_FALSE; - - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Write - writes a specified number of bytes into the stream object starting -// at the current seek pointer - -STDMETHODIMP FileStream::Write(void const *pv, ULONG cb, ULONG *pcbWritten) -{ - if (!::WriteFile(m_hFile, pv, cb, pcbWritten, NULL)) return S_FALSE; - - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Seek - changes the seek pointer to a new location relative to the beginning -// of the stream, to the end of the stream, or to the current seek pointer - -STDMETHODIMP FileStream::Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) -{ - DWORD dwFileOrigin; - - DWORD dwMoveLow = dlibMove.LowPart; - LONG lMoveHigh = dlibMove.HighPart; - - switch (dwOrigin) { - case STREAM_SEEK_SET : dwFileOrigin = FILE_BEGIN; break; - case STREAM_SEEK_CUR : dwFileOrigin = FILE_CURRENT; break; - case STREAM_SEEK_END : dwFileOrigin = FILE_END; break; - default:dwFileOrigin = FILE_BEGIN; - } - - DWORD dwRet = ::SetFilePointer(m_hFile, dwMoveLow, &lMoveHigh, dwFileOrigin); - - if (::GetLastError() != NO_ERROR) return STG_E_INVALIDPOINTER; - - plibNewPosition->LowPart = dwRet; - plibNewPosition->HighPart = lMoveHigh; - - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// SetSize - not really doing anything here - -STDMETHODIMP FileStream::SetSize(ULARGE_INTEGER libNewSize) -{ - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// CopyTo - copies a specified number of bytes from the current seek pointer -// in the stream to the current seek pointer in another stream - -STDMETHODIMP FileStream::CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) -{ - // later... - return E_NOTIMPL; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Commit - no work here... - -STDMETHODIMP FileStream::Commit(DWORD grfCommitFlags) -{ - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Revert - no work here... - -STDMETHODIMP FileStream::Revert(void) -{ - return S_OK; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// LockRegion - no work here... - -STDMETHODIMP FileStream::LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) -{ - return E_NOTIMPL; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// UnlockRegion - no work here... - -STDMETHODIMP FileStream::UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) -{ - return E_NOTIMPL; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Stat - no work here... - -STDMETHODIMP FileStream::Stat(STATSTG *pstatstg, DWORD grfStatFlag) -{ - return E_NOTIMPL; -} - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Clone - no work here... - -STDMETHODIMP FileStream::Clone(IStream **ppstm) -{ - return E_NOTIMPL; -} - -///////////////////////////////////////////////////////////////////////////// diff --git a/Console/FileStream.h b/Console/FileStream.h deleted file mode 100644 index 4ac8966b..00000000 --- a/Console/FileStream.h +++ /dev/null @@ -1,107 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Copyright (C) 2001-2004 by Marko Bozikovic -// All rights reserved -// -// 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 2 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, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Send bug reports, bug fixes, enhancements, requests, flames, etc., and -// I'll try to keep a version up to date. I can be reached as follows: -// marko.bozikovic@alterbox.net -// bozho@kset.org -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// FileStream.h - implementation of IStream interface on any file -// (not really COM, I'm faking it here a bit :-) -// - -#pragma once - - -///////////////////////////////////////////////////////////////////////////// -// CreateFileStream - opens/creates a file and returns an IStream interface - -HRESULT CreateFileStream( - LPCTSTR lpFileName, // file name - DWORD dwDesiredAccess, // access mode - DWORD dwShareMode, // share mode - LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD - DWORD dwCreationDisposition, // how to create - DWORD dwFlagsAndAttributes, // file attributes - HANDLE hTemplateFile, // handle to template file - IStream** ppStream // pointer to IStream interface -); - - -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// FileStream class - -class FileStream : public IStream { - public: - FileStream(HANDLE hFile); - ~FileStream(); - - // IUnknown methods - STDMETHOD(QueryInterface)(REFIID riid, void ** ppv) { - if (riid == IID_IUnknown) { - *ppv = static_cast(this); - } else if (riid == IID_IStream) { - *ppv = static_cast(this); - } else { - *ppv = NULL; - return E_NOINTERFACE; - } - - static_cast(*ppv)->AddRef(); - return S_OK; - }; - - STDMETHOD_(ULONG, AddRef)(void) { - return ::InterlockedIncrement(&m_lRefCount); - }; - - STDMETHOD_(ULONG, Release)(void) { - long l = ::InterlockedDecrement(&m_lRefCount); - if (l == 0) delete this; - return l; - }; - - // IStream methods - STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead); - STDMETHOD(Write)(void const *pv, ULONG cb, ULONG *pcbWritten); - STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition); - STDMETHOD(SetSize)(ULARGE_INTEGER libNewSize); - STDMETHOD(CopyTo)(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten); - STDMETHOD(Commit)(DWORD grfCommitFlags); - STDMETHOD(Revert)(void); - STDMETHOD(LockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); - STDMETHOD(UnlockRegion)(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType); - STDMETHOD(Stat)(STATSTG *pstatstg, DWORD grfStatFlag); - STDMETHOD(Clone)(IStream **ppstm); - - private: // private data - - // reference count - long m_lRefCount; - - // file handle - HANDLE m_hFile; -}; - -///////////////////////////////////////////////////////////////////////////// diff --git a/Console/ReadMe.txt b/Console/ReadMe.txt deleted file mode 100644 index dd1ac002..00000000 --- a/Console/ReadMe.txt +++ /dev/null @@ -1,1200 +0,0 @@ -Console v1.5 Sep 2005 -===================== -for Windows NT/2000/XP - -Copyright (C) 2001-2005 Marko Bozikovic - -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 2 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, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Send bug reports, bug fixes, enhancements, requests, flames, etc., and -I'll try to keep a version up to date. I can be reached as follows: - bozho@kset.org - -Console icon is Copyright (C) 2001-2005 by Ante Vukorepa (orcinus@kset.org) - - -1. Requirements -=============== -WinNT 4.0 SP4 or later (it won't work on Win9x/Me) -IE 4.0 (or later) installed. - - -2. File list -============ - -console.exe -FreeImage.dll -FreeImagePlus.dll -console.inf -console.xml -console_big.xml -console_small.xml -devel-changes.txt -Readme.txt -License.txt -Tab Completition.reg -FixedMedium*.fon -TerminalMedium14.fon - - -3. Installation -=============== - -Unzip Console.zip file somewhere :-) - -If you'd like to have "Console here" in the Explorer right-click menu for -drives and directories, install console.inf file (right-click on console.inf -and choose "Install") Remember to do it in the Console directory! - - -4. Uninstall -============ - -If you have installed console.inf (see "Installation" section), run -"Add/Remove Programs" Control Panel applet and remove "Console Here -Extension". - -Delete all the files. - - -5. Overview -=========== - -Console is a Win console window enhancement. It was inspired by eConsole -(http://www.informatik.uni-frankfurt.de/~corion), a great console-enhancement -program (unfortunately, it seems that it's no longer being developed) - -Console features include configurable font, color, size, background image and -transparency (on Win2000 and later) - -Console is *not* a shell. It's simply a nice-looking front end for a shell -of your choice (cmd.exe, 4NT, ksh, Cygwin bash, etc.) - - -6. Acknowledgements -=================== - -A big thanks to Ante Vukorepa for the program icon. -Also, big thanks to Alen Ladavac for help with painting optimizations. - -Many thanks to code contributors: -- Francois Leblanc for mouse wheel messages patch -- Daniel Soto for adding multiple monitors support -- Dean Scarff for adding stuff -- Adam Hodson for adding flat scrollbar support -- Daniel Cheng for making Console window looking like a regular window when - is set to 'tray' or 'hide' -- Rob Davenport for config reload prompt patch and initial comments in the - sample console.xml file - -Thanks also goes to all the people using and testing Console, reporting bugs -and asking for new stuff :-) - - -7. Included fonts -================= - -The fonts included with Console are XFree86 'misc' fonts converted to TTF. I -added them here, since Windows could use nicer console fonts. If you wish to -use them, simply install them as you would any other TTF font (go to Control -Panel -> Fonts and follow instructions :-) - -I guess these fonts are distributed under XFree86 licence, and if you think -I'm in violation of any licence terms by providing these fonts, please drop me -a line. - - -8. FreeImage library -==================== - -Console uses FreeImage library for background image loading and manipulations. -Console source distribution includes only FreeImage library, include and DLL -files. Complete source code for FreeImage can be obtained at: -http://freeimage.sourceforge.net - - -9. Configuration & usage -======================== - -9.1 Running Console -------------------- - -The first thing you might want to set is your COMSPEC environment variable, -since that is the shell Console will start. Set it to your favorite shell -(cmd.exe, 4nt.exe) - -Console command line syntax: -console.exe [] [OPTIONS] - - is the path to the configuration file. If ommited, Console will -try to locate console.xml configuration file in console.exe directory. If the -path contains blanks, enclose it in double quotes. - -Options: - --c - sets initial shell command --t - sets default window title --r - sets default new configuration auto-load - flag - -You can pass initial shell command by using "-c" switch. If the command string -contains blanks, enclose it in double quotes. If the command string itself -contains double quotes, put two double quotes for each double quote appearing -in the command string. E.g: - console.exe console.xml -c "cd ""C:\Program Files""" - -Note: If you use cmd.exe as your shell, you must use /k switch in your command -line string (4NT doesn't need the /k switch): - console.exe console.xml -c "/k " - --t switch specifies the default Console window title. Using the 'title' -attribute in the config file will override this switch. - --r switch specifies the default new configuration auto-reload flag. Possible -values are: 'yes', 'no' and 'prompt'. 'prompt' is the default. Using -'reload_new_config' tag in the config file will override this switch. - -9.2 Copy/Paste --------------- - -To copy text, press and hold shift+left click (or simply left click if Console -is not mouse draggable) Drag to select text, and then left-click inside the -selection to copy. Left-click outside the selection clears it. If you set -copy_on_select tag to true, the selection will be copied immediately after -releasing the mouse button. - -You can paste text into Console using shift+right click or middle click (you -might want to disable middle-button click support for Console in your mouse -drivers for better performance) - -Note: text selection and copy work for fixed-width fonts *only*. Use Lucida -Console or the supplied fonts (if you have any nice looking free fixed width -fonts, feel free to share them :-) - -9.3 International characters ----------------------------- - -Console fully supports Unicode characters, so it should be able to handle all -national characters, but there are some things to note: - -The font you use in Console must include international characters (this one is -obvious, isn't it? :-) Supplied FixedMediumXX fonts don't include all of them. -I have found some FixedMedium Unicode fonts, but I wasn't able to convert them -from bdf to ttf format yet. Your best bet is using Lucida Console font -supplied with Windows. - -After that, you have to configure the Windows console. Start Console and -unhide Win console. By default, the Win console uses the Raster Font that -doesn't have international characters. Open Win console properties and on the -Fonts tab change the font to Lucida Console. Click OK and on the next small -dialog select "Save properties for future windows with the same title" This -will make Win console windows started by Console use Lucida Console font that -has international characters. - -9.4 Controlling Console from other applications ------------------------------------------------ - -Console can be controlled from other applications that support sending -messages to application windows (e.g. PowerPro) - -Console can handle messages for its menu commands sent from other -applications. The other application should send WM_COMMAND message (0x0111 in -hex, or 273 decimal) to the main Console window, with wParam set to command -ID, and lParam set to 0. - -Command IDs (decimal values) are: - -Show Readme.txt file...............40001 -Show About dialog..................40002 -Copy selected text.................40003 -Paste from clipboard...............40004 -Toggle 'always on top' status......40005 -Toggle show/hide Windows console...40006 -Edit configuration file............40008 -Reload settings....................40009 -Exit Console.......................40010 - -For selecting a configuration file, wParam should be between 1000 and 2000 -(1000 being the first .XML file in the startup config file direcotry, files -sorted by filename, ascending) - -9.5 Maximizing Console window ------------------------------ - -Console window can be maximized by setting 'rows' and/or 'columns' of the - tag to 'max'. - -Maximum number of rows and/or columns is determined by both maximum Windows' -console dimensions and maximum Console window size. The smaller will be used -(since Windows console cannot be resized beyond desktop size) - -If the size of your Console window is limited by Windows console maximum size, -you can choose a smaller font in Windows console properties. - -Note that increasing the number of rows and/or columns and reloading the -settings can sometimes result in a corrupt output. I haven't found a solution -for this yet, but it seems that restarting Console solves the problem. - - -9.6 Misc stuff --------------- - -Using left button double click you can toggle between z-order selected in the -configuration file and "always on top" z-order. - -Right-click pops up a menu. You can copy/paste text from the menu, toggle -'always on top' and 'hide console' flags, work with configuration files. You -can switch configuration files by selecting a file from 'Select configuration -file' submenu (currently active configuration file is checked) and reloading -configuration. Configuration files are enumerated from the initial -configuration file's directory. - -You can drag-n-drop a file or directory to Console. If several files are -dropped at once, they will be sent to Console, separated by spaces. Filenames -that contain spaces will be enclosed in double quotes. - -The supplied .reg file is a registry file that will turn on file and directory -name completion for cmd.exe (thanks to Rob 'insanitee' for the idea) To -install it, just double-click on it, and click 'Yes'. - -You can map console font colors to custom values (see configuration section) -Check out supplied console.xml for an example with default values. - -Color indexes for default colors are: -00 - Black 08 - Gray (bright black) -01 - Blue 09 - Bright blue -02 - Green 10 - Bright green -03 - Cyan 11 - Bright cyan -04 - Red 12 - Bright red -05 - Magenta 13 - Bright magenta -06 - Yellow 14 - Bright yellow -07 - White 15 - Bright white - - -10. Configuration file -====================== - -The console configuration file is a simple xml file. Here's a general layout -of the configuration file: - - - - - - 8 - - false - false - Lucida Console - - - - 150 - 150 - bottom left - 10 - regular - - - - - true - - - - - 10 - 10 - 120 - - - false - - 1 - - normal - - - - alpha - - - - - 2.bmp - - - - - - - - - - - - true - - true - - true - - prompt - - - - - -If you ommit tags and/or attributes, default values will be used. - -Here are the tags and attributes: - -console -------- -Description: root tag -Parent: none -Attributes: - title -> sets the console window title (default: console) - - change_refresh -> change refresh interval (in ms) for window - repaint (default: 50) It controls how long window repainting is - delayed after a change has been detected in the real console. - The minimum value for this setting is 5. Note that small values - will increase CPU usage when console contents changes - rapidly (like dumping a large text file on the console) - - refresh -> sets main refresh interval (in ms) for window - repaint (default: 500) Console window is periodically refresh - even if there are no changes detected. This is needed for - proper operation of some DOS programs (eg, RAR). You can switch - this off (by setting it to 0) to reduce CPU usage, but some DOS - programs will not be displayed correctly (if at all :-) - - shell -> sets shell program, overriding COMSPEC environment - variable (if you change this while Console is running, you'll - have to restart it for chages to take effect) - - editor -> specifies text editor that will be used to edit the - configuration file (notepad.exe by default); if the program is - not in your PATH, you'll need to specify the full path - - editor_params -> specifies additional parameters to be passed - to a text editor used to edit configuration file and view the - Readme file; %f in editor_params will be replaced by the - configuration/readme file name; if there's no %f in the - editor_params, the configuration/readme file name will be - concatenated to the editor_params string; if there are spaces - in the filename, place " around %f ("%f") -Data: none - -Note on 'change_refresh' and 'refresh' attributes: Console v1.4 introduced -some window painting improvements, increasing the speed and reducing CPU -usage. You might want to set these parameters much lower for better -performance (something like 5-10 for 'change_refresh' and 100-200 for -'refresh') - - - ------ - Description: Sets the font and its properties - Parent: console - Attributes: none - Data: none - - - ------ - Description: sets font size in points - Parent: font - Attributes: none - Data: font size in points (default: 8) - - - ------ - Description: sets font's bold flag - Parent: font - Attributes: none - Data: true/false (default: false) - - - -------- - Description: sets font's italic flag - Parent: font - Attributes: none - Data: true/false (default: false) - - - ------- - Description: sets font color - Parent: font - Attributes: - r -> 0-255, sets Red component (default: 0) - - g -> 0-255, sets Green component (default: 0) - - b -> 0-255, sets Blue component (default: 0) - Data: none - Note: if this tag is not present, Console will use font colors - from the real console (useful if your shell, like 4NT, - supports different coloring options) - - - -------- - Description: groups font color mapping tags - Parent: font - Attributes: none - Data: none - - - ---------- - Description: maps color No. XX to a new color - Parent: colors - Attributes: - r -> 0-255, sets Red component (default: 0) - - g -> 0-255, sets Green component (default: 0) - - b -> 0-255, sets Blue component (default: 0) - Data: none - Note: XX goes from 00 to 15 (you may ommit colors you don't - want to change) See 'Misc Stuff' section above for - color indexes - - - ------ - Description: sets font's name - Parent: font - Attributes: none - Data: font name (default: Lucida Console) - - - - ---------- - Description: groups window position tags - Parent: console - Attributes: none - Data: none - - - --- - Description: sets initial window X coordinate - Parent: position - Attributes: none - Data: X coordinate - Note: Set to -1 to let the system place the Console window at - startup - - - --- - Description: sets initial window Y coordinate - Parent: position - Attributes: none - Data: Y coordinate - Note: Set to -1 to let the system place the Console window at - startup - - - -------- - Description: sets initial window docking position - Parent: position - Attributes: none - Data: docked position: none, bottom left, bottom right, top - left, top right (default: none) - - - --------------- - Description: sets window snap distance - Parent: position - Attributes: none - Data: snap distance in pixels; use -1 for no snapping (default: - 10) - - - --------- - Description: sets window z ordering - Parent: position - Attributes: none - Data: window z-order: regular, on top, on bottom (default: - regular) - - - - ------------ - Description: groups window appearance tags - Parent: console - Attributes: none - Data: none - - - -------------- - Description: sets real console window visibility - Parent: appearance - Attributes: none - Data: true/false (default: true) - - - ---------------------- - Description: sets timeout for initial console hiding (during startup); - some shells need real console window visible during - startup in order to initialize properly - Parent: appearance - Attributes: none - Data: timeout in milliseconds (default: 0) - - - ----------------- - Description: sets initial 'minimized' status - Parent: appearance - Attributes: none - Data: true/false (default: true) - - - ---------------- - Description: groups scrollbar attributes (if visible) - Parent: appearance - Attributes: none - Data: none - - - ------- - Description: sets scrollbar background color - Parent: scrollbar - Attributes: - r -> 0-255, sets Red component (default: system - default) - - g -> 0-255, sets Green component (default: system - default) - - b -> 0-255, sets Blue component (default: system - default) - Data: none - -