New feature: delayed grenade explosions:

- use transformation menu to change explosion mode
- only Normal/Stun/Flashbang type grenades can be delayed
- AI soldiers will avoid staying close to armed grenades\explosives
- use option DELAYED_GRENADE_EXPLOSION to make all hand\GL grenades work as delayed
- new value AP_GRENADE_MODE = 4 in APBPConstants.ini
- new item flag DELAYED_GRENADE_EXPLOSION

Other changes:
- fixed call to sqrt in DrawExplosionWarning() that prevented compiling in VS2010
- correctly update interface after transformations
- PATHAI: AI soldiers will skip gassed tiles if not in gas already
- InGas check: AI soldiers will avoid mustard gas even when wearing gas mask
- Yellow AI: added check to avoid gas/water/bomb using FindNearestUngassedLand
- gas/flare grenades will always explode instantly even when in bad state
- LegalNPCDestination: locations near armed bombs are not legal
- FindBestNearbyCover: avoid locations near armed bombs

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8324 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2016-10-18 12:39:06 +00:00
parent 926b9d9e5c
commit e9a1f4b352
23 changed files with 365 additions and 87 deletions
+19 -5
View File
@@ -1084,7 +1084,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: get out of water and gas"));
if (bInWater || bInGas)
if (bInWater || bInGas || FindBombNearby(pSoldier, pSoldier->sGridNo, DAY_VISION_RANGE/8))
{
pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier);
@@ -1543,11 +1543,11 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
BOOLEAN fReachable;
#ifdef DEBUGDECISIONS
STR16 tempstr;
#endif
#endif
// Flugente: to prevent an accidental call
if ( pSoldier->IsZombie() )
return( ZombieDecideActionYellow(pSoldier) );
return( ZombieDecideActionYellow(pSoldier) );
if (fCivilian || (gGameExternalOptions.fAllNamedNpcsDecideAction && pSoldier->ubProfile != NO_PROFILE))
{
@@ -1602,6 +1602,20 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
}
}
////////////////////////////////////////////////////////////////////////////
// WHEN IN GAS, GO TO NEAREST REACHABLE SPOT OF UNGASSED LAND
////////////////////////////////////////////////////////////////////////////
if ( InGas(pSoldier, pSoldier->sGridNo) || DeepWater( pSoldier->sGridNo, pSoldier->pathing.bLevel ) || FindBombNearby(pSoldier, pSoldier->sGridNo, DAY_VISION_RANGE/8) )
{
pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier);
if (!TileIsOutOfBounds(pSoldier->aiData.usActionData))
{
return(AI_ACTION_LEAVE_WATER_GAS);
}
}
// determine the most important noise heard, and its relative value
sNoiseGridNo = MostImportantNoiseHeard(pSoldier,&iNoiseValue, &fClimb, &fReachable);
//NumMessage("iNoiseValue = ",iNoiseValue);
@@ -2537,7 +2551,7 @@ INT8 DecideActionRed(SOLDIERTYPE *pSoldier, UINT8 ubUnconsciousOK)
// WHEN IN GAS, GO TO NEAREST REACHABLE SPOT OF UNGASSED LAND
////////////////////////////////////////////////////////////////////////////
if (bInGas && ubCanMove)
if (ubCanMove && (bInGas || FindBombNearby(pSoldier, pSoldier->sGridNo, DAY_VISION_RANGE/8)))
{
pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier);
@@ -4712,7 +4726,7 @@ INT16 ubMinAPCost;
////////////////////////////////////////////////////////////////////////////
// if soldier in water/gas has enough APs left to move at least 1 square
if ( ( bInDeepWater || bInGas ) && ubCanMove)
if ( ( bInDeepWater || bInGas || FindBombNearby(pSoldier, pSoldier->sGridNo, DAY_VISION_RANGE/8) ) && ubCanMove)
{
pSoldier->aiData.usActionData = FindNearestUngassedLand(pSoldier);