From 5863f8bb7aea0202e790d3259fa21d8bbb13e29b Mon Sep 17 00:00:00 2001 From: James O'Neill Date: Fri, 8 Mar 2024 18:59:22 +0900 Subject: [PATCH] Try and match formatting to CONTRIBUTING.md guidelines --- snd_mix.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/snd_mix.c b/snd_mix.c index e18bbcecb..6ef41ba51 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -335,21 +335,20 @@ void S_SetUnderwaterIntensity(void) { float host_frametime = cl.realframetime; float target = cl.view_underwater ? 1.f : 0.f; - if (snd_waterfx.value < 0.f) { + if (snd_waterfx.value < 0.f) target *= 0.f; - } - else if (snd_waterfx.value > 2.f) { + else if (snd_waterfx.value > 2.f) target *= 2.f; - } - else { + else target *= snd_waterfx.value; - } - if (underwater.intensity < target) { + if (underwater.intensity < target) + { underwater.intensity += host_frametime * 4.f; underwater.intensity = min(underwater.intensity, target); } - else if (underwater.intensity > target) { + else if (underwater.intensity > target) + { underwater.intensity -= host_frametime * 4.f; underwater.intensity = max(underwater.intensity, target); } @@ -363,20 +362,22 @@ static void S_UnderwaterFilter(int endtime) { int i; int sl; - if (!underwater.intensity) { - if (endtime > 0) { - for (sl = 0; sl < SND_LISTENERS; sl++) { + + if (!underwater.intensity) + { + if (endtime > 0) + for (sl = 0; sl < SND_LISTENERS; sl++) underwater.accum[sl] = paintbuffer[endtime-1].sample[sl]; - } - } + return; } - for (i = 0; i < endtime; i++) { - for (sl = 0; sl < SND_LISTENERS; sl++) { + + for (i = 0; i < endtime; i++) + for (sl = 0; sl < SND_LISTENERS; sl++) + { underwater.accum[sl] += underwater.alpha * (paintbuffer[i].sample[sl] - underwater.accum[sl]); paintbuffer[i].sample[sl] = underwater.accum[sl]; } - } }