From b2579dca98adbe18ea6d9aef3bdcc33c01d93868 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Thu, 25 Apr 2002 16:50:56 +0000 Subject: [PATCH] WOOHOO! The hardcoded framerate cap is gone! cl_maxfps 0 now allows an unbounded frame rate (you can still set it to clamp your fps to, for example, your monitor's refresh rate), and cl_maxnetfps 0 is now based on your network rate. The NetQuake-compatible targets now also have an unbounded framerate. This is OK, because the built-in server uses its own tick rate. --- nq/source/host.c | 15 ++------------- qw/include/client.h | 2 ++ qw/source/cl_input.c | 41 +++++++++++++++++++---------------------- qw/source/cl_main.c | 4 ++-- 4 files changed, 25 insertions(+), 37 deletions(-) diff --git a/nq/source/host.c b/nq/source/host.c index f7323a261..fd860aa9a 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -510,7 +510,6 @@ Host_ClearMemory (void) qboolean Host_FilterTime (float time) { - float timedifference; float timescale = 1.0; if (cls.demoplayback) { @@ -520,23 +519,13 @@ Host_FilterTime (float time) realtime += time; - timedifference = (timescale / 72.0) - (realtime - oldrealtime); - - if (!cls.timedemo && (timedifference > 0)) - return false; // framerate is too high - host_frametime = realtime - oldrealtime; oldrealtime = realtime; 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 = bound (0.001, host_frametime, 0.1); return true; } diff --git a/qw/include/client.h b/qw/include/client.h index f3faf1dd8..90ce75469 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -313,6 +313,8 @@ extern struct cvar_s *cl_name; extern struct cvar_s *cl_model_crcs; +extern struct cvar_s *rate; + extern struct cvar_s *show_ping; extern struct cvar_s *show_pl; diff --git a/qw/source/cl_input.c b/qw/source/cl_input.c index 0607439bd..cff317d13 100644 --- a/qw/source/cl_input.c +++ b/qw/source/cl_input.c @@ -704,30 +704,27 @@ CL_SendCmd (void) if (cls.demorecording) CL_WriteDemoCmd (cmd); - if (cl_maxnetfps->int_val) { - pps_balance += host_frametime; - // never drop more than 2 messages in a row -- that'll cause PL - // and don't drop if one of the last two movemessages have an impulse - if (pps_balance > 0.0 || dropcount >= 2 || dontdrop) { - float pps; + pps_balance += host_frametime; + // never drop more than 2 messages in a row -- that'll cause PL + // and don't drop if one of the last two movemessages have an impulse + if (pps_balance > 0.0 || dropcount >= 2 || dontdrop) { + float pps; - pps = cl_maxnetfps->int_val; - if (pps < 10) pps = 10; - if (pps > 72) pps = 72; - pps_balance -= 1.0 / pps; - pps_balance = bound (-0.1, pps_balance, 0.1); - dropcount = 0; - } else { - // don't count this message when calculating PL - cl.frames[i].receivedtime = -3; - // drop this message - cls.netchan.outgoing_sequence++; - dropcount++; - return; - } - } else { - pps_balance = 0; + if (!(pps = cl_maxnetfps->int_val)) + pps = rate->value / 80.0; + + pps = bound (1, pps, 72); + + pps_balance -= 1.0 / pps; + pps_balance = bound (-0.1, pps_balance, 0.1); dropcount = 0; + } else { + // don't count this message when calculating PL + cl.frames[i].receivedtime = -3; + // drop this message + cls.netchan.outgoing_sequence++; + dropcount++; + return; } // deliver the message diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 30231a471..0dbea4575 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1458,9 +1458,9 @@ Host_SimulationTime (float time) oldrealtime = 0; if (cl_maxfps->int_val) - fps = bound (1, cl_maxfps->value, 72); + fps = max (1, cl_maxfps->value); else - fps = bound (30, rate->value / 80.0, 72); + return 0; timedifference = (timescale / fps) - (realtime - oldrealtime);