Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
_all.inc
Go to the documentation of this file.
1#ifndef NOCOMPAT
2 #define COMPAT_NO_MOD_IS_XONOTIC
3#endif
4
5#ifdef CSQC
6#define IS_CSQC 1
7#else
8#define IS_CSQC 0
9#endif
10
11#ifdef SVQC
12#define IS_SVQC 1
13#else
14#define IS_SVQC 0
15#endif
16
17#include "compiler.qh"
18
19#ifndef QCC_SUPPORT_INT
20 #define int float
21#endif
22
23#ifndef QCC_SUPPORT_BOOL
24 #define bool float
25#endif
26
27#ifndef QCC_SUPPORT_ACCUMULATE
28 #warning "QCC does not support accumulate, may not compile correctly"
29 #define ACCUMULATE
30#else
31 #define ACCUMULATE [[accumulate]]
32#endif
33
34#ifndef QCC_SUPPORT_ERASEABLE
35 #define ERASEABLE
36#else
37 #define ERASEABLE [[eraseable]]
38#endif
39
40#ifndef QCC_SUPPORT_ALIAS
41 #warning "QCC does not support alias, may not compile correctly"
42 #define ALIAS(var)
43#else
44 #define ALIAS(var) [[alias(var)]]
45#endif
46
47#include <dpdefs/pre.qh>
48
49#ifdef CSQC
50 #include <dpdefs/csprogsdefs.qh>
51 #include <dpdefs/keycodes.qh>
52#elifdef SVQC
53 #include <server/sys-pre.qh>
54 #include <dpdefs/progsdefs.qh>
55 #include <dpdefs/dpextensions.qh>
56 #include <server/sys-post.qh>
57#elifdef MENUQC
58 #include <dpdefs/menudefs.qh>
59 #include <dpdefs/keycodes.qh>
60#endif
61
62#include <dpdefs/post.qh>
63
64#ifndef QCC_SUPPORT_POW
65 #define pow(a, b) pow(a, b)
66#else
67 #define pow(a, b) ((a) ** (b))
68#endif
69
70#include "self.qh"
71
72#define USING(name, T) typedef T name
73
74#include "bool.qh"
75#include "int.qh"
76
77#include "macro.qh"
78
79#if NDEBUG
80 #define TC(T, sym) MACRO_BEGIN MACRO_END
81#else
82 #define TC(T, sym) MACRO_BEGIN \
83 if (!is_##T(sym)) \
84 { \
85 LOG_WARNF("Type check failed: " #sym " :: " #T); \
86 isnt_##T(sym); \
87 } \
88 MACRO_END
89#endif
90
91#if !(NDEBUG)
92 #define is_float(this) (true || ftoe(this))
93 #define isnt_float(this)
94 #define is_vector(this) (true || vtos(this))
95 #define isnt_vector(this)
96 #define is_string(this) (true || stof(this))
97 #define isnt_string(this)
98 #define is_entity(this) (true || etof(this))
99 #define isnt_entity(this)
100 bool is_int(float this) { return this == floor(this); }
101 void isnt_int(float this) { print(ftos(this)); }
102 bool is_bool(float this) { return this == true || this == false; }
103 void isnt_bool(float this) { print(ftos(this)); }
104#endif
105
106#include "warpzone/mathlib.qc"
107
108// needs to be included before any of the functions which use globals are called
109#include "deglobalization.qh"
110
111#include "accumulate.qh"
112#include "angle.qc"
113#include "arraylist.qh"
114#include "bits.qh"
115#include "color.qh"
116#include "counting.qh"
117#include "cvar.qh"
118#include "defer.qh"
119#include "draw.qh"
120#include "enumclass.qh"
121#include "file.qh"
122#include "float.qh"
123#include "functional.qh"
124#include "i18n.qh"
125#include "intrusivelist.qh"
126#include "iter.qh"
127#include "json.qc"
128#include "lazy.qh"
129#include "linkedlist.qh"
130#include "log.qh"
131#include "map.qh"
132#include "markdown.qh"
133#include "math.qh"
134#include "misc.qh"
135#include "net.qh"
136#include "nil.qh"
137#include "noise.qh"
138#include "oo.qh"
139#include "p2mathlib.qc"
140#include "progname.qh"
141#include "promise.qc"
142#include "random.qc"
143#include "registry.qh"
144#include "registry_net.qh"
145#include "replicate.qh"
146#include "sortlist.qc"
147#include "sort.qh"
148#include "spawnfunc.qh"
149#include "static.qh"
150#include "stats.qh"
151#include "string.qh"
152#include "struct.qh"
153#include "test.qc"
154#include "unsafe.qh"
155#include "urllib.qc"
156#include "vector.qh"
157#include "yenc.qh"
158
159#if XONOTIC
160 #include "matrix/_mod.inc"
161#endif
162
163#ifndef SVQC
164#define objerror_safe(e)
165#else
167 #define objerror_safe(e) make_safe_for_remove(e)
168#endif
169
170#define objerror(this, msg) MACRO_BEGIN \
171 LOG_WARN("======OBJECT ERROR======"); \
172 entity _e = (this); \
173 eprint(_e); \
174 objerror_safe(_e); \
175 delete(_e); \
176 LOG_WARNF("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information", PROGNAME, __FUNC__, msg); \
177MACRO_END
178
179#ifdef MENUQC
180 void _m_init();
181 void m_init() { if (_m_init) _m_init(); }
182 #define m_init _m_init
183
186 #define m_shutdown _m_shutdown
187
188 void _m_draw(float width, float height);
189 void m_draw(float width, float height) { if (_m_draw) _m_draw(width, height); }
190 #define m_draw _m_draw
191
192 void _m_keydown(int keynr, int ascii);
193 void m_keydown(int keynr, int ascii) { if (_m_keydown) _m_keydown(keynr, ascii); }
194 #define m_keydown _m_keydown
195
196 void _m_toggle(int mode);
197 void m_toggle(int mode) { if (_m_toggle) _m_toggle(mode); }
198 #define m_toggle _m_toggle
199#endif
200
201#ifdef SVQC
202 void _main();
203 void main() { if (_main) _main(); }
204 #define main _main
205
208 #define SV_Shutdown _SV_Shutdown
209
214 {
215 if (!_StartFrame_init)
216 {
217 _StartFrame_init = true;
218 float oldtime = time; time = 1;
219 __spawnfunc_expecting = 2; NULL.__spawnfunc_constructor(NULL);
220 time = oldtime;
221 }
222 if (_StartFrame)
223 _StartFrame();
224 }
225 #define StartFrame _StartFrame
226
229 #define SetNewParms _SetNewParms
230
233 #define SetChangeParms _SetChangeParms
234
235#ifdef DP_EXT_PRECONNECT
236 void _ClientPreConnect(entity this);
237 void ClientPreConnect() { ENGINE_EVENT(); if (_ClientPreConnect) _ClientPreConnect(this); }
238 #define ClientPreConnect _ClientPreConnect
239#endif
240
243 #define ClientConnect _ClientConnect
244
247 #define ClientDisconnect _ClientDisconnect
248
251 #define PutClientInServer _PutClientInServer
252
253 void _ClientKill(entity this);
255 #define ClientKill _ClientKill
256
259 #define PlayerPreThink _PlayerPreThink
260
263 #define PlayerPostThink _PlayerPostThink
264
267 #define SV_PlayerPhysics _SV_PlayerPhysics
268
271 {
272 ENGINE_EVENT();
274 __spawnfunc_expect = this;
275 }
276 #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction
277
278 void _SV_ChangeTeam(entity this, int _color);
279 void SV_ChangeTeam(int _color) { ENGINE_EVENT(); if (_SV_ChangeTeam) _SV_ChangeTeam(this, _color); }
280 #define SV_ChangeTeam _SV_ChangeTeam
281
282 void _SV_ParseClientCommand(entity this, string command);
283 void SV_ParseClientCommand(string command)
284 {
285 ENGINE_EVENT();
287 _SV_ParseClientCommand(this, command);
288 }
289 #define SV_ParseClientCommand _SV_ParseClientCommand
290#endif
291
292#ifdef CSQC
293 void _CSQC_Init(float apilevel, string enginename, float engineversion);
294 void CSQC_Init(float apilevel, string enginename, float engineversion) { if (_CSQC_Init) _CSQC_Init(apilevel, enginename, engineversion); }
295 #define CSQC_Init _CSQC_Init
296
299 #define CSQC_Shutdown _CSQC_Shutdown
300
301 void _CSQC_UpdateView(entity this, float w, float h, bool notmenu);
302 void CSQC_UpdateView(float w, float h, bool notmenu) { ENGINE_EVENT(); if (_CSQC_UpdateView) _CSQC_UpdateView(this, w, h, notmenu); }
303 #define CSQC_UpdateView _CSQC_UpdateView
304
305 bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary);
306 bool CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
307 {
308 return _CSQC_InputEvent ? _CSQC_InputEvent(inputType, nPrimary, nSecondary) : false;
309 }
310 #define CSQC_InputEvent _CSQC_InputEvent
311
312 bool _CSQC_ConsoleCommand(string s);
313 bool CSQC_ConsoleCommand(string s) { return _CSQC_ConsoleCommand ? _CSQC_ConsoleCommand(s) : false; }
314 #define CSQC_ConsoleCommand _CSQC_ConsoleCommand
315
316 void _CSQC_Ent_Update(entity this, bool isNew);
317 void CSQC_Ent_Update(bool isNew) { ENGINE_EVENT(); if (_CSQC_Ent_Update) _CSQC_Ent_Update(this, isNew); }
318 #define CSQC_Ent_Update _CSQC_Ent_Update
319
322 #define CSQC_Ent_Remove _CSQC_Ent_Remove
323#endif
324#undef ENGINE_EVENT
325
326#if XONOTIC
327#ifdef GAMEQC
328 #include <ecs/_mod.qh>
329#endif
330#endif
float height
Definition bobbing.qc:3
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float time
void isnt_bool(float this)
Definition _all.inc:103
void _CSQC_Ent_Remove(entity this)
#define SV_Shutdown
Definition _all.inc:207
void _CSQC_Init(float apilevel, string enginename, float engineversion)
#define m_keydown
Definition _all.inc:194
#define PlayerPostThink
Definition _all.inc:262
void _StartFrame()
#define CSQC_Init
Definition _all.inc:295
void _ClientConnect(entity this)
void _PlayerPreThink(entity this)
#define ClientConnect
Definition _all.inc:242
void _ClientDisconnect(entity this)
#define CSQC_Shutdown
Definition _all.inc:298
#define main
Definition _all.inc:203
void _SetChangeParms(entity this)
void _CSQC_UpdateView(entity this, float w, float h, bool notmenu)
bool is_int(float this)
Definition _all.inc:100
void _m_keydown(int keynr, int ascii)
void _PutClientInServer(entity this)
void _SV_Shutdown()
void _SV_ChangeTeam(entity this, int _color)
void _SV_OnEntityPreSpawnFunction(entity this)
void _ClientKill(entity this)
#define StartFrame
Definition _all.inc:213
void isnt_int(float this)
Definition _all.inc:101
#define m_draw
Definition _all.inc:190
#define ClientKill
Definition _all.inc:254
void _PlayerPostThink(entity this)
#define m_toggle
Definition _all.inc:198
void _SV_ParseClientCommand(entity this, string command)
#define SV_OnEntityPreSpawnFunction
Definition _all.inc:270
void _CSQC_Shutdown()
#define CSQC_InputEvent
Definition _all.inc:310
#define PlayerPreThink
Definition _all.inc:258
void _m_draw(float width, float height)
#define CSQC_ConsoleCommand
Definition _all.inc:314
#define SV_ParseClientCommand
Definition _all.inc:289
void _main()
#define SV_ChangeTeam
Definition _all.inc:280
bool is_bool(float this)
Definition _all.inc:102
void make_safe_for_remove(entity this)
Definition main.qc:238
#define CSQC_UpdateView
Definition _all.inc:303
#define SetChangeParms
Definition _all.inc:232
#define CSQC_Ent_Remove
Definition _all.inc:321
#define PutClientInServer
Definition _all.inc:250
#define m_init
Definition _all.inc:181
#define ClientDisconnect
Definition _all.inc:246
void _SetNewParms()
#define m_shutdown
Definition _all.inc:185
void _m_shutdown()
void _SV_PlayerPhysics(entity this)
void _m_init()
void spawnfunc_worldspawn(entity)
bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
#define CSQC_Ent_Update
Definition _all.inc:318
#define SV_PlayerPhysics
Definition _all.inc:266
#define SetNewParms
Definition _all.inc:228
void _CSQC_Ent_Update(entity this, bool isNew)
bool _StartFrame_init
Definition _all.inc:211
void _m_toggle(int mode)
bool _CSQC_ConsoleCommand(string s)
string ftos(float f)
void print(string text,...)
float floor(float f)
#define NULL
Definition post.qh:14
#define ENGINE_EVENT()
Definition self.qh:26
noref entity __spawnfunc_expect
Definition spawnfunc.qh:39
noref int __spawnfunc_expecting
Definition spawnfunc.qh:38