diff --git a/Quake/host.c b/Quake/host.c index e0b3caf3..e8c713c1 100644 --- a/Quake/host.c +++ b/Quake/host.c @@ -63,6 +63,9 @@ float host_netinterval = 1.0 / MAX_PHYSICS_FREQ; cvar_t host_framerate = {"host_framerate", "0", CVAR_NONE}; // set for slow motion cvar_t host_speeds = {"host_speeds", "0", CVAR_NONE}; // set for running times cvar_t host_maxfps = {"host_maxfps", "200", CVAR_ARCHIVE}; // johnfitz + +cvar_t host_phys_max_ticrate = {"host_phys_max_ticrate", "0", CVAR_NONE}; // vso = [0 = disabled; MAX_PHYSICS_FREQ] + cvar_t host_timescale = {"host_timescale", "0", CVAR_NONE}; // johnfitz cvar_t max_edicts = {"max_edicts", "8192", CVAR_NONE}; // johnfitz //ericw -- changed from 2048 to 8192, removed CVAR_ARCHIVE cvar_t cl_nocsqc = {"cl_nocsqc", "0", CVAR_NONE}; // spike -- blocks the loading of any csqc modules @@ -110,6 +113,10 @@ static void Max_Edicts_f (cvar_t *var) Con_Printf ("Changes to max_edicts will not take effect until the next time a map is loaded.\n"); } +// forward declarations for below... +static void Max_Fps_f (cvar_t *var); +static void Phys_Ticrate_f (cvar_t *var); + /* ================ Max_Fps_f -- ericw @@ -117,6 +124,13 @@ Max_Fps_f -- ericw */ static void Max_Fps_f (cvar_t *var) { + // host_phys_max_ticrate overrides normal behaviour + if (host_phys_max_ticrate.value > 0) + { + Phys_Ticrate_f (&host_phys_max_ticrate); + return; + } + if (var->value > MAX_PHYSICS_FREQ || var->value <= 0) { if (!host_netinterval) @@ -134,6 +148,29 @@ static void Max_Fps_f (cvar_t *var) } } +/* +================ +Phys_Ticrate_f -- vso +================ +*/ +static void Phys_Ticrate_f (cvar_t *var) +{ + if (var->value > 0) + { + // clamp within valid limits, authorize float values + var->value = CLAMP (0.0, var->value, MAX_PHYSICS_FREQ); + + Con_Printf ("Using max physics tics rate = %dHz.\n", (int)var->value); + host_netinterval = 1.0 / var->value; + } + else + { + Con_Printf ("Disable max physics tics rate, using host_maxfps control...\n"); + // apply max_fps policy + Max_Fps_f (&host_maxfps); + } +} + /* ================ Host_EndGame @@ -294,6 +331,8 @@ void Host_InitLocal (void) Cvar_RegisterVariable (&host_speeds); Cvar_RegisterVariable (&host_maxfps); // johnfitz Cvar_SetCallback (&host_maxfps, Max_Fps_f); + Cvar_RegisterVariable (&host_phys_max_ticrate); // vso + Cvar_SetCallback (&host_phys_max_ticrate, Phys_Ticrate_f); Cvar_RegisterVariable (&host_timescale); // johnfitz Cvar_RegisterVariable (&cl_nocsqc); // spike