mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
84 lines
2.8 KiB
C++
84 lines
2.8 KiB
C++
//=============================================================================//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $NoKeywords: $
|
|
//
|
|
//=============================================================================//
|
|
// clientstate.cpp: implementation of the CClientState class.
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
#include "core/stdafx.h"
|
|
#include "client/cdll_engine_int.h"
|
|
#include "engine/host.h"
|
|
#include "engine/client/clientstate.h"
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Purpose: returns true if client simulation is paused
|
|
//------------------------------------------------------------------------------
|
|
bool CClientState::IsPaused()
|
|
{
|
|
return m_bPaused;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Purpose: gets the client time
|
|
// Technically doesn't belong here
|
|
//------------------------------------------------------------------------------
|
|
float CClientState::GetClientTime()
|
|
{
|
|
if (m_bClockCorrectionEnabled)
|
|
{
|
|
return (float)m_ClockDriftMgr.m_nSimulationTick * (*(float*)&interval_per_tick); // VERIFY DEREF
|
|
}
|
|
else
|
|
{
|
|
return m_flClockDriftFrameTime;
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Purpose: gets the simulation tick count
|
|
//------------------------------------------------------------------------------
|
|
int CClientState::GetTick() const
|
|
{
|
|
return m_ClockDriftMgr.m_nSimulationTick;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Purpose: gets the last-received server tick count
|
|
//------------------------------------------------------------------------------
|
|
int CClientState::GetServerTickCount() const
|
|
{
|
|
return m_ClockDriftMgr.m_nServerTick;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Purpose: sets the server tick count
|
|
//------------------------------------------------------------------------------
|
|
void CClientState::SetServerTickCount(int tick)
|
|
{
|
|
m_ClockDriftMgr.m_nServerTick = tick;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Purpose: gets the client tick count
|
|
//------------------------------------------------------------------------------
|
|
int CClientState::GetClientTickCount() const
|
|
{
|
|
return m_ClockDriftMgr.m_nClientTick;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Purpose: sets the client tick count
|
|
//------------------------------------------------------------------------------
|
|
void CClientState::SetClientTickCount(int tick)
|
|
{
|
|
m_ClockDriftMgr.m_nClientTick = tick;
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
CClientState* g_pClientState = nullptr;
|
|
CClientState** g_pClientState_Shifted = nullptr;
|