From: TimePath Date: Sun, 30 Aug 2015 05:40:14 +0000 (+1000) Subject: AUTOCVAR macro: don't archive by default X-Git-Tag: xonotic-v0.8.2~1983 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=765e8ee2512aedc44a69a6ca08314b1cf69aaf78;p=xonotic%2Fxonotic-data.pk3dir.git AUTOCVAR macro: don't archive by default --- diff --git a/qcsrc/common/mutators/mutator/damagetext.qc b/qcsrc/common/mutators/mutator/damagetext.qc index 23301fe94..eec2d356b 100644 --- a/qcsrc/common/mutators/mutator/damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext.qc @@ -1,15 +1,15 @@ REGISTER_MUTATOR(damagetext, true); #if defined(CSQC) || defined(MENUQC) -AUTOCVAR(cl_damagetext, bool, false, _("Draw damage dealt. 0: disabled, 1: enabled")); -AUTOCVAR(cl_damagetext_format, string, "-%3$d", _("How to format the damage text. 1$ is health, 2$ is armor, 3$ is both")); -AUTOCVAR(cl_damagetext_color, vector, '1 1 0', _("Default damage text color")); -AUTOCVAR(cl_damagetext_size, float, 8, _("Damage text font size")); -AUTOCVAR(cl_damagetext_alpha_start, float, 1, _("Damage text initial alpha")); -AUTOCVAR(cl_damagetext_alpha_lifetime, float, 3, _("Damage text lifetime in seconds")); -AUTOCVAR(cl_damagetext_velocity, vector, '0 0 20', _("Damage text move direction")); -AUTOCVAR(cl_damagetext_offset, vector, '0 -40 0', _("Damage text offset")); -AUTOCVAR(cl_damagetext_accumulate_range, float, 30, _("Damage text spawned within this range is accumulated")); +AUTOCVAR_SAVE(cl_damagetext, bool, false, _("Draw damage dealt. 0: disabled, 1: enabled")); +AUTOCVAR_SAVE(cl_damagetext_format, string, "-%3$d", _("How to format the damage text. 1$ is health, 2$ is armor, 3$ is both")); +AUTOCVAR_SAVE(cl_damagetext_color, vector, '1 1 0', _("Default damage text color")); +AUTOCVAR_SAVE(cl_damagetext_size, float, 8, _("Damage text font size")); +AUTOCVAR_SAVE(cl_damagetext_alpha_start, float, 1, _("Damage text initial alpha")); +AUTOCVAR_SAVE(cl_damagetext_alpha_lifetime, float, 3, _("Damage text lifetime in seconds")); +AUTOCVAR_SAVE(cl_damagetext_velocity, vector, '0 0 20', _("Damage text move direction")); +AUTOCVAR_SAVE(cl_damagetext_offset, vector, '0 -40 0', _("Damage text offset")); +AUTOCVAR_SAVE(cl_damagetext_accumulate_range, float, 30, _("Damage text spawned within this range is accumulated")); #endif #ifdef CSQC @@ -56,10 +56,7 @@ ENDCLASS(DamageText) #endif #ifdef SVQC -int autocvar_sv_damagetext = 2; -STATIC_INIT(sv_damagetext) { - CVAR_DESCRIBE(sv_damagetext, _("<= 0: disabled, >= 1: spectators, >= 2: players, >= 3: all players")); -} +AUTOCVAR(sv_damagetext, int, 2, _("<= 0: disabled, >= 1: spectators, >= 2: players, >= 3: all players")); #define SV_DAMAGETEXT_DISABLED() (autocvar_sv_damagetext <= 0 /* disabled */) #define SV_DAMAGETEXT_SPECTATORS_ONLY() (autocvar_sv_damagetext >= 1 /* spectators only */) #define SV_DAMAGETEXT_PLAYERS() (autocvar_sv_damagetext >= 2 /* players */) diff --git a/qcsrc/lib/Cvar.qh b/qcsrc/lib/Cvar.qh index 210a84c0c..5eeafddce 100644 --- a/qcsrc/lib/Cvar.qh +++ b/qcsrc/lib/Cvar.qh @@ -1,13 +1,15 @@ #ifndef CVAR_H #define CVAR_H -#define CVAR_DESCRIBE(var, desc) localcmd(sprintf("\nseta %1$s \"$%1$s\" \"%2$s\"\n", #var, desc)) +#define CVAR_DESCRIBE(set, var, desc) localcmd(sprintf("\n"set" %1$s \"$%1$s\" \"%2$s\"\n", #var, desc)) -#define AUTOCVAR_3(var, type, desc) \ - STATIC_INIT(autocvar_##var) { CVAR_DESCRIBE(var, desc); } \ +#define AUTOCVAR_4(set, var, type, desc) \ + STATIC_INIT(autocvar_##var) { CVAR_DESCRIBE(set, var, desc); } \ type autocvar_##var -#define AUTOCVAR_4(var, type, default, desc) \ - AUTOCVAR_3(var, type, desc) = default -#define AUTOCVAR(...) OVERLOAD(AUTOCVAR, __VA_ARGS__) +#define AUTOCVAR_5(set, var, type, default, desc) \ + AUTOCVAR_4(set, var, type, desc) = default +#define _AUTOCVAR(...) OVERLOAD(AUTOCVAR, __VA_ARGS__) +#define AUTOCVAR_SAVE(...) _AUTOCVAR("seta", __VA_ARGS__) +#define AUTOCVAR(...) _AUTOCVAR("set", __VA_ARGS__) #endif