]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/dpdefs/post.qh
Merge branch 'bones_was_here/lms_items' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / dpdefs / post.qh
index c33695e73b7a2559b87da66befe2da0c6fc25294..93ea3612b7cc50e1fc19547f767a0ce077554b04 100644 (file)
        #define NULL (RVALUE, world)
 #endif
 
-#include "lib/accumulate.qh"
-#include "lib/misc.qh"
-#include "lib/static.qh"
-#include "lib/vector.qh"
-
-//void(vector) _vectorvectors;
-
-#ifdef GAMEQC
-STATIC_INIT(globals) {
-       //_vectorvectors = vectorvectors;
-
-       // set to NaN to more easily detect uninitialized use
-       v_forward = VEC_NAN;
-       v_right = VEC_NAN;
-       v_up = VEC_NAN;
-}
-
-/// Same as the `makevectors` builtin but uses the provided locals instead of the `v_*` globals.
-/// Always use this instead of raw `makevectors` to make the data flow clear.
-/// It's 2018, they even teach that globals are bad at my uni... though for some reason they never explained why. Sigh.
-#define MAKEVECTORS(angles, forward, right, up) MACRO_BEGIN { \
-       makevectors(angles); \
-       forward = v_forward; \
-       right = v_right; \
-       up = v_up; \
-       v_forward = VEC_NAN; \
-       v_right = VEC_NAN; \
-       v_up = VEC_NAN; \
-} MACRO_END
-
-// Same as `MAKEVECTORS` but also creates the locals for convenience.
-#define MAKEVECTORS_NEW(angles, forward, right, up) \
-       vector forward = '0 0 0'; \
-       vector right = '0 0 0'; \
-       vector up = '0 0 0'; \
-       MAKEVECTORS(angles, forward, right, up);
-
-#define VECTOR_VECTORS(forward_in, forward, right, up) MACRO_BEGIN { \
-       vectorvectors_broken(forward_in); \
-       forward = v_forward; \
-       right = v_right; \
-       up = v_up; \
-       v_forward = VEC_NAN; \
-       v_right = VEC_NAN; \
-       v_up = VEC_NAN; \
-} MACRO_END
-
-#define VECTOR_VECTORS_NEW(forward_in, forward, right, up) \
-       vector forward = '0 0 0'; \
-       vector right = '0 0 0'; \
-       vector up = '0 0 0'; \
-       VECTOR_VECTORS(forward_in, forward, right, up);
-
-#define vectorvectors DO_NOT_USE_GLOBALS
-
-// FIXME find a good place for this
-// FIXME MAKE_VECTORS because current naming sucks
-// FIXME ban vectorvectors
-
-// TODO when raw makevectors and similar functions are not used anywhere else anymore,
-// assert that the global vectors are NaN before calling makevectors in MAKEVECTORS
-// to make sure nobody (even builtins) is accidentally using them - NaN is the most liekly value to expose values clearly
-// also uncomment these:
-//#define makevectors DO_NOT_USE_GLOBALS
-//#define v_forward DO_NOT_USE_GLOBALS
-//#define v_right DO_NOT_USE_GLOBALS
-//#define v_up DO_NOT_USE_GLOBALS
-// FIXME ^ won't work
-#endif
+// Shadow functions which use globals - see deglobalization.qh for details.
+#define makevectors DO_NOT_USE_GLOBALS_PREFER_MAKE_VECTORS_MACRO_INSTEAD
+#define aim DO_NOT_USE_GLOBALS
+#define makestatic DO_NOT_USE_GLOBALS
+#define skel_get_bonerel DO_NOT_USE_GLOBALS
+#define skel_get_boneabs DO_NOT_USE_GLOBALS_PREFER_SKEL_GET_BONE_ABS_MACRO_INSTEAD
+#define skel_set_bone DO_NOT_USE_GLOBALS_PREFER_SKEL_SET_BONE_MACRO_INSTEAD
+#define skel_mul_bone DO_NOT_USE_GLOBALS
+#define skel_mul_bones DO_NOT_USE_GLOBALS
+#define adddynamiclight DO_NOT_USE_GLOBALS_PREFER_ADD_DYNAMIC_LIGHT_MACRO_INSTEAD
+#define adddynamiclight2 DO_NOT_USE_GLOBALS
+#define vectorvectors DO_NOT_USE_GLOBALS_PREFER_VECTOR_VECTORS_MACRO_INSTEAD
+#define gettaginfo DO_NOT_USE_GLOBALS_PREFER_GET_TAG_INFO_MACRO_INSTEAD
+#define getentity DO_NOT_USE_GLOBALS
+#define getentityvec DO_NOT_USE_GLOBALS