2020-04-22 18:56:21 +02: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.
|
2024-07-23 03:05:29 +02:00
|
|
|
void SetServerTick( int iServerTick, int nLaggedTick, float flServerHostFrametime, float flServerHostFrametimeStdDeviation);
|
2024-07-26 05:32:47 +02:00
|
|
|
void IncrementCachedTickCount(bool bFinalTick);
|
2020-04-22 18:56:21 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2024-07-23 03:05:29 +02:00
|
|
|
void ShowDebugInfo();
|
2020-04-22 18:56:21 +02:00
|
|
|
|
|
|
|
|
2024-07-23 03:05:29 +02:00
|
|
|
public:
|
|
|
|
int m_nLagDiff;
|
|
|
|
int m_nOldServerTick;
|
2020-04-22 18:56:21 +02:00
|
|
|
int m_nServerTick; // Last-received tick from the server.
|
2024-07-23 03:05:29 +02:00
|
|
|
int m_nClientTick;
|
2024-07-23 05:03:22 +02:00
|
|
|
int m_nNumberOfTicks;
|
2024-07-23 03:05:29 +02:00
|
|
|
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 18:56:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CLOCKDRIFTMGR_H
|