diff --git a/src/common/header/common.h b/src/common/header/common.h index cd0ccb04..4021ab68 100644 --- a/src/common/header/common.h +++ b/src/common/header/common.h @@ -784,6 +784,6 @@ void SCR_BeginLoadingPlaque(void); void SV_Init(void); void SV_Shutdown(char *finalmsg, qboolean reconnect); -void SV_Frame(); +void SV_Frame(int msec); #endif diff --git a/src/common/misc.c b/src/common/misc.c index ade63c2a..a83c877a 100644 --- a/src/common/misc.c +++ b/src/common/misc.c @@ -327,8 +327,11 @@ Qcommon_Frame(int msec) // Time since last misc. frame in microsec. static int miscdelta = 100000; - // Accumulated time since last (packet|render|misc|time) frame. - static int timedelta = 1001; + // Accumulated time since last client run. + static int clienttimedelta = 0; + + // Accumulated time since last server run. + static int servertimedelta = 0; /* A packetframe runs the server and the client, but not the renderer. The minimal interval of @@ -348,12 +351,6 @@ Qcommon_Frame(int msec) An interval of 100.000 microseconds is enough. */ qboolean miscframe = true; - /* Timeframes are empty frames. We need to call the - client at regular intervals to forward several - internal timers, even if there's nothing to do. - This is also necessary to speed up loading times. */ - qboolean timeframe = true; - /* In case of ERR_DROP we're jumping here. Don't know if that' really save but it seems to work. So leave @@ -441,7 +438,8 @@ Qcommon_Frame(int msec) packetdelta += msec; renderdelta += msec; miscdelta += msec; - timedelta += msec; + clienttimedelta += msec; + servertimedelta += msec; if (cl_async->value) { @@ -474,24 +472,17 @@ Qcommon_Frame(int msec) } } - if (timedelta < 1001) - { - timeframe = false; - } + // Dedicated server terminal console. + do { + s = Sys_ConsoleInput(); - // No need to run the terminal console too often. - if (timeframe) { - do { - s = Sys_ConsoleInput(); + if (s) { + Cbuf_AddText(va("%s\n", s)); + } + } while (s); - if (s) { - Cbuf_AddText(va("%s\n", s)); - } - } while (s); - - Cbuf_Execute(); - } + Cbuf_Execute(); #ifndef DEDICATED_ONLY @@ -504,7 +495,8 @@ Qcommon_Frame(int msec) // Run the serverframe. if (packetframe) { - SV_Frame(); + SV_Frame(servertimedelta); + servertimedelta = 0; } @@ -516,9 +508,10 @@ Qcommon_Frame(int msec) // Run the client frame. - if (packetframe || renderframe || miscframe || timeframe) { - CL_Frame(packetdelta, renderdelta, miscdelta, timedelta, + if (packetframe || renderframe || miscframe) { + CL_Frame(packetdelta, renderdelta, miscdelta, clienttimedelta, packetframe, renderframe, miscframe); + clienttimedelta = 0; } @@ -552,10 +545,6 @@ Qcommon_Frame(int msec) if (miscframe) { miscdelta = 0; } - - if (timeframe) { - timedelta = 0; - } } void diff --git a/src/server/sv_main.c b/src/server/sv_main.c index 1d9cfa96..69f86d8c 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -376,7 +376,7 @@ SV_RunGameFrame(void) } void -SV_Frame() +SV_Frame(int msec) { #ifndef DEDICATED_ONLY time_before_game = time_after_game = 0; @@ -388,7 +388,7 @@ SV_Frame() return; } - svs.realtime = curtime; + svs.realtime += msec / 1000; /* keep the random time dependent */ randk();