From bc4c6e4bba8d8387814978bd906b30482360c243 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 4 Apr 2007 04:27:17 +0000 Subject: [PATCH] fixed two timing flaws where cl.realframetime was used instead of (cl.time - cl.oldtime), one being centerprint fade time, and the other being ambient sky/water noise fading git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7039 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_screen.c | 3 ++- snd_main.c | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cl_screen.c b/cl_screen.c index d53b012c..68c06cf9 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -168,7 +168,8 @@ void SCR_CheckDrawCenterString (void) if (scr_center_lines > scr_erase_lines) scr_erase_lines = scr_center_lines; - scr_centertime_off -= cl.realframetime; + if (cl.time > cl.oldtime) + scr_centertime_off -= cl.time - cl.oldtime; // don't draw if this is a normal stats-screen intermission, // only if it is not an intermission, or a finale intermission diff --git a/snd_main.c b/snd_main.c index de354563..0462d380 100644 --- a/snd_main.c +++ b/snd_main.c @@ -1403,17 +1403,20 @@ void S_UpdateAmbientSounds (void) // Don't adjust volume too fast // FIXME: this rounds off to an int each frame, meaning there is little to no fade at extremely high framerates! - if (chan->master_vol < vol) + if (cl.time > cl.oldtime) { - chan->master_vol += (int)(cl.realframetime * ambient_fade.value); - if (chan->master_vol > vol) - chan->master_vol = vol; - } - else if (chan->master_vol > vol) - { - chan->master_vol -= (int)(cl.realframetime * ambient_fade.value); if (chan->master_vol < vol) - chan->master_vol = vol; + { + chan->master_vol += (int)((cl.time - cl.oldtime) * ambient_fade.value); + if (chan->master_vol > vol) + chan->master_vol = vol; + } + else if (chan->master_vol > vol) + { + chan->master_vol -= (int)((cl.time - cl.oldtime) * ambient_fade.value); + if (chan->master_vol < vol) + chan->master_vol = vol; + } } for (i = 0;i < SND_LISTENERS;i++) -- 2.39.2