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#if defined(CSQC)
50 #include <dpdefs/csprogsdefs.qh>
51 #include <dpdefs/keycodes.qh>
52#elif defined(SVQC)
53 #include <server/sys-pre.qh>
54 #include <dpdefs/progsdefs.qh>
55 #include <dpdefs/dpextensions.qh>
56 #include <server/sys-post.qh>
57#elif defined(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 LOG_WARNF("Type check failed: " #sym " :: " #T); \
85 isnt_##T(sym); \
86 } \
87 MACRO_END
88#endif
89
90#if !(NDEBUG)
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)); }
103#endif
104
105#include "warpzone/mathlib.qc"
106
107// needs to be included before any of the functions which use globals are called
108#include "deglobalization.qh"
109
110#include "accumulate.qh"
111#include "angle.qc"
112#include "arraylist.qh"
113#include "bits.qh"
114#include "color.qh"
115#include "counting.qh"
116#include "cvar.qh"
117#include "defer.qh"
118#include "draw.qh"
119#include "enumclass.qh"
120#include "file.qh"
121#include "float.qh"
122#include "functional.qh"
123#include "i18n.qh"
124#include "intrusivelist.qh"
125#include "iter.qh"
126#include "json.qc"
127#include "lazy.qh"
128#include "linkedlist.qh"
129#include "log.qh"
130#include "map.qh"
131#include "markdown.qh"
132#include "math.qh"
133#include "misc.qh"
134#include "net.qh"
135#include "nil.qh"
136#include "noise.qh"
137#include "oo.qh"
138#include "p2mathlib.qc"
139#include "progname.qh"
140#include "promise.qc"
141#include "random.qc"
142#include "registry.qh"
143#include "registry_net.qh"
144#include "replicate.qh"
145#include "sortlist.qc"
146#include "sort.qh"
147#include "spawnfunc.qh"
148#include "static.qh"
149#include "stats.qh"
150#include "string.qh"
151#include "struct.qh"
152#include "test.qc"
153#include "unsafe.qh"
154#include "urllib.qc"
155#include "vector.qh"
156#include "yenc.qh"
157
158#if XONOTIC
159 #include "matrix/_mod.inc"
160#endif
161
162#ifndef SVQC
163#define objerror_safe(e)
164#else
166 #define objerror_safe(e) make_safe_for_remove(e)
167#endif
168
169#define objerror(this, msg) MACRO_BEGIN \
170 LOG_WARN("======OBJECT ERROR======"); \
171 entity _e = (this); \
172 eprint(_e); \
173 objerror_safe(_e); \
174 delete(_e); \
175 LOG_WARNF("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information", PROGNAME, __FUNC__, msg); \
176MACRO_END
177
178#ifdef MENUQC
179 void _m_init();
180 void m_init() { if (_m_init) _m_init(); }
181 #define m_init _m_init
182
185 #define m_shutdown _m_shutdown
186
187 void _m_draw(float width, float height);
188 void m_draw(float width, float height) { if (_m_draw) _m_draw(width, height); }
189 #define m_draw _m_draw
190
191 void _m_keydown(int keynr, int ascii);
192 void m_keydown(int keynr, int ascii) { if (_m_keydown) _m_keydown(keynr, ascii); }
193 #define m_keydown _m_keydown
194
195 void _m_toggle(int mode);
196 void m_toggle(int mode) { if (_m_toggle) _m_toggle(mode); }
197 #define m_toggle _m_toggle
198#endif
199
200#ifdef SVQC
201 void _main();
202 void main() { if (_main) _main(); }
203 #define main _main
204
207 #define SV_Shutdown _SV_Shutdown
208
212 void StartFrame() {
213 if (!_StartFrame_init) {
214 _StartFrame_init = true;
215 float oldtime = time; time = 1;
216 __spawnfunc_expecting = 2; NULL.__spawnfunc_constructor(NULL);
217 time = oldtime;
218 }
220 }
221 #define StartFrame _StartFrame
222
225 #define SetNewParms _SetNewParms
226
229 #define SetChangeParms _SetChangeParms
230
231#ifdef DP_EXT_PRECONNECT
232 void _ClientPreConnect(entity this);
233 void ClientPreConnect() { ENGINE_EVENT(); if (_ClientPreConnect) _ClientPreConnect(this); }
234 #define ClientPreConnect _ClientPreConnect
235#endif
236
239 #define ClientConnect _ClientConnect
240
243 #define ClientDisconnect _ClientDisconnect
244
247 #define PutClientInServer _PutClientInServer
248
249 void _ClientKill(entity this);
251 #define ClientKill _ClientKill
252
255 #define PlayerPreThink _PlayerPreThink
256
259 #define PlayerPostThink _PlayerPostThink
260
263 #define SV_PlayerPhysics _SV_PlayerPhysics
264
267 {
268 ENGINE_EVENT();
270 __spawnfunc_expect = this;
271 }
272 #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction
273
274 void _SV_ChangeTeam(entity this, int _color);
275 void SV_ChangeTeam(int _color) { ENGINE_EVENT(); if (_SV_ChangeTeam) _SV_ChangeTeam(this, _color); }
276 #define SV_ChangeTeam _SV_ChangeTeam
277
278 void _SV_ParseClientCommand(entity this, string command);
279 void SV_ParseClientCommand(string command)
280 {
281 ENGINE_EVENT();
283 }
284 #define SV_ParseClientCommand _SV_ParseClientCommand
285#endif
286
287#ifdef CSQC
288 void _CSQC_Init(float apilevel, string enginename, float engineversion);
289 void CSQC_Init(float apilevel, string enginename, float engineversion) { if (_CSQC_Init) _CSQC_Init(apilevel, enginename, engineversion); }
290 #define CSQC_Init _CSQC_Init
291
294 #define CSQC_Shutdown _CSQC_Shutdown
295
296 void _CSQC_UpdateView(entity this, float w, float h, bool notmenu);
297 void CSQC_UpdateView(float w, float h, bool notmenu) { ENGINE_EVENT(); if (_CSQC_UpdateView) _CSQC_UpdateView(this, w, h, notmenu); }
298 #define CSQC_UpdateView _CSQC_UpdateView
299
300 bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary);
301 bool CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
302 {
303 return _CSQC_InputEvent ? _CSQC_InputEvent(inputType, nPrimary, nSecondary) : false;
304 }
305 #define CSQC_InputEvent _CSQC_InputEvent
306
307 bool _CSQC_ConsoleCommand(string s);
308 bool CSQC_ConsoleCommand(string s) { return _CSQC_ConsoleCommand ? _CSQC_ConsoleCommand(s) : false; }
309 #define CSQC_ConsoleCommand _CSQC_ConsoleCommand
310
311 void _CSQC_Ent_Update(entity this, bool isNew);
312 void CSQC_Ent_Update(bool isNew) { ENGINE_EVENT(); if (_CSQC_Ent_Update) _CSQC_Ent_Update(this, isNew); }
313 #define CSQC_Ent_Update _CSQC_Ent_Update
314
317 #define CSQC_Ent_Remove _CSQC_Ent_Remove
318#endif
319#undef ENGINE_EVENT
320
321#if XONOTIC
322#ifdef GAMEQC
323 #include <ecs/_mod.qh>
324#endif
325#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:102
void _CSQC_Ent_Remove(entity this)
#define SV_Shutdown
Definition _all.inc:206
void _CSQC_Init(float apilevel, string enginename, float engineversion)
#define m_keydown
Definition _all.inc:193
#define PlayerPostThink
Definition _all.inc:258
void _StartFrame()
#define CSQC_Init
Definition _all.inc:290
void _ClientConnect(entity this)
void _PlayerPreThink(entity this)
#define ClientConnect
Definition _all.inc:238
void _ClientDisconnect(entity this)
#define CSQC_Shutdown
Definition _all.inc:293
#define main
Definition _all.inc:202
void _SetChangeParms(entity this)
void _CSQC_UpdateView(entity this, float w, float h, bool notmenu)
bool is_int(float this)
Definition _all.inc:99
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:212
void isnt_int(float this)
Definition _all.inc:100
#define m_draw
Definition _all.inc:189
#define ClientKill
Definition _all.inc:250
void _PlayerPostThink(entity this)
#define m_toggle
Definition _all.inc:197
void _SV_ParseClientCommand(entity this, string command)
#define SV_OnEntityPreSpawnFunction
Definition _all.inc:266
void _CSQC_Shutdown()
#define CSQC_InputEvent
Definition _all.inc:305
#define PlayerPreThink
Definition _all.inc:254
void _m_draw(float width, float height)
#define CSQC_ConsoleCommand
Definition _all.inc:309
#define SV_ParseClientCommand
Definition _all.inc:284
void _main()
#define SV_ChangeTeam
Definition _all.inc:276
bool is_bool(float this)
Definition _all.inc:101
void make_safe_for_remove(entity this)
Definition main.qc:238
#define CSQC_UpdateView
Definition _all.inc:298
#define SetChangeParms
Definition _all.inc:228
#define CSQC_Ent_Remove
Definition _all.inc:316
#define PutClientInServer
Definition _all.inc:246
#define m_init
Definition _all.inc:180
#define ClientDisconnect
Definition _all.inc:242
void _SetNewParms()
#define m_shutdown
Definition _all.inc:184
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:313
#define SV_PlayerPhysics
Definition _all.inc:262
#define SetNewParms
Definition _all.inc:224
void _CSQC_Ent_Update(entity this, bool isNew)
bool _StartFrame_init
Definition _all.inc:210
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:37
noref int __spawnfunc_expecting
Definition spawnfunc.qh:36