diff options
author | Franklin Wei <git@fwei.tk> | 2018-02-11 15:34:30 -0500 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2019-07-19 22:37:40 -0400 |
commit | 5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4 (patch) | |
tree | 84406e21639529a185556a33e5de7f43cffc277b /apps/plugins/sdl/progs/quake/quakedef.h | |
parent | b70fecf21ddc21877ec1ae7888d9c18a979e37ad (diff) | |
download | rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.tar.gz rockbox-5d05b9d3e920a6aa5fcb553758e98ed0da8c91e4.zip |
Quake!
This ports id Software's Quake to run on the SDL plugin runtime. The
source code originated from id under the GPLv2 license. I used
https://github.com/ahefner/sdlquake as the base of my port.
Performance is, unsurprisingly, not on par with what you're probably
used to on PC. I average about 10FPS on ipod6g, but it's still
playable.
Sound works well enough, but in-game music is not supported. I've
written ARM assembly routines for the inner sound loop. Make sure you
turn the "brightness" all the way down, or colors will look funky.
To run, extract Quake's data files to /.rockbox/quake. Have fun!
Change-Id: I4285036e967d7f0722802d43cf2096c808ca5799
Diffstat (limited to 'apps/plugins/sdl/progs/quake/quakedef.h')
-rw-r--r-- | apps/plugins/sdl/progs/quake/quakedef.h | 333 |
1 files changed, 333 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/quake/quakedef.h b/apps/plugins/sdl/progs/quake/quakedef.h new file mode 100644 index 0000000000..e676b7c9e7 --- /dev/null +++ b/apps/plugins/sdl/progs/quake/quakedef.h | |||
@@ -0,0 +1,333 @@ | |||
1 | /* | ||
2 | Copyright (C) 1996-1997 Id Software, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU General Public License | ||
6 | as published by the Free Software Foundation; either version 2 | ||
7 | of the License, or (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | |||
13 | See the GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | */ | ||
20 | // quakedef.h -- primary header for client | ||
21 | |||
22 | //#define GLTEST // experimental stuff | ||
23 | |||
24 | #include "SDL.h" | ||
25 | #include <stdarg.h> | ||
26 | #include <setjmp.h> | ||
27 | |||
28 | #define QUAKE_GAME // as opposed to utilities | ||
29 | |||
30 | #undef VERSION | ||
31 | #define VERSION 1.09 | ||
32 | #define GLQUAKE_VERSION 1.00 | ||
33 | #define D3DQUAKE_VERSION 0.01 | ||
34 | #define WINQUAKE_VERSION 0.996 | ||
35 | #define LINUX_VERSION 1.30 | ||
36 | #define X11_VERSION 1.10 | ||
37 | |||
38 | //define PARANOID // speed sapping error checking | ||
39 | |||
40 | #ifdef QUAKE2 | ||
41 | #define GAMENAME "id1" // directory to look in by default | ||
42 | #else | ||
43 | #define GAMENAME "id1" | ||
44 | #endif | ||
45 | |||
46 | #if defined(_WIN32) && !defined(WINDED) | ||
47 | |||
48 | #if defined(_M_IX86) | ||
49 | #define __i386__ 1 | ||
50 | #endif | ||
51 | |||
52 | void VID_LockBuffer (void); | ||
53 | void VID_UnlockBuffer (void); | ||
54 | |||
55 | #else | ||
56 | |||
57 | #define VID_LockBuffer() | ||
58 | #define VID_UnlockBuffer() | ||
59 | |||
60 | #endif | ||
61 | |||
62 | #if defined(__i386__) && defined(USE_ASM) | ||
63 | #define id386 1 | ||
64 | #else | ||
65 | #define id386 0 | ||
66 | #endif | ||
67 | |||
68 | #if id386 | ||
69 | #define UNALIGNED_OK 1 // set to 0 if unaligned accesses are not supported | ||
70 | #else | ||
71 | #define UNALIGNED_OK 0 | ||
72 | #endif | ||
73 | |||
74 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! | ||
75 | #define CACHE_SIZE 32 // used to align key data structures | ||
76 | |||
77 | #define UNUSED(x) (x = x) // for pesky compiler / lint warnings | ||
78 | |||
79 | #define MINIMUM_MEMORY 0x550000 | ||
80 | #define MINIMUM_MEMORY_LEVELPAK (MINIMUM_MEMORY + 0x100000) | ||
81 | |||
82 | #define MAX_NUM_ARGVS 50 | ||
83 | |||
84 | // up / down | ||
85 | #define PITCH 0 | ||
86 | |||
87 | // left / right | ||
88 | #define YAW 1 | ||
89 | |||
90 | // fall over | ||
91 | #define ROLL 2 | ||
92 | |||
93 | |||
94 | #define MAX_QPATH 64 // max length of a quake game pathname | ||
95 | #define MAX_OSPATH 128 // max length of a filesystem pathname | ||
96 | |||
97 | #define ON_EPSILON 0.1 // point on plane side epsilon | ||
98 | |||
99 | #define MAX_MSGLEN 8000 // max length of a reliable message | ||
100 | #define MAX_DATAGRAM 1024 // max length of unreliable message | ||
101 | |||
102 | // | ||
103 | // per-level limits | ||
104 | // | ||
105 | #define MAX_EDICTS 600 // FIXME: ouch! ouch! ouch! | ||
106 | #define MAX_LIGHTSTYLES 64 | ||
107 | #define MAX_MODELS 256 // these are sent over the net as bytes | ||
108 | #define MAX_SOUNDS 256 // so they cannot be blindly increased | ||
109 | |||
110 | #define SAVEGAME_COMMENT_LENGTH 39 | ||
111 | |||
112 | #define MAX_STYLESTRING 64 | ||
113 | |||
114 | // | ||
115 | // stats are integers communicated to the client by the server | ||
116 | // | ||
117 | #define MAX_CL_STATS 32 | ||
118 | #define STAT_HEALTH 0 | ||
119 | #define STAT_FRAGS 1 | ||
120 | #define STAT_WEAPON 2 | ||
121 | #define STAT_AMMO 3 | ||
122 | #define STAT_ARMOR 4 | ||
123 | #define STAT_WEAPONFRAME 5 | ||
124 | #define STAT_SHELLS 6 | ||
125 | #define STAT_NAILS 7 | ||
126 | #define STAT_ROCKETS 8 | ||
127 | #define STAT_CELLS 9 | ||
128 | #define STAT_ACTIVEWEAPON 10 | ||
129 | #define STAT_TOTALSECRETS 11 | ||
130 | #define STAT_TOTALMONSTERS 12 | ||
131 | #define STAT_SECRETS 13 // bumped on client side by svc_foundsecret | ||
132 | #define STAT_MONSTERS 14 // bumped by svc_killedmonster | ||
133 | |||
134 | // stock defines | ||
135 | |||
136 | #define IT_SHOTGUN 1 | ||
137 | #define IT_SUPER_SHOTGUN 2 | ||
138 | #define IT_NAILGUN 4 | ||
139 | #define IT_SUPER_NAILGUN 8 | ||
140 | #define IT_GRENADE_LAUNCHER 16 | ||
141 | #define IT_ROCKET_LAUNCHER 32 | ||
142 | #define IT_LIGHTNING 64 | ||
143 | #define IT_SUPER_LIGHTNING 128 | ||
144 | #define IT_SHELLS 256 | ||
145 | #define IT_NAILS 512 | ||
146 | #define IT_ROCKETS 1024 | ||
147 | #define IT_CELLS 2048 | ||
148 | #define IT_AXE 4096 | ||
149 | #define IT_ARMOR1 8192 | ||
150 | #define IT_ARMOR2 16384 | ||
151 | #define IT_ARMOR3 32768 | ||
152 | #define IT_SUPERHEALTH 65536 | ||
153 | #define IT_KEY1 131072 | ||
154 | #define IT_KEY2 262144 | ||
155 | #define IT_INVISIBILITY 524288 | ||
156 | #define IT_INVULNERABILITY 1048576 | ||
157 | #define IT_SUIT 2097152 | ||
158 | #define IT_QUAD 4194304 | ||
159 | #define IT_SIGIL1 (1<<28) | ||
160 | #define IT_SIGIL2 (1<<29) | ||
161 | #define IT_SIGIL3 (1<<30) | ||
162 | #define IT_SIGIL4 (1<<31) | ||
163 | |||
164 | //=========================================== | ||
165 | //rogue changed and added defines | ||
166 | |||
167 | #define RIT_SHELLS 128 | ||
168 | #define RIT_NAILS 256 | ||
169 | #define RIT_ROCKETS 512 | ||
170 | #define RIT_CELLS 1024 | ||
171 | #define RIT_AXE 2048 | ||
172 | #define RIT_LAVA_NAILGUN 4096 | ||
173 | #define RIT_LAVA_SUPER_NAILGUN 8192 | ||
174 | #define RIT_MULTI_GRENADE 16384 | ||
175 | #define RIT_MULTI_ROCKET 32768 | ||
176 | #define RIT_PLASMA_GUN 65536 | ||
177 | #define RIT_ARMOR1 8388608 | ||
178 | #define RIT_ARMOR2 16777216 | ||
179 | #define RIT_ARMOR3 33554432 | ||
180 | #define RIT_LAVA_NAILS 67108864 | ||
181 | #define RIT_PLASMA_AMMO 134217728 | ||
182 | #define RIT_MULTI_ROCKETS 268435456 | ||
183 | #define RIT_SHIELD 536870912 | ||
184 | #define RIT_ANTIGRAV 1073741824 | ||
185 | #define RIT_SUPERHEALTH 2147483648 | ||
186 | |||
187 | //MED 01/04/97 added hipnotic defines | ||
188 | //=========================================== | ||
189 | //hipnotic added defines | ||
190 | #define HIT_PROXIMITY_GUN_BIT 16 | ||
191 | #define HIT_MJOLNIR_BIT 7 | ||
192 | #define HIT_LASER_CANNON_BIT 23 | ||
193 | #define HIT_PROXIMITY_GUN (1<<HIT_PROXIMITY_GUN_BIT) | ||
194 | #define HIT_MJOLNIR (1<<HIT_MJOLNIR_BIT) | ||
195 | #define HIT_LASER_CANNON (1<<HIT_LASER_CANNON_BIT) | ||
196 | #define HIT_WETSUIT (1<<(23+2)) | ||
197 | #define HIT_EMPATHY_SHIELDS (1<<(23+3)) | ||
198 | |||
199 | //=========================================== | ||
200 | |||
201 | #define MAX_SCOREBOARD 16 | ||
202 | #define MAX_SCOREBOARDNAME 32 | ||
203 | |||
204 | #define SOUND_CHANNELS 8 | ||
205 | |||
206 | // This makes anyone on id's net privileged | ||
207 | // Use for multiplayer testing only - VERY dangerous!!! | ||
208 | // #define IDGODS | ||
209 | |||
210 | #include "common.h" | ||
211 | #include "bspfile.h" | ||
212 | #include "vid.h" | ||
213 | #include "sys.h" | ||
214 | #include "zone.h" | ||
215 | #include "mathlib.h" | ||
216 | |||
217 | typedef struct | ||
218 | { | ||
219 | vec3_t origin; | ||
220 | vec3_t angles; | ||
221 | int modelindex; | ||
222 | int frame; | ||
223 | int colormap; | ||
224 | int skin; | ||
225 | int effects; | ||
226 | } entity_state_t; | ||
227 | |||
228 | |||
229 | #include "wad.h" | ||
230 | #include "draw.h" | ||
231 | #include "cvar.h" | ||
232 | #include "screen.h" | ||
233 | #include "net.h" | ||
234 | #include "protocol.h" | ||
235 | #include "cmd.h" | ||
236 | #include "sbar.h" | ||
237 | #include "quakesound.h" | ||
238 | #include "render.h" | ||
239 | #include "client.h" | ||
240 | #include "progs.h" | ||
241 | #include "server.h" | ||
242 | |||
243 | #ifdef GLQUAKE | ||
244 | #include "gl_model.h" | ||
245 | #else | ||
246 | #include "model.h" | ||
247 | #include "d_iface.h" | ||
248 | #endif | ||
249 | |||
250 | #include "input.h" | ||
251 | #include "world.h" | ||
252 | #include "keys.h" | ||
253 | #include "console.h" | ||
254 | #include "view.h" | ||
255 | #include "menu.h" | ||
256 | #include "crc.h" | ||
257 | #include "cdaudio.h" | ||
258 | |||
259 | #ifdef GLQUAKE | ||
260 | #include "glquake.h" | ||
261 | #endif | ||
262 | |||
263 | //============================================================================= | ||
264 | |||
265 | // the host system specifies the base of the directory tree, the | ||
266 | // command line parms passed to the program, and the amount of memory | ||
267 | // available for the program to use | ||
268 | |||
269 | typedef struct | ||
270 | { | ||
271 | char *basedir; | ||
272 | char *cachedir; // for development over ISDN lines | ||
273 | int argc; | ||
274 | char **argv; | ||
275 | void *membase; | ||
276 | int memsize; | ||
277 | } quakeparms_t; | ||
278 | |||
279 | |||
280 | //============================================================================= | ||
281 | |||
282 | |||
283 | |||
284 | extern qboolean noclip_anglehack; | ||
285 | |||
286 | |||
287 | // | ||
288 | // host | ||
289 | // | ||
290 | extern quakeparms_t host_parms; | ||
291 | |||
292 | extern cvar_t sys_ticrate; | ||
293 | extern cvar_t sys_nostdout; | ||
294 | extern cvar_t developer; | ||
295 | |||
296 | extern qboolean host_initialized; // true if into command execution | ||
297 | extern double host_frametime; | ||
298 | extern byte *host_basepal; | ||
299 | extern byte *host_colormap; | ||
300 | extern int host_framecount; // incremented every frame, never reset | ||
301 | extern double realtime; // not bounded in any way, changed at | ||
302 | // start of every frame, never reset | ||
303 | |||
304 | void Host_ClearMemory (void); | ||
305 | void Host_ServerFrame (void); | ||
306 | void Host_InitCommands (void); | ||
307 | void Host_Init (quakeparms_t *parms); | ||
308 | void Host_Shutdown(void); | ||
309 | void Host_Error (char *error, ...); | ||
310 | void Host_EndGame (char *message, ...); | ||
311 | void Host_Frame (float time); | ||
312 | void Host_Quit_f (void); | ||
313 | void Host_ClientCommands (char *fmt, ...); | ||
314 | void Host_ShutdownServer (qboolean crash); | ||
315 | |||
316 | extern qboolean msg_suppress_1; // suppresses resolution and cache size console output | ||
317 | // an fullscreen DIB focus gain/loss | ||
318 | extern int current_skill; // skill level for currently loaded level (in case | ||
319 | // the user changes the cvar while the level is | ||
320 | // running, this reflects the level actually in use) | ||
321 | |||
322 | extern qboolean isDedicated; | ||
323 | |||
324 | extern int minimum_memory; | ||
325 | |||
326 | // | ||
327 | // chase | ||
328 | // | ||
329 | extern cvar_t chase_active; | ||
330 | |||
331 | void Chase_Init (void); | ||
332 | void Chase_Reset (void); | ||
333 | void Chase_Update (void); | ||