Convert to SoldierID

This commit is contained in:
Asdow
2024-11-17 16:43:39 +02:00
parent f39078357b
commit 2e92da4e12
3 changed files with 11 additions and 10 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pA
return( TRUE ); return( TRUE );
} }
void DeleteAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ) void DeleteAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache )
{ {
// Allocate entries // Allocate entries
if ( pAnimCache->usCachedSurfaces!= NULL ) 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; UINT8 cnt;
+2 -2
View File
@@ -20,9 +20,9 @@ extern UINT32 guiCacheSize;
BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation ); BOOLEAN GetCachedAnimationSurface( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache, UINT16 usSurfaceIndex, UINT16 usCurrentAnimation );
BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache ); BOOLEAN InitAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache );
void DeleteAnimationCache( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ); void DeleteAnimationCache( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache );
void DetermineOptimumAnimationCacheSize( ); void DetermineOptimumAnimationCacheSize( );
void UnLoadCachedAnimationSurfaces( UINT16 usSoldierID, AnimationSurfaceCacheType *pAnimCache ); void UnLoadCachedAnimationSurfaces( SoldierID usSoldierID, AnimationSurfaceCacheType *pAnimCache );
+7 -6
View File
@@ -2820,9 +2820,10 @@ BOOLEAN SOLDIERTYPE::ChangeSoldierState( UINT16 usNewState, UINT16 usStartingAni
// This function reevaluates the stance if the guy sees us! // This function reevaluates the stance if the guy sees us!
BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState )
{ {
INT32 cnt, iClosestEnemy = NOBODY; INT32 cnt;
SoldierID iClosestEnemy = NOBODY;
INT16 sTargetXPos, sTargetYPos; INT16 sTargetXPos, sTargetYPos;
BOOLEAN fReturnVal = FALSE; BOOLEAN fReturnVal = FALSE;
INT16 sDist, sClosestDist = 10000; INT16 sDist, sClosestDist = 10000;
// make the chosen one not turn to face us // make the chosen one not turn to face us
@@ -2875,21 +2876,21 @@ BOOLEAN ReevaluateEnemyStance( SOLDIERTYPE *pSoldier, UINT16 usAnimState )
if ( gGameExternalOptions.fNoEnemyAutoReadyWeapon == 0 ) if ( gGameExternalOptions.fNoEnemyAutoReadyWeapon == 0 )
{ {
// Change to fire ready animation // Change to fire ready animation
ConvertGridNoToXY( MercPtrs[iClosestEnemy]->sGridNo, &sTargetXPos, &sTargetYPos ); ConvertGridNoToXY( iClosestEnemy->sGridNo, &sTargetXPos, &sTargetYPos );
pSoldier->flags.fDontChargeReadyAPs = TRUE; pSoldier->flags.fDontChargeReadyAPs = TRUE;
// Ready weapon // 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); return(fReturnVal);
} }
// this makes the soldier to only turn towards our direction, instead of raising his weapon // this makes the soldier to only turn towards our direction, instead of raising his weapon
else if ( gGameExternalOptions.fNoEnemyAutoReadyWeapon == 2 ) else if ( gGameExternalOptions.fNoEnemyAutoReadyWeapon == 2 )
{ {
//ConvertGridNoToXY( MercPtrs[ iClosestEnemy ]->sGridNo, &sTargetXPos, &sTargetYPos ); //ConvertGridNoToXY( iClosestEnemy->sGridNo, &sTargetXPos, &sTargetYPos );
//sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier ); //sFacingDir = GetDirectionFromXY( sXPos, sYPos, pSoldier );
INT16 sFacingDir = GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, MercPtrs[iClosestEnemy]->sGridNo ); INT16 sFacingDir = GetDirectionToGridNoFromGridNo( pSoldier->sGridNo, iClosestEnemy->sGridNo );
if ( sFacingDir != pSoldier->ubDirection ) if ( sFacingDir != pSoldier->ubDirection )
{ {