]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/lib/_all.inc
Show joystick binds in the HUD only when a joystick is active (detected and enabled)
[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_WARNF("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 "intrusivelist.qh"
93 #include "iter.qh"
94 #include "json.qc"
95 #include "lazy.qh"
96 #include "linkedlist.qh"
97 #include "log.qh"
98 #include "map.qh"
99 #include "markdown.qh"
100 #include "math.qh"
101 #include "misc.qh"
102 #include "net.qh"
103 #include "nil.qh"
104 #include "noise.qh"
105 #include "oo.qh"
106 #include "p2mathlib.qc"
107 #include "progname.qh"
108 #include "random.qc"
109 #include "registry.qh"
110 #include "registry_net.qh"
111 #include "replicate.qh"
112 #include "sortlist.qc"
113 #include "sort.qh"
114 #include "spawnfunc.qh"
115 #include "static.qh"
116 #include "stats.qh"
117 #include "string.qh"
118 #include "struct.qh"
119 #include "test.qc"
120 #include "unsafe.qh"
121 #include "urllib.qc"
122 #include "vector.qh"
123 #include "yenc.qh"
124
125 #if XONOTIC
126         #include "matrix/_mod.inc"
127 #endif
128
129 #ifndef SVQC
130 #define objerror_safe(e)
131 #else
132 void make_safe_for_remove(entity this);
133     #define objerror_safe(e) make_safe_for_remove(e)
134 #endif
135
136 #define objerror(this, msg) MACRO_BEGIN { \
137         LOG_WARN("======OBJECT ERROR======"); \
138         entity _e = (this); \
139         eprint(_e); \
140         objerror_safe(_e); \
141         delete(_e); \
142         LOG_WARNF("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information", PROGNAME, __FUNC__, msg); \
143 } MACRO_END
144
145 #ifdef MENUQC
146         void _m_init();
147         void m_init() { if (_m_init) _m_init(); }
148         #define m_init _m_init
149
150         void _m_shutdown();
151         void m_shutdown() { if (_m_shutdown) _m_shutdown(); }
152         #define m_shutdown _m_shutdown
153
154         void _m_draw(float width, float height);
155         void m_draw(float width, float height) { if (_m_draw) _m_draw(width, height); }
156         #define m_draw _m_draw
157
158         void _m_keydown(int keynr, int ascii);
159         void m_keydown(int keynr, int ascii) { if (_m_keydown) _m_keydown(keynr, ascii); }
160         #define m_keydown _m_keydown
161
162         void _m_toggle(int mode);
163         void m_toggle(int mode) { if (_m_toggle) _m_toggle(mode); }
164         #define m_toggle _m_toggle
165 #endif
166
167 #ifdef SVQC
168         void _main();
169         void main() { if (_main) _main(); }
170         #define main _main
171
172         void _SV_Shutdown();
173         void SV_Shutdown() { if (_SV_Shutdown) _SV_Shutdown(); }
174         #define SV_Shutdown _SV_Shutdown
175
176         void _StartFrame();
177         void StartFrame() { if (_StartFrame) _StartFrame(); }
178         #define StartFrame _StartFrame
179
180         void _SetNewParms();
181         void SetNewParms() { if (_SetNewParms) _SetNewParms(); }
182         #define SetNewParms _SetNewParms
183
184         void _SetChangeParms(entity this);
185         void SetChangeParms() { ENGINE_EVENT(); if (_SetChangeParms) _SetChangeParms(this); }
186         #define SetChangeParms _SetChangeParms
187
188 #ifdef DP_EXT_PRECONNECT
189         void _ClientPreConnect(entity this);
190         void ClientPreConnect() { ENGINE_EVENT(); if (_ClientPreConnect) _ClientPreConnect(this); }
191         #define ClientPreConnect _ClientPreConnect
192 #endif
193
194         void _ClientConnect(entity this);
195         void ClientConnect() { ENGINE_EVENT(); if (_ClientConnect) _ClientConnect(this); }
196         #define ClientConnect _ClientConnect
197
198         void _ClientDisconnect(entity this);
199         void ClientDisconnect() { ENGINE_EVENT(); if (_ClientDisconnect) _ClientDisconnect(this); }
200         #define ClientDisconnect _ClientDisconnect
201
202         void _PutClientInServer(entity this);
203         void PutClientInServer() { ENGINE_EVENT(); if (_PutClientInServer) _PutClientInServer(this); }
204         #define PutClientInServer _PutClientInServer
205
206         void _ClientKill(entity this);
207         void ClientKill() { ENGINE_EVENT(); if (_ClientKill) _ClientKill(this); }
208         #define ClientKill _ClientKill
209
210         void _PlayerPreThink(entity this);
211         void PlayerPreThink() { ENGINE_EVENT(); if (_PlayerPreThink) _PlayerPreThink(this); }
212         #define PlayerPreThink _PlayerPreThink
213
214         void _PlayerPostThink(entity this);
215         void PlayerPostThink() { ENGINE_EVENT(); if (_PlayerPostThink) _PlayerPostThink(this); }
216         #define PlayerPostThink _PlayerPostThink
217
218         void _SV_PlayerPhysics(entity this);
219         void SV_PlayerPhysics() { ENGINE_EVENT(); if (_SV_PlayerPhysics) _SV_PlayerPhysics(this); }
220         #define SV_PlayerPhysics _SV_PlayerPhysics
221
222         void _SV_OnEntityPreSpawnFunction(entity this);
223         void SV_OnEntityPreSpawnFunction()
224         {
225                 ENGINE_EVENT();
226                 if (_SV_OnEntityPreSpawnFunction) _SV_OnEntityPreSpawnFunction(this);
227         }
228         #define SV_OnEntityPreSpawnFunction _SV_OnEntityPreSpawnFunction
229
230         void _SV_ChangeTeam(entity this, int _color);
231         void SV_ChangeTeam(int _color) { ENGINE_EVENT(); if (_SV_ChangeTeam) _SV_ChangeTeam(this, _color); }
232         #define SV_ChangeTeam _SV_ChangeTeam
233
234         void _SV_ParseClientCommand(entity this, string command);
235         void SV_ParseClientCommand(string command)
236         {
237                 ENGINE_EVENT();
238                 if (_SV_ParseClientCommand) _SV_ParseClientCommand(this, command);
239         }
240         #define SV_ParseClientCommand _SV_ParseClientCommand
241 #endif
242
243 #ifdef CSQC
244         void _CSQC_Init();
245         void CSQC_Init() { if (_CSQC_Init) _CSQC_Init(); }
246         #define CSQC_Init _CSQC_Init
247
248         void _CSQC_Shutdown();
249         void CSQC_Shutdown() { if (_CSQC_Shutdown) _CSQC_Shutdown(); }
250         #define CSQC_Shutdown _CSQC_Shutdown
251
252         void _CSQC_UpdateView(entity this, float w, float h);
253         void CSQC_UpdateView(float w, float h) { ENGINE_EVENT(); if (_CSQC_UpdateView) _CSQC_UpdateView(this, w, h); }
254         #define CSQC_UpdateView _CSQC_UpdateView
255
256         bool _CSQC_InputEvent(int inputType, float nPrimary, float nSecondary);
257         bool CSQC_InputEvent(int inputType, float nPrimary, float nSecondary)
258         {
259                 return _CSQC_InputEvent ? _CSQC_InputEvent(inputType, nPrimary, nSecondary) : false;
260         }
261         #define CSQC_InputEvent _CSQC_InputEvent
262
263         bool _CSQC_ConsoleCommand(string s);
264         bool CSQC_ConsoleCommand(string s) { return _CSQC_ConsoleCommand ? _CSQC_ConsoleCommand(s) : false; }
265         #define CSQC_ConsoleCommand _CSQC_ConsoleCommand
266
267         void _CSQC_Ent_Update(entity this, bool isNew);
268         void CSQC_Ent_Update(bool isNew) { ENGINE_EVENT(); if (_CSQC_Ent_Update) _CSQC_Ent_Update(this, isNew); }
269         #define CSQC_Ent_Update _CSQC_Ent_Update
270
271         void _CSQC_Ent_Remove(entity this);
272         void CSQC_Ent_Remove() { ENGINE_EVENT(); if (_CSQC_Ent_Remove) _CSQC_Ent_Remove(this); }
273         #define CSQC_Ent_Remove _CSQC_Ent_Remove
274 #endif
275 #undef ENGINE_EVENT
276
277 #if XONOTIC
278 #ifdef GAMEQC
279         #include <ecs/_mod.qh>
280 #endif
281 #endif