Split DecideAction into several specialized DecideAction functions

* Removes the need to constantly check for fCivilian, ARMED_VEHICLE, ENEMY_ROBOT etc inside DecideAction
* Move AI decision checks into their own functions, such as DecideActionRadioRedAlert
* Add new entry to ActionType. AI_ACTION_INVALID signals that no valid action was found when a function returns, or no valid action is possible
* Do a weighted random selection for choosing target under DecideActionBlackSoldier
This commit is contained in:
Asdow
2026-01-19 22:50:27 +02:00
parent c3f4ee754a
commit cd054b549f
16 changed files with 12707 additions and 23 deletions
+4 -4
View File
@@ -244,7 +244,7 @@ void PossiblyMakeThisEnemyChosenOne( SOLDIERTYPE * pSoldier )
}
INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove)
ActionType PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove)
{
BOOLEAN fFoundRoute = FALSE;
INT8 bSlot;
@@ -307,7 +307,7 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove)
if (bPanicTrigger == -1)
{
// augh!
return( -1 );
return( AI_ACTION_INVALID );
}
sPanicTriggerGridNo = gTacticalStatus.sPanicTriggerGridNo[ bPanicTrigger ];
@@ -430,7 +430,7 @@ INT8 PanicAI(SOLDIERTYPE *pSoldier, UINT8 ubCanMove)
}
// no action decided
return(-1);
return(AI_ACTION_INVALID);
}
void InitPanicSystem( void )
@@ -534,7 +534,7 @@ BOOLEAN NeedToRadioAboutPanicTrigger( void )
#define STAIRCASE_GRIDNO 12067
#define STAIRCASE_DIRECTION 0
INT8 HeadForTheStairCase( SOLDIERTYPE * pSoldier )
ActionType HeadForTheStairCase( SOLDIERTYPE * pSoldier )
{
UNDERGROUND_SECTORINFO * pBasementInfo;