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] 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 ) {