css_enhanced_waf/engine/clockdriftmgr.h
Kamay Xutax 6691968046 Added enhanced cl_clock_correction & misc
- Added vprof
- Fixed few issues again with cl_showhitboxes
- Fixed some shader compilation
- Fixed few issues with bitbuf
2024-07-23 03:05:29 +02:00

50 lines
1.3 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef CLOCKDRIFTMGR_H
#define CLOCKDRIFTMGR_H
#ifdef _WIN32
#pragma once
#endif
class CClockDriftMgr
{
friend class CBaseClientState;
public:
CClockDriftMgr();
// Is clock correction even enabled right now?
static bool IsClockCorrectionEnabled();
// Clear our state.
void Clear();
// This is called each time a server packet comes in. It is used to correlate
// where the server is in time compared to us.
void SetServerTick( int iServerTick, int nLaggedTick, float flServerHostFrametime, float flServerHostFrametimeStdDeviation);
void ApplyClockCorrection(bool bFinalTick);
private:
void ShowDebugInfo();
public:
int m_nLagDiff;
int m_nOldServerTick;
int m_nServerTick; // Last-received tick from the server.
int m_nClientTick;
int m_nCachedRealClientTick; // The client's own tick counter (specifically, for interpolation during rendering).
// The server may be on a slightly different tick and the client will drift towards it.
int m_nLaggedClientTick;
float m_flServerHostFrametime;
float m_flServerHostFrametimeStdDeviation;
};
#endif // CLOCKDRIFTMGR_H