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 string _msg = msg; /* evaluating it may require reading a field of the entity */ \
173 entity _e = (this); \
174 eprint(_e); \
175 objerror_safe(_e); \
176 delete(_e); \
177 LOG_WARNF("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information", PROGNAME, __FUNC__, _msg); \
178MACRO_END
179
180#ifdef MENUQC
181 void _m_init();
182 void m_init() { if (_m_init) _m_init(); }
183 #define m_init _m_init
184
187 #define m_shutdown _m_shutdown
188
189 void _m_draw(float width, float height);
190 void m_draw(float width, float height) { if (_m_draw) _m_draw(width, height); }
191 #define m_draw _m_draw
192
193 void _m_keydown(int keynr, int ascii);
194 void m_keydown(int keynr, int ascii) { if (_m_keydown) _m_keydown(keynr, ascii); }
195 #define m_keydown _m_keydown
196
197 void _m_toggle(int mode);
198 void m_toggle(int mode) { if (_m_toggle) _m_toggle(mode); }
199 #define m_toggle _m_toggle
200#endif
201
202#ifdef SVQC
203 void _main();
204 void main() { if (_main) _main(); }
205 #define main _main
206
209 #define SV_Shutdown _SV_Shutdown
210
215 {
216 if (!_StartFrame_init)
217 {
218 _StartFrame_init = true;
219 float oldtime = time; time = 1;
220 __spawnfunc_expecting = 2; NULL.__spawnfunc_constructor(NULL);
221 time = oldtime;
222 }
223 if (_StartFrame)
224 _StartFrame();
225 }
226 #define StartFrame _StartFrame
227
230 #define SetNewParms _SetNewParms
231
234 #define SetChangeParms _SetChangeParms
235
236#ifdef DP_EXT_PRECONNECT
237 void _ClientPreConnect(entity this);
238 void ClientPreConnect() { ENGINE_EVENT(); if (_ClientPreConnect) _ClientPreConnect(this); }
239 #define ClientPreConnect _ClientPreConnect
240#endif
241
244 #define ClientConnect _ClientConnect
245
248 #define ClientDisconnect _ClientDisconnect
249
252 #define PutClientInServer _PutClientInServer
253
254 void _ClientKill(entity this);
256 #define ClientKill _ClientKill
257
260 #define PlayerPreThink _PlayerPreThink
261
264 #define PlayerPostThink _PlayerPostThink
265
268 #define SV_PlayerPhysics _SV_PlayerPhysics
269
272 {
273 ENGINE_EVENT();
275 __spawnfunc_expect = this;
276 }
277 #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction
278
279 void _SV_ChangeTeam(entity this, int _color);
280 void SV_ChangeTeam(int _color) { ENGINE_EVENT(); if (_SV_ChangeTeam) _SV_ChangeTeam(this, _color); }
281 #define SV_ChangeTeam _SV_ChangeTeam
282
283 void _SV_ParseClientCommand(entity this, string command);
284 void SV_ParseClientCommand(string command)
285 {
286 ENGINE_EVENT();
288 _SV_ParseClientCommand(this, command);
289 }
290 #define SV_ParseClientCommand _SV_ParseClientCommand
291#endif
292
293#ifdef CSQC
294 void _CSQC_Init(float apilevel, string enginename, float engineversion);
295 void CSQC_Init(float apilevel, string enginename, float engineversion) { if (_CSQC_Init) _CSQC_Init(apilevel, enginename, engineversion); }
296 #define CSQC_Init _CSQC_Init
297
300 #define CSQC_Shutdown _CSQC_Shutdown
301
302 void _CSQC_UpdateView(entity this, float w, float h, bool notmenu);
303 void CSQC_UpdateView(float w, float h, bool notmenu) { ENGINE_EVENT(); if (_CSQC_UpdateView) _CSQC_UpdateView(this, w, h, notmenu); }
304 #define CSQC_UpdateView _CSQC_UpdateView
305
306 bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary);
307 bool CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
308 {
309 return _CSQC_InputEvent ? _CSQC_InputEvent(inputType, nPrimary, nSecondary) : false;
310 }
311 #define CSQC_InputEvent _CSQC_InputEvent
312
313 bool _CSQC_ConsoleCommand(string s);
314 bool CSQC_ConsoleCommand(string s) { return _CSQC_ConsoleCommand ? _CSQC_ConsoleCommand(s) : false; }
315 #define CSQC_ConsoleCommand _CSQC_ConsoleCommand
316
317 void _CSQC_Ent_Update(entity this, bool isNew);
318 void CSQC_Ent_Update(bool isNew) { ENGINE_EVENT(); if (_CSQC_Ent_Update) _CSQC_Ent_Update(this, isNew); }
319 #define CSQC_Ent_Update _CSQC_Ent_Update
320
323 #define CSQC_Ent_Remove _CSQC_Ent_Remove
324#endif
325#undef ENGINE_EVENT
326
327#if XONOTIC
328#ifdef GAMEQC
329 #include <ecs/_mod.qh>
330#endif
331#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:208
void _CSQC_Init(float apilevel, string enginename, float engineversion)
#define m_keydown
Definition _all.inc:195
#define PlayerPostThink
Definition _all.inc:263
void _StartFrame()
#define CSQC_Init
Definition _all.inc:296
void _ClientConnect(entity this)
void _PlayerPreThink(entity this)
#define ClientConnect
Definition _all.inc:243
void _ClientDisconnect(entity this)
#define CSQC_Shutdown
Definition _all.inc:299
#define main
Definition _all.inc:204
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:214
void isnt_int(float this)
Definition _all.inc:101
#define m_draw
Definition _all.inc:191
#define ClientKill
Definition _all.inc:255
void _PlayerPostThink(entity this)
#define m_toggle
Definition _all.inc:199
void _SV_ParseClientCommand(entity this, string command)
#define SV_OnEntityPreSpawnFunction
Definition _all.inc:271
void _CSQC_Shutdown()
#define CSQC_InputEvent
Definition _all.inc:311
#define PlayerPreThink
Definition _all.inc:259
void _m_draw(float width, float height)
#define CSQC_ConsoleCommand
Definition _all.inc:315
#define SV_ParseClientCommand
Definition _all.inc:290
void _main()
#define SV_ChangeTeam
Definition _all.inc:281
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:304
#define SetChangeParms
Definition _all.inc:233
#define CSQC_Ent_Remove
Definition _all.inc:322
#define PutClientInServer
Definition _all.inc:251
#define m_init
Definition _all.inc:182
#define ClientDisconnect
Definition _all.inc:247
void _SetNewParms()
#define m_shutdown
Definition _all.inc:186
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:319
#define SV_PlayerPhysics
Definition _all.inc:267
#define SetNewParms
Definition _all.inc:229
void _CSQC_Ent_Update(entity this, bool isNew)
bool _StartFrame_init
Definition _all.inc:212
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