From dfc2cd8580c59e486cf72d84c146d5ab7df8415c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 22 Nov 2020 18:16:08 +0100 Subject: [PATCH] - make sure that all of SW's sound function check SoundEnabled(). Fixes #192 --- source/sw/src/sounds.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/sw/src/sounds.cpp b/source/sw/src/sounds.cpp index 5b9ef013d..ab9eb8b2b 100644 --- a/source/sw/src/sounds.cpp +++ b/source/sw/src/sounds.cpp @@ -300,6 +300,8 @@ void StartAmbientSound(void) static void RestartAmbient(AmbientSound* amb) { + if (!SoundEnabled()) return; + auto& vp = voc[amb->vocIndex]; auto rolloff = GetRolloff(vp.voc_distance); int pitch = 0; @@ -368,6 +370,8 @@ static void DoTimedSound(AmbientSound* amb) static void UpdateAmbients() { + if (!SoundEnabled()) return; + for (auto& amb : ambients) { auto sp = amb->sp; @@ -807,7 +811,7 @@ int _PlayerSound(int num, PLAYERp pp) return 0; } - if (num < 0 || num >= DIGI_MAX || !soundEngine->isValidSoundId(num)) + if (num < 0 || num >= DIGI_MAX || !soundEngine->isValidSoundId(num) || !SoundEnabled()) return 0; if (TEST(pp->Flags, PF_DEAD)) return 0; // You're dead, no talking!