2022-01-23 18:26:48 +01:00
|
|
|
#include "core/stdafx.h"
|
2023-04-10 22:35:41 +02:00
|
|
|
#include "tier1/cvar.h"
|
2022-01-23 18:26:48 +01:00
|
|
|
#include "sys_engine.h"
|
2023-04-10 22:35:41 +02:00
|
|
|
#ifdef DEDICATED
|
|
|
|
#include "game/shared/shareddefs.h"
|
|
|
|
#endif // DEDICATED
|
2022-01-23 18:26:48 +01:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-04-18 03:35:08 +02:00
|
|
|
CEngine* g_pEngine = nullptr;
|
2023-09-09 15:12:58 +02:00
|
|
|
IEngine::QuitState_t* gsm_Quitting = nullptr;
|
2022-01-23 18:33:01 +01:00
|
|
|
|
2023-04-10 22:35:41 +02:00
|
|
|
bool CEngine::_Frame(CEngine* thisp)
|
|
|
|
{
|
|
|
|
#ifdef DEDICATED
|
|
|
|
|
|
|
|
// The first engine frame is ran before the global variables are initialized.
|
|
|
|
// By default, the tick interval is set to '0.0f'; we can't divide by zero.
|
|
|
|
if (TICK_INTERVAL > 0.0f)
|
|
|
|
{
|
|
|
|
int nTickRate = TIME_TO_TICKS(1.0f);
|
|
|
|
if (fps_max->GetInt() != nTickRate)
|
|
|
|
{
|
|
|
|
// Clamp the framerate of the server to its simulation tick rate.
|
|
|
|
// This saves a significant amount of CPU time in CEngine::Frame,
|
|
|
|
// as the engine uses this to decided when to run a new frame.
|
|
|
|
fps_max->SetValue(nTickRate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DEDICATED
|
2024-01-02 15:21:36 +01:00
|
|
|
return CEngine__Frame(thisp);
|
2023-04-10 22:35:41 +02:00
|
|
|
}
|
|
|
|
|
2023-11-26 13:21:20 +01:00
|
|
|
void VEngine::Detour(const bool bAttach) const
|
2023-04-10 22:35:41 +02:00
|
|
|
{
|
2024-01-02 15:21:36 +01:00
|
|
|
DetourSetup(&CEngine__Frame, &CEngine::_Frame, bAttach);
|
2023-04-10 22:35:41 +02:00
|
|
|
}
|