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) {
51 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) { \
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 ADD_DYNAMIC_LIGHT2(org, radius, lightcolours, style, cubemapname, pflags, forward, right, up) MACRO_BEGIN \
111 DEGLOB_LOG(DEGLOB_WRAPPED, "ADD_DYNAMIC_LIGHT2", #org, #radius, #lightcolours, #style, #cubemapname, #pflags); \
112 SET_V_GLOBALS(forward, right, up); \
113 _adddynamiclight2_hidden(org, radius, lightcolours, style, cubemapname, pflags); \
117#define VECTOR_VECTORS(forward_in, forward, right, up) MACRO_BEGIN \
118 DEGLOB_LOG(DEGLOB_WRAPPED, "VECTOR_VECTORS", #forward_in); \
119 _vectorvectors_hidden(forward_in); \
120 GET_V_GLOBALS(forward, right, up); \
125#define GET_TAG_INFO(ent, tagindex, forward, right, up, origin) MACRO_BEGIN \
126 DEGLOB_LOG(DEGLOB_WRAPPED, "GET_TAG_INFO", #ent, #tagindex); \
127 origin = _gettaginfo_hidden(ent, tagindex); \
128 GET_V_GLOBALS(forward, right, up); \
133#define makevectors(angles) MACRO_BEGIN \
134 DEGLOB_LOG(DEGLOB_ORIGINAL, "makevectors", #angles); \
135 _makevectors_hidden(angles); \
138#undef skel_get_boneabs
139#define skel_get_boneabs(skel, bonenum) ( \
140 deglob_log(DEGLOB_ORIGINAL, "skel_get_boneabs", __FILE__, __LINE__, __FUNC__, #skel ", " #bonenum), \
141 _skel_get_boneabs_hidden(skel, bonenum) \
145#define skel_set_bone(skel, bonenum, org) MACRO_BEGIN \
146 DEGLOB_LOG(DEGLOB_ORIGINAL, "skel_set_bone", #skel, #bonenum, #org); \
147 _skel_set_bone_hidden(skel, bonenum, org); \
150#undef adddynamiclight
151#define adddynamiclight(org, radius, lightcolours) MACRO_BEGIN \
152 DEGLOB_LOG(DEGLOB_ORIGINAL, "adddynamiclight", #org, #radius, #lightcolours); \
153 _adddynamiclight_hidden(org, radius, lightcolours); \
156#undef adddynamiclight2
157#define adddynamiclight2(org, radius, lightcolours, style, cubemapname, pflags) MACRO_BEGIN \
158 DEGLOB_LOG(DEGLOB_ORIGINAL, "adddynamiclight2", #org, #radius, #lightcolours, #style, #cubemapname, #pflags); \
159 _adddynamiclight2_hidden(org, radius, lightcolours, style, cubemapname, pflags); \
163#define gettaginfo(ent, tagindex) ( \
164 deglob_log(DEGLOB_ORIGINAL, "gettaginfo", __FILE__, __LINE__, __FUNC__, #ent ", " #tagindex), \
165 _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