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/d_iface.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/d_iface.h')
-rw-r--r-- | apps/plugins/sdl/progs/quake/d_iface.h | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/quake/d_iface.h b/apps/plugins/sdl/progs/quake/d_iface.h new file mode 100644 index 0000000000..8dc5ce94bc --- /dev/null +++ b/apps/plugins/sdl/progs/quake/d_iface.h | |||
@@ -0,0 +1,231 @@ | |||
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 | // d_iface.h: interface header file for rasterization driver modules | ||
21 | |||
22 | #define WARP_WIDTH 320 | ||
23 | #define WARP_HEIGHT 200 | ||
24 | |||
25 | #define MAX_LBM_HEIGHT 480 | ||
26 | |||
27 | typedef struct | ||
28 | { | ||
29 | float u, v; | ||
30 | float s, t; | ||
31 | float zi; | ||
32 | } emitpoint_t; | ||
33 | |||
34 | typedef int ptype_t; | ||
35 | |||
36 | enum { | ||
37 | pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2 | ||
38 | }; | ||
39 | |||
40 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! | ||
41 | typedef struct particle_s | ||
42 | { | ||
43 | // driver-usable fields | ||
44 | vec3_t org; | ||
45 | float color; | ||
46 | // drivers never touch the following fields | ||
47 | struct particle_s *next; | ||
48 | vec3_t vel; | ||
49 | float ramp; | ||
50 | float die; | ||
51 | ptype_t type; | ||
52 | } particle_t; | ||
53 | |||
54 | #define PARTICLE_Z_CLIP 8.0 | ||
55 | |||
56 | typedef struct polyvert_s { | ||
57 | float u, v, zi, s, t; | ||
58 | } polyvert_t; | ||
59 | |||
60 | typedef struct polydesc_s { | ||
61 | int numverts; | ||
62 | float nearzi; | ||
63 | msurface_t *pcurrentface; | ||
64 | polyvert_t *pverts; | ||
65 | } polydesc_t; | ||
66 | |||
67 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! | ||
68 | typedef struct finalvert_s { | ||
69 | int v[6]; // u, v, s, t, l, 1/z | ||
70 | int flags; | ||
71 | float reserved; | ||
72 | } finalvert_t; | ||
73 | |||
74 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! | ||
75 | typedef struct | ||
76 | { | ||
77 | void *pskin; | ||
78 | maliasskindesc_t *pskindesc; | ||
79 | int skinwidth; | ||
80 | int skinheight; | ||
81 | mtriangle_t *ptriangles; | ||
82 | finalvert_t *pfinalverts; | ||
83 | int numtriangles; | ||
84 | int drawtype; | ||
85 | int seamfixupX16; | ||
86 | } affinetridesc_t; | ||
87 | |||
88 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! | ||
89 | typedef struct { | ||
90 | float u, v, zi, color; | ||
91 | } screenpart_t; | ||
92 | |||
93 | typedef struct | ||
94 | { | ||
95 | int nump; | ||
96 | emitpoint_t *pverts; // there's room for an extra element at [nump], | ||
97 | // if the driver wants to duplicate element [0] at | ||
98 | // element [nump] to avoid dealing with wrapping | ||
99 | mspriteframe_t *pspriteframe; | ||
100 | vec3_t vup, vright, vpn; // in worldspace | ||
101 | float nearzi; | ||
102 | } spritedesc_t; | ||
103 | |||
104 | typedef struct | ||
105 | { | ||
106 | int u, v; | ||
107 | float zi; | ||
108 | int color; | ||
109 | } zpointdesc_t; | ||
110 | |||
111 | extern cvar_t r_drawflat; | ||
112 | extern int d_spanpixcount; | ||
113 | extern int r_framecount; // sequence # of current frame since Quake | ||
114 | // started | ||
115 | extern qboolean r_drawpolys; // 1 if driver wants clipped polygons | ||
116 | // rather than a span list | ||
117 | extern qboolean r_drawculledpolys; // 1 if driver wants clipped polygons that | ||
118 | // have been culled by the edge list | ||
119 | extern qboolean r_worldpolysbacktofront; // 1 if driver wants polygons | ||
120 | // delivered back to front rather | ||
121 | // than front to back | ||
122 | extern qboolean r_recursiveaffinetriangles; // true if a driver wants to use | ||
123 | // recursive triangular subdivison | ||
124 | // and vertex drawing via | ||
125 | // D_PolysetDrawFinalVerts() past | ||
126 | // a certain distance (normally | ||
127 | // only used by the software | ||
128 | // driver) | ||
129 | extern float r_aliasuvscale; // scale-up factor for screen u and v | ||
130 | // on Alias vertices passed to driver | ||
131 | extern int r_pixbytes; | ||
132 | extern qboolean r_dowarp; | ||
133 | |||
134 | extern affinetridesc_t r_affinetridesc; | ||
135 | extern spritedesc_t r_spritedesc; | ||
136 | extern zpointdesc_t r_zpointdesc; | ||
137 | extern polydesc_t r_polydesc; | ||
138 | |||
139 | extern int d_con_indirect; // if 0, Quake will draw console directly | ||
140 | // to vid.buffer; if 1, Quake will | ||
141 | // draw console via D_DrawRect. Must be | ||
142 | // defined by driver | ||
143 | |||
144 | extern vec3_t r_pright, r_pup, r_ppn; | ||
145 | |||
146 | |||
147 | void D_Aff8Patch (void *pcolormap); | ||
148 | void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height); | ||
149 | void D_DisableBackBufferAccess (void); | ||
150 | void D_EndDirectRect (int x, int y, int width, int height); | ||
151 | void D_PolysetDraw (void); | ||
152 | void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts); | ||
153 | void D_DrawParticle (particle_t *pparticle); | ||
154 | void D_DrawPoly (void); | ||
155 | void D_DrawSprite (void); | ||
156 | void D_DrawSurfaces (void); | ||
157 | void D_DrawZPoint (void); | ||
158 | void D_EnableBackBufferAccess (void); | ||
159 | void D_EndParticles (void); | ||
160 | void D_Init (void); | ||
161 | void D_ViewChanged (void); | ||
162 | void D_SetupFrame (void); | ||
163 | void D_StartParticles (void); | ||
164 | void D_TurnZOn (void); | ||
165 | void D_WarpScreen (void); | ||
166 | |||
167 | void D_FillRect (vrect_t *vrect, int color); | ||
168 | void D_DrawRect (void); | ||
169 | void D_UpdateRects (vrect_t *prect); | ||
170 | |||
171 | // currently for internal use only, and should be a do-nothing function in | ||
172 | // hardware drivers | ||
173 | // FIXME: this should go away | ||
174 | void D_PolysetUpdateTables (void); | ||
175 | |||
176 | // these are currently for internal use only, and should not be used by drivers | ||
177 | extern int r_skydirect; | ||
178 | extern byte *r_skysource; | ||
179 | |||
180 | // transparency types for D_DrawRect () | ||
181 | #define DR_SOLID 0 | ||
182 | #define DR_TRANSPARENT 1 | ||
183 | |||
184 | // !!! must be kept the same as in quakeasm.h !!! | ||
185 | #define TRANSPARENT_COLOR 0xFF | ||
186 | |||
187 | extern void *acolormap; // FIXME: should go away | ||
188 | |||
189 | //=======================================================================// | ||
190 | |||
191 | // callbacks to Quake | ||
192 | |||
193 | typedef struct | ||
194 | { | ||
195 | pixel_t *surfdat; // destination for generated surface | ||
196 | int rowbytes; // destination logical width in bytes | ||
197 | msurface_t *surf; // description for surface to generate | ||
198 | fixed8_t lightadj[MAXLIGHTMAPS]; | ||
199 | // adjust for lightmap levels for dynamic lighting | ||
200 | texture_t *texture; // corrected for animating textures | ||
201 | int surfmip; // mipmapped ratio of surface texels / world pixels | ||
202 | int surfwidth; // in mipmapped texels | ||
203 | int surfheight; // in mipmapped texels | ||
204 | } drawsurf_t; | ||
205 | |||
206 | extern drawsurf_t r_drawsurf; | ||
207 | |||
208 | void R_DrawSurface (void); | ||
209 | void R_GenTile (msurface_t *psurf, void *pdest); | ||
210 | |||
211 | |||
212 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! | ||
213 | #define TURB_TEX_SIZE 64 // base turbulent texture size | ||
214 | |||
215 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! | ||
216 | #define CYCLE 128 // turbulent cycle size | ||
217 | |||
218 | #define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf | ||
219 | |||
220 | #define SKYSHIFT 7 | ||
221 | #define SKYSIZE (1 << SKYSHIFT) | ||
222 | #define SKYMASK (SKYSIZE - 1) | ||
223 | |||
224 | extern float skyspeed, skyspeed2; | ||
225 | extern float skytime; | ||
226 | |||
227 | extern int c_surf; | ||
228 | extern vrect_t scr_vrect; | ||
229 | |||
230 | extern byte *r_warpbuffer; | ||
231 | |||