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