From ae57b1a7607d2dd52a2ef023e5a71be269edb207 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 27 May 2017 18:23:23 +0200 Subject: [PATCH] Document vec2, AUTOCVAR and AUTOCVAR_SAVE usage, which isn't very intuitive for everybody by reading the implementation --- qcsrc/lib/cvar.qh | 6 ++++++ qcsrc/lib/vector.qh | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/qcsrc/lib/cvar.qh b/qcsrc/lib/cvar.qh index adcb7dfee0..666e14ab93 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 151d788c06..6c32e4312d 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) -- 2.39.2