From 8d2bcae65af1c9bc815b24bfbb5b5a17c260e597 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Tue, 12 Mar 2024 03:36:42 +1000 Subject: [PATCH] Underwater sound filter: an optimisation from terencehill Signed-off-by: bones_was_here --- snd_mix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snd_mix.c b/snd_mix.c index 9d5c2e54..d8ea1dbe 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -344,7 +344,7 @@ void S_SetUnderwaterIntensity(void) underwater.intensity = max(underwater.intensity, target); } - underwater.alpha = exp(-underwater.intensity * log(12.f)); + underwater.alpha = underwater.intensity ? exp(-underwater.intensity * log(12.f)) : 1.f; } static void S_UnderwaterFilter(int endtime) -- 2.39.2