]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/_all.inc
Implement intrusive lists
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / _all.inc
1 #ifndef NOCOMPAT
2         #define COMPAT_NO_MOD_IS_XONOTIC
3 #endif
4
5 #include "compiler.qh"
6
7 #ifndef QCC_SUPPORT_INT
8         #define int float
9 #endif
10
11 #ifndef QCC_SUPPORT_BOOL
12         #define bool float
13 #endif
14
15 #include <dpdefs/pre.qh>
16
17 #if defined(CSQC)
18         #include <dpdefs/csprogsdefs.qh>
19         #include <dpdefs/keycodes.qh>
20 #elif defined(SVQC)
21         #include <server/sys-pre.qh>
22         #include <dpdefs/progsdefs.qh>
23         #include <dpdefs/dpextensions.qh>
24         #include <server/sys-post.qh>
25 #elif defined(MENUQC)
26         #include <dpdefs/menudefs.qh>
27         #include <dpdefs/keycodes.qh>
28 #endif
29
30 #include <dpdefs/post.qh>
31
32 #include "self.qh"
33
34 #define USING(name, T) typedef T name
35
36 #include "bool.qh"
37 #include "int.qh"
38
39 #include "macro.qh"
40
41 #if NDEBUG
42         #define TC(T, sym) MACRO_BEGIN MACRO_END
43 #else
44         #define TC(T, sym) MACRO_BEGIN \
45                 if (!is_##T(sym)) { \
46                         LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
47                         isnt_##T(sym); \
48                 } \
49         MACRO_END
50 #endif
51
52 #define   is_float(this) (true || ftoe(this))
53 #define isnt_float(this)
54 #define   is_vector(this) (true || vtos(this))
55 #define isnt_vector(this)
56 #define   is_string(this) (true || stof(this))
57 #define isnt_string(this)
58 #define   is_entity(this) (true || etof(this))
59 #define isnt_entity(this)
60 bool      is_int(float this) { return this == floor(this); }
61 void    isnt_int(float this) { print(ftos(this)); }
62 bool      is_bool(float this) { return this == true || this == false; }
63 void    isnt_bool(float this) { print(ftos(this)); }
64
65 #include "warpzone/mathlib.qc"
66
67 #include "accumulate.qh"
68 #include "angle.qc"
69 #include "arraylist.qh"
70 #include "bits.qh"
71 #include "color.qh"
72 #include "counting.qh"
73 #include "cvar.qh"
74 #include "defer.qh"
75 #include "draw.qh"
76 #include "enumclass.qh"
77 #include "file.qh"
78 #include "functional.qh"
79 #include "i18n.qh"
80 #include "intrusivelist.qh"
81 #include "iter.qh"
82 #include "json.qc"
83 #include "lazy.qh"
84 #include "linkedlist.qh"
85 #include "log.qh"
86 #include "map.qh"
87 #include "markdown.qh"
88 #include "math.qh"
89 #include "misc.qh"
90 #include "net.qh"
91 #include "nil.qh"
92 #include "noise.qh"
93 #include "oo.qh"
94 #include "p2mathlib.qc"
95 #include "progname.qh"
96 #include "random.qc"
97 #include "registry.qh"
98 #include "registry_net.qh"
99 #include "replicate.qh"
100 #include "sortlist.qc"
101 #include "sort.qh"
102 #include "spawnfunc.qh"
103 #include "static.qh"
104 #include "stats.qh"
105 #include "string.qh"
106 #include "struct.qh"
107 #include "test.qc"
108 #include "unsafe.qh"
109 #include "urllib.qc"
110 #include "vector.qh"
111 #include "yenc.qh"
112
113 #include "matrix/_mod.inc"
114
115 #ifdef MENUQC
116         void _m_init();
117         void m_init() { if (_m_init) _m_init(); }
118         #define m_init _m_init
119
120         void _m_shutdown();
121         void m_shutdown() { if (_m_shutdown) _m_shutdown(); }
122         #define m_shutdown _m_shutdown
123
124         void _m_draw(float width, float height);
125         void m_draw(float width, float height) { if (_m_draw) _m_draw(width, height); }
126         #define m_draw _m_draw
127
128         void _m_keydown(int keynr, int ascii);
129         void m_keydown(int keynr, int ascii) { if (_m_keydown) _m_keydown(keynr, ascii); }
130         #define m_keydown _m_keydown
131
132         void _m_toggle(int mode);
133         void m_toggle(int mode) { if (_m_toggle) _m_toggle(mode); }
134         #define m_toggle _m_toggle
135 #endif
136
137 #ifdef SVQC
138         void _main();
139         void main() { if (_main) _main(); }
140         #define main _main
141
142         void _SV_Shutdown();
143         void SV_Shutdown() { if (_SV_Shutdown) _SV_Shutdown(); }
144         #define SV_Shutdown _SV_Shutdown
145
146         void _StartFrame();
147         void StartFrame() { if (_StartFrame) _StartFrame(); }
148         #define StartFrame _StartFrame
149
150         void _SetNewParms();
151         void SetNewParms() { if (_SetNewParms) _SetNewParms(); }
152         #define SetNewParms _SetNewParms
153
154         void _SetChangeParms(entity this);
155         void SetChangeParms() { ENGINE_EVENT(); if (_SetChangeParms) _SetChangeParms(this); }
156         #define SetChangeParms _SetChangeParms
157
158         void _ClientConnect(entity this);
159         void ClientConnect() { ENGINE_EVENT(); if (_ClientConnect) _ClientConnect(this); }
160         #define ClientConnect _ClientConnect
161
162         void _ClientDisconnect(entity this);
163         void ClientDisconnect() { ENGINE_EVENT(); if (_ClientDisconnect) _ClientDisconnect(this); }
164         #define ClientDisconnect _ClientDisconnect
165
166         void _PutClientInServer(entity this);
167         void PutClientInServer() { ENGINE_EVENT(); if (_PutClientInServer) _PutClientInServer(this); }
168         #define PutClientInServer _PutClientInServer
169
170         void _ClientKill(entity this);
171         void ClientKill() { ENGINE_EVENT(); if (_ClientKill) _ClientKill(this); }
172         #define ClientKill _ClientKill
173
174         void _PlayerPreThink(entity this);
175         void PlayerPreThink() { ENGINE_EVENT(); if (_PlayerPreThink) _PlayerPreThink(this); }
176         #define PlayerPreThink _PlayerPreThink
177
178         void _PlayerPostThink(entity this);
179         void PlayerPostThink() { ENGINE_EVENT(); if (_PlayerPostThink) _PlayerPostThink(this); }
180         #define PlayerPostThink _PlayerPostThink
181
182         void _SV_PlayerPhysics(entity this);
183         void SV_PlayerPhysics() { ENGINE_EVENT(); if (_SV_PlayerPhysics) _SV_PlayerPhysics(this); }
184         #define SV_PlayerPhysics _SV_PlayerPhysics
185
186         void _SV_OnEntityPreSpawnFunction(entity this);
187         void SV_OnEntityPreSpawnFunction()
188         {
189                 ENGINE_EVENT();
190                 if (_SV_OnEntityPreSpawnFunction) _SV_OnEntityPreSpawnFunction(this);
191         }
192         #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction
193
194         void _SV_ChangeTeam(entity this, int _color);
195         void SV_ChangeTeam(int _color) { ENGINE_EVENT(); if (_SV_ChangeTeam) _SV_ChangeTeam(this, _color); }
196         #define SV_ChangeTeam _SV_ChangeTeam
197
198         void _SV_ParseClientCommand(entity this, string command);
199         void SV_ParseClientCommand(string command)
200         {
201                 ENGINE_EVENT();
202                 if (_SV_ParseClientCommand) _SV_ParseClientCommand(this, command);
203         }
204         #define SV_ParseClientCommand _SV_ParseClientCommand
205 #endif
206
207 #ifdef CSQC
208         void _CSQC_Init();
209         void CSQC_Init() { if (_CSQC_Init) _CSQC_Init(); }
210         #define CSQC_Init _CSQC_Init
211
212         void _CSQC_Shutdown();
213         void CSQC_Shutdown() { if (_CSQC_Shutdown) _CSQC_Shutdown(); }
214         #define CSQC_Shutdown _CSQC_Shutdown
215
216         void _CSQC_UpdateView(entity this, float w, float h);
217         void CSQC_UpdateView(float w, float h) { ENGINE_EVENT(); if (_CSQC_UpdateView) _CSQC_UpdateView(this, w, h); }
218         #define CSQC_UpdateView _CSQC_UpdateView
219
220         bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary);
221         bool CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
222         {
223                 return _CSQC_InputEvent ? _CSQC_InputEvent(inputType, nPrimary, nSecondary) : false;
224         }
225         #define CSQC_InputEvent _CSQC_InputEvent
226
227         bool _CSQC_ConsoleCommand(string s);
228         bool CSQC_ConsoleCommand(string s) { return _CSQC_ConsoleCommand ? _CSQC_ConsoleCommand(s) : false; }
229         #define CSQC_ConsoleCommand _CSQC_ConsoleCommand
230
231         void _CSQC_Ent_Update(entity this, bool isNew);
232         void CSQC_Ent_Update(bool isNew) { ENGINE_EVENT(); if (_CSQC_Ent_Update) _CSQC_Ent_Update(this, isNew); }
233         #define CSQC_Ent_Update _CSQC_Ent_Update
234
235         void _CSQC_Ent_Remove(entity this);
236         void CSQC_Ent_Remove() { ENGINE_EVENT(); if (_CSQC_Ent_Remove) _CSQC_Ent_Remove(this); }
237         #define CSQC_Ent_Remove _CSQC_Ent_Remove
238 #endif
239 #undef ENGINE_EVENT