34 #ifdef GAMEQC // menu doesn't use any globals 37 #define DEGLOB_LOGGING 1 38 #define DEGLOB_CLEAR 1 40 const int DEGLOB_ORIGINAL = 1;
41 const int DEGLOB_WRAPPED = 2;
43 int autocvar_debug_deglobalization_logging = 0;
46 #define DEGLOB_LOG(kind, name, ...) deglob_log(kind, name, __FILE__, __LINE__, __FUNC__, #__VA_ARGS__) 50 void deglob_log(
int kind,
string name,
string file,
int line,
string func,
string more_text) {
51 if (autocvar_debug_deglobalization_logging & kind) {
52 LOG_INFOF(
"%s %f %s %s:%d:%s args: %s", PROGNAME,
time, name, file, line, func, more_text);
56 #define DEGLOB_LOG(kind, name, ...) 57 void deglob_log(
int kind,
string name,
string file,
int line,
string func,
string more_text) {}
61 #define GET_V_GLOBALS(forward, right, up) MACRO_BEGIN forward = v_forward; right = v_right; up = v_up; MACRO_END 62 #define SET_V_GLOBALS(forward, right, up) MACRO_BEGIN v_forward = forward; v_right = right; v_up = up; MACRO_END 64 bool autocvar_debug_deglobalization_clear =
true;
65 #define CLEAR_V_GLOBALS() MACRO_BEGIN \ 66 if (autocvar_debug_deglobalization_clear) { \ 67 v_forward = VEC_NAN; v_right = VEC_NAN; v_up = VEC_NAN \ 75 #define CLEAR_V_GLOBALS() 81 #define MAKE_VECTORS(angles, forward, right, up) MACRO_BEGIN \ 82 DEGLOB_LOG(DEGLOB_WRAPPED, "MAKE_VECTORS", #angles); \ 83 _makevectors_hidden(angles); \ 84 GET_V_GLOBALS(forward, right, up); \ 89 #define SKEL_GET_BONE_ABS(skel, bonenum, forward, right, up, origin) MACRO_BEGIN \ 90 DEGLOB_LOG(DEGLOB_WRAPPED, "SKEL_GET_BONE_ABS", #skel, #bonenum); \ 91 origin = _skel_get_boneabs_hidden(skel, bonenum) \ 92 GET_V_GLOBALS(forward, right, up); \ 96 #define SKEL_SET_BONE(skel, bonenum, org, forward, right, up) MACRO_BEGIN \ 97 DEGLOB_LOG(DEGLOB_WRAPPED, "SKEL_SET_BONE", #skel, #bonenum, #org); \ 98 SET_V_GLOBALS(forward, right, up); \ 99 _skel_set_bone_hidden(skel, bonenum, org); \ 103 #define ADD_DYNAMIC_LIGHT(org, radius, lightcolours, forward, right, up) MACRO_BEGIN \ 104 DEGLOB_LOG(DEGLOB_WRAPPED, "ADD_DYNAMIC_LIGHT", #org, #radius, #lightcolours); \ 105 SET_V_GLOBALS(forward, right, up); \ 106 _adddynamiclight_hidden(org, radius, lightcolours); \ 110 #define VECTOR_VECTORS(forward_in, forward, right, up) MACRO_BEGIN \ 111 DEGLOB_LOG(DEGLOB_WRAPPED, "VECTOR_VECTORS", #forward_in); \ 112 _vectorvectors_hidden(forward_in); \ 113 GET_V_GLOBALS(forward, right, up); \ 118 #define GET_TAG_INFO(ent, tagindex, forward, right, up, origin) MACRO_BEGIN \ 119 DEGLOB_LOG(DEGLOB_WRAPPED, "GET_TAG_INFO", #ent, #tagindex); \ 120 origin = _gettaginfo_hidden(ent, tagindex); \ 121 GET_V_GLOBALS(forward, right, up); \ 126 #define makevectors(angles) MACRO_BEGIN \ 127 DEGLOB_LOG(DEGLOB_ORIGINAL, "makevectors", #angles); \ 128 _makevectors_hidden(angles); \ 131 #undef skel_get_boneabs 132 #define skel_get_boneabs(skel, bonenum) ( \ 133 deglob_log(DEGLOB_ORIGINAL, "skel_get_boneabs", __FILE__, __LINE__, __FUNC__, #skel ", " #bonenum), \ 134 _skel_get_boneabs_hidden(skel, bonenum) \ 138 #define skel_set_bone(skel, bonenum, org) MACRO_BEGIN \ 139 DEGLOB_LOG(DEGLOB_ORIGINAL, "skel_set_bone", #skel, #bonenum, #org); \ 140 _skel_set_bone_hidden(skel, bonenum, org); \ 143 #undef adddynamiclight 144 #define adddynamiclight(org, radius, lightcolours) MACRO_BEGIN \ 145 DEGLOB_LOG(DEGLOB_ORIGINAL, "adddynamiclight", #org, #radius, #lightcolours); \ 146 _adddynamiclight_hidden(org, radius, lightcolours); \ 150 #define gettaginfo(ent, tagindex) ( \ 151 deglob_log(DEGLOB_ORIGINAL, "gettaginfo", __FILE__, __LINE__, __FUNC__, #ent ", " #tagindex), \ 152 _gettaginfo_hidden(ent, tagindex) \
#define STATIC_INIT(func)
during worldspawn