mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-22 08:51:28 +00:00
- added boolean CVar ZScript commands contributed by Nero: https://forum.zdoom.org/viewtopic.php?f=15&t=58050
This commit is contained in:
parent
4f5b459703
commit
9d458c73df
2 changed files with 22 additions and 0 deletions
|
@ -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)
|
DEFINE_ACTION_FUNCTION(_CVar, GetInt)
|
||||||
{
|
{
|
||||||
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
|
PARAM_SELF_STRUCT_PROLOGUE(FBaseCVar);
|
||||||
|
@ -204,6 +212,18 @@ DEFINE_ACTION_FUNCTION(_CVar, GetString)
|
||||||
ACTION_RETURN_STRING(v.String);
|
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)
|
DEFINE_ACTION_FUNCTION(_CVar, SetInt)
|
||||||
{
|
{
|
||||||
// Only menus are allowed to change CVARs.
|
// Only menus are allowed to change CVARs.
|
||||||
|
|
|
@ -301,9 +301,11 @@ struct CVar native
|
||||||
|
|
||||||
native static CVar FindCVar(Name name);
|
native static CVar FindCVar(Name name);
|
||||||
native static CVar GetCVar(Name name, PlayerInfo player = null);
|
native static CVar GetCVar(Name name, PlayerInfo player = null);
|
||||||
|
native bool GetBool();
|
||||||
native int GetInt();
|
native int GetInt();
|
||||||
native double GetFloat();
|
native double GetFloat();
|
||||||
native String GetString();
|
native String GetString();
|
||||||
|
native void SetBool(bool b);
|
||||||
native void SetInt(int v);
|
native void SetInt(int v);
|
||||||
native void SetFloat(double v);
|
native void SetFloat(double v);
|
||||||
native void SetString(String s);
|
native void SetString(String s);
|
||||||
|
|
Loading…
Reference in a new issue