mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Further refinement of new ModularizedTacticalAI architecture; added plans for Crows
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6017 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -5766,163 +5766,6 @@ INT16 ubMinAPCost;
|
||||
|
||||
}
|
||||
|
||||
INT8 DecideAction(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideAction");
|
||||
INT8 bAction=AI_ACTION_NONE;
|
||||
#ifdef DEBUGDECISIONS
|
||||
STR16 tempstr;
|
||||
#endif
|
||||
|
||||
#ifdef AI_TIMING_TESTS
|
||||
UINT32 uiStartTime, uiEndTime;
|
||||
#endif
|
||||
|
||||
if ( pSoldier->bTeam != MILITIA_TEAM )
|
||||
{
|
||||
if ( !sniperwarning && pSoldier->aiData.bOrders == SNIPER )
|
||||
{
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, New113Message[MSG113_WATHCHOUTFORSNIPERS] );
|
||||
sniperwarning = TRUE;
|
||||
}
|
||||
|
||||
if (!biggunwarning && FindRocketLauncherOrCannon(pSoldier) != NO_SLOT )
|
||||
{
|
||||
biggunwarning = TRUE;
|
||||
//TODO: don't say this again after reloading a savegame
|
||||
SayQuoteFromAnyBodyInSector( QUOTE_WEARY_SLASH_SUSPUCIOUS );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// turn off cautious flag
|
||||
pSoldier->aiData.fAIFlags &= (~AI_CAUTIOUS);
|
||||
//reset flank count
|
||||
|
||||
//NumMessage("DecideAction - Guy#",pSoldier->ubID);
|
||||
|
||||
// if the NPC is being "ESCORTED" (seen civilians only for now)
|
||||
if (pSoldier->aiData.bUnderEscort)
|
||||
{
|
||||
#ifdef DEBUGDECISIONS
|
||||
AIPopMessage("AlertStatus = ESCORT");
|
||||
#endif
|
||||
|
||||
//bAction = DecideActionEscort(pSoldier);
|
||||
}
|
||||
else // "normal" NPC AI
|
||||
{
|
||||
// if status over-ride is set, bypass RED/YELLOW and go directly to GREEN!
|
||||
if ((pSoldier->aiData.bBypassToGreen) && (pSoldier->aiData.bAlertStatus < STATUS_BLACK))
|
||||
{
|
||||
bAction = DecideActionGreen(pSoldier);
|
||||
if ( !gfTurnBasedAI )
|
||||
{
|
||||
// reset bypass now
|
||||
pSoldier->aiData.bBypassToGreen = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (pSoldier->aiData.bAlertStatus)
|
||||
{
|
||||
case STATUS_GREEN:
|
||||
#ifdef DEBUGDECISIONS
|
||||
AIPopMessage("AlertStatus = GREEN");
|
||||
#endif
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiStartTime = GetJA2Clock();
|
||||
#endif
|
||||
bAction = DecideActionGreen(pSoldier);
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiEndTime = GetJA2Clock();
|
||||
guiGreenTimeTotal += (uiEndTime - uiStartTime);
|
||||
guiGreenCounter++;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case STATUS_YELLOW:
|
||||
#ifdef DEBUGDECISIONS
|
||||
AIPopMessage("AlertStatus = YELLOW");
|
||||
#endif
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiStartTime = GetJA2Clock();
|
||||
#endif
|
||||
bAction = DecideActionYellow(pSoldier);
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiEndTime = GetJA2Clock();
|
||||
guiYellowTimeTotal += (uiEndTime - uiStartTime);
|
||||
guiYellowCounter++;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case STATUS_RED:
|
||||
#ifdef DEBUGDECISIONS
|
||||
AIPopMessage("AlertStatus = RED");
|
||||
#endif
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiStartTime = GetJA2Clock();
|
||||
#endif
|
||||
bAction = DecideActionRed(pSoldier,TRUE);
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiEndTime = GetJA2Clock();
|
||||
guiRedTimeTotal += (uiEndTime - uiStartTime);
|
||||
guiRedCounter++;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case STATUS_BLACK:
|
||||
#ifdef DEBUGDECISIONS
|
||||
AIPopMessage("AlertStatus = BLACK");
|
||||
#endif
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiStartTime = GetJA2Clock();
|
||||
#endif
|
||||
bAction = DecideActionBlack(pSoldier);
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("DecideActionBlack=%d",bAction));
|
||||
#ifdef AI_TIMING_TESTS
|
||||
uiEndTime = GetJA2Clock();
|
||||
guiBlackTimeTotal += (uiEndTime - uiStartTime);
|
||||
guiBlackCounter++;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUGDECISIONS
|
||||
sprintf( tempstr,"DecideAction: selected action %d, actionData %d\n\n",bAction,pSoldier->aiData.usActionData);
|
||||
DebugAI( tempstr );
|
||||
#endif
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideAction done");
|
||||
|
||||
return(bAction);
|
||||
}
|
||||
|
||||
INT8 DecideActionEscort(SOLDIERTYPE *pSoldier)
|
||||
{
|
||||
#ifdef DEBUGDECISIONS
|
||||
STR16 tempstr;
|
||||
#endif
|
||||
|
||||
// if he has a place to go, and isn't already there... go!
|
||||
if (!TileIsOutOfBounds(pSoldier->aiData.usActionData) && (pSoldier->sGridNo != pSoldier->aiData.usActionData))
|
||||
{
|
||||
#ifdef DEBUGDECISIONS
|
||||
sprintf(tempstr,"%s - ESCORTED NPC GOING to grid %d",pSoldier->name,pSoldier->aiData.usActionData);
|
||||
AIPopMessage(tempstr);
|
||||
#endif
|
||||
|
||||
return(AI_ACTION_ESCORTED_MOVE);
|
||||
}
|
||||
else
|
||||
return(AI_ACTION_NONE);
|
||||
}
|
||||
|
||||
|
||||
void DecideAlertStatus( SOLDIERTYPE *pSoldier )
|
||||
{
|
||||
#ifdef DEBUGDECISIONS
|
||||
|
||||
Reference in New Issue
Block a user