diff options
Diffstat (limited to 'apps/plugins/sdl/progs/wolf3d/wl_def.h')
-rw-r--r-- | apps/plugins/sdl/progs/wolf3d/wl_def.h | 1479 |
1 files changed, 1479 insertions, 0 deletions
diff --git a/apps/plugins/sdl/progs/wolf3d/wl_def.h b/apps/plugins/sdl/progs/wolf3d/wl_def.h new file mode 100644 index 0000000000..04bbb41bfb --- /dev/null +++ b/apps/plugins/sdl/progs/wolf3d/wl_def.h | |||
@@ -0,0 +1,1479 @@ | |||
1 | #ifndef WL_DEF_H | ||
2 | #define WL_DEF_H | ||
3 | |||
4 | // Defines which version shall be built and configures supported extra features | ||
5 | #include "version.h" | ||
6 | |||
7 | #define SOUND_ENABLE | ||
8 | |||
9 | #include "fixedpoint.h" | ||
10 | #include <ctype.h> | ||
11 | #include <stdint.h> | ||
12 | #include <stdarg.h> | ||
13 | #include <SDL.h> | ||
14 | #include <SDL_mixer.h> | ||
15 | |||
16 | #define open rb->open | ||
17 | #define read(a, b, c) rb->read((a), (b), (c)) | ||
18 | #define write(a, b, c) rb->write((a), (b), (c)) | ||
19 | #define close(a) rb->close(a) | ||
20 | |||
21 | #if !defined O_BINARY | ||
22 | # define O_BINARY 0 | ||
23 | #endif | ||
24 | |||
25 | #pragma pack(1) | ||
26 | |||
27 | #if defined(_arch_dreamcast) | ||
28 | #define YESBUTTONNAME "A" | ||
29 | #define NOBUTTONNAME "B" | ||
30 | #elif defined(GP2X) | ||
31 | #define YESBUTTONNAME "Y" | ||
32 | #define NOBUTTONNAME "B" | ||
33 | #else | ||
34 | #define YESBUTTONNAME "Y" | ||
35 | #define NOBUTTONNAME "N" | ||
36 | #endif | ||
37 | |||
38 | #include "foreign.h" | ||
39 | |||
40 | #ifndef SPEAR | ||
41 | #include "audiowl6.h" | ||
42 | #ifdef UPLOAD | ||
43 | #include "gfxv_apo.h" | ||
44 | #else | ||
45 | #ifdef GOODTIMES | ||
46 | #include "gfxv_wl6.h" | ||
47 | #else | ||
48 | #include "gfxv_apo.h" | ||
49 | #endif | ||
50 | #endif | ||
51 | #else | ||
52 | #include "audiosod.h" | ||
53 | #include "gfxv_sod.h" | ||
54 | #include "f_spear.h" | ||
55 | #endif | ||
56 | |||
57 | typedef uint8_t byte; | ||
58 | typedef uint16_t word; | ||
59 | typedef int32_t fixed; | ||
60 | typedef uint32_t longword; | ||
61 | typedef int8_t boolean; | ||
62 | typedef void * memptr; | ||
63 | |||
64 | typedef struct | ||
65 | { | ||
66 | int x,y; | ||
67 | } Point; | ||
68 | typedef struct | ||
69 | { | ||
70 | Point ul,lr; | ||
71 | } Rect; | ||
72 | |||
73 | void Quit(const char *errorStr, ...); | ||
74 | |||
75 | #include "id_pm.h" | ||
76 | #include "id_sd.h" | ||
77 | #include "id_in.h" | ||
78 | #include "id_vl.h" | ||
79 | #include "id_vh.h" | ||
80 | #include "id_us.h" | ||
81 | #include "id_ca.h" | ||
82 | |||
83 | #include "wl_menu.h" | ||
84 | |||
85 | #define MAPSPOT(x,y,plane) (mapsegs[plane][((y)<<mapshift)+(x)]) | ||
86 | |||
87 | #define SIGN(x) ((x)>0?1:-1) | ||
88 | #define ABS(x) ((int)(x)>0?(x):-(x)) | ||
89 | #define LABS(x) ((int32_t)(x)>0?(x):-(x)) | ||
90 | |||
91 | #define abs(x) ABS(x) | ||
92 | |||
93 | /* | ||
94 | ============================================================================= | ||
95 | |||
96 | GLOBAL CONSTANTS | ||
97 | |||
98 | ============================================================================= | ||
99 | */ | ||
100 | |||
101 | #define MAXTICS 10 | ||
102 | #define DEMOTICS 4 | ||
103 | |||
104 | #define MAXACTORS 150 // max number of nazis, etc / map | ||
105 | #define MAXSTATS 400 // max number of lamps, bonus, etc | ||
106 | #define MAXDOORS 64 // max number of sliding doors | ||
107 | #define MAXWALLTILES 64 // max number of wall tiles | ||
108 | |||
109 | // | ||
110 | // tile constants | ||
111 | // | ||
112 | |||
113 | #define ICONARROWS 90 | ||
114 | #define PUSHABLETILE 98 | ||
115 | #define EXITTILE 99 // at end of castle | ||
116 | #define AREATILE 107 // first of NUMAREAS floor tiles | ||
117 | #define NUMAREAS 37 | ||
118 | #define ELEVATORTILE 21 | ||
119 | #define AMBUSHTILE 106 | ||
120 | #define ALTELEVATORTILE 107 | ||
121 | |||
122 | #define NUMBERCHARS 9 | ||
123 | |||
124 | |||
125 | //---------------- | ||
126 | |||
127 | #define EXTRAPOINTS 40000 | ||
128 | |||
129 | #define PLAYERSPEED 3000 | ||
130 | #define RUNSPEED 6000 | ||
131 | |||
132 | #define SCREENSEG 0xa000 | ||
133 | |||
134 | #define SCREENBWIDE 80 | ||
135 | |||
136 | #define HEIGHTRATIO 0.50 // also defined in id_mm.c | ||
137 | |||
138 | #define BORDERCOLOR 3 | ||
139 | #define FLASHCOLOR 5 | ||
140 | #define FLASHTICS 4 | ||
141 | |||
142 | #ifndef SPEAR | ||
143 | #define LRpack 8 // # of levels to store in endgame | ||
144 | #else | ||
145 | #define LRpack 20 | ||
146 | #endif | ||
147 | |||
148 | #define PLAYERSIZE MINDIST // player radius | ||
149 | #define MINACTORDIST 0x10000l // minimum dist from player center | ||
150 | // to any actor center | ||
151 | |||
152 | #define NUMLATCHPICS 100 | ||
153 | |||
154 | #undef M_PI | ||
155 | #define PI 3.141592657 | ||
156 | #define M_PI PI | ||
157 | |||
158 | #define GLOBAL1 (1l<<16) | ||
159 | #define TILEGLOBAL GLOBAL1 | ||
160 | #define PIXGLOBAL (GLOBAL1/64) | ||
161 | #define TILESHIFT 16l | ||
162 | #define UNSIGNEDSHIFT 8 | ||
163 | |||
164 | #define ANGLES 360 // must be divisable by 4 | ||
165 | #define ANGLEQUAD (ANGLES/4) | ||
166 | #define FINEANGLES 3600 | ||
167 | #define ANG90 (FINEANGLES/4) | ||
168 | #define ANG180 (ANG90*2) | ||
169 | #define ANG270 (ANG90*3) | ||
170 | #define ANG360 (ANG90*4) | ||
171 | #define VANG90 (ANGLES/4) | ||
172 | #define VANG180 (VANG90*2) | ||
173 | #define VANG270 (VANG90*3) | ||
174 | #define VANG360 (VANG90*4) | ||
175 | |||
176 | #define MINDIST (0x5800l) | ||
177 | |||
178 | #define mapshift 6 | ||
179 | #define MAPSIZE (1<<mapshift) | ||
180 | #define maparea MAPSIZE*MAPSIZE | ||
181 | |||
182 | #define mapheight MAPSIZE | ||
183 | #define mapwidth MAPSIZE | ||
184 | |||
185 | #ifdef USE_HIRES | ||
186 | |||
187 | #define TEXTURESHIFT 7 | ||
188 | #define TEXTURESIZE (1<<TEXTURESHIFT) | ||
189 | #define TEXTUREFROMFIXEDSHIFT 2 | ||
190 | #define TEXTUREMASK (TEXTURESIZE*(TEXTURESIZE-1)) | ||
191 | |||
192 | #define SPRITESCALEFACTOR 1 | ||
193 | |||
194 | #else | ||
195 | |||
196 | #define TEXTURESHIFT 6 | ||
197 | #define TEXTURESIZE (1<<TEXTURESHIFT) | ||
198 | #define TEXTUREFROMFIXEDSHIFT 4 | ||
199 | #define TEXTUREMASK (TEXTURESIZE*(TEXTURESIZE-1)) | ||
200 | |||
201 | #define SPRITESCALEFACTOR 2 | ||
202 | |||
203 | #endif | ||
204 | |||
205 | #define NORTH 0 | ||
206 | #define EAST 1 | ||
207 | #define SOUTH 2 | ||
208 | #define WEST 3 | ||
209 | |||
210 | |||
211 | #define STATUSLINES 40 | ||
212 | |||
213 | #define SCREENSIZE (SCREENBWIDE*208) | ||
214 | #define PAGE1START 0 | ||
215 | #define PAGE2START (SCREENSIZE) | ||
216 | #define PAGE3START (SCREENSIZE*2u) | ||
217 | #define FREESTART (SCREENSIZE*3u) | ||
218 | |||
219 | |||
220 | #define PIXRADIUS 512 | ||
221 | |||
222 | #define STARTAMMO 8 | ||
223 | |||
224 | |||
225 | // object flag values | ||
226 | |||
227 | typedef enum | ||
228 | { | ||
229 | FL_SHOOTABLE = 0x00000001, | ||
230 | FL_BONUS = 0x00000002, | ||
231 | FL_NEVERMARK = 0x00000004, | ||
232 | FL_VISABLE = 0x00000008, | ||
233 | FL_ATTACKMODE = 0x00000010, | ||
234 | FL_FIRSTATTACK = 0x00000020, | ||
235 | FL_AMBUSH = 0x00000040, | ||
236 | FL_NONMARK = 0x00000080, | ||
237 | FL_FULLBRIGHT = 0x00000100, | ||
238 | #ifdef USE_DIR3DSPR | ||
239 | // you can choose one of the following values in wl_act1.cpp | ||
240 | // to make a static sprite a directional 3d sprite | ||
241 | // (see example at the end of the statinfo array) | ||
242 | FL_DIR_HORIZ_MID = 0x00000200, | ||
243 | FL_DIR_HORIZ_FW = 0x00000400, | ||
244 | FL_DIR_HORIZ_BW = 0x00000600, | ||
245 | FL_DIR_VERT_MID = 0x00000a00, | ||
246 | FL_DIR_VERT_FW = 0x00000c00, | ||
247 | FL_DIR_VERT_BW = 0x00000e00, | ||
248 | |||
249 | // these values are just used to improve readability of code | ||
250 | FL_DIR_NONE = 0x00000000, | ||
251 | FL_DIR_POS_MID = 0x00000200, | ||
252 | FL_DIR_POS_FW = 0x00000400, | ||
253 | FL_DIR_POS_BW = 0x00000600, | ||
254 | FL_DIR_POS_MASK = 0x00000600, | ||
255 | FL_DIR_VERT_FLAG = 0x00000800, | ||
256 | FL_DIR_MASK = 0x00000e00, | ||
257 | #endif | ||
258 | // next free bit is 0x00001000 | ||
259 | } objflag_t; | ||
260 | |||
261 | |||
262 | // | ||
263 | // sprite constants | ||
264 | // | ||
265 | |||
266 | enum | ||
267 | { | ||
268 | SPR_DEMO, | ||
269 | #ifndef APOGEE_1_0 | ||
270 | SPR_DEATHCAM, | ||
271 | #endif | ||
272 | // | ||
273 | // static sprites | ||
274 | // | ||
275 | SPR_STAT_0,SPR_STAT_1,SPR_STAT_2,SPR_STAT_3, | ||
276 | SPR_STAT_4,SPR_STAT_5,SPR_STAT_6,SPR_STAT_7, | ||
277 | |||
278 | SPR_STAT_8,SPR_STAT_9,SPR_STAT_10,SPR_STAT_11, | ||
279 | SPR_STAT_12,SPR_STAT_13,SPR_STAT_14,SPR_STAT_15, | ||
280 | |||
281 | SPR_STAT_16,SPR_STAT_17,SPR_STAT_18,SPR_STAT_19, | ||
282 | SPR_STAT_20,SPR_STAT_21,SPR_STAT_22,SPR_STAT_23, | ||
283 | |||
284 | SPR_STAT_24,SPR_STAT_25,SPR_STAT_26,SPR_STAT_27, | ||
285 | SPR_STAT_28,SPR_STAT_29,SPR_STAT_30,SPR_STAT_31, | ||
286 | |||
287 | SPR_STAT_32,SPR_STAT_33,SPR_STAT_34,SPR_STAT_35, | ||
288 | SPR_STAT_36,SPR_STAT_37,SPR_STAT_38,SPR_STAT_39, | ||
289 | |||
290 | SPR_STAT_40,SPR_STAT_41,SPR_STAT_42,SPR_STAT_43, | ||
291 | SPR_STAT_44,SPR_STAT_45,SPR_STAT_46,SPR_STAT_47, | ||
292 | |||
293 | #ifdef SPEAR | ||
294 | SPR_STAT_48,SPR_STAT_49,SPR_STAT_50,SPR_STAT_51, | ||
295 | #endif | ||
296 | |||
297 | // | ||
298 | // guard | ||
299 | // | ||
300 | SPR_GRD_S_1,SPR_GRD_S_2,SPR_GRD_S_3,SPR_GRD_S_4, | ||
301 | SPR_GRD_S_5,SPR_GRD_S_6,SPR_GRD_S_7,SPR_GRD_S_8, | ||
302 | |||
303 | SPR_GRD_W1_1,SPR_GRD_W1_2,SPR_GRD_W1_3,SPR_GRD_W1_4, | ||
304 | SPR_GRD_W1_5,SPR_GRD_W1_6,SPR_GRD_W1_7,SPR_GRD_W1_8, | ||
305 | |||
306 | SPR_GRD_W2_1,SPR_GRD_W2_2,SPR_GRD_W2_3,SPR_GRD_W2_4, | ||
307 | SPR_GRD_W2_5,SPR_GRD_W2_6,SPR_GRD_W2_7,SPR_GRD_W2_8, | ||
308 | |||
309 | SPR_GRD_W3_1,SPR_GRD_W3_2,SPR_GRD_W3_3,SPR_GRD_W3_4, | ||
310 | SPR_GRD_W3_5,SPR_GRD_W3_6,SPR_GRD_W3_7,SPR_GRD_W3_8, | ||
311 | |||
312 | SPR_GRD_W4_1,SPR_GRD_W4_2,SPR_GRD_W4_3,SPR_GRD_W4_4, | ||
313 | SPR_GRD_W4_5,SPR_GRD_W4_6,SPR_GRD_W4_7,SPR_GRD_W4_8, | ||
314 | |||
315 | SPR_GRD_PAIN_1,SPR_GRD_DIE_1,SPR_GRD_DIE_2,SPR_GRD_DIE_3, | ||
316 | SPR_GRD_PAIN_2,SPR_GRD_DEAD, | ||
317 | |||
318 | SPR_GRD_SHOOT1,SPR_GRD_SHOOT2,SPR_GRD_SHOOT3, | ||
319 | |||
320 | // | ||
321 | // dogs | ||
322 | // | ||
323 | SPR_DOG_W1_1,SPR_DOG_W1_2,SPR_DOG_W1_3,SPR_DOG_W1_4, | ||
324 | SPR_DOG_W1_5,SPR_DOG_W1_6,SPR_DOG_W1_7,SPR_DOG_W1_8, | ||
325 | |||
326 | SPR_DOG_W2_1,SPR_DOG_W2_2,SPR_DOG_W2_3,SPR_DOG_W2_4, | ||
327 | SPR_DOG_W2_5,SPR_DOG_W2_6,SPR_DOG_W2_7,SPR_DOG_W2_8, | ||
328 | |||
329 | SPR_DOG_W3_1,SPR_DOG_W3_2,SPR_DOG_W3_3,SPR_DOG_W3_4, | ||
330 | SPR_DOG_W3_5,SPR_DOG_W3_6,SPR_DOG_W3_7,SPR_DOG_W3_8, | ||
331 | |||
332 | SPR_DOG_W4_1,SPR_DOG_W4_2,SPR_DOG_W4_3,SPR_DOG_W4_4, | ||
333 | SPR_DOG_W4_5,SPR_DOG_W4_6,SPR_DOG_W4_7,SPR_DOG_W4_8, | ||
334 | |||
335 | SPR_DOG_DIE_1,SPR_DOG_DIE_2,SPR_DOG_DIE_3,SPR_DOG_DEAD, | ||
336 | SPR_DOG_JUMP1,SPR_DOG_JUMP2,SPR_DOG_JUMP3, | ||
337 | |||
338 | |||
339 | |||
340 | // | ||
341 | // ss | ||
342 | // | ||
343 | SPR_SS_S_1,SPR_SS_S_2,SPR_SS_S_3,SPR_SS_S_4, | ||
344 | SPR_SS_S_5,SPR_SS_S_6,SPR_SS_S_7,SPR_SS_S_8, | ||
345 | |||
346 | SPR_SS_W1_1,SPR_SS_W1_2,SPR_SS_W1_3,SPR_SS_W1_4, | ||
347 | SPR_SS_W1_5,SPR_SS_W1_6,SPR_SS_W1_7,SPR_SS_W1_8, | ||
348 | |||
349 | SPR_SS_W2_1,SPR_SS_W2_2,SPR_SS_W2_3,SPR_SS_W2_4, | ||
350 | SPR_SS_W2_5,SPR_SS_W2_6,SPR_SS_W2_7,SPR_SS_W2_8, | ||
351 | |||
352 | SPR_SS_W3_1,SPR_SS_W3_2,SPR_SS_W3_3,SPR_SS_W3_4, | ||
353 | SPR_SS_W3_5,SPR_SS_W3_6,SPR_SS_W3_7,SPR_SS_W3_8, | ||
354 | |||
355 | SPR_SS_W4_1,SPR_SS_W4_2,SPR_SS_W4_3,SPR_SS_W4_4, | ||
356 | SPR_SS_W4_5,SPR_SS_W4_6,SPR_SS_W4_7,SPR_SS_W4_8, | ||
357 | |||
358 | SPR_SS_PAIN_1,SPR_SS_DIE_1,SPR_SS_DIE_2,SPR_SS_DIE_3, | ||
359 | SPR_SS_PAIN_2,SPR_SS_DEAD, | ||
360 | |||
361 | SPR_SS_SHOOT1,SPR_SS_SHOOT2,SPR_SS_SHOOT3, | ||
362 | |||
363 | // | ||
364 | // mutant | ||
365 | // | ||
366 | SPR_MUT_S_1,SPR_MUT_S_2,SPR_MUT_S_3,SPR_MUT_S_4, | ||
367 | SPR_MUT_S_5,SPR_MUT_S_6,SPR_MUT_S_7,SPR_MUT_S_8, | ||
368 | |||
369 | SPR_MUT_W1_1,SPR_MUT_W1_2,SPR_MUT_W1_3,SPR_MUT_W1_4, | ||
370 | SPR_MUT_W1_5,SPR_MUT_W1_6,SPR_MUT_W1_7,SPR_MUT_W1_8, | ||
371 | |||
372 | SPR_MUT_W2_1,SPR_MUT_W2_2,SPR_MUT_W2_3,SPR_MUT_W2_4, | ||
373 | SPR_MUT_W2_5,SPR_MUT_W2_6,SPR_MUT_W2_7,SPR_MUT_W2_8, | ||
374 | |||
375 | SPR_MUT_W3_1,SPR_MUT_W3_2,SPR_MUT_W3_3,SPR_MUT_W3_4, | ||
376 | SPR_MUT_W3_5,SPR_MUT_W3_6,SPR_MUT_W3_7,SPR_MUT_W3_8, | ||
377 | |||
378 | SPR_MUT_W4_1,SPR_MUT_W4_2,SPR_MUT_W4_3,SPR_MUT_W4_4, | ||
379 | SPR_MUT_W4_5,SPR_MUT_W4_6,SPR_MUT_W4_7,SPR_MUT_W4_8, | ||
380 | |||
381 | SPR_MUT_PAIN_1,SPR_MUT_DIE_1,SPR_MUT_DIE_2,SPR_MUT_DIE_3, | ||
382 | SPR_MUT_PAIN_2,SPR_MUT_DIE_4,SPR_MUT_DEAD, | ||
383 | |||
384 | SPR_MUT_SHOOT1,SPR_MUT_SHOOT2,SPR_MUT_SHOOT3,SPR_MUT_SHOOT4, | ||
385 | |||
386 | // | ||
387 | // officer | ||
388 | // | ||
389 | SPR_OFC_S_1,SPR_OFC_S_2,SPR_OFC_S_3,SPR_OFC_S_4, | ||
390 | SPR_OFC_S_5,SPR_OFC_S_6,SPR_OFC_S_7,SPR_OFC_S_8, | ||
391 | |||
392 | SPR_OFC_W1_1,SPR_OFC_W1_2,SPR_OFC_W1_3,SPR_OFC_W1_4, | ||
393 | SPR_OFC_W1_5,SPR_OFC_W1_6,SPR_OFC_W1_7,SPR_OFC_W1_8, | ||
394 | |||
395 | SPR_OFC_W2_1,SPR_OFC_W2_2,SPR_OFC_W2_3,SPR_OFC_W2_4, | ||
396 | SPR_OFC_W2_5,SPR_OFC_W2_6,SPR_OFC_W2_7,SPR_OFC_W2_8, | ||
397 | |||
398 | SPR_OFC_W3_1,SPR_OFC_W3_2,SPR_OFC_W3_3,SPR_OFC_W3_4, | ||
399 | SPR_OFC_W3_5,SPR_OFC_W3_6,SPR_OFC_W3_7,SPR_OFC_W3_8, | ||
400 | |||
401 | SPR_OFC_W4_1,SPR_OFC_W4_2,SPR_OFC_W4_3,SPR_OFC_W4_4, | ||
402 | SPR_OFC_W4_5,SPR_OFC_W4_6,SPR_OFC_W4_7,SPR_OFC_W4_8, | ||
403 | |||
404 | SPR_OFC_PAIN_1,SPR_OFC_DIE_1,SPR_OFC_DIE_2,SPR_OFC_DIE_3, | ||
405 | SPR_OFC_PAIN_2,SPR_OFC_DIE_4,SPR_OFC_DEAD, | ||
406 | |||
407 | SPR_OFC_SHOOT1,SPR_OFC_SHOOT2,SPR_OFC_SHOOT3, | ||
408 | |||
409 | #ifndef SPEAR | ||
410 | // | ||
411 | // ghosts | ||
412 | // | ||
413 | SPR_BLINKY_W1,SPR_BLINKY_W2,SPR_PINKY_W1,SPR_PINKY_W2, | ||
414 | SPR_CLYDE_W1,SPR_CLYDE_W2,SPR_INKY_W1,SPR_INKY_W2, | ||
415 | |||
416 | // | ||
417 | // hans | ||
418 | // | ||
419 | SPR_BOSS_W1,SPR_BOSS_W2,SPR_BOSS_W3,SPR_BOSS_W4, | ||
420 | SPR_BOSS_SHOOT1,SPR_BOSS_SHOOT2,SPR_BOSS_SHOOT3,SPR_BOSS_DEAD, | ||
421 | |||
422 | SPR_BOSS_DIE1,SPR_BOSS_DIE2,SPR_BOSS_DIE3, | ||
423 | |||
424 | // | ||
425 | // schabbs | ||
426 | // | ||
427 | SPR_SCHABB_W1,SPR_SCHABB_W2,SPR_SCHABB_W3,SPR_SCHABB_W4, | ||
428 | SPR_SCHABB_SHOOT1,SPR_SCHABB_SHOOT2, | ||
429 | |||
430 | SPR_SCHABB_DIE1,SPR_SCHABB_DIE2,SPR_SCHABB_DIE3,SPR_SCHABB_DEAD, | ||
431 | SPR_HYPO1,SPR_HYPO2,SPR_HYPO3,SPR_HYPO4, | ||
432 | |||
433 | // | ||
434 | // fake | ||
435 | // | ||
436 | SPR_FAKE_W1,SPR_FAKE_W2,SPR_FAKE_W3,SPR_FAKE_W4, | ||
437 | SPR_FAKE_SHOOT,SPR_FIRE1,SPR_FIRE2, | ||
438 | |||
439 | SPR_FAKE_DIE1,SPR_FAKE_DIE2,SPR_FAKE_DIE3,SPR_FAKE_DIE4, | ||
440 | SPR_FAKE_DIE5,SPR_FAKE_DEAD, | ||
441 | |||
442 | // | ||
443 | // hitler | ||
444 | // | ||
445 | SPR_MECHA_W1,SPR_MECHA_W2,SPR_MECHA_W3,SPR_MECHA_W4, | ||
446 | SPR_MECHA_SHOOT1,SPR_MECHA_SHOOT2,SPR_MECHA_SHOOT3,SPR_MECHA_DEAD, | ||
447 | |||
448 | SPR_MECHA_DIE1,SPR_MECHA_DIE2,SPR_MECHA_DIE3, | ||
449 | |||
450 | SPR_HITLER_W1,SPR_HITLER_W2,SPR_HITLER_W3,SPR_HITLER_W4, | ||
451 | SPR_HITLER_SHOOT1,SPR_HITLER_SHOOT2,SPR_HITLER_SHOOT3,SPR_HITLER_DEAD, | ||
452 | |||
453 | SPR_HITLER_DIE1,SPR_HITLER_DIE2,SPR_HITLER_DIE3,SPR_HITLER_DIE4, | ||
454 | SPR_HITLER_DIE5,SPR_HITLER_DIE6,SPR_HITLER_DIE7, | ||
455 | |||
456 | // | ||
457 | // giftmacher | ||
458 | // | ||
459 | SPR_GIFT_W1,SPR_GIFT_W2,SPR_GIFT_W3,SPR_GIFT_W4, | ||
460 | SPR_GIFT_SHOOT1,SPR_GIFT_SHOOT2, | ||
461 | |||
462 | SPR_GIFT_DIE1,SPR_GIFT_DIE2,SPR_GIFT_DIE3,SPR_GIFT_DEAD, | ||
463 | #endif | ||
464 | // | ||
465 | // Rocket, smoke and small explosion | ||
466 | // | ||
467 | SPR_ROCKET_1,SPR_ROCKET_2,SPR_ROCKET_3,SPR_ROCKET_4, | ||
468 | SPR_ROCKET_5,SPR_ROCKET_6,SPR_ROCKET_7,SPR_ROCKET_8, | ||
469 | |||
470 | SPR_SMOKE_1,SPR_SMOKE_2,SPR_SMOKE_3,SPR_SMOKE_4, | ||
471 | SPR_BOOM_1,SPR_BOOM_2,SPR_BOOM_3, | ||
472 | |||
473 | // | ||
474 | // Angel of Death's DeathSparks(tm) | ||
475 | // | ||
476 | #ifdef SPEAR | ||
477 | SPR_HROCKET_1,SPR_HROCKET_2,SPR_HROCKET_3,SPR_HROCKET_4, | ||
478 | SPR_HROCKET_5,SPR_HROCKET_6,SPR_HROCKET_7,SPR_HROCKET_8, | ||
479 | |||
480 | SPR_HSMOKE_1,SPR_HSMOKE_2,SPR_HSMOKE_3,SPR_HSMOKE_4, | ||
481 | SPR_HBOOM_1,SPR_HBOOM_2,SPR_HBOOM_3, | ||
482 | |||
483 | SPR_SPARK1,SPR_SPARK2,SPR_SPARK3,SPR_SPARK4, | ||
484 | #endif | ||
485 | |||
486 | #ifndef SPEAR | ||
487 | // | ||
488 | // gretel | ||
489 | // | ||
490 | SPR_GRETEL_W1,SPR_GRETEL_W2,SPR_GRETEL_W3,SPR_GRETEL_W4, | ||
491 | SPR_GRETEL_SHOOT1,SPR_GRETEL_SHOOT2,SPR_GRETEL_SHOOT3,SPR_GRETEL_DEAD, | ||
492 | |||
493 | SPR_GRETEL_DIE1,SPR_GRETEL_DIE2,SPR_GRETEL_DIE3, | ||
494 | |||
495 | // | ||
496 | // fat face | ||
497 | // | ||
498 | SPR_FAT_W1,SPR_FAT_W2,SPR_FAT_W3,SPR_FAT_W4, | ||
499 | SPR_FAT_SHOOT1,SPR_FAT_SHOOT2,SPR_FAT_SHOOT3,SPR_FAT_SHOOT4, | ||
500 | |||
501 | SPR_FAT_DIE1,SPR_FAT_DIE2,SPR_FAT_DIE3,SPR_FAT_DEAD, | ||
502 | |||
503 | // | ||
504 | // bj | ||
505 | // | ||
506 | #ifdef APOGEE_1_0 | ||
507 | SPR_BJ_W1=360, | ||
508 | #elif defined(APOGEE_1_1) && defined(UPLOAD) | ||
509 | SPR_BJ_W1=406, | ||
510 | #else | ||
511 | SPR_BJ_W1, | ||
512 | #endif | ||
513 | SPR_BJ_W2,SPR_BJ_W3,SPR_BJ_W4, | ||
514 | SPR_BJ_JUMP1,SPR_BJ_JUMP2,SPR_BJ_JUMP3,SPR_BJ_JUMP4, | ||
515 | #else | ||
516 | // | ||
517 | // THESE ARE FOR 'SPEAR OF DESTINY' | ||
518 | // | ||
519 | |||
520 | // | ||
521 | // Trans Grosse | ||
522 | // | ||
523 | SPR_TRANS_W1,SPR_TRANS_W2,SPR_TRANS_W3,SPR_TRANS_W4, | ||
524 | SPR_TRANS_SHOOT1,SPR_TRANS_SHOOT2,SPR_TRANS_SHOOT3,SPR_TRANS_DEAD, | ||
525 | |||
526 | SPR_TRANS_DIE1,SPR_TRANS_DIE2,SPR_TRANS_DIE3, | ||
527 | |||
528 | // | ||
529 | // Wilhelm | ||
530 | // | ||
531 | SPR_WILL_W1,SPR_WILL_W2,SPR_WILL_W3,SPR_WILL_W4, | ||
532 | SPR_WILL_SHOOT1,SPR_WILL_SHOOT2,SPR_WILL_SHOOT3,SPR_WILL_SHOOT4, | ||
533 | |||
534 | SPR_WILL_DIE1,SPR_WILL_DIE2,SPR_WILL_DIE3,SPR_WILL_DEAD, | ||
535 | |||
536 | // | ||
537 | // UberMutant | ||
538 | // | ||
539 | SPR_UBER_W1,SPR_UBER_W2,SPR_UBER_W3,SPR_UBER_W4, | ||
540 | SPR_UBER_SHOOT1,SPR_UBER_SHOOT2,SPR_UBER_SHOOT3,SPR_UBER_SHOOT4, | ||
541 | |||
542 | SPR_UBER_DIE1,SPR_UBER_DIE2,SPR_UBER_DIE3,SPR_UBER_DIE4, | ||
543 | SPR_UBER_DEAD, | ||
544 | |||
545 | // | ||
546 | // Death Knight | ||
547 | // | ||
548 | SPR_DEATH_W1,SPR_DEATH_W2,SPR_DEATH_W3,SPR_DEATH_W4, | ||
549 | SPR_DEATH_SHOOT1,SPR_DEATH_SHOOT2,SPR_DEATH_SHOOT3,SPR_DEATH_SHOOT4, | ||
550 | |||
551 | SPR_DEATH_DIE1,SPR_DEATH_DIE2,SPR_DEATH_DIE3,SPR_DEATH_DIE4, | ||
552 | SPR_DEATH_DIE5,SPR_DEATH_DIE6,SPR_DEATH_DEAD, | ||
553 | |||
554 | // | ||
555 | // Ghost | ||
556 | // | ||
557 | SPR_SPECTRE_W1,SPR_SPECTRE_W2,SPR_SPECTRE_W3,SPR_SPECTRE_W4, | ||
558 | SPR_SPECTRE_F1,SPR_SPECTRE_F2,SPR_SPECTRE_F3,SPR_SPECTRE_F4, | ||
559 | |||
560 | // | ||
561 | // Angel of Death | ||
562 | // | ||
563 | SPR_ANGEL_W1,SPR_ANGEL_W2,SPR_ANGEL_W3,SPR_ANGEL_W4, | ||
564 | SPR_ANGEL_SHOOT1,SPR_ANGEL_SHOOT2,SPR_ANGEL_TIRED1,SPR_ANGEL_TIRED2, | ||
565 | |||
566 | SPR_ANGEL_DIE1,SPR_ANGEL_DIE2,SPR_ANGEL_DIE3,SPR_ANGEL_DIE4, | ||
567 | SPR_ANGEL_DIE5,SPR_ANGEL_DIE6,SPR_ANGEL_DIE7,SPR_ANGEL_DEAD, | ||
568 | |||
569 | #endif | ||
570 | |||
571 | // | ||
572 | // player attack frames | ||
573 | // | ||
574 | SPR_KNIFEREADY,SPR_KNIFEATK1,SPR_KNIFEATK2,SPR_KNIFEATK3, | ||
575 | SPR_KNIFEATK4, | ||
576 | |||
577 | SPR_PISTOLREADY,SPR_PISTOLATK1,SPR_PISTOLATK2,SPR_PISTOLATK3, | ||
578 | SPR_PISTOLATK4, | ||
579 | |||
580 | SPR_MACHINEGUNREADY,SPR_MACHINEGUNATK1,SPR_MACHINEGUNATK2,MACHINEGUNATK3, | ||
581 | SPR_MACHINEGUNATK4, | ||
582 | |||
583 | SPR_CHAINREADY,SPR_CHAINATK1,SPR_CHAINATK2,SPR_CHAINATK3, | ||
584 | SPR_CHAINATK4, | ||
585 | |||
586 | }; | ||
587 | |||
588 | |||
589 | /* | ||
590 | ============================================================================= | ||
591 | |||
592 | GLOBAL TYPES | ||
593 | |||
594 | ============================================================================= | ||
595 | */ | ||
596 | |||
597 | typedef enum { | ||
598 | di_north, | ||
599 | di_east, | ||
600 | di_south, | ||
601 | di_west | ||
602 | } controldir_t; | ||
603 | |||
604 | typedef enum { | ||
605 | dr_normal, | ||
606 | dr_lock1, | ||
607 | dr_lock2, | ||
608 | dr_lock3, | ||
609 | dr_lock4, | ||
610 | dr_elevator | ||
611 | } door_t; | ||
612 | |||
613 | typedef enum { | ||
614 | ac_badobject = -1, | ||
615 | ac_no, | ||
616 | ac_yes, | ||
617 | ac_allways | ||
618 | } activetype; | ||
619 | |||
620 | typedef enum { | ||
621 | nothing, | ||
622 | playerobj, | ||
623 | inertobj, | ||
624 | guardobj, | ||
625 | officerobj, | ||
626 | ssobj, | ||
627 | dogobj, | ||
628 | bossobj, | ||
629 | schabbobj, | ||
630 | fakeobj, | ||
631 | mechahitlerobj, | ||
632 | mutantobj, | ||
633 | needleobj, | ||
634 | fireobj, | ||
635 | bjobj, | ||
636 | ghostobj, | ||
637 | realhitlerobj, | ||
638 | gretelobj, | ||
639 | giftobj, | ||
640 | fatobj, | ||
641 | rocketobj, | ||
642 | |||
643 | spectreobj, | ||
644 | angelobj, | ||
645 | transobj, | ||
646 | uberobj, | ||
647 | willobj, | ||
648 | deathobj, | ||
649 | hrocketobj, | ||
650 | sparkobj | ||
651 | } classtype; | ||
652 | |||
653 | typedef enum { | ||
654 | none, | ||
655 | block, | ||
656 | bo_gibs, | ||
657 | bo_alpo, | ||
658 | bo_firstaid, | ||
659 | bo_key1, | ||
660 | bo_key2, | ||
661 | bo_key3, | ||
662 | bo_key4, | ||
663 | bo_cross, | ||
664 | bo_chalice, | ||
665 | bo_bible, | ||
666 | bo_crown, | ||
667 | bo_clip, | ||
668 | bo_clip2, | ||
669 | bo_machinegun, | ||
670 | bo_chaingun, | ||
671 | bo_food, | ||
672 | bo_fullheal, | ||
673 | bo_25clip, | ||
674 | bo_spear | ||
675 | } wl_stat_t; | ||
676 | |||
677 | typedef enum { | ||
678 | east, | ||
679 | northeast, | ||
680 | north, | ||
681 | northwest, | ||
682 | west, | ||
683 | southwest, | ||
684 | south, | ||
685 | southeast, | ||
686 | nodir | ||
687 | } dirtype; | ||
688 | |||
689 | |||
690 | #define NUMENEMIES 22 | ||
691 | typedef enum { | ||
692 | en_guard, | ||
693 | en_officer, | ||
694 | en_ss, | ||
695 | en_dog, | ||
696 | en_boss, | ||
697 | en_schabbs, | ||
698 | en_fake, | ||
699 | en_hitler, | ||
700 | en_mutant, | ||
701 | en_blinky, | ||
702 | en_clyde, | ||
703 | en_pinky, | ||
704 | en_inky, | ||
705 | en_gretel, | ||
706 | en_gift, | ||
707 | en_fat, | ||
708 | en_spectre, | ||
709 | en_angel, | ||
710 | en_trans, | ||
711 | en_uber, | ||
712 | en_will, | ||
713 | en_death | ||
714 | } enemy_t; | ||
715 | |||
716 | typedef void (* statefunc) (void *); | ||
717 | |||
718 | typedef struct statestruct | ||
719 | { | ||
720 | boolean rotate; | ||
721 | short shapenum; // a shapenum of -1 means get from ob->temp1 | ||
722 | short tictime; | ||
723 | void (*think) (void *),(*action) (void *); | ||
724 | struct statestruct *next; | ||
725 | } statetype; | ||
726 | |||
727 | |||
728 | //--------------------- | ||
729 | // | ||
730 | // trivial actor structure | ||
731 | // | ||
732 | //--------------------- | ||
733 | |||
734 | typedef struct statstruct | ||
735 | { | ||
736 | byte tilex,tiley; | ||
737 | short shapenum; // if shapenum == -1 the obj has been removed | ||
738 | byte *visspot; | ||
739 | uint32_t flags; | ||
740 | byte itemnumber; | ||
741 | } statobj_t; | ||
742 | |||
743 | |||
744 | //--------------------- | ||
745 | // | ||
746 | // door actor structure | ||
747 | // | ||
748 | //--------------------- | ||
749 | |||
750 | typedef enum | ||
751 | { | ||
752 | dr_open,dr_closed,dr_opening,dr_closing | ||
753 | } doortype; | ||
754 | |||
755 | typedef struct doorstruct | ||
756 | { | ||
757 | byte tilex,tiley; | ||
758 | boolean vertical; | ||
759 | byte lock; | ||
760 | doortype action; | ||
761 | short ticcount; | ||
762 | } doorobj_t; | ||
763 | |||
764 | |||
765 | //-------------------- | ||
766 | // | ||
767 | // thinking actor structure | ||
768 | // | ||
769 | //-------------------- | ||
770 | |||
771 | typedef struct objstruct | ||
772 | { | ||
773 | activetype active; | ||
774 | short ticcount; | ||
775 | classtype obclass; | ||
776 | statetype *state; | ||
777 | |||
778 | uint32_t flags; // FL_SHOOTABLE, etc | ||
779 | |||
780 | int32_t distance; // if negative, wait for that door to open | ||
781 | dirtype dir; | ||
782 | |||
783 | fixed x,y; | ||
784 | word tilex,tiley; | ||
785 | byte areanumber; | ||
786 | |||
787 | short viewx; | ||
788 | word viewheight; | ||
789 | fixed transx,transy; // in global coord | ||
790 | |||
791 | short angle; | ||
792 | short hitpoints; | ||
793 | int32_t speed; | ||
794 | |||
795 | short temp1,temp2,hidden; | ||
796 | struct objstruct *next,*prev; | ||
797 | } objtype; | ||
798 | |||
799 | enum | ||
800 | { | ||
801 | bt_nobutton=-1, | ||
802 | bt_attack=0, | ||
803 | bt_strafe, | ||
804 | bt_run, | ||
805 | bt_use, | ||
806 | bt_readyknife, | ||
807 | bt_readypistol, | ||
808 | bt_readymachinegun, | ||
809 | bt_readychaingun, | ||
810 | bt_nextweapon, | ||
811 | bt_prevweapon, | ||
812 | bt_esc, | ||
813 | bt_pause, | ||
814 | bt_strafeleft, | ||
815 | bt_straferight, | ||
816 | bt_moveforward, | ||
817 | bt_movebackward, | ||
818 | bt_turnleft, | ||
819 | bt_turnright, | ||
820 | NUMBUTTONS | ||
821 | }; | ||
822 | |||
823 | |||
824 | #define NUMWEAPONS 4 | ||
825 | typedef enum | ||
826 | { | ||
827 | wp_knife, | ||
828 | wp_pistol, | ||
829 | wp_machinegun, | ||
830 | wp_chaingun | ||
831 | } weapontype; | ||
832 | |||
833 | |||
834 | enum | ||
835 | { | ||
836 | gd_baby, | ||
837 | gd_easy, | ||
838 | gd_medium, | ||
839 | gd_hard | ||
840 | }; | ||
841 | |||
842 | //--------------- | ||
843 | // | ||
844 | // gamestate structure | ||
845 | // | ||
846 | //--------------- | ||
847 | |||
848 | typedef struct | ||
849 | { | ||
850 | short difficulty; | ||
851 | short mapon; | ||
852 | int32_t oldscore,score,nextextra; | ||
853 | short lives; | ||
854 | short health; | ||
855 | short ammo; | ||
856 | short keys; | ||
857 | weapontype bestweapon,weapon,chosenweapon; | ||
858 | |||
859 | short faceframe; | ||
860 | short attackframe,attackcount,weaponframe; | ||
861 | |||
862 | short episode,secretcount,treasurecount,killcount, | ||
863 | secrettotal,treasuretotal,killtotal; | ||
864 | int32_t TimeCount; | ||
865 | int32_t killx,killy; | ||
866 | boolean victoryflag; // set during victory animations | ||
867 | } gametype; | ||
868 | |||
869 | |||
870 | typedef enum | ||
871 | { | ||
872 | ex_stillplaying, | ||
873 | ex_completed, | ||
874 | ex_died, | ||
875 | ex_warped, | ||
876 | ex_resetgame, | ||
877 | ex_loadedgame, | ||
878 | ex_victorious, | ||
879 | ex_abort, | ||
880 | ex_demodone, | ||
881 | ex_secretlevel | ||
882 | } exit_t; | ||
883 | |||
884 | |||
885 | extern word *mapsegs[MAPPLANES]; | ||
886 | extern int mapon; | ||
887 | |||
888 | /* | ||
889 | ============================================================================= | ||
890 | |||
891 | WL_MAIN DEFINITIONS | ||
892 | |||
893 | ============================================================================= | ||
894 | */ | ||
895 | |||
896 | extern boolean loadedgame; | ||
897 | extern fixed focallength; | ||
898 | extern int viewscreenx, viewscreeny; | ||
899 | extern int viewwidth; | ||
900 | extern int viewheight; | ||
901 | extern short centerx; | ||
902 | extern int32_t heightnumerator; | ||
903 | extern fixed scale; | ||
904 | |||
905 | extern int dirangle[9]; | ||
906 | |||
907 | extern int mouseadjustment; | ||
908 | extern int shootdelta; | ||
909 | extern unsigned screenofs; | ||
910 | |||
911 | extern boolean startgame; | ||
912 | extern char str[80]; | ||
913 | extern char configdir[256]; | ||
914 | extern char configname[13]; | ||
915 | |||
916 | // | ||
917 | // Command line parameter variables | ||
918 | // | ||
919 | extern boolean param_debugmode; | ||
920 | extern boolean param_nowait; | ||
921 | extern int param_difficulty; | ||
922 | extern int param_tedlevel; | ||
923 | extern int param_joystickindex; | ||
924 | extern int param_joystickhat; | ||
925 | extern int param_samplerate; | ||
926 | extern int param_audiobuffer; | ||
927 | extern int param_mission; | ||
928 | extern boolean param_goodtimes; | ||
929 | extern boolean param_ignorenumchunks; | ||
930 | |||
931 | |||
932 | void NewGame (int difficulty,int episode); | ||
933 | void CalcProjection (int32_t focal); | ||
934 | void NewViewSize (int width); | ||
935 | boolean SetViewSize (unsigned width, unsigned height); | ||
936 | boolean LoadTheGame(FILE *file,int x,int y); | ||
937 | boolean SaveTheGame(FILE *file,int x,int y); | ||
938 | void ShowViewSize (int width); | ||
939 | void ShutdownId (void); | ||
940 | |||
941 | |||
942 | /* | ||
943 | ============================================================================= | ||
944 | |||
945 | WL_GAME DEFINITIONS | ||
946 | |||
947 | ============================================================================= | ||
948 | */ | ||
949 | |||
950 | extern gametype gamestate; | ||
951 | extern byte bordercol; | ||
952 | extern SDL_Surface *latchpics[NUMLATCHPICS]; | ||
953 | extern char demoname[13]; | ||
954 | |||
955 | void SetupGameLevel (void); | ||
956 | void GameLoop (void); | ||
957 | void DrawPlayBorder (void); | ||
958 | void DrawStatusBorder (byte color); | ||
959 | void DrawPlayScreen (void); | ||
960 | void DrawPlayBorderSides (void); | ||
961 | void ShowActStatus(); | ||
962 | |||
963 | void PlayDemo (int demonumber); | ||
964 | void RecordDemo (void); | ||
965 | |||
966 | |||
967 | #ifdef SPEAR | ||
968 | extern int32_t spearx,speary; | ||
969 | extern unsigned spearangle; | ||
970 | extern boolean spearflag; | ||
971 | #endif | ||
972 | |||
973 | |||
974 | #define ClearMemory SD_StopDigitized | ||
975 | |||
976 | |||
977 | // JAB | ||
978 | #define PlaySoundLocTile(s,tx,ty) PlaySoundLocGlobal(s,(((int32_t)(tx) << TILESHIFT) + (1L << (TILESHIFT - 1))),(((int32_t)ty << TILESHIFT) + (1L << (TILESHIFT - 1)))) | ||
979 | #define PlaySoundLocActor(s,ob) PlaySoundLocGlobal(s,(ob)->x,(ob)->y) | ||
980 | void PlaySoundLocGlobal(word s,fixed gx,fixed gy); | ||
981 | void UpdateSoundLoc(void); | ||
982 | |||
983 | |||
984 | /* | ||
985 | ============================================================================= | ||
986 | |||
987 | WL_PLAY DEFINITIONS | ||
988 | |||
989 | ============================================================================= | ||
990 | */ | ||
991 | |||
992 | #define BASEMOVE 35 | ||
993 | #define RUNMOVE 70 | ||
994 | #define BASETURN 35 | ||
995 | #define RUNTURN 70 | ||
996 | |||
997 | #define JOYSCALE 2 | ||
998 | |||
999 | extern byte tilemap[MAPSIZE][MAPSIZE]; // wall values only | ||
1000 | extern byte spotvis[MAPSIZE][MAPSIZE]; | ||
1001 | extern objtype *actorat[MAPSIZE][MAPSIZE]; | ||
1002 | |||
1003 | extern objtype *player; | ||
1004 | |||
1005 | extern unsigned tics; | ||
1006 | extern int viewsize; | ||
1007 | |||
1008 | extern int lastgamemusicoffset; | ||
1009 | |||
1010 | // | ||
1011 | // current user input | ||
1012 | // | ||
1013 | extern int controlx,controly; // range from -100 to 100 | ||
1014 | extern boolean buttonstate[NUMBUTTONS]; | ||
1015 | extern objtype objlist[MAXACTORS]; | ||
1016 | extern boolean buttonheld[NUMBUTTONS]; | ||
1017 | extern exit_t playstate; | ||
1018 | extern boolean madenoise; | ||
1019 | extern statobj_t statobjlist[MAXSTATS]; | ||
1020 | extern statobj_t *laststatobj; | ||
1021 | extern objtype *newobj,*killerobj; | ||
1022 | extern doorobj_t doorobjlist[MAXDOORS]; | ||
1023 | extern doorobj_t *lastdoorobj; | ||
1024 | extern int godmode; | ||
1025 | |||
1026 | extern boolean demorecord,demoplayback; | ||
1027 | extern int8_t *demoptr, *lastdemoptr; | ||
1028 | extern memptr demobuffer; | ||
1029 | |||
1030 | // | ||
1031 | // control info | ||
1032 | // | ||
1033 | extern boolean mouseenabled,joystickenabled; | ||
1034 | extern int dirscan[4]; | ||
1035 | extern int buttonscan[NUMBUTTONS]; | ||
1036 | extern int buttonmouse[4]; | ||
1037 | extern int buttonjoy[32]; | ||
1038 | |||
1039 | void InitActorList (void); | ||
1040 | void GetNewActor (void); | ||
1041 | void PlayLoop (void); | ||
1042 | |||
1043 | void CenterWindow(word w,word h); | ||
1044 | |||
1045 | void InitRedShifts (void); | ||
1046 | void FinishPaletteShifts (void); | ||
1047 | |||
1048 | void RemoveObj (objtype *gone); | ||
1049 | void PollControls (void); | ||
1050 | int StopMusic(void); | ||
1051 | void StartMusic(void); | ||
1052 | void ContinueMusic(int offs); | ||
1053 | void StartDamageFlash (int damage); | ||
1054 | void StartBonusFlash (void); | ||
1055 | |||
1056 | #ifdef SPEAR | ||
1057 | extern int32_t funnyticount; // FOR FUNNY BJ FACE | ||
1058 | #endif | ||
1059 | |||
1060 | extern objtype *objfreelist; // *obj,*player,*lastobj, | ||
1061 | |||
1062 | extern boolean noclip,ammocheat; | ||
1063 | extern int singlestep, extravbls; | ||
1064 | |||
1065 | /* | ||
1066 | ============================================================================= | ||
1067 | |||
1068 | WL_INTER | ||
1069 | |||
1070 | ============================================================================= | ||
1071 | */ | ||
1072 | |||
1073 | void IntroScreen (void); | ||
1074 | void PG13(void); | ||
1075 | void DrawHighScores(void); | ||
1076 | void CheckHighScore (int32_t score,word other); | ||
1077 | void Victory (void); | ||
1078 | void LevelCompleted (void); | ||
1079 | void ClearSplitVWB (void); | ||
1080 | |||
1081 | void PreloadGraphics(void); | ||
1082 | |||
1083 | |||
1084 | /* | ||
1085 | ============================================================================= | ||
1086 | |||
1087 | WL_DEBUG | ||
1088 | |||
1089 | ============================================================================= | ||
1090 | */ | ||
1091 | |||
1092 | int DebugKeys (void); | ||
1093 | |||
1094 | /* | ||
1095 | ============================================================================= | ||
1096 | |||
1097 | WL_DRAW DEFINITIONS | ||
1098 | |||
1099 | ============================================================================= | ||
1100 | */ | ||
1101 | |||
1102 | // | ||
1103 | // math tables | ||
1104 | // | ||
1105 | extern short *pixelangle; | ||
1106 | extern int32_t finetangent[FINEANGLES/4]; | ||
1107 | extern fixed sintable[]; | ||
1108 | extern fixed *costable; | ||
1109 | extern int *wallheight; | ||
1110 | extern word horizwall[],vertwall[]; | ||
1111 | extern int32_t lasttimecount; | ||
1112 | extern int32_t frameon; | ||
1113 | |||
1114 | extern unsigned screenloc[3]; | ||
1115 | |||
1116 | extern boolean fizzlein, fpscounter; | ||
1117 | |||
1118 | extern fixed viewx,viewy; // the focal point | ||
1119 | extern fixed viewsin,viewcos; | ||
1120 | |||
1121 | void ThreeDRefresh (void); | ||
1122 | void CalcTics (void); | ||
1123 | |||
1124 | typedef struct | ||
1125 | { | ||
1126 | word leftpix,rightpix; | ||
1127 | word dataofs[64]; | ||
1128 | // table data after dataofs[rightpix-leftpix+1] | ||
1129 | } t_compshape; | ||
1130 | |||
1131 | /* | ||
1132 | ============================================================================= | ||
1133 | |||
1134 | WL_STATE DEFINITIONS | ||
1135 | |||
1136 | ============================================================================= | ||
1137 | */ | ||
1138 | #define TURNTICS 10 | ||
1139 | #define SPDPATROL 512 | ||
1140 | #define SPDDOG 1500 | ||
1141 | |||
1142 | |||
1143 | void InitHitRect (objtype *ob, unsigned radius); | ||
1144 | void SpawnNewObj (unsigned tilex, unsigned tiley, statetype *state); | ||
1145 | void NewState (objtype *ob, statetype *state); | ||
1146 | |||
1147 | boolean TryWalk (objtype *ob); | ||
1148 | void SelectChaseDir (objtype *ob); | ||
1149 | void SelectDodgeDir (objtype *ob); | ||
1150 | void SelectRunDir (objtype *ob); | ||
1151 | void MoveObj (objtype *ob, int32_t move); | ||
1152 | boolean SightPlayer (objtype *ob); | ||
1153 | |||
1154 | void KillActor (objtype *ob); | ||
1155 | void DamageActor (objtype *ob, unsigned damage); | ||
1156 | |||
1157 | boolean CheckLine (objtype *ob); | ||
1158 | boolean CheckSight (objtype *ob); | ||
1159 | |||
1160 | /* | ||
1161 | ============================================================================= | ||
1162 | |||
1163 | WL_AGENT DEFINITIONS | ||
1164 | |||
1165 | ============================================================================= | ||
1166 | */ | ||
1167 | |||
1168 | extern short anglefrac; | ||
1169 | extern int facecount, facetimes; | ||
1170 | extern word plux,pluy; // player coordinates scaled to unsigned | ||
1171 | extern int32_t thrustspeed; | ||
1172 | extern objtype *LastAttacker; | ||
1173 | |||
1174 | void Thrust (int angle, int32_t speed); | ||
1175 | void SpawnPlayer (int tilex, int tiley, int dir); | ||
1176 | void TakeDamage (int points,objtype *attacker); | ||
1177 | void GivePoints (int32_t points); | ||
1178 | void GetBonus (statobj_t *check); | ||
1179 | void GiveWeapon (int weapon); | ||
1180 | void GiveAmmo (int ammo); | ||
1181 | void GiveKey (int key); | ||
1182 | |||
1183 | // | ||
1184 | // player state info | ||
1185 | // | ||
1186 | |||
1187 | void StatusDrawFace(unsigned picnum); | ||
1188 | void DrawFace (void); | ||
1189 | void DrawHealth (void); | ||
1190 | void HealSelf (int points); | ||
1191 | void DrawLevel (void); | ||
1192 | void DrawLives (void); | ||
1193 | void GiveExtraMan (void); | ||
1194 | void DrawScore (void); | ||
1195 | void DrawWeapon (void); | ||
1196 | void DrawKeys (void); | ||
1197 | void DrawAmmo (void); | ||
1198 | |||
1199 | |||
1200 | /* | ||
1201 | ============================================================================= | ||
1202 | |||
1203 | WL_ACT1 DEFINITIONS | ||
1204 | |||
1205 | ============================================================================= | ||
1206 | */ | ||
1207 | |||
1208 | extern doorobj_t doorobjlist[MAXDOORS]; | ||
1209 | extern doorobj_t *lastdoorobj; | ||
1210 | extern short doornum; | ||
1211 | |||
1212 | extern word doorposition[MAXDOORS]; | ||
1213 | |||
1214 | extern byte areaconnect[NUMAREAS][NUMAREAS]; | ||
1215 | |||
1216 | extern boolean areabyplayer[NUMAREAS]; | ||
1217 | |||
1218 | extern word pwallstate; | ||
1219 | extern word pwallpos; // amount a pushable wall has been moved (0-63) | ||
1220 | extern word pwallx,pwally; | ||
1221 | extern byte pwalldir,pwalltile; | ||
1222 | |||
1223 | |||
1224 | void InitDoorList (void); | ||
1225 | void InitStaticList (void); | ||
1226 | void SpawnStatic (int tilex, int tiley, int type); | ||
1227 | void SpawnDoor (int tilex, int tiley, boolean vertical, int lock); | ||
1228 | void MoveDoors (void); | ||
1229 | void MovePWalls (void); | ||
1230 | void OpenDoor (int door); | ||
1231 | void PlaceItemType (int itemtype, int tilex, int tiley); | ||
1232 | void PushWall (int checkx, int checky, int dir); | ||
1233 | void OperateDoor (int door); | ||
1234 | void InitAreas (void); | ||
1235 | |||
1236 | /* | ||
1237 | ============================================================================= | ||
1238 | |||
1239 | WL_ACT2 DEFINITIONS | ||
1240 | |||
1241 | ============================================================================= | ||
1242 | */ | ||
1243 | |||
1244 | #define s_nakedbody s_static10 | ||
1245 | |||
1246 | extern statetype s_grddie1; | ||
1247 | extern statetype s_dogdie1; | ||
1248 | extern statetype s_ofcdie1; | ||
1249 | extern statetype s_mutdie1; | ||
1250 | extern statetype s_ssdie1; | ||
1251 | extern statetype s_bossdie1; | ||
1252 | extern statetype s_schabbdie1; | ||
1253 | extern statetype s_fakedie1; | ||
1254 | extern statetype s_mechadie1; | ||
1255 | extern statetype s_hitlerdie1; | ||
1256 | extern statetype s_greteldie1; | ||
1257 | extern statetype s_giftdie1; | ||
1258 | extern statetype s_fatdie1; | ||
1259 | |||
1260 | extern statetype s_spectredie1; | ||
1261 | extern statetype s_angeldie1; | ||
1262 | extern statetype s_transdie0; | ||
1263 | extern statetype s_uberdie0; | ||
1264 | extern statetype s_willdie1; | ||
1265 | extern statetype s_deathdie1; | ||
1266 | |||
1267 | |||
1268 | extern statetype s_grdchase1; | ||
1269 | extern statetype s_dogchase1; | ||
1270 | extern statetype s_ofcchase1; | ||
1271 | extern statetype s_sschase1; | ||
1272 | extern statetype s_mutchase1; | ||
1273 | extern statetype s_bosschase1; | ||
1274 | extern statetype s_schabbchase1; | ||
1275 | extern statetype s_fakechase1; | ||
1276 | extern statetype s_mechachase1; | ||
1277 | extern statetype s_gretelchase1; | ||
1278 | extern statetype s_giftchase1; | ||
1279 | extern statetype s_fatchase1; | ||
1280 | |||
1281 | extern statetype s_spectrechase1; | ||
1282 | extern statetype s_angelchase1; | ||
1283 | extern statetype s_transchase1; | ||
1284 | extern statetype s_uberchase1; | ||
1285 | extern statetype s_willchase1; | ||
1286 | extern statetype s_deathchase1; | ||
1287 | |||
1288 | extern statetype s_blinkychase1; | ||
1289 | extern statetype s_hitlerchase1; | ||
1290 | |||
1291 | extern statetype s_grdpain; | ||
1292 | extern statetype s_grdpain1; | ||
1293 | extern statetype s_ofcpain; | ||
1294 | extern statetype s_ofcpain1; | ||
1295 | extern statetype s_sspain; | ||
1296 | extern statetype s_sspain1; | ||
1297 | extern statetype s_mutpain; | ||
1298 | extern statetype s_mutpain1; | ||
1299 | |||
1300 | extern statetype s_deathcam; | ||
1301 | |||
1302 | extern statetype s_schabbdeathcam2; | ||
1303 | extern statetype s_hitlerdeathcam2; | ||
1304 | extern statetype s_giftdeathcam2; | ||
1305 | extern statetype s_fatdeathcam2; | ||
1306 | |||
1307 | void SpawnStand (enemy_t which, int tilex, int tiley, int dir); | ||
1308 | void SpawnPatrol (enemy_t which, int tilex, int tiley, int dir); | ||
1309 | void KillActor (objtype *ob); | ||
1310 | |||
1311 | void SpawnDeadGuard (int tilex, int tiley); | ||
1312 | void SpawnBoss (int tilex, int tiley); | ||
1313 | void SpawnGretel (int tilex, int tiley); | ||
1314 | void SpawnTrans (int tilex, int tiley); | ||
1315 | void SpawnUber (int tilex, int tiley); | ||
1316 | void SpawnWill (int tilex, int tiley); | ||
1317 | void SpawnDeath (int tilex, int tiley); | ||
1318 | void SpawnAngel (int tilex, int tiley); | ||
1319 | void SpawnSpectre (int tilex, int tiley); | ||
1320 | void SpawnGhosts (int which, int tilex, int tiley); | ||
1321 | void SpawnSchabbs (int tilex, int tiley); | ||
1322 | void SpawnGift (int tilex, int tiley); | ||
1323 | void SpawnFat (int tilex, int tiley); | ||
1324 | void SpawnFakeHitler (int tilex, int tiley); | ||
1325 | void SpawnHitler (int tilex, int tiley); | ||
1326 | |||
1327 | void A_DeathScream (objtype *ob); | ||
1328 | void SpawnBJVictory (void); | ||
1329 | |||
1330 | /* | ||
1331 | ============================================================================= | ||
1332 | |||
1333 | WL_TEXT DEFINITIONS | ||
1334 | |||
1335 | ============================================================================= | ||
1336 | */ | ||
1337 | |||
1338 | extern char helpfilename[],endfilename[]; | ||
1339 | |||
1340 | extern void HelpScreens(void); | ||
1341 | extern void EndText(void); | ||
1342 | |||
1343 | |||
1344 | /* | ||
1345 | ============================================================================= | ||
1346 | |||
1347 | GP2X DEFINITIONS | ||
1348 | |||
1349 | ============================================================================= | ||
1350 | */ | ||
1351 | |||
1352 | #if defined(GP2X) | ||
1353 | |||
1354 | #if defined(GP2X_940) | ||
1355 | void GP2X_MemoryInit(void); | ||
1356 | void GP2X_Shutdown(void); | ||
1357 | #endif | ||
1358 | void GP2X_ButtonDown(int button); | ||
1359 | void GP2X_ButtonUp(int button); | ||
1360 | |||
1361 | #endif | ||
1362 | |||
1363 | |||
1364 | /* | ||
1365 | ============================================================================= | ||
1366 | |||
1367 | MISC DEFINITIONS | ||
1368 | |||
1369 | ============================================================================= | ||
1370 | */ | ||
1371 | |||
1372 | static fixed FixedMul(fixed a, fixed b) | ||
1373 | { | ||
1374 | return (fixed)(((int64_t)a * b + 0x8000) >> 16); | ||
1375 | } | ||
1376 | |||
1377 | #ifdef PLAYDEMOLIKEORIGINAL | ||
1378 | #define DEMOCHOOSE_ORIG_SDL(orig, sdl) ((demorecord || demoplayback) ? (orig) : (sdl)) | ||
1379 | #define DEMOCOND_ORIG (demorecord || demoplayback) | ||
1380 | #define DEMOIF_SDL if(DEMOCOND_SDL) | ||
1381 | #else | ||
1382 | #define DEMOCHOOSE_ORIG_SDL(orig, sdl) (sdl) | ||
1383 | #define DEMOCOND_ORIG false | ||
1384 | #define DEMOIF_SDL | ||
1385 | #endif | ||
1386 | #define DEMOCOND_SDL (!DEMOCOND_ORIG) | ||
1387 | |||
1388 | #define GetTicks() ((SDL_GetTicks()*7)/100) | ||
1389 | |||
1390 | #define ISPOINTER(x) ((((uintptr_t)(x)) & ~0xffff) != 0) | ||
1391 | |||
1392 | #define CHECKMALLOCRESULT(x) if(!(x)) Quit("Out of memory at %s:%i", __FILE__, __LINE__) | ||
1393 | |||
1394 | #ifdef _WIN32 | ||
1395 | #define strcasecmp stricmp | ||
1396 | #define strncasecmp strnicmp | ||
1397 | #define snprintf _snprintf | ||
1398 | #else | ||
1399 | static char* itoa(int value, char* string, int radix) | ||
1400 | { | ||
1401 | sprintf(string, "%d", value); | ||
1402 | return string; | ||
1403 | } | ||
1404 | |||
1405 | static char* ltoa(long value, char* string, int radix) | ||
1406 | { | ||
1407 | sprintf(string, "%ld", value); | ||
1408 | return string; | ||
1409 | } | ||
1410 | #endif | ||
1411 | |||
1412 | #define lengthof(x) (sizeof(x) / sizeof(*(x))) | ||
1413 | #define endof(x) ((x) + lengthof(x)) | ||
1414 | |||
1415 | static word READWORD(byte **ptr) | ||
1416 | { | ||
1417 | word val = (*ptr)[0] | (*ptr)[1] << 8; | ||
1418 | *ptr += 2; | ||
1419 | return val; | ||
1420 | } | ||
1421 | |||
1422 | static longword READLONGWORD(byte **ptr) | ||
1423 | { | ||
1424 | longword val = (*ptr)[0] | (*ptr)[1] << 8 | (*ptr)[2] << 16 | (*ptr)[3] << 24; | ||
1425 | *ptr += 4; | ||
1426 | return val; | ||
1427 | } | ||
1428 | |||
1429 | |||
1430 | /* | ||
1431 | ============================================================================= | ||
1432 | |||
1433 | FEATURE DEFINITIONS | ||
1434 | |||
1435 | ============================================================================= | ||
1436 | */ | ||
1437 | |||
1438 | #ifdef USE_FEATUREFLAGS | ||
1439 | // The currently available feature flags | ||
1440 | #define FF_STARSKY 0x0001 | ||
1441 | #define FF_PARALLAXSKY 0x0002 | ||
1442 | #define FF_CLOUDSKY 0x0004 | ||
1443 | #define FF_RAIN 0x0010 | ||
1444 | #define FF_SNOW 0x0020 | ||
1445 | |||
1446 | // The ffData... variables contain the 16-bit values of the according corners of the current level. | ||
1447 | // The corners are overwritten with adjacent tiles after initialization in SetupGameLevel | ||
1448 | // to avoid interpretation as e.g. doors. | ||
1449 | extern int ffDataTopLeft, ffDataTopRight, ffDataBottomLeft, ffDataBottomRight; | ||
1450 | |||
1451 | /************************************************************* | ||
1452 | * Current usage of ffData... variables: | ||
1453 | * ffDataTopLeft: lower 8-bit: ShadeDefID | ||
1454 | * ffDataTopRight: FeatureFlags | ||
1455 | * ffDataBottomLeft: CloudSkyDefID or ParallaxStartTexture | ||
1456 | * ffDataBottomRight: unused | ||
1457 | *************************************************************/ | ||
1458 | |||
1459 | // The feature flags are stored as a wall in the upper right corner of each level | ||
1460 | static word GetFeatureFlags() | ||
1461 | { | ||
1462 | return ffDataTopRight; | ||
1463 | } | ||
1464 | |||
1465 | #endif | ||
1466 | |||
1467 | #ifdef USE_FLOORCEILINGTEX | ||
1468 | void DrawFloorAndCeiling(byte *vbuf, unsigned vbufPitch, int min_wallheight); | ||
1469 | #endif | ||
1470 | |||
1471 | #ifdef USE_PARALLAX | ||
1472 | void DrawParallax(byte *vbuf, unsigned vbufPitch); | ||
1473 | #endif | ||
1474 | |||
1475 | #ifdef USE_DIR3DSPR | ||
1476 | void Scale3DShape(byte *vbuf, unsigned vbufPitch, statobj_t *ob); | ||
1477 | #endif | ||
1478 | |||
1479 | #endif | ||