diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index f34b3071..759cf7df 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -7903,6 +7903,67 @@ void SOLDIERTYPE::EVENT_BeginMercTurn( BOOLEAN fFromRealTime, INT32 iRealTimeCou // UTILITY FUNCTIONS CALLED BY OVERHEAD.H UINT8 gDirectionFrom8to2[] = {0, 0, 1, 1, 0, 1, 1, 0}; +// Flugente: frozen soldiers do not move. We simulate this by using fixed animation frames, which we determine here +UINT16 SOLDIERTYPE::CryoAniFrame() +{ + // get anim surface and determine # of frames + UINT16 usAnimSurface = GetSoldierAnimationSurface( this, this->usAnimState ); + + //If we are only one frame, ignore what the script is telling us! + if ( usAnimSurface == INVALID_ANIMATION_SURFACE || gAnimSurfaceDatabase[usAnimSurface].hVideoObject == NULL || gAnimSurfaceDatabase[usAnimSurface].ubFlags & ANIM_DATA_FLAG_NOFRAMES ) + { + return 0; + } + + // COnvert world direction into sprite direction + UINT8 ubTempDir = gOneCDirection[this->ubDirection]; + + if ( gAnimSurfaceDatabase[usAnimSurface].uiNumDirections == 32 ) + { + ubTempDir = gExtOneCDirection[this->ubHiResDirection]; + } + // Check # of directions /surface, adjust if ness. + else if ( gAnimSurfaceDatabase[usAnimSurface].uiNumDirections == 4 ) + { + ubTempDir = ubTempDir / 2; + } + // Check # of directions /surface, adjust if ness. + else if ( gAnimSurfaceDatabase[usAnimSurface].uiNumDirections == 1 ) + { + ubTempDir = 0; + } + // Check # of directions /surface, adjust if ness. + else if ( gAnimSurfaceDatabase[usAnimSurface].uiNumDirections == 3 ) + { + if ( this->ubDirection == NORTHWEST ) + { + ubTempDir = 1; + } + else if ( this->ubDirection == WEST ) + { + ubTempDir = 0; + } + else if ( this->ubDirection == EAST ) + { + ubTempDir = 2; + } + } + else if ( gAnimSurfaceDatabase[usAnimSurface].uiNumDirections == 2 ) + { + ubTempDir = gDirectionFrom8to2[this->ubDirection]; + } + + UINT16 cryoframe = 0; + + UINT16 newframe = cryoframe + (UINT16)((gAnimSurfaceDatabase[usAnimSurface].uiNumFramesPerDir * ubTempDir)); + + if ( newframe >= gAnimSurfaceDatabase[usAnimSurface].hVideoObject->usNumberOfObjects ) + { + return 0; + } + + return newframe; +} BOOLEAN SOLDIERTYPE::ConvertAniCodeToAniFrame( UINT16 usAniFrame ) { @@ -7945,11 +8006,11 @@ BOOLEAN SOLDIERTYPE::ConvertAniCodeToAniFrame( UINT16 usAniFrame ) { ubTempDir = 1; } - if ( this->ubDirection == WEST ) + else if ( this->ubDirection == WEST ) { ubTempDir = 0; } - if ( this->ubDirection == EAST ) + else if ( this->ubDirection == EAST ) { ubTempDir = 2; } @@ -18477,7 +18538,7 @@ void SOLDIERTYPE::PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc ) { if ( fShowExactPoints ) { - swprintf( atStr, L"\n\n%s (undiagnosed) - %d / %d\n", Disease[i].szFatName, this->sDiseasePoints[i], Disease[i].sInfectionPtsFull ); + swprintf( atStr, L"\n\n%s - %d / %d\n", Disease[i].szFatName, this->sDiseasePoints[i], Disease[i].sInfectionPtsFull ); } else { @@ -18592,7 +18653,7 @@ void SOLDIERTYPE::PrintFoodDesc( CHAR16* apStr, BOOLEAN fFullDesc ) // only for living mercs with a profile if ( this->flags.uiStatusFlags & SOLDIER_VEHICLE || this->ubProfile == NO_PROFILE ) return; - + CHAR16 atStr[500]; swprintf( atStr, L"" ); diff --git a/Tactical/Soldier Control.h b/Tactical/Soldier Control.h index 4d09b520..752b64b3 100644 --- a/Tactical/Soldier Control.h +++ b/Tactical/Soldier Control.h @@ -1627,6 +1627,8 @@ public: // Soldier Management functions called by Overhead.c + // Flugente: frozen soldiers do not move. We simulate this by using fixed animation frames, which we determine here + UINT16 CryoAniFrame(); BOOLEAN ConvertAniCodeToAniFrame( UINT16 usAniFrame ); void TurnSoldier( void ); void ChangeSoldierStance( UINT8 ubDesiredStance ); diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 32c48546..11dc07f9 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -9654,7 +9654,7 @@ INT32 BulletImpact( SOLDIERTYPE *pFirer, BULLET *pBullet, SOLDIERTYPE * pTarget, } // Flugente: if this is cryo ammo, freeze target. - if ( !TANK( pTarget ) && AmmoTypes[ubAmmoType].ammoflag & AMMO_CRYO ) + if ( !TANK( pTarget ) && !(pTarget->flags.uiStatusFlags & SOLDIER_VEHICLE) && AmmoTypes[ubAmmoType].ammoflag & AMMO_CRYO ) { pTarget->usSkillCooldown[SOLDIER_COOLDOWN_CRYO] += 2; diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index d83f100c..f90bf383 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -1834,7 +1834,7 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT // Flugente: frozen soldiers don't move if ( pSoldier->usSkillCooldown[SOLDIER_COOLDOWN_CRYO] && pSoldier->stats.bLife > 0 ) { - usImageIndex = 0; + usImageIndex = pSoldier->CryoAniFrame( ); } uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED| BGND_FLAG_MERC;