diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index 6b0b62da7f7..48b08b005c2 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -183,6 +183,14 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type) } } +// ADDED BY NERO +DEFINE_ACTION_FUNCTION(_CVar, GetBool) +{ + PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar); + auto v = self->GetGenericRep(CVAR_Bool); + ACTION_RETURN_BOOL(v.Bool); +} + DEFINE_ACTION_FUNCTION(_CVar, GetInt) { PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar); @@ -204,6 +212,18 @@ DEFINE_ACTION_FUNCTION(_CVar, GetString) ACTION_RETURN_STRING(v.String); } +//ADDED BY NERO +DEFINE_ACTION_FUNCTION(_CVar, SetBool) +{ + PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar); + if (!(self->GetFlags() & CVAR_MOD) && CurrentMenu == nullptr) return 0; + PARAM_BOOL(val); + UCVarValue v; + v.Bool = val; + self->SetGenericRep(v, CVAR_Bool); + return 0; +} + DEFINE_ACTION_FUNCTION(_CVar, SetInt) { // Only menus are allowed to change CVARs. diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 898265995e3..9ddcd282e90 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -301,9 +301,11 @@ struct CVar native native static CVar FindCVar(Name name); native static CVar GetCVar(Name name, PlayerInfo player = null); + native bool GetBool(); native int GetInt(); native double GetFloat(); native String GetString(); + native void SetBool(bool b); native void SetInt(int v); native void SetFloat(double v); native void SetString(String s);