mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
New option AI_DECISION_INFO enables extended logging for AI decisions.
Moved zombie AI into separate file ZombieDecideAction.cpp New zombie AI: - simplified code - advancing using cover - if zombie cannot reach any opponent, he tries to hide - if zombie cannot reach opponent and cannot hide and he is under fire, he will retreat, seeking cover away from known opponents - if zombie doesn't know enemy location, he will try to run to closest friend who knows enemy location - new zombie AI has extended AI logging More water splash sounds (Data\Sounds\Misc\Splash1.ogg .. SplashN.ogg). CalcCoverValue: - allow moving into shallow water if it provides better position - special calculations for zombies: zombie is very dangerous at close range - if soldier has no gun, use different calculation based on distance instead of CTGT FindBestNearbyCover: zombies only choose spots that provide sight cover. Added functions for extended AI log. ClosestReachableDisturbance: - if soldier is zombie and he cannot climb, skip location - zombies do not attack vehicles - improved check to avoid choosing dying opponents EstimatePathCostToLocation: return 0 if checking for zombie which cannot climb and path needs climbing. RoamingRange: always max roaming range for zombies. SightCoverAtSpot, ProneSightCoverAtSpot: - improved max sight range calculation - added option for unlimited sight range check New AI functions: - AIDirection - AICheckIsSniper - AICheckIsMarksman - AICheckIsMedic - AICheckIsMortarOperator - AICheckIsGLOperator - AICheckIsOfficer - AICheckIsCommander - AICheckIsMachinegunner - AIGunInHandScoped - AIGunScoped - AIGunRange - AIGunClass - AIGunType - AIGunDeadliness - AIGunAmmo - AIGunAutofireCapable - FindObstacleNearSpot - InSmoke - CorpseWarning - CorpseEnemyTeam - CorpseMilitiaTeam - AICheckUnderground - AnyCoverAtSpot - AICheckHasWeaponOfType - AICheckHasGun - AICheckShortWeaponRange GetCorpseAtGridNo: additional check for valid gridno. More zombie raise sounds (Data\Sounds\Misc\ZombieRaise1.ogg .. ZombieRaiseN.ogg). GetCorpseRotFactor: improved code to return FLOAT value between 0 and 1. New debug topic id TOPIC_DECISIONS for logging AI decisions. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8760 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
#include "Campaign Types.h"
|
||||
#include "Tactical Save.h"
|
||||
#include "strategicmap.h"
|
||||
// sevenfm
|
||||
#include "environment.h"
|
||||
#include "Render Fun.h"
|
||||
#endif
|
||||
|
||||
#include "SaveLoadGame.h"
|
||||
@@ -1188,6 +1191,34 @@ BOOL GetRandomSignalSmokeGridNo(INT32* psGridNo)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// sevenfm: check smoke effect of certain type at gridno
|
||||
BOOLEAN CheckSmokeEffect(INT32 sGridNo, INT8 bLevel, INT8 bType)
|
||||
{
|
||||
UINT32 uiCnt;
|
||||
INT8 bSmokeEffectLevel;
|
||||
|
||||
//loop through all smoke effects
|
||||
for (uiCnt = 0; uiCnt < guiNumSmokeEffects; uiCnt++)
|
||||
{
|
||||
if (gSmokeEffectData[uiCnt].fAllocated &&
|
||||
gSmokeEffectData[uiCnt].sGridNo == sGridNo &&
|
||||
gSmokeEffectData[uiCnt].bType == bType)
|
||||
{
|
||||
if (gSmokeEffectData[uiCnt].bFlags & SMOKE_EFFECT_ON_ROOF)
|
||||
bSmokeEffectLevel = 1;
|
||||
else
|
||||
bSmokeEffectLevel = 0;
|
||||
|
||||
if (bSmokeEffectLevel == bLevel)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOLEAN FindVisibleSmokeEffect(INT8 bType)
|
||||
{
|
||||
UINT32 uiCnt;
|
||||
|
||||
@@ -71,6 +71,8 @@ void UpdateSmokeEffectGraphics( );
|
||||
// Flugente: get the gridno and blevel of a random smoke signal, if one exists
|
||||
BOOL GetRandomSignalSmokeGridNo(INT32* psGridNo);
|
||||
|
||||
// sevenfm: check if smoke effect of certain type is present at gridno
|
||||
BOOLEAN CheckSmokeEffect(INT32 sGridNo, INT8 bLevel, INT8 bType);
|
||||
// find smoke effect on visible screen
|
||||
BOOLEAN FindVisibleSmokeEffect(INT8 bType);
|
||||
|
||||
|
||||
+20
-3
@@ -793,6 +793,7 @@ void PhysicsDeleteObject( REAL_OBJECT *pObject )
|
||||
}
|
||||
}
|
||||
|
||||
INT16 gsWaterSplashSoundNum = -1;
|
||||
|
||||
BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID )
|
||||
{
|
||||
@@ -1113,9 +1114,25 @@ BOOLEAN PhysicsCheckForCollisions( REAL_OBJECT *pObject, INT32 *piCollisionID )
|
||||
|
||||
// sevenfm: also play sound
|
||||
CHAR8 zFilename[512];
|
||||
sprintf(zFilename, "sounds\\misc\\Splash%d.ogg", Random(3) + 1);
|
||||
if (FileExists(zFilename))
|
||||
PlayJA2SampleFromFile(zFilename, RATE_11025, SoundVolume(MIDVOLUME, pObject->sGridNo), 1, SoundDir(pObject->sGridNo));
|
||||
// prepare water splash sound
|
||||
if (gsWaterSplashSoundNum < 0)
|
||||
{
|
||||
gsWaterSplashSoundNum = 0;
|
||||
do
|
||||
{
|
||||
gsWaterSplashSoundNum++;
|
||||
sprintf(zFilename, "sounds\\misc\\Splash%d.ogg", gsWaterSplashSoundNum);
|
||||
} while (FileExists(zFilename));
|
||||
gsWaterSplashSoundNum--;
|
||||
}
|
||||
if (gsWaterSplashSoundNum > 0)
|
||||
{
|
||||
sprintf(zFilename, "sounds\\misc\\Splash%d.ogg", Random(gsWaterSplashSoundNum) + 1);
|
||||
if (FileExists(zFilename))
|
||||
{
|
||||
PlayJA2SampleFromFile(zFilename, RATE_11025, SoundVolume(MIDVOLUME, pObject->sGridNo), 1, SoundDir(pObject->sGridNo));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user