-/*
-===================
-Host_FilterTime
-
-Returns false if the time is too short to run a frame
-===================
-*/
-extern cvar_t cl_avidemo;
-qboolean Host_FilterTime (double time)
-{
- double timecap;
- realtime += time;
-
- if (slowmo.value < 0.0f)
- Cvar_SetValue("slowmo", 0.0f);
- if (host_minfps.value < 10.0f)
- Cvar_SetValue("host_minfps", 10.0f);
- if (host_maxfps.value < host_minfps.value)
- Cvar_SetValue("host_maxfps", host_minfps.value);
- if (cl_avidemo.value < 0.1f && cl_avidemo.value != 0.0f)
- Cvar_SetValue("cl_avidemo", 0.0f);
-
- // check if framerate is too high
- if (cl_avidemo.value >= 0.1f)
- {
- timecap = 1.0 / (double)cl_avidemo.value;
- if ((realtime - oldrealtime) < timecap)
- return false;
- }
- else if (!cls.timedemo)
- {
- // default to sys_ticrate (server framerate - presumably low) unless we're the active window and either connected to a server or playing a video
- timecap = sys_ticrate.value;
- if (vid_activewindow && (cls.state == ca_connected || cl_videoplaying))
- timecap = 1.0 / host_maxfps.value;
-
- if ((realtime - oldrealtime) < timecap)
- return false;
- }
-
- // LordHavoc: copy into host_realframetime as well
- host_realframetime = host_frametime = realtime - oldrealtime;
- oldrealtime = realtime;
-
- if (cls.timedemo)
- {
- // disable time effects
- cl.frametime = host_frametime;
- return true;
- }
-
- if (host_framerate.value > 0)
- host_frametime = host_framerate.value;
- else if (cl_avidemo.value >= 0.1f)
- host_frametime = (1.0 / cl_avidemo.value);
- else
- {
- // don't allow really short frames
- if (host_frametime > (1.0 / host_minfps.value))
- host_frametime = (1.0 / host_minfps.value);
- }
-
- cl.frametime = host_frametime = bound(0, host_frametime * slowmo.value, 0.1f); // LordHavoc: the QC code relies on no less than 10fps
-
- return true;
-}
-
-