37#define DEGLOB_LOGGING 1
43int autocvar_debug_deglobalization_logging = 0;
46#define DEGLOB_LOG(kind, name, ...) deglob_log(kind, name, __FILE__, __LINE__, __FUNC__, #__VA_ARGS__)
50void deglob_log(
int kind,
string name,
string file,
int line,
string func,
string more_text)
52 if (autocvar_debug_deglobalization_logging & kind)
56#define DEGLOB_LOG(kind, name, ...)
57void 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
64bool autocvar_debug_deglobalization_clear =
true;
65#define CLEAR_V_GLOBALS() MACRO_BEGIN \
66 if (autocvar_debug_deglobalization_clear) \
68 v_forward = VEC_NAN; \
79#define CLEAR_V_GLOBALS()
85#define MAKE_VECTORS(angles, forward, right, up) MACRO_BEGIN \
86 DEGLOB_LOG(DEGLOB_WRAPPED, "MAKE_VECTORS", #angles); \
87 _makevectors_hidden(angles); \
88 GET_V_GLOBALS(forward, right, up); \
93#define SKEL_GET_BONE_ABS(skel, bonenum, forward, right, up, origin) MACRO_BEGIN \
94 DEGLOB_LOG(DEGLOB_WRAPPED, "SKEL_GET_BONE_ABS", #skel, #bonenum); \
95 origin = _skel_get_boneabs_hidden(skel, bonenum) \
96 GET_V_GLOBALS(forward, right, up); \
100#define SKEL_SET_BONE(skel, bonenum, org, forward, right, up) MACRO_BEGIN \
101 DEGLOB_LOG(DEGLOB_WRAPPED, "SKEL_SET_BONE", #skel, #bonenum, #org); \
102 SET_V_GLOBALS(forward, right, up); \
103 _skel_set_bone_hidden(skel, bonenum, org); \
107#define ADD_DYNAMIC_LIGHT(org, radius, lightcolours, forward, right, up) MACRO_BEGIN \
108 DEGLOB_LOG(DEGLOB_WRAPPED, "ADD_DYNAMIC_LIGHT", #org, #radius, #lightcolours); \
109 SET_V_GLOBALS(forward, right, up); \
110 _adddynamiclight_hidden(org, radius, lightcolours); \
114#define ADD_DYNAMIC_LIGHT2(org, radius, lightcolours, style, cubemapname, pflags, forward, right, up) MACRO_BEGIN \
115 DEGLOB_LOG(DEGLOB_WRAPPED, "ADD_DYNAMIC_LIGHT2", #org, #radius, #lightcolours, #style, #cubemapname, #pflags); \
116 SET_V_GLOBALS(forward, right, up); \
117 _adddynamiclight2_hidden(org, radius, lightcolours, style, cubemapname, pflags); \
121#define VECTOR_VECTORS(forward_in, forward, right, up) MACRO_BEGIN \
122 DEGLOB_LOG(DEGLOB_WRAPPED, "VECTOR_VECTORS", #forward_in); \
123 _vectorvectors_hidden(forward_in); \
124 GET_V_GLOBALS(forward, right, up); \
129#define GET_TAG_INFO(ent, tagindex, forward, right, up, origin) MACRO_BEGIN \
130 DEGLOB_LOG(DEGLOB_WRAPPED, "GET_TAG_INFO", #ent, #tagindex); \
131 origin = _gettaginfo_hidden(ent, tagindex); \
132 GET_V_GLOBALS(forward, right, up); \
137#define makevectors(angles) MACRO_BEGIN \
138 DEGLOB_LOG(DEGLOB_ORIGINAL, "makevectors", #angles); \
139 _makevectors_hidden(angles); \
142#undef skel_get_boneabs
143#define skel_get_boneabs(skel, bonenum) ( \
144 deglob_log(DEGLOB_ORIGINAL, "skel_get_boneabs", __FILE__, __LINE__, __FUNC__, #skel ", " #bonenum), \
145 _skel_get_boneabs_hidden(skel, bonenum) \
149#define skel_set_bone(skel, bonenum, org) MACRO_BEGIN \
150 DEGLOB_LOG(DEGLOB_ORIGINAL, "skel_set_bone", #skel, #bonenum, #org); \
151 _skel_set_bone_hidden(skel, bonenum, org); \
154#undef adddynamiclight
155#define adddynamiclight(org, radius, lightcolours) MACRO_BEGIN \
156 DEGLOB_LOG(DEGLOB_ORIGINAL, "adddynamiclight", #org, #radius, #lightcolours); \
157 _adddynamiclight_hidden(org, radius, lightcolours); \
160#undef adddynamiclight2
161#define adddynamiclight2(org, radius, lightcolours, style, cubemapname, pflags) MACRO_BEGIN \
162 DEGLOB_LOG(DEGLOB_ORIGINAL, "adddynamiclight2", #org, #radius, #lightcolours, #style, #cubemapname, #pflags); \
163 _adddynamiclight2_hidden(org, radius, lightcolours, style, cubemapname, pflags); \
167#define gettaginfo(ent, tagindex) ( \
168 deglob_log(DEGLOB_ORIGINAL, "gettaginfo", __FILE__, __LINE__, __FUNC__, #ent ", " #tagindex), \
169 _gettaginfo_hidden(ent, tagindex) \
#define CLEAR_V_GLOBALS()
void deglob_log(int kind, string name, string file, int line, string func, string more_text)
const int DEGLOB_ORIGINAL
#define STATIC_INIT(func)
during worldspawn