mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
add Cvar_Toggle
This commit is contained in:
parent
ecf4eabe9d
commit
d1bf75d218
1 changed files with 14 additions and 0 deletions
|
@ -57,8 +57,22 @@ bi_Cvar_GetCvarString (progs_t *pr)
|
||||||
RETURN_STRING (pr, Cvar_VariableString (varname));
|
RETURN_STRING (pr, Cvar_VariableString (varname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
bi_Cvar_Toggle (progs_t *pr)
|
||||||
|
{
|
||||||
|
const char *varname = P_GSTRING (pr, 0);
|
||||||
|
cvar_t *var;
|
||||||
|
|
||||||
|
var = Cvar_FindVar (varname);
|
||||||
|
if (!var)
|
||||||
|
var = Cvar_FindAlias (varname);
|
||||||
|
if (var)
|
||||||
|
Cvar_Set (var, var->int_val ? "0" : "1");
|
||||||
|
}
|
||||||
|
|
||||||
static builtin_t builtins[] = {
|
static builtin_t builtins[] = {
|
||||||
{"Cvar_GetCvarString", bi_Cvar_GetCvarString, -1},
|
{"Cvar_GetCvarString", bi_Cvar_GetCvarString, -1},
|
||||||
|
{"Cvar_Toggle", bi_Cvar_Toggle, -1},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue