Allow negative host_maxfps to set a packetrate while leaving video rates uncapped, for weird people who want that...

This commit is contained in:
Shpoike 2023-07-25 13:27:33 +01:00
parent 9f5d6f0355
commit 039d61dbfa
2 changed files with 18 additions and 5 deletions

View file

@ -112,7 +112,17 @@ Max_Fps_f -- ericw
*/
static void Max_Fps_f (cvar_t *var)
{
if (var->value > 72 || var->value <= 0)
if (var->value < 0)
{
if (!host_netinterval)
Con_Printf ("Using renderer/network isolation.\n");
host_netinterval = 1/-var->value;
if (host_netinterval > 1/10.f) //don't let it get too jerky for other players
host_netinterval = 1/10.f;
if (host_netinterval < 1/150.f) //don't let us spam servers too often. just abusive.
host_netinterval = 1/150.f;
}
else if (var->value > 72 || var->value <= 0)
{
if (!host_netinterval)
Con_Printf ("Using renderer/network isolation.\n");
@ -650,7 +660,7 @@ qboolean Host_FilterTime (float time)
//johnfitz -- max fps cvar
maxfps = CLAMP (10.f, host_maxfps.value, 1000.0);
if (host_maxfps.value && !cls.timedemo && realtime - oldrealtime < 1.0/maxfps)
if (host_maxfps.value>0 && !cls.timedemo && realtime - oldrealtime < 1.0/maxfps)
return false; // framerate is too high
//johnfitz
@ -663,7 +673,7 @@ qboolean Host_FilterTime (float time)
//johnfitz
else if (host_framerate.value > 0)
host_frametime = host_framerate.value;
else if (host_maxfps.value)// don't allow really long or short frames
else if (host_maxfps.value>0)// don't allow really long or short frames
host_frametime = CLAMP (0.0001, host_frametime, 0.1); //johnfitz -- use CLAMP
return true;

View file

@ -1870,9 +1870,12 @@ void M_Extras_Draw (void)
M_DrawCheckbox(220, y, !!r_lerpmodels.value && !!r_lerpmove.value);
break;
case EXTRAS_FPSCAP:
M_Print (16, y, " Maximum FPS");
if (host_maxfps.value < 0)
M_Print (16, y, " Maximum PPS");
else
M_Print (16, y, " Maximum FPS");
if (host_maxfps.value)
M_Print (220, y, va("%g", host_maxfps.value));
M_Print (220, y, va("%g", fabs(host_maxfps.value)));
else
M_Print (220, y, "uncapped");
break;