diff --git a/src/Components/Modules/Dvar.cpp b/src/Components/Modules/Dvar.cpp index ad28175c..c83a1f7c 100644 --- a/src/Components/Modules/Dvar.cpp +++ b/src/Components/Modules/Dvar.cpp @@ -134,6 +134,36 @@ namespace Components } } + void Dvar::Var::setRaw(int integer) + { + assert(this->dvar->type == Game::DVAR_TYPE_INT); + if (this->dvar) + { + this->dvar->current.integer = integer; + this->dvar->latched.integer = integer; + } + } + + void Dvar::Var::setRaw(float value) + { + assert(this->dvar->type == Game::DVAR_TYPE_FLOAT); + if (this->dvar) + { + this->dvar->current.value = value; + this->dvar->latched.value = value; + } + } + + void Dvar::Var::setRaw(bool enabled) + { + assert(this->dvar->type == Game::DVAR_TYPE_BOOL); + if (this->dvar) + { + this->dvar->current.enabled = enabled; + this->dvar->latched.enabled = enabled; + } + } + 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); diff --git a/src/Components/Modules/Dvar.hpp b/src/Components/Modules/Dvar.hpp index 47cf8102..33f291fb 100644 --- a/src/Components/Modules/Dvar.hpp +++ b/src/Components/Modules/Dvar.hpp @@ -33,6 +33,10 @@ namespace Components void set(float value); void set(bool enabled); + void setRaw(int integer); + void setRaw(float value); + void setRaw(bool enabled); + private: Game::dvar_t* dvar; };