2 #define COMPAT_NO_MOD_IS_XONOTIC
17 #include "compiler.qh"
19 #ifndef QCC_SUPPORT_INT
23 #ifndef QCC_SUPPORT_BOOL
27 #ifndef QCC_SUPPORT_ACCUMULATE
28 #warning "QCC does not support accumulate, may not compile correctly"
31 #define ACCUMULATE [[accumulate]]
34 #ifndef QCC_SUPPORT_ERASEABLE
37 #define ERASEABLE [[eraseable]]
40 #ifndef QCC_SUPPORT_ALIAS
41 #warning "QCC does not support alias, may not compile correctly"
44 #define ALIAS(var) [[alias(var)]]
47 #include <dpdefs/pre.qh>
50 #include <dpdefs/csprogsdefs.qh>
51 #include <dpdefs/keycodes.qh>
53 #include <server/sys-pre.qh>
54 #include <dpdefs/progsdefs.qh>
55 #include <dpdefs/dpextensions.qh>
56 #include <server/sys-post.qh>
58 #include <dpdefs/menudefs.qh>
59 #include <dpdefs/keycodes.qh>
62 #include <dpdefs/post.qh>
64 #ifndef QCC_SUPPORT_POW
65 #define pow(a, b) pow(a, b)
67 #define pow(a, b) ((a) ** (b))
72 #define USING(name, T) typedef T name
80 #define TC(T, sym) MACRO_BEGIN MACRO_END
82 #define TC(T, sym) MACRO_BEGIN \
84 LOG_WARNF("Type check failed: " #sym " :: " #T); \
91 #define is_float(this) (true || ftoe(this))
92 #define isnt_float(this)
93 #define is_vector(this) (true || vtos(this))
94 #define isnt_vector(this)
95 #define is_string(this) (true || stof(this))
96 #define isnt_string(this)
97 #define is_entity(this) (true || etof(this))
98 #define isnt_entity(this)
99 bool is_int(float this) { return this == floor(this); }
100 void isnt_int(float this) { print(ftos(this)); }
101 bool is_bool(float this) { return this == true || this == false; }
102 void isnt_bool(float this) { print(ftos(this)); }
105 #include "warpzone/mathlib.qc"
107 #include "accumulate.qh"
109 #include "arraylist.qh"
112 #include "counting.qh"
116 #include "enumclass.qh"
118 #include "functional.qh"
120 #include "intrusivelist.qh"
124 #include "linkedlist.qh"
127 #include "markdown.qh"
134 #include "p2mathlib.qc"
135 #include "progname.qh"
136 #include "promise.qc"
138 #include "registry.qh"
139 #include "registry_net.qh"
140 #include "replicate.qh"
141 #include "sortlist.qc"
143 #include "spawnfunc.qh"
155 #include "matrix/_mod.inc"
159 #define objerror_safe(e)
161 void make_safe_for_remove(entity this);
162 #define objerror_safe(e) make_safe_for_remove(e)
165 #define objerror(this, msg) MACRO_BEGIN \
166 LOG_WARN("======OBJECT ERROR======"); \
167 entity _e = (this); \
171 LOG_WARNF("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information", PROGNAME, __FUNC__, msg); \
176 void m_init() { if (_m_init) _m_init(); }
177 #define m_init _m_init
180 void m_shutdown() { if (_m_shutdown) _m_shutdown(); }
181 #define m_shutdown _m_shutdown
183 void _m_draw(float width, float height);
184 void m_draw(float width, float height) { if (_m_draw) _m_draw(width, height); }
185 #define m_draw _m_draw
187 void _m_keydown(int keynr, int ascii);
188 void m_keydown(int keynr, int ascii) { if (_m_keydown) _m_keydown(keynr, ascii); }
189 #define m_keydown _m_keydown
191 void _m_toggle(int mode);
192 void m_toggle(int mode) { if (_m_toggle) _m_toggle(mode); }
193 #define m_toggle _m_toggle
198 void main() { if (_main) _main(); }
202 void SV_Shutdown() { if (_SV_Shutdown) _SV_Shutdown(); }
203 #define SV_Shutdown _SV_Shutdown
206 bool _StartFrame_init;
207 void spawnfunc_worldspawn(entity);
209 if (!_StartFrame_init) {
210 _StartFrame_init = true;
211 float oldtime = time; time = 1;
212 __spawnfunc_expecting = 2; NULL.__spawnfunc_constructor(NULL);
215 if (_StartFrame) _StartFrame();
217 #define StartFrame _StartFrame
220 void SetNewParms() { if (_SetNewParms) _SetNewParms(); }
221 #define SetNewParms _SetNewParms
223 void _SetChangeParms(entity this);
224 void SetChangeParms() { ENGINE_EVENT(); if (_SetChangeParms) _SetChangeParms(this); }
225 #define SetChangeParms _SetChangeParms
227 #ifdef DP_EXT_PRECONNECT
228 void _ClientPreConnect(entity this);
229 void ClientPreConnect() { ENGINE_EVENT(); if (_ClientPreConnect) _ClientPreConnect(this); }
230 #define ClientPreConnect _ClientPreConnect
233 void _ClientConnect(entity this);
234 void ClientConnect() { ENGINE_EVENT(); if (_ClientConnect) _ClientConnect(this); }
235 #define ClientConnect _ClientConnect
237 void _ClientDisconnect(entity this);
238 void ClientDisconnect() { ENGINE_EVENT(); if (_ClientDisconnect) _ClientDisconnect(this); }
239 #define ClientDisconnect _ClientDisconnect
241 void _PutClientInServer(entity this);
242 void PutClientInServer() { ENGINE_EVENT(); if (_PutClientInServer) _PutClientInServer(this); }
243 #define PutClientInServer _PutClientInServer
245 void _ClientKill(entity this);
246 void ClientKill() { ENGINE_EVENT(); if (_ClientKill) _ClientKill(this); }
247 #define ClientKill _ClientKill
249 void _PlayerPreThink(entity this);
250 void PlayerPreThink() { ENGINE_EVENT(); if (_PlayerPreThink) _PlayerPreThink(this); }
251 #define PlayerPreThink _PlayerPreThink
253 void _PlayerPostThink(entity this);
254 void PlayerPostThink() { ENGINE_EVENT(); if (_PlayerPostThink) _PlayerPostThink(this); }
255 #define PlayerPostThink _PlayerPostThink
257 void _SV_PlayerPhysics(entity this);
258 void SV_PlayerPhysics() { ENGINE_EVENT(); if (_SV_PlayerPhysics) _SV_PlayerPhysics(this); }
259 #define SV_PlayerPhysics _SV_PlayerPhysics
261 void _SV_OnEntityPreSpawnFunction(entity this);
262 void SV_OnEntityPreSpawnFunction()
265 __spawnfunc_expecting = true;
266 __spawnfunc_expect = this;
268 #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction
270 void _SV_ChangeTeam(entity this, int _color);
271 void SV_ChangeTeam(int _color) { ENGINE_EVENT(); if (_SV_ChangeTeam) _SV_ChangeTeam(this, _color); }
272 #define SV_ChangeTeam _SV_ChangeTeam
274 void _SV_ParseClientCommand(entity this, string command);
275 void SV_ParseClientCommand(string command)
278 if (_SV_ParseClientCommand) _SV_ParseClientCommand(this, command);
280 #define SV_ParseClientCommand _SV_ParseClientCommand
285 void CSQC_Init() { if (_CSQC_Init) _CSQC_Init(); }
286 #define CSQC_Init _CSQC_Init
288 void _CSQC_Shutdown();
289 void CSQC_Shutdown() { if (_CSQC_Shutdown) _CSQC_Shutdown(); }
290 #define CSQC_Shutdown _CSQC_Shutdown
292 void _CSQC_UpdateView(entity this, float w, float h);
293 void CSQC_UpdateView(float w, float h) { ENGINE_EVENT(); if (_CSQC_UpdateView) _CSQC_UpdateView(this, w, h); }
294 #define CSQC_UpdateView _CSQC_UpdateView
296 bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary);
297 bool CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
299 return _CSQC_InputEvent ? _CSQC_InputEvent(inputType, nPrimary, nSecondary) : false;
301 #define CSQC_InputEvent _CSQC_InputEvent
303 bool _CSQC_ConsoleCommand(string s);
304 bool CSQC_ConsoleCommand(string s) { return _CSQC_ConsoleCommand ? _CSQC_ConsoleCommand(s) : false; }
305 #define CSQC_ConsoleCommand _CSQC_ConsoleCommand
307 void _CSQC_Ent_Update(entity this, bool isNew);
308 void CSQC_Ent_Update(bool isNew) { ENGINE_EVENT(); if (_CSQC_Ent_Update) _CSQC_Ent_Update(this, isNew); }
309 #define CSQC_Ent_Update _CSQC_Ent_Update
311 void _CSQC_Ent_Remove(entity this);
312 void CSQC_Ent_Remove() { ENGINE_EVENT(); if (_CSQC_Ent_Remove) _CSQC_Ent_Remove(this); }
313 #define CSQC_Ent_Remove _CSQC_Ent_Remove
319 #include <ecs/_mod.qh>