diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 54cd0bb11..e34f8e505 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -2092,6 +2092,8 @@ static void GameMove(void) bobangle &= kAngleMask; } + UpdateCreepySounds(); + // loc_120E9: totalmoves++; moveframes--; diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index a96bf640f..098eb2de0 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -345,7 +345,7 @@ void InitFX(void) nTotalSoundBytes = 0; nSoundCount = 0; - nCreepyTimer = 450; + nCreepyTimer = kCreepyCount; #if 0 int status = FX_Init(FXDevice, NumVoices, NumChannels, NumBits, MixRate); @@ -817,29 +817,32 @@ void UpdateSounds() } } } +} - if (!nFreeze && levelnum != 20) +void UpdateCreepySounds() +{ + if (levelnum == 20) + return; + spritetype *pSprite = &sprite[PlayerList[nLocalPlayer].nSprite]; + nCreepyTimer--; + if (nCreepyTimer <= 0) { - nCreepyTimer--; - if (nCreepyTimer <= 0) + if (nCreaturesLeft > 0 && !(SectFlag[nPlayerViewSect[nLocalPlayer]]&0x2000)) { - if (nCreaturesLeft > 0 && !(SectFlag[nPlayerViewSect[nLocalPlayer]]&0x2000)) + int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves%SeqSize[SeqOffsets[kSeqCreepy]]); + if (vsi >= 0 && (vsi&0x1ff) < kMaxSounds) { - int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves%SeqSize[SeqOffsets[kSeqCreepy]]); - if (vsi >= 0 && (vsi&0x1ff) < kMaxSounds) - { - int vdx = (totalmoves+32)&31; - if (totalmoves & 1) - vdx = -vdx; - int vax = (totalmoves+32)&63; - if (totalmoves & 2) - vax = -vax; + int vdx = (totalmoves+32)&31; + if (totalmoves & 1) + vdx = -vdx; + int vax = (totalmoves+32)&63; + if (totalmoves & 2) + vax = -vax; - PlayFXAtXYZ(vsi, pSprite->x+vdx, pSprite->y+vax, pSprite->z, pSprite->sectnum); - } + PlayFXAtXYZ(vsi, pSprite->x+vdx, pSprite->y+vax, pSprite->z, pSprite->sectnum); } - nCreepyTimer = 450; } + nCreepyTimer = kCreepyCount; } } @@ -1153,7 +1156,7 @@ short PlayFX2(unsigned short nSound, short nSprite) // Nuke: added nSprite >= 0 check if (nSprite != nLocalSpr && nSprite >= 0 && (sprite[nSprite].cstat&257)) - nCreepyTimer = 450; + nCreepyTimer = kCreepyCount; return v14; } diff --git a/source/exhumed/src/sound.h b/source/exhumed/src/sound.h index 0ce3faaab..4c69dc779 100644 --- a/source/exhumed/src/sound.h +++ b/source/exhumed/src/sound.h @@ -7,6 +7,8 @@ #define kMaxSoundNameLen 8 #define kMaxActiveSounds 8 +#define kCreepyCount 150 + enum { kSound0 = 0, kSound1, @@ -91,6 +93,7 @@ extern short StaticSound[]; void UpdateSounds(); +void UpdateCreepySounds(); void InitFX(); void UnInitFX(); diff --git a/source/exhumed/src/view.cpp b/source/exhumed/src/view.cpp index 082ef8d1f..e5fa5e7cf 100644 --- a/source/exhumed/src/view.cpp +++ b/source/exhumed/src/view.cpp @@ -213,7 +213,7 @@ static void analyzesprites() { spritetype *pTarget = &sprite[besttarget]; - nCreepyTimer = 450; + nCreepyTimer = kCreepyCount; if (!cansee(x, y, z, nSector, pTarget->x, pTarget->y, pTarget->z - GetSpriteHeight(besttarget), pTarget->sectnum)) {