[IW4MVM] Make sure to reset the timescale

This commit is contained in:
momo5502 2017-07-09 01:54:02 +02:00
parent 1d6b340af3
commit 32789b29cf
3 changed files with 16 additions and 0 deletions

View File

@ -118,6 +118,14 @@ namespace Components
}
}
void Dvar::Var::setRaw(float value)
{
if (this->dvar)
{
this->dvar->current.value = value;
}
}
template<> static Dvar::Var Dvar::Register(const char* name, bool value, Dvar::Flag flag, const char* description)
{
return Game::Dvar_RegisterBool(name, value, flag.val, description);

View File

@ -34,6 +34,7 @@ namespace Components
// TODO: Add others
void setRaw(int integer);
void setRaw(float value);
private:
Game::dvar_t* dvar;

View File

@ -13,6 +13,13 @@ namespace Components
client_main::Init();
Scheduler::Once(client_main::PostInit);
Scheduler::OnFrame([]()
{
if (!Game::CL_IsCgameInitialized())
{
Dvar::Var("com_timescale").setRaw(1.0f);
}
});
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect);
}