From: bones_was_here Date: Mon, 11 Mar 2024 17:36:42 +0000 (+1000) Subject: Underwater sound filter: an optimisation from terencehill X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=8d2bcae65af1c9bc815b24bfbb5b5a17c260e597 Underwater sound filter: an optimisation from terencehill Signed-off-by: bones_was_here --- 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)