diff --git a/src/common/scripting/interface/vmnatives.cpp b/src/common/scripting/interface/vmnatives.cpp index ca967c264bd..c1bb2a2b59d 100644 --- a/src/common/scripting/interface/vmnatives.cpp +++ b/src/common/scripting/interface/vmnatives.cpp @@ -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. diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 28d8a56045c..70710d7dee4 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -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);