Merge pull request #357 from Brentdevent/dvar_sessionmode
Fix registering sessionmode bool dvars
This commit is contained in:
commit
1f70006719
@ -112,6 +112,9 @@ namespace game
|
||||
const char* description)> Dvar_SessionModeRegisterBool{
|
||||
0x1422D0D40, 0x14057BAA0
|
||||
};
|
||||
WEAK symbol<void(dvarStrHash_t hash, bool value, eModes mode)> Dvar_SessionModeSetDefaultBool{
|
||||
0x1422D0E90, 0x14057BCE0
|
||||
};
|
||||
WEAK symbol<dvar_t*(dvarStrHash_t hash, const char* dvarName, const char* value, dvarFlags_e flags,
|
||||
const char* description)> Dvar_RegisterString{
|
||||
0x1422D0B70
|
||||
|
@ -38,7 +38,7 @@ namespace game
|
||||
return dvar->current.value.enabled;
|
||||
}
|
||||
|
||||
dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description)
|
||||
dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description, const eModes mode)
|
||||
{
|
||||
const auto hash = Dvar_GenerateHash(dvar_name);
|
||||
auto registered_dvar = Dvar_SessionModeRegisterBool(hash, dvar_name, value, flags, description);
|
||||
@ -46,6 +46,18 @@ namespace game
|
||||
if (registered_dvar)
|
||||
{
|
||||
registered_dvar->debugName = dvar_name;
|
||||
|
||||
if (mode == MODE_COUNT)
|
||||
{
|
||||
for (int i = MODE_FIRST; i < MODE_COUNT; ++i)
|
||||
{
|
||||
game::Dvar_SessionModeSetDefaultBool.call_safe(hash, value, static_cast<eModes>(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
game::Dvar_SessionModeSetDefaultBool.call_safe(hash, value, mode);
|
||||
}
|
||||
}
|
||||
|
||||
return registered_dvar;
|
||||
|
@ -9,7 +9,7 @@ namespace game
|
||||
bool get_dvar_bool(const char* dvar_name);
|
||||
|
||||
dvar_t* register_dvar_bool(const char* dvar_name, bool value, dvarFlags_e flags, const char* description);
|
||||
dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description);
|
||||
dvar_t* register_sessionmode_dvar_bool(const char* dvar_name, const bool value, const dvarFlags_e flags, const char* description, const eModes mode = MODE_COUNT);
|
||||
void dvar_add_flags(const char* dvar, dvarFlags_e flags);
|
||||
void dvar_set_flags(const char* dvar_name, dvarFlags_e flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user