1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-01-09 10:39:03 +08:00
hl2sdk/public/globalvars_base.h

92 lines
2.5 KiB
C
Raw Normal View History

2023-09-08 19:41:57 +07:00
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#ifndef GLOBALVARS_BASE_H
#define GLOBALVARS_BASE_H
#ifdef _WIN32
#pragma once
#endif
2023-09-08 19:41:57 +07:00
enum GlobalVarsUsageWarning_t
{
GV_RENDERTIME_CALLED_DURING_SIMULATION,
GV_CURTIME_CALLED_DURING_RENDERING
};
typedef void (*FnGlobalVarsWarningFunc)(GlobalVarsUsageWarning_t);
//-----------------------------------------------------------------------------
// Purpose: Global variables used by shared code
//-----------------------------------------------------------------------------
class CGlobalVarsBase
{
public:
2023-09-08 19:41:57 +07:00
CGlobalVarsBase();
public:
// Absolute time (per frame still - Use Plat_FloatTime() for a high precision real time
// perf clock, but not that it doesn't obey host_timescale/host_framerate)
2023-09-08 19:41:57 +07:00
float realtime;
// Absolute frame counter - continues to increase even if game is paused
2023-09-08 19:41:57 +07:00
int framecount;
// Non-paused frametime
2023-09-08 19:41:57 +07:00
float absoluteframetime;
float absoluteframestarttimestddev;
int maxClients;
// zer0k: Command queue related
int unknown1;
int unknown2;
int unknown3;
int unknown4;
int unknown5;
2023-09-08 19:41:57 +07:00
FnGlobalVarsWarningFunc m_pfnWarningFunc;
// Time spent on last server or client frame (has nothing to do with think intervals)
float frametime;
// Current time
//
// On the client, this (along with tickcount) takes a different meaning based on what
// piece of code you're in:
//
// - While receiving network packets (like in PreDataUpdate/PostDataUpdate and proxies),
// this is set to the SERVER TICKCOUNT for that packet. There is no interval between
// the server ticks.
// [server_current_Tick * tick_interval]
//
// - While rendering, this is the exact client clock
// [client_current_tick * tick_interval + interpolation_amount]
//
// - During prediction, this is based on the client's current tick:
// [client_current_tick * tick_interval]
2023-09-08 19:41:57 +07:00
float curtime;
float rendertime;
2023-09-08 19:41:57 +07:00
// zer0k: Command queue + interpolation related
float unknown6;
float unknown7;
2023-09-08 19:41:57 +07:00
bool m_bInSimulation;
bool m_bEnableAssertions;
2023-09-08 19:41:57 +07:00
// Simulation ticks - does not increase when game is paused
int tickcount;
2024-02-10 09:17:18 +01:00
// Non-zero when during movement processing, it's the part after the decimal point of the "when" field in player's subtick moves.
float m_flSubtickFraction;
};
2023-09-08 19:41:57 +07:00
inline CGlobalVarsBase::CGlobalVarsBase()
{
}
#endif // GLOBALVARS_BASE_H