add default cvar getters

This commit is contained in:
marrub 2025-02-16 21:21:38 -07:00 committed by Ricardo Luís Vaz Silva
parent f1e6445e82
commit 9f6c1d65c5
2 changed files with 25 additions and 0 deletions

View file

@ -902,6 +902,27 @@ DEFINE_ACTION_FUNCTION(_CVar, GetString)
ACTION_RETURN_STRING(v.String);
}
DEFINE_ACTION_FUNCTION(_CVar, GetDefaultInt)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
auto v = self->GetGenericRepDefault(CVAR_Int);
ACTION_RETURN_INT(v.Int);
}
DEFINE_ACTION_FUNCTION(_CVar, GetDefaultFloat)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
auto v = self->GetGenericRepDefault(CVAR_Float);
ACTION_RETURN_FLOAT(v.Float);
}
DEFINE_ACTION_FUNCTION(_CVar, GetDefaultString)
{
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
auto v = self->GetGenericRepDefault(CVAR_String);
ACTION_RETURN_STRING(v.String);
}
DEFINE_ACTION_FUNCTION(_CVar, SetInt)
{
// Only menus are allowed to change CVARs.

View file

@ -696,6 +696,10 @@ struct CVar native
native int GetInt();
native double GetFloat();
native String GetString();
bool GetDefaultBool() { return GetDefaultInt(); }
native int GetDefaultInt();
native double GetDefaultFloat();
native String GetDefaultString();
void SetBool(bool b) { SetInt(b); }
native void SetInt(int v);
native void SetFloat(double v);