mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
fixes for running over water
- merc will continue running after he walks out of last water tile - fixed both pathing prediction AP cost calculation and an actual AP cost deduction when running into water and out of water git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9068 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -4558,6 +4558,8 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl
|
|||||||
iLastGrid = giPathDataSize;
|
iLastGrid = giPathDataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INT16 usMovementModeBefore = pSold->usAnimState;
|
||||||
|
|
||||||
for ( iCnt=0; iCnt < iLastGrid; iCnt++ )
|
for ( iCnt=0; iCnt < iLastGrid; iCnt++ )
|
||||||
{
|
{
|
||||||
sExtraCostStand = 0;
|
sExtraCostStand = 0;
|
||||||
@@ -4586,6 +4588,13 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl
|
|||||||
usMovementModeToUseForAPs = WALKING;
|
usMovementModeToUseForAPs = WALKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//shadooow: moved inside loop because it can happen we (re)start running after we walked in water
|
||||||
|
if (sSwitchValue != TRAVELCOST_FENCE && usMovementModeToUseForAPs == RUNNING && usMovementModeBefore != RUNNING)
|
||||||
|
{
|
||||||
|
sPoints += GetAPsStartRun(pSold);
|
||||||
|
}
|
||||||
|
usMovementModeBefore = usMovementModeToUseForAPs;
|
||||||
|
|
||||||
// get the tile cost for that tile based on WALKING
|
// get the tile cost for that tile based on WALKING
|
||||||
sTileCost = TerrainActionPoints( pSold, sTempGrid, (INT8)guiPathingData[iCnt], pSold->pathing.bLevel );
|
sTileCost = TerrainActionPoints( pSold, sTempGrid, (INT8)guiPathingData[iCnt], pSold->pathing.bLevel );
|
||||||
|
|
||||||
|
|||||||
+15
-1
@@ -542,6 +542,19 @@ INT16 ActionPointCost( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bDir, UINT16 u
|
|||||||
sPoints = max(1.0f, ( sPoints * (100 - (FLOAT)gSkillTraitValues.ubATAPsMovementReduction) / 100.0f ) );
|
sPoints = max(1.0f, ( sPoints * (100 - (FLOAT)gSkillTraitValues.ubATAPsMovementReduction) / 100.0f ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usMovementMode == RUNNING && pSoldier->usAnimState != RUNNING)
|
||||||
|
{
|
||||||
|
// CHRISL
|
||||||
|
if ((UsingNewInventorySystem() == true) && FindBackpackOnSoldier(pSoldier) != ITEM_NOT_FOUND)
|
||||||
|
{
|
||||||
|
sPoints += GetAPsStartRun(pSoldier) + 2; // changed by SANDRO
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sPoints += GetAPsStartRun(pSoldier); // changed by SANDRO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Flugente: riot shields lower movement speed
|
// Flugente: riot shields lower movement speed
|
||||||
if ( pSoldier->IsRiotShieldEquipped( ) )
|
if ( pSoldier->IsRiotShieldEquipped( ) )
|
||||||
sPoints *= gItemSettings.fShieldMovementAPCostModifier;
|
sPoints *= gItemSettings.fShieldMovementAPCostModifier;
|
||||||
@@ -2802,11 +2815,12 @@ INT8 MinAPsToStartMovement( SOLDIERTYPE * pSoldier, UINT16 usMovementMode )
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (usMovementMode == RUNNING && pSoldier->usAnimState != RUNNING )
|
if (usMovementMode == RUNNING && pSoldier->usAnimState != RUNNING )
|
||||||
{
|
{
|
||||||
bAPs += GetAPsStartRun( pSoldier ); // changed by SANDRO
|
bAPs += GetAPsStartRun( pSoldier ); // changed by SANDRO
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return( bAPs );
|
return( bAPs );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3919,6 +3919,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
|
|||||||
case RUNNING:
|
case RUNNING:
|
||||||
|
|
||||||
// Only if our previous is not running
|
// Only if our previous is not running
|
||||||
|
/* //shadooow: moved to ActionPointCost
|
||||||
if ( this->usAnimState != RUNNING )
|
if ( this->usAnimState != RUNNING )
|
||||||
{
|
{
|
||||||
// CHRISL
|
// CHRISL
|
||||||
@@ -3931,6 +3932,7 @@ BOOLEAN SOLDIERTYPE::EVENT_InitNewSoldierAnim( UINT16 usNewState, UINT16 usStart
|
|||||||
sAPCost = GetAPsStartRun( this ); // changed by SANDRO
|
sAPCost = GetAPsStartRun( this ); // changed by SANDRO
|
||||||
DeductPoints( this, sAPCost, sBPCost, MOVEMENT_INTERRUPT );
|
DeductPoints( this, sAPCost, sBPCost, MOVEMENT_INTERRUPT );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// Set pending action count to 0
|
// Set pending action count to 0
|
||||||
this->aiData.ubPendingActionAnimCount = 0;
|
this->aiData.ubPendingActionAnimCount = 0;
|
||||||
this->usPendingAnimation = NO_PENDING_ANIMATION;
|
this->usPendingAnimation = NO_PENDING_ANIMATION;
|
||||||
@@ -4873,7 +4875,7 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove )
|
|||||||
|
|
||||||
// OK, check that our animation is up to date!
|
// OK, check that our animation is up to date!
|
||||||
// Check our water value
|
// Check our water value
|
||||||
|
INT16 usUIMovementModeToSet = this->usUIMovementMode;
|
||||||
if ( !(this->flags.uiStatusFlags & (SOLDIER_DRIVER | SOLDIER_PASSENGER)) )
|
if ( !(this->flags.uiStatusFlags & (SOLDIER_DRIVER | SOLDIER_PASSENGER)) )
|
||||||
{
|
{
|
||||||
fInWaterValue = this->MercInWater( );
|
fInWaterValue = this->MercInWater( );
|
||||||
@@ -4881,7 +4883,7 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove )
|
|||||||
// ATE: If ever in water MAKE SURE WE WALK AFTERWOODS!
|
// ATE: If ever in water MAKE SURE WE WALK AFTERWOODS!
|
||||||
if ( fInWaterValue )
|
if ( fInWaterValue )
|
||||||
{
|
{
|
||||||
this->usUIMovementMode = WALKING;
|
usUIMovementModeToSet = WALKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fInWaterValue != this->flags.fPrevInWater )
|
if ( fInWaterValue != this->flags.fPrevInWater )
|
||||||
@@ -4901,7 +4903,7 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove )
|
|||||||
{
|
{
|
||||||
// ATE: Check if we are going from water to land - if so, resume
|
// ATE: Check if we are going from water to land - if so, resume
|
||||||
// with regular movement mode...
|
// with regular movement mode...
|
||||||
this->EVENT_InitNewSoldierAnim( this->usUIMovementMode, 0, FALSE );
|
this->EVENT_InitNewSoldierAnim( usUIMovementModeToSet, 0, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4946,7 +4948,7 @@ void SOLDIERTYPE::SetSoldierGridNo( INT32 sNewGridNo, BOOLEAN fForceRemove )
|
|||||||
// Make transition from low to deep
|
// Make transition from low to deep
|
||||||
this->EVENT_InitNewSoldierAnim( DEEP_TO_LOW_WATER, 0, FALSE );
|
this->EVENT_InitNewSoldierAnim( DEEP_TO_LOW_WATER, 0, FALSE );
|
||||||
this->usDontUpdateNewGridNoOnMoveAnimChange = 1;
|
this->usDontUpdateNewGridNoOnMoveAnimChange = 1;
|
||||||
this->usPendingAnimation = this->usUIMovementMode;
|
this->usPendingAnimation = usUIMovementModeToSet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user