css_enhanced_waf/engine/clockdriftmgr.h

52 lines
1.3 KiB
C
Raw Normal View History

2020-04-22 17:56:21 +01:00
//========= 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 IncrementCachedTickCount(bool bFinalTick);
2020-04-22 17:56:21 +01:00
private:
void ShowDebugInfo();
2020-04-22 17:56:21 +01:00
public:
int m_nLagDiff;
int m_nOldServerTick;
2020-04-22 17:56:21 +01:00
int m_nServerTick; // Last-received tick from the server.
int m_nClientTick;
int m_nNumberOfTicks;
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;
2020-04-22 17:56:21 +01:00
};
#endif // CLOCKDRIFTMGR_H