Implement host_timescale; replace host_frametime

This commit is contained in:
moto 2022-05-19 13:11:21 -04:00
parent a2ce78450d
commit 8558301901
2 changed files with 11 additions and 14 deletions

View file

@ -83,6 +83,8 @@ cvar_t pausable = {"pausable","1"};
cvar_t temp1 = {"temp1","0"};
cvar_t host_timescale = {"host_timescale", "0"}; //johnfitz
qboolean bmg_type_changed = false;
@ -239,6 +241,7 @@ void Host_InitLocal (void)
Cvar_RegisterVariable (&pausable);
Cvar_RegisterVariable (&temp1);
Cvar_RegisterVariable (&host_timescale);
Host_FindMaxClients ();
@ -537,11 +540,6 @@ qboolean Host_FilterTime (float time)
{
realtime += time;
/* dr_mabuse1981: old dquake values commented out
if (!cls.timedemo && realtime - oldrealtime < 1.0/250.0)
return false; // framerate is too high
*/
if (cl_maxfps.value < 1) Cvar_SetValue("cl_maxfps", 30);
if (!cls.timedemo && realtime - oldrealtime < 1.0/cl_maxfps.value)
return false; // framerate is too high
@ -549,15 +547,14 @@ qboolean Host_FilterTime (float time)
host_frametime = realtime - oldrealtime;
oldrealtime = realtime;
if (host_framerate.value > 0)
//johnfitz -- host_timescale is more intuitive than host_framerate
if (host_timescale.value > 0)
host_frametime *= host_timescale.value;
//johnfitz
else if (host_framerate.value > 0)
host_frametime = host_framerate.value;
else
{ // don't allow really long or short frames
if (host_frametime > 0.1)
host_frametime = 0.1;
if (host_frametime < 0.001)
host_frametime = 0.001;
}
else // don't allow really long or short frames
host_frametime = CLAMP (0.001, host_frametime, 0.1); //johnfitz -- use CLAMP
return true;
}

View file

@ -494,6 +494,6 @@ byte *W_GetTextureHL(char *name)
else
break;
}
tex->width = tex->width = 0;
return NULL;
}