- Exhumed: Avoid playing the same pickup sound while another copy of it is already active.

The pickup code here is not robust enough to play the sound only once per pickup.
This commit is contained in:
Christoph Oelckers 2022-01-15 16:11:42 +01:00
parent 4ee64df844
commit b1d3e8ee54
2 changed files with 2 additions and 1 deletions

View file

@ -751,7 +751,7 @@ void SetTorch(int nPlayer, int bTorchOnOff)
}
if (bTorch) {
PlayLocalSound(StaticSound[kSoundTorchOn], 0);
PlayLocalSound(StaticSound[kSoundTorchOn], 0, CHANF_UI);
}
const char* buf = bTorch ? "TXT_EX_TORCHLIT" : "TXT_EX_TORCHOUT";

View file

@ -294,6 +294,7 @@ void PlayLocalSound(int nSound, int nRate, bool unattached, EChanFlags cflags)
FSoundChan* chan;
if (!unattached)
{
if (!(cflags & CHANF_UI) && soundEngine->IsSourcePlayingSomething(SOURCE_None, nullptr, CHAN_BODY, nSound + 1)) return;
soundEngine->StopSound(SOURCE_None, nullptr, CHAN_BODY);
chan = soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_BODY, cflags, nSound + 1, 1.f, ATTN_NONE, nullptr);
}