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