Change REGISTER_CVAR macro
Remove manual initialization, remove string arguments to macro (convert to str inside it with #name)
This commit is contained in:
parent
e83dad0409
commit
67f4c5ed88
14
src/cvars.c
14
src/cvars.c
|
@ -12,13 +12,13 @@ DECL_CVAR(crosshair);
|
||||||
DECL_CVAR(clmove);
|
DECL_CVAR(clmove);
|
||||||
|
|
||||||
bool cvars_init(void) {
|
bool cvars_init(void) {
|
||||||
cv_bhop = REGISTER_CVAR("bhop", "1");
|
REGISTER_CVAR(bhop, 1);
|
||||||
cv_autostrafe = REGISTER_CVAR("autostrafe", "0");
|
REGISTER_CVAR(autostrafe, 0);
|
||||||
cv_aimbot = REGISTER_CVAR("aimbot", "1");
|
REGISTER_CVAR(aimbot, 1);
|
||||||
cv_esp = REGISTER_CVAR("esp", "3");
|
REGISTER_CVAR(esp, 3);
|
||||||
cv_chams = REGISTER_CVAR("chams", "1");
|
REGISTER_CVAR(chams, 1);
|
||||||
cv_crosshair = REGISTER_CVAR("crosshair", "0");
|
REGISTER_CVAR(crosshair, 0);
|
||||||
cv_clmove = REGISTER_CVAR("clmove", "0");
|
REGISTER_CVAR(clmove, 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
#define DECL_CVAR_EXTERN(name) extern cvar_t* cv_##name;
|
#define DECL_CVAR_EXTERN(name) extern cvar_t* cv_##name;
|
||||||
|
|
||||||
#define REGISTER_CVAR(name, value) \
|
#define REGISTER_CVAR(name, value) \
|
||||||
i_engine->pfnRegisterVariable(CVAR_PREFIX name, value, CVAR_HACK_ID);
|
cv_##name = \
|
||||||
|
i_engine->pfnRegisterVariable(CVAR_PREFIX #name, #value, CVAR_HACK_ID);
|
||||||
|
|
||||||
#define CVAR_ON(name) (cv_##name->value != 0.0f)
|
#define CVAR_ON(name) (cv_##name->value != 0.0f)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue