From 1bf50d65f48e405b5921efbddab708a0302edddc Mon Sep 17 00:00:00 2001 From: Overhaul Date: Sun, 8 Jul 2007 09:29:15 +0000 Subject: [PATCH] Fixed a pathing issue where a soldier would sometimes jump the wrong fence git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1034 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Soldier Ani.cpp | 12 ++++-------- Tactical/Soldier Control.cpp | 12 +++++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Tactical/Soldier Ani.cpp b/Tactical/Soldier Ani.cpp index 5354f617..d56c045f 100644 --- a/Tactical/Soldier Ani.cpp +++ b/Tactical/Soldier Ani.cpp @@ -626,6 +626,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) // Only in realtime... //if ( !( gTacticalStatus.uiFlags & INCOMBAT ) ) // This has to be here to make guys continue along fence path +#if 0 if ( pSoldier->sGridNo == pSoldier->sFinalDestination ) { if ( gAnimControl[ pSoldier->usAnimState ].ubEndHeight != gAnimControl[ pSoldier->usUIMovementMode ].ubEndHeight ) @@ -637,20 +638,15 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier ) } else { - SoldierGotoStationaryStance( pSoldier ); + //SoldierGotoStationaryStance( pSoldier ); // Set UI Busy UnSetUIBusy( pSoldier->ubID ); - // 0verhaul - // I hate this kludgy stuff. We need to simplify the animation system so that things can be centralized - // and handled properly. - pSoldier->usPathIndex++; - // Kludge done - - return( TRUE ); + //return( TRUE ); } } +#endif break; case 445: diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index ed5d1663..255dab58 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -7029,7 +7029,17 @@ void BeginSoldierClimbFence( SOLDIERTYPE *pSoldier ) { INT8 bDirection; - if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, pSoldier->bDirection, &bDirection ) ) + // Make sure we hop the correct fence to follow our path! + if (pSoldier->usPathIndex < pSoldier->usPathDataSize) + { + bDirection = (INT8) pSoldier->usPathingData[ pSoldier->usPathIndex]; + } + else + { + bDirection = pSoldier->bDirection; + } + + if ( FindFenceJumpDirection( pSoldier, pSoldier->sGridNo, bDirection, &bDirection ) ) { pSoldier->sTempNewGridNo = NewGridNo( (UINT16)pSoldier->sGridNo, (UINT16)DirectionInc(bDirection ) ); pSoldier->fDontChargeTurningAPs = TRUE;