From: terencehill Date: Sat, 27 May 2017 16:23:23 +0000 (+0200) Subject: Document vec2, AUTOCVAR and AUTOCVAR_SAVE usage, which isn't very intuitive for every... X-Git-Tag: xonotic-v0.8.5~2699^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ae57b1a7607d2dd52a2ef023e5a71be269edb207;p=xonotic%2Fxonotic-data.pk3dir.git Document vec2, AUTOCVAR and AUTOCVAR_SAVE usage, which isn't very intuitive for everybody by reading the implementation --- diff --git a/qcsrc/lib/cvar.qh b/qcsrc/lib/cvar.qh index adcb7dfee..666e14ab9 100644 --- a/qcsrc/lib/cvar.qh +++ b/qcsrc/lib/cvar.qh @@ -73,6 +73,12 @@ const noref vector default_vector = '0 0 0'; #define repr_cvar_string(x) (x) #define repr_cvar_vector(x) (sprintf("%v", x)) +//pseudo prototypes: +// void AUTOCVAR(, , default_cvar_value, string desc) +// void AUTOCVAR_SAVE(, , default_cvar_value, string desc) +// where default_cvar_value has type +// e.g.: AUTOCVAR(mycvar, float, 2.5, "cvar description") + #define __AUTOCVAR(file, archive, var, type, desc, default) \ [[accumulate]] void RegisterCvars(void(string, string, string, bool, string) f) \ { \ diff --git a/qcsrc/lib/vector.qh b/qcsrc/lib/vector.qh index 151d788c0..6c32e4312 100644 --- a/qcsrc/lib/vector.qh +++ b/qcsrc/lib/vector.qh @@ -93,6 +93,10 @@ float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs) { ret up = v_up; \ } MACRO_END +//pseudo prototypes: +// vector vec2(vector v); // returns a vector with just the x and y components of the given vector +// vector vec2(float x, float y); // returns a vector with the given x and y components + noref vector _vec2; #define vec2(...) EVAL(OVERLOAD(vec2, __VA_ARGS__)) #define vec2_1(v) (_vec2 = (v), _vec2.z = 0, _vec2)