Improved door noise sound playing: only play sound if merc opening/closing door is visible on screen or if player team hears noise from door.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9259 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2022-01-16 13:33:11 +00:00
parent 5bb4de2484
commit 94b7d5611d
2 changed files with 24 additions and 10 deletions
+10 -5
View File
@@ -5784,7 +5784,7 @@ void TheirNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType
// else if noiseMaker's NOBODY, no opplist changes or interrupts are possible
}
BOOLEAN gfPlayerMercHeardNoise = FALSE;
void ProcessNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrType, UINT8 ubBaseVolume, UINT8 ubNoiseType, STR16 zNoiseMessage )
{
@@ -6019,6 +6019,15 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrTy
continue;
}
// Can the listener hear noise of that volume given his circumstances?
ubEffVolume = CalcEffVolume(pSoldier, sGridNo, bLevel, ubNoiseType, ubBaseVolume, bCheckTerrain, pSoldier->bOverTerrainType, ubSourceTerrType);
// sevenfm: indicate that player team heard noise
if (bTeam == gbPlayerNum && ubEffVolume > 0)
{
gfPlayerMercHeardNoise = TRUE;
}
// if a the noise maker is a person, not just NOBODY
if (ubNoiseMaker < TOTAL_SOLDIERS)
{
@@ -6147,15 +6156,11 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT32 sGridNo, INT8 bLevel, UINT8 ubTerrTy
pSoldier->ubMiscSoldierFlags |= SOLDIER_MISC_HEARD_GUNSHOT;
}
// Can the listener hear noise of that volume given his circumstances?
ubEffVolume = CalcEffVolume(pSoldier,sGridNo,bLevel,ubNoiseType,ubBaseVolume,bCheckTerrain,pSoldier->bOverTerrainType,ubSourceTerrType);
#ifdef RECORDOPPLIST
fprintf(OpplistFile,"PN: guy %d - effVol=%d,chkTer=%d,pSoldier->tType=%d,srcTType=%d\n",
bLoop,effVolume,bCheckTerrain,pSoldier->terrtype,ubSourceTerrType);
#endif
if (ubEffVolume > 0)
{
// ALL RIGHT! Passed all the tests, this listener hears this noise!!!