Bright future is here, introduced turning AP costs into pathing AP prediction. Full changelog:

- fixed camera action AP cost shown and made soldier to turn towards target
- fixed handcuffs, jar and can actions AP cost shown calculating pathing cost twice and not calculating stance change at all
- fixed refueling and repairing pathing leading to inside vehicle
- fixed endless clock issue when trying to refuel from spot next to vehicle
- fixed endless clock issue when trying to repair vehicle/SAM site during combat
- fixed refuel, repair and jar actions not costing any AP in turn based mode
- fixed multiple actions not calculating and substracting AP cost for turning
- fixed using toolkit asking whether player wants to attack ally
- fixed issue where the required AP cost for melee attack was not recalculated when changing movement mode
- allowed to start repairs on robot manually from tactical mode
still a problem:
- repairing during combat still does nothing as soldiers cannot go into assignment while there are enemies on map
- we need new function to return action gridno for actions on vehicles, FindAdjacentGridEx is not working very well
- soldiers doesn't turn during interactive actions

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9033 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Shadooow
2021-05-20 11:42:57 +00:00
parent a5d13a6ebe
commit 43dfa982a5
13 changed files with 192 additions and 160 deletions
+17 -15
View File
@@ -1049,19 +1049,16 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
if ( EnoughPoints( pSoldier, sAPCost, 0, fFromUI ) )
{
// OK, set UI
SetUIBusy(pSoldier->ubID);
// CHECK IF WE ARE AT THIS GRIDNO NOW
if ( pSoldier->sGridNo != sActionGridNo )
{
// SEND PENDING ACTION
pSoldier->aiData.ubPendingAction = MERC_REPAIR;
pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo;
if ( fVehicle )
{
pSoldier->aiData.sPendingActionData2 = sVehicleGridNo;
}
pSoldier->aiData.bPendingActionData3 = ubDirection;
pSoldier->aiData.sPendingActionData2 = fVehicle ? sVehicleGridNo : sAdjustedGridNo;
pSoldier->aiData.bPendingActionData3 = ubDirection;
pSoldier->aiData.ubPendingActionAnimCount = 0;
// WALK UP TO DEST FIRST
@@ -1069,12 +1066,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
}
else
{
pSoldier->EVENT_SoldierBeginRepair( sAdjustedGridNo, ubDirection );
pSoldier->EVENT_SoldierBeginRepair(fVehicle ? sVehicleGridNo : sAdjustedGridNo, ubDirection );
}
// OK, set UI
SetUIBusy( pSoldier->ubID );
if ( fFromUI )
{
guiPendingOverrideEvent = A_CHANGE_TO_MOVE;
@@ -1131,8 +1125,6 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
{
// SEND PENDING ACTION
pSoldier->aiData.ubPendingAction = MERC_FUEL_VEHICLE;
pSoldier->aiData.sPendingActionData2 = sAdjustedGridNo;
pSoldier->aiData.sPendingActionData2 = sVehicleGridNo;
pSoldier->aiData.bPendingActionData3 = ubDirection;
pSoldier->aiData.ubPendingActionAnimCount = 0;
@@ -1142,7 +1134,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
}
else
{
pSoldier->EVENT_SoldierBeginRefuel( sAdjustedGridNo, ubDirection );
pSoldier->EVENT_SoldierBeginRefuel(sVehicleGridNo, ubDirection );
}
// OK, set UI
@@ -10267,6 +10259,16 @@ void TakePhoto(SOLDIERTYPE* pSoldier, INT32 sGridNo, INT8 bLevel )
INT16 sBaseX, sBaseY;
ConvertGridNoToXY( sGridNo, &sBaseX, &sBaseY );
UINT8 ubDirection = GetDirectionFromGridNo(sGridNo, pSoldier);
// CHANGE DIRECTION AND GOTO ANIMATION NOW
if (pSoldier->ubDirection != ubDirection)
{
pSoldier->flags.uiStatusFlags |= SOLDIER_LOOK_NEXT_TURNSOLDIER;//shadooow: fix for vision not updating
pSoldier->EVENT_SetSoldierDesiredDirection(ubDirection);
pSoldier->EVENT_SetSoldierDirection(ubDirection);
}
int radius = 3;
for ( int x = -radius; x < radius; ++x )