From: terencehill Date: Fri, 23 Feb 2018 19:05:58 +0000 (+0100) Subject: debug_text_3d_* macros: remove trailing semicolons, read cvars instead of autocvars... X-Git-Tag: xonotic-v0.8.5~2284 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4f7ec68c9a21f078e92d213813cc05ab36b49145;p=xonotic%2Fxonotic-data.pk3dir.git debug_text_3d_* macros: remove trailing semicolons, read cvars instead of autocvars (removing a hack and 5 globals) --- diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index cdba3af6e..e05d67fcd 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -445,19 +445,11 @@ NET_HANDLE(debug_text_3d, bool is_new) { #ifdef SVQC -AUTOCVAR(debug_text_3d_default_duration, float, 10, "Default duration for debug_text_3d()"); -AUTOCVAR(debug_text_3d_default_velocity, vector, '0 -10 0', "Default velocity for debug_text_3d() in screen coords (X and Y from top left)"); - -STATIC_INIT(debug_text_3d) { - // HACK: these cvars are only used in macros so they give unused warning unless the macros are expanded - autocvar_debug_text_3d_default_duration = autocvar_debug_text_3d_default_duration; - autocvar_debug_text_3d_default_velocity = autocvar_debug_text_3d_default_velocity; -} - +// can't use autocvars because they give unused warning unless the macros are expanded #define debug_text_3d(...) EVAL(OVERLOAD(debug_text_3d, __VA_ARGS__)) -#define debug_text_3d_2(pos, msg) debug_text_3d_3(pos, msg, autocvar_debug_text_3d_default_duration); -#define debug_text_3d_3(pos, msg, dur) debug_text_3d_4(pos, msg, dur, autocvar_debug_text_3d_default_velocity); -#define debug_text_3d_4(pos, msg, dur, vel) debug_text_3d_fn(pos, msg, dur, vel); +#define debug_text_3d_2(pos, msg) debug_text_3d_3(pos, msg, cvar("debug_text_3d_default_duration")) +#define debug_text_3d_3(pos, msg, dur) debug_text_3d_4(pos, msg, dur, stov(cvar_string("debug_text_3d_default_velocity"))) +#define debug_text_3d_4(pos, msg, dur, vel) debug_text_3d_fn(pos, msg, dur, vel) void debug_text_3d_fn(vector pos, string msg, float duration, vector velocity) { WriteHeader(MSG_BROADCAST, debug_text_3d); diff --git a/xonotic-server.cfg b/xonotic-server.cfg index d8310d5f7..dcd61c09c 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -469,8 +469,8 @@ set sv_accuracy_data_send 1 "1 send weapon accuracy data statistics and improved set _independent_players 0 "DO NOT TOUCH" set _notarget 0 "NO, REALLY, DON'T" -set debug_text_3d_default_duration 10 -set debug_text_3d_default_velocity "0 -10 0" +set debug_text_3d_default_duration 10 "Default duration for debug_text_3d()" +set debug_text_3d_default_velocity "0 -10 0" "Default velocity for debug_text_3d() in screen coords (X and Y from top left)" // otherwise, antilag breaks sv_gameplayfix_consistentplayerprethink 1