]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Underwater sound filter: an optimisation from terencehill
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 11 Mar 2024 17:36:42 +0000 (03:36 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 11 Mar 2024 17:36:42 +0000 (03:36 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
snd_mix.c

index 9d5c2e54748357bac63074411114388e7d743e6e..d8ea1dbe3764a297ead5aef44712325d5d901ee4 100644 (file)
--- 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)