diff --git a/engine/cl_main.cpp b/engine/cl_main.cpp index 291b24e557..de2a44f292 100644 --- a/engine/cl_main.cpp +++ b/engine/cl_main.cpp @@ -515,10 +515,31 @@ void CL_ReadPackets ( bool bFinalTick ) if ( !Host_ShouldRun() ) return; - - // update client times/tick - cl.oldtickcount = cl.GetServerTickCount(); + // update client times/tick + if (!CClockDriftMgr::IsClockCorrectionEnabled()) + { + cl.oldtickcount = cl.GetServerTickCount(); + } + + // Moved after process socket so we can receive the lastest updates. + if ( !cl.IsPaused() ) + { + // While clock correction is off, we have the old behavior of matching the client and server clocks. + if (!CClockDriftMgr::IsClockCorrectionEnabled()) + { + cl.SetClientTickCount(cl.GetClientTickCount() + 1); + cl.SetServerTickCount(cl.GetClientTickCount()); + g_ClientGlobalVariables.tickcount = cl.GetClientTickCount(); + g_ClientGlobalVariables.curtime = cl.GetTime(); + } + } + + if (!CClockDriftMgr::IsClockCorrectionEnabled()) + { + // 0 or tick_rate if simulating + g_ClientGlobalVariables.frametime = cl.GetFrameTime(); + } // read packets, if any in queue if ( demoplayer->IsPlayingBack() && cl.m_NetChannel ) @@ -562,25 +583,28 @@ void CL_ReadPackets ( bool bFinalTick ) } #endif + if (CClockDriftMgr::IsClockCorrectionEnabled()) + { + cl.oldtickcount = cl.GetServerTickCount(); + } + // Moved after process socket so we can receive the lastest updates. if ( !cl.IsPaused() ) - { + { // While clock correction is off, we have the old behavior of matching the client and server clocks. - if (!CClockDriftMgr::IsClockCorrectionEnabled()) - { - cl.SetClientTickCount(cl.GetClientTickCount() + 1); - cl.SetServerTickCount(cl.GetClientTickCount()); - } - else - { - cl.m_ClockDriftMgr.IncrementCachedTickCount(bFinalTick); - } - - g_ClientGlobalVariables.tickcount = cl.GetClientTickCount(); - g_ClientGlobalVariables.curtime = cl.GetTime(); + if (CClockDriftMgr::IsClockCorrectionEnabled()) + { + cl.m_ClockDriftMgr.IncrementCachedTickCount(bFinalTick); + g_ClientGlobalVariables.tickcount = cl.GetClientTickCount(); + g_ClientGlobalVariables.curtime = cl.GetTime(); + } + } + + if (CClockDriftMgr::IsClockCorrectionEnabled()) + { + // 0 or tick_rate if simulating + g_ClientGlobalVariables.frametime = cl.GetFrameTime(); } - // 0 or tick_rate if simulating - g_ClientGlobalVariables.frametime = cl.GetFrameTime(); } diff --git a/engine/clockdriftmgr.cpp b/engine/clockdriftmgr.cpp index 1c8c56e788..21abd5d528 100644 --- a/engine/clockdriftmgr.cpp +++ b/engine/clockdriftmgr.cpp @@ -11,7 +11,7 @@ #include "enginethreads.h" -ConVar cl_clock_correction( "cl_clock_correction", "1", FCVAR_CHEAT, "Enable/disable clock correction on the client." ); +ConVar cl_clock_correction( "cl_clock_correction", "0", FCVAR_CHEAT, "Enable/disable clock correction on the client." ); ConVar cl_clockdrift_max_ms( "cl_clockdrift_max_ms", "150", FCVAR_CHEAT, "Maximum number of milliseconds the clock is allowed to drift before the client snaps its clock to the server's." ); ConVar cl_clockdrift_max_ms_threadmode( "cl_clockdrift_max_ms_threadmode", "0", FCVAR_CHEAT, "Maximum number of milliseconds the clock is allowed to drift before the client snaps its clock to the server's." );