mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
- New Feature: The rosine system now allows to capture enemy soldeirs via using handcuffs on them. They can e transferred to a prison the player controls, and be interrogated there.
- GameDir revision 1568 is required for this feature. - Savegame compatibility is maintained. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5709 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1789,7 +1789,12 @@ void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Flugente: pows don't do anything
|
||||
if ( pSoldier->bSoldierFlagMask & SOLDIER_POW )
|
||||
{
|
||||
EndAIGuysTurn( pSoldier);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pSoldier->aiData.bAction != AI_ACTION_NONE) && pSoldier->aiData.bActionInProgress)
|
||||
{
|
||||
|
||||
@@ -2971,3 +2971,48 @@ INT32 CalcStraightThreatValue( SOLDIERTYPE *pEnemy )
|
||||
|
||||
return(iThreatValue);
|
||||
}
|
||||
|
||||
// Flugente: get the id of the closest soldier with a specific flag that we can currently see
|
||||
UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag )
|
||||
{
|
||||
UINT8 id = NOBODY;
|
||||
|
||||
UINT32 uiLoop;
|
||||
BOOLEAN fRangeRestricted = FALSE, fFound = FALSE;
|
||||
SOLDIERTYPE * pFriend;
|
||||
INT16 range = aRange;
|
||||
|
||||
// go through each soldier, looking for "friends" (soldiers on same side)
|
||||
for (uiLoop = 0; uiLoop < guiNumMercSlots; ++uiLoop)
|
||||
{
|
||||
pFriend = MercSlots[ uiLoop ];
|
||||
|
||||
// if this merc is inactive, not in sector, or dead
|
||||
if (!pFriend)
|
||||
continue;
|
||||
|
||||
if ( auTeam != pFriend->bTeam )
|
||||
continue;
|
||||
|
||||
// check for flag
|
||||
if ( !(pFriend->bSoldierFlagMask & aFlag) )
|
||||
continue;
|
||||
|
||||
// skip ourselves
|
||||
if (pFriend->ubID == pSoldier->ubID)
|
||||
continue;
|
||||
|
||||
// if we're not already neighbors
|
||||
if (SpacesAway(pSoldier->sGridNo, pFriend->sGridNo) < range)
|
||||
{
|
||||
// can we see this guy?
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pFriend->sGridNo, pSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) )
|
||||
{
|
||||
range = SpacesAway(pSoldier->sGridNo,pFriend->sGridNo);
|
||||
id = pFriend->ubID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
+38
-21
@@ -869,32 +869,42 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
|
||||
//ddd{
|
||||
if(gGameExternalOptions.bNewTacticalAIBehavior
|
||||
&& !( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||
&& pSoldier->bTeam == ENEMY_TEAM)
|
||||
if(gGameExternalOptions.bNewTacticalAIBehavior && pSoldier->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
|
||||
INT32 cnt;
|
||||
ROTTING_CORPSE * pCorpse;
|
||||
|
||||
for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ )
|
||||
if ( !(gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
|
||||
{
|
||||
pCorpse = &(gRottingCorpse[ cnt ] );
|
||||
|
||||
INT32 cnt;
|
||||
ROTTING_CORPSE * pCorpse;
|
||||
|
||||
for ( cnt = 0; cnt < giNumRottingCorpse; cnt++ )
|
||||
{
|
||||
pCorpse = &(gRottingCorpse[ cnt ] );
|
||||
|
||||
if ( pCorpse->fActivated && pCorpse->def.ubAIWarningValue > 0 )
|
||||
if ( PythSpacesAway( pSoldier->sGridNo, pCorpse->def.sGridNo ) <= 5 )//ïðèäåëàòü ñðàâíåíèå ïåðåìåííî äàëüíîñòè âèäåíèÿ (smaxvid ?)
|
||||
{
|
||||
//ïðîâåðèòü, íàõîäèòñÿ ëè òðóï â ïîëå çðåíèÿ äðàíèêà.ìåíòà?
|
||||
//CHRISL: Shouldn't we be using the corpse's bLevel? Otherwise a soldier inside a building can see a corpse on the roof of that building
|
||||
//if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) )
|
||||
if ( pCorpse->fActivated && pCorpse->def.ubAIWarningValue > 0 )
|
||||
if ( PythSpacesAway( pSoldier->sGridNo, pCorpse->def.sGridNo ) <= 5 )//ïðèäåëàòü ñðàâíåíèå ïåðåìåííî äàëüíîñòè âèäåíèÿ (smaxvid ?)
|
||||
{
|
||||
ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, New113Message[MSG113_ENEMY_FOUND_DEAD_BODY]);
|
||||
//pCorpse->def.ubAIWarningValue=0;
|
||||
gRottingCorpse[ cnt ].def.ubAIWarningValue=0;
|
||||
return( AI_ACTION_RED_ALERT );
|
||||
//ïðîâåðèòü, íàõîäèòñÿ ëè òðóï â ïîëå çðåíèÿ äðàíèêà.ìåíòà?
|
||||
//CHRISL: Shouldn't we be using the corpse's bLevel? Otherwise a soldier inside a building can see a corpse on the roof of that building
|
||||
//if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pSoldier->pathing.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) )
|
||||
if ( SoldierTo3DLocationLineOfSightTest( pSoldier, pCorpse->def.sGridNo, pCorpse->def.bLevel, 3, TRUE, CALC_FROM_WANTED_DIR ) )
|
||||
{
|
||||
ScreenMsg( MSG_FONT_YELLOW, MSG_INTERFACE, New113Message[MSG113_ENEMY_FOUND_DEAD_BODY]);
|
||||
//pCorpse->def.ubAIWarningValue=0;
|
||||
gRottingCorpse[ cnt ].def.ubAIWarningValue=0;
|
||||
return( AI_ACTION_RED_ALERT );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: if we see one of our buddies in handcuffs, its a clear sign of enemy activity!
|
||||
if ( pSoldier->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 10, ENEMY_TEAM, SOLDIER_POW );
|
||||
|
||||
if ( ubPerson != NOBODY )
|
||||
return( AI_ACTION_RED_ALERT );
|
||||
}
|
||||
}
|
||||
//ddd}
|
||||
@@ -1462,7 +1472,14 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
return(AI_ACTION_NONE);
|
||||
}
|
||||
|
||||
// Flugente: if we see one of our buddies in handcuffs, its a clear sign of enemy activity!
|
||||
if ( pSoldier->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 10, ENEMY_TEAM, SOLDIER_POW );
|
||||
|
||||
if ( ubPerson != NOBODY )
|
||||
return( AI_ACTION_RED_ALERT );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// LOOK AROUND TOWARD NOISE: determine %chance for man to turn towards noise
|
||||
|
||||
@@ -132,8 +132,12 @@ void RTHandleAI( SOLDIERTYPE * pSoldier )
|
||||
#endif
|
||||
// let it continue
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flugente: prisoners of war don't do anything
|
||||
if ( pSoldier->bSoldierFlagMask & SOLDIER_POW )
|
||||
return;
|
||||
|
||||
// if man has nothing to do
|
||||
if (pSoldier->aiData.bAction == AI_ACTION_NONE)
|
||||
|
||||
@@ -256,4 +256,7 @@ INT8 CalcBestCTGT( SOLDIERTYPE *pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8
|
||||
INT8 CalcAverageCTGTForPosition( SOLDIERTYPE * pSoldier, UINT8 ubOppID, INT32 sOppGridNo, INT8 bLevel, INT32 iMyAPsLeft );
|
||||
UINT8 NumberOfTeamMatesAdjacent( SOLDIERTYPE * pSoldier, INT32 sGridNo );
|
||||
|
||||
// Flugente: get the id of the closest soldier (coser than x tiles) of a specific team with a specific flag that we can currently see
|
||||
UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTeam, UINT32 aFlag );
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user