Change REGISTER_CVAR macro

Remove manual initialization, remove string arguments to macro (convert
to str inside it with #name)
This commit is contained in:
8dcc 2023-07-29 16:27:01 +02:00
parent e83dad0409
commit 67f4c5ed88
2 changed files with 9 additions and 8 deletions

View File

@ -12,13 +12,13 @@ DECL_CVAR(crosshair);
DECL_CVAR(clmove);
bool cvars_init(void) {
cv_bhop = REGISTER_CVAR("bhop", "1");
cv_autostrafe = REGISTER_CVAR("autostrafe", "0");
cv_aimbot = REGISTER_CVAR("aimbot", "1");
cv_esp = REGISTER_CVAR("esp", "3");
cv_chams = REGISTER_CVAR("chams", "1");
cv_crosshair = REGISTER_CVAR("crosshair", "0");
cv_clmove = REGISTER_CVAR("clmove", "0");
REGISTER_CVAR(bhop, 1);
REGISTER_CVAR(autostrafe, 0);
REGISTER_CVAR(aimbot, 1);
REGISTER_CVAR(esp, 3);
REGISTER_CVAR(chams, 1);
REGISTER_CVAR(crosshair, 0);
REGISTER_CVAR(clmove, 0);
return true;
}

View File

@ -23,7 +23,8 @@
#define DECL_CVAR_EXTERN(name) extern cvar_t* cv_##name;
#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)