From b8aac91b9eb5fd1a427afb3017cb7da25950516e Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Fri, 23 Apr 2021 06:42:09 +0000 Subject: [PATCH] Fixes (by Shadooow): - fixed AP cost shown at the cursor when pressing ALT during RUN mode since game doesn't allow to "reverse run" and forces walking - shows walking cursor instead of running if ALT is held git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8966 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle UI.cpp | 4 ++-- Tactical/PATHAI.cpp | 39 +++++++++------------------------------ 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 58f51ab1..0c604de2 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -5188,7 +5188,7 @@ void SetMovementModeCursor( SOLDIERTYPE *pSoldier ) break; case RUNNING: - guiNewUICursor = MOVE_RUN_UICURSOR; + guiNewUICursor = gUIUseReverse ? MOVE_WALK_UICURSOR : MOVE_RUN_UICURSOR; break; case SWATTING: @@ -5292,7 +5292,7 @@ void SetConfirmMovementModeCursor( SOLDIERTYPE *pSoldier, BOOLEAN fFromMove ) break; case RUNNING: - guiNewUICursor = CONFIRM_MOVE_RUN_UICURSOR; + guiNewUICursor = gUIUseReverse ? CONFIRM_MOVE_WALK_UICURSOR : CONFIRM_MOVE_RUN_UICURSOR; break; case SWATTING: diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index 112eee68..fedcfade 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -4518,7 +4518,6 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl // For now, use known hight adjustment // sevenfm: ignore person at destination if we are estimating path cost if ( gfRecalculatingExistingPathCost || FindBestPath( pSold, sDestGridNo, pSold->pathing.bLevel, usMovementMode, bCopyRoute, gfEstimatePath ? PATH_IGNORE_PERSON_AT_DEST : 0 ) ) - //if ( gfRecalculatingExistingPathCost || FindBestPath( pSold, sDestGridNo, pSold->pathing.bLevel, usMovementMode, bCopyRoute, 0 ) ) { // if soldier would be STARTING to run then he pays a penalty since it takes time to // run full speed @@ -4528,11 +4527,16 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl sPointsRun = GetAPsStartRun( pSold ); // changed by SANDRO } - // Add to points, those needed to start from different stance! + //shadooow: a little hack to calculate correct AP cost because game doesn't allow to run in reverse and forces walk mode + if (usMovementMode && (pSold->bReverse || bReverse)) + { + usMovementMode = WALKING; + } + + // Add to points, those needed to start from different stance! sPoints = sPoints + MinAPsToStartMovement( pSold, usMovementMode ); - - // We should reduce points for starting to run if first tile is a fence... + // We should reduce points for starting to run if first tile is a fence... sTestGridNo = NewGridNo(pSold->sGridNo, DirectionInc( (UINT8)guiPathingData[0])); // WANNE: Quickfix for wrong pathing data (direction). This fixes crash that could rarly occur @@ -4549,30 +4553,7 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl } } - // FIRST, add up "startup" additional costs - such as intermediate animations, etc. -/* removing warning C4060 (jonathanl) - switch(pSold->usAnimState) - { - //case START_AID : - //case GIVING_AID : sAnimCost = APBPConstants[AP_STOP_FIRST_AID]; - // break; - //case TWISTOMACH : - //case COLLAPSED : sAnimCost = APBPConstants[AP_GET_UP]; - // break; - //case TWISTBACK : - //case UNCONSCIOUS : sAnimCost = (APBPConstants[AP_ROLL_OVER]+APBPConstants[AP_GET_UP]); - // break; - - // case CROUCHING : if (usMovementMode == WALKING || usMovementMode == RUNNING) - // sAnimCost = APBPConstants[AP_CROUCH]; - // break; - } - - - sPoints = sPoints + sAnimCost; - gusAPtsToMove = gusAPtsToMove + sAnimCost;*/ - - if (bStayOn) + if (bStayOn) { iLastGrid = giPathDataSize+1; } @@ -4581,7 +4562,6 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl iLastGrid = giPathDataSize; } - for ( iCnt=0; iCnt < iLastGrid; iCnt++ ) { sExtraCostStand = 0; @@ -4597,7 +4577,6 @@ INT32 PlotPath( SOLDIERTYPE *pSold, INT32 sDestGridNo, INT8 bCopyRoute, INT8 bPl usMovementModeToUseForAPs = usMovementMode; - // WANNE.WATER: If our soldier is not on the ground level and the tile is a "water" tile, then simply set the tile to "FLAT_GROUND" // This should fix "problems" for special modified maps UINT8 ubTerrainID = gpWorldLevelData[ sTempGrid ].ubTerrainID;