From edbf1af98c69f872f02b51c31045680a8ef247b7 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 18 Aug 2022 11:35:32 +0200 Subject: [PATCH] Use clock drift managers for displaying the server and client tick count --- r5dev/engine/client/clientstate.cpp | 2 +- r5dev/engine/client/clientstate.h | 6 +++--- r5dev/engine/clockdriftmgr.h | 8 ++++---- r5dev/vgui/vgui_debugpanel.cpp | 7 +------ 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/r5dev/engine/client/clientstate.cpp b/r5dev/engine/client/clientstate.cpp index 38bac390..3981ea91 100644 --- a/r5dev/engine/client/clientstate.cpp +++ b/r5dev/engine/client/clientstate.cpp @@ -34,7 +34,7 @@ float CClientState::GetClientTime() } else { - return m_flClockDriftUnknown_TIME; // VERIFY OFS + return m_flClockDriftFrameTime; } } diff --git a/r5dev/engine/client/clientstate.h b/r5dev/engine/client/clientstate.h index bbba2611..71120615 100644 --- a/r5dev/engine/client/clientstate.h +++ b/r5dev/engine/client/clientstate.h @@ -53,7 +53,7 @@ public: double m_flNextCmdTime; int m_nServerCount; int field_AC; - float m_flClockDriftUnknown_TIME; + float m_flClockDriftFrameTime; CClockDriftMgr m_ClockDriftMgr; _BYTE field_148; _BYTE field_149; @@ -108,10 +108,10 @@ public: char m_bClockCorrectionEnabled; char m_b_unknown; bool m_bLocalPredictionInitialized_MAYBE; - int field_18CCC; + int m_nServerTick; int dword18CD0; int field_18CD4; - float GetFrameTime; + float m_flFrameTime; int outgoing_command; int current_movement_sequence_number; char gap18CE4[4]; diff --git a/r5dev/engine/clockdriftmgr.h b/r5dev/engine/clockdriftmgr.h index 4f249e7f..1bb2752d 100644 --- a/r5dev/engine/clockdriftmgr.h +++ b/r5dev/engine/clockdriftmgr.h @@ -18,11 +18,11 @@ struct __declspec(align(4)) CClockDriftMgr int m_iCurClockOffset; float field_78; float field_7C; - float m_flClientTickTime; - int m_nClientTick; - float m_flServerTickTime; - int m_nServerTick; int m_nSimulationTick; + float m_flClientTickTime; + float m_flServerTickTime; + int m_nClientTick; + int m_nServerTick; }; #endif // CLOCKDRIFTMGR_H \ No newline at end of file diff --git a/r5dev/vgui/vgui_debugpanel.cpp b/r5dev/vgui/vgui_debugpanel.cpp index 14dc4b62..1639e264 100644 --- a/r5dev/vgui/vgui_debugpanel.cpp +++ b/r5dev/vgui/vgui_debugpanel.cpp @@ -149,13 +149,8 @@ void CLogSystem::DrawSimStats(void) const static Color c = { 255, 255, 255, 255 }; static const char* szLogbuf[4096]{}; -#ifdef CLIENT_DLL - snprintf((char*)szLogbuf, 4096, "Client Frame: (%d) Render Frame: (%d)\n", - g_pClientState->GetTick(), *render_tickcount); -#else snprintf((char*)szLogbuf, 4096, "Server Frame: (%d) Client Frame: (%d) Render Frame: (%d)\n", - g_pServer->GetTick(), g_pClientState->GetTick(), *g_nRenderTickCount); -#endif + g_pClientState->GetServerTickCount(), g_pClientState->GetClientTickCount(), *g_nRenderTickCount); if (cl_simstats_invert_rect_x->GetBool()) {