mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
If the player retreats from an enemy attack that was targetted at this sector, the enemy group pursuits instead of being given new orders.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7901 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -503,17 +503,6 @@ void SAIReportError( STR16 wErrorString );
|
||||
#define SAIReportError( a ) //define it out
|
||||
#endif
|
||||
|
||||
enum SAIMOVECODE
|
||||
{
|
||||
DIRECT,
|
||||
EVASIVE,
|
||||
STAGE,
|
||||
};
|
||||
void MoveSAIGroupToSector( GROUP **pGroup, UINT8 ubSectorID, UINT32 uiMoveCode, UINT8 ubIntention );
|
||||
|
||||
|
||||
|
||||
|
||||
/* This is only a dirty fix to prevent CTD:
|
||||
* when loading a game, sometimes I found that
|
||||
* 'gGarrisonGroup' was not allocated.
|
||||
|
||||
@@ -59,6 +59,13 @@ INT16 FindGarrisonIndexForGroupIDPending( UINT8 ubGroupID );
|
||||
|
||||
GROUP* FindPendingGroupInSector( UINT8 ubSectorID );
|
||||
|
||||
enum SAIMOVECODE
|
||||
{
|
||||
DIRECT,
|
||||
EVASIVE,
|
||||
STAGE,
|
||||
};
|
||||
void MoveSAIGroupToSector( GROUP **pGroup, UINT8 ubSectorID, UINT32 uiMoveCode, UINT8 ubIntention );
|
||||
|
||||
void RepollSAIGroup( GROUP *pGroup );
|
||||
|
||||
|
||||
@@ -4758,7 +4758,43 @@ void ResetMovementForNonPlayerGroup( GROUP *pGroup )
|
||||
#ifdef JA2UB
|
||||
//Ja25 No strategic ai
|
||||
#else
|
||||
RepollSAIGroup( pGroup );
|
||||
// Flugente: instead of just running back to their original sector, enemy patrols on pursuit should follow player groups
|
||||
// first, determine whether there are any player groups nearby
|
||||
BOOLEAN sucess = FALSE;
|
||||
GROUP* pOtherGroup = gpGroupList;
|
||||
while ( pOtherGroup )
|
||||
{
|
||||
if ( pOtherGroup->usGroupTeam == OUR_TEAM )
|
||||
{
|
||||
if ( pGroup->ubSectorX == pOtherGroup->ubSectorX && pGroup->ubSectorY == pOtherGroup->ubSectorY )
|
||||
{
|
||||
MoveSAIGroupToSector( &pGroup, (UINT8)SECTOR( pOtherGroup->ubNextX, pOtherGroup->ubNextY ), DIRECT, PURSUIT );
|
||||
|
||||
// the group has to be delayed - otherwise they could arrive at the same time as the player, resulting in odd behaviour during insertion
|
||||
DeleteStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->ubGroupID );
|
||||
|
||||
// NOTE: This can cause the arrival time to be > GetWorldTotalMin() + TraverseTime, so keep that in mind
|
||||
// if you have any code that uses these 3 values to figure out how far along its route a group is!
|
||||
SetGroupArrivalTime( pGroup, pOtherGroup->uiArrivalTime + 5 );
|
||||
|
||||
if ( !AddStrategicEvent( EVENT_GROUP_ARRIVAL, pGroup->uiArrivalTime, pGroup->ubGroupID ) )
|
||||
{
|
||||
AssertMsg( 0, "Failed to add movement event." );
|
||||
break;
|
||||
}
|
||||
|
||||
sucess = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
pOtherGroup = pOtherGroup->next;
|
||||
}
|
||||
|
||||
if ( !sucess )
|
||||
{
|
||||
RepollSAIGroup( pGroup );
|
||||
}
|
||||
#endif
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user