Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | SDLPoP, a port/conversion of the DOS game Prince of Persia. |
||
3 | Copyright (C) 2013-2018 Dávid Nagy |
||
4 | |||
5 | This program is free software: you can redistribute it and/or modify |
||
6 | it under the terms of the GNU General Public License as published by |
||
7 | the Free Software Foundation, either version 3 of the License, or |
||
8 | (at your option) any later version. |
||
9 | |||
10 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | GNU General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU General Public License |
||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
17 | |||
18 | The authors of this program may be contacted at http://forum.princed.org |
||
19 | */ |
||
20 | |||
21 | #ifndef TYPES_H |
||
22 | #define TYPES_H |
||
23 | |||
24 | #if !defined(_MSC_VER) |
||
7 | pmbaty | 25 | #ifdef __APPLE__ |
26 | # include <SDL2.framework/Headers/SDL.h> |
||
27 | # include <SDL2_image.framework/Headers/SDL_image.h> |
||
28 | # ifdef USE_MIXER |
||
29 | # include <SDL2_mixer.framework/Headers/SDL_mixer.h> |
||
30 | # endif |
||
31 | #else |
||
1 | pmbaty | 32 | # include <SDL2/SDL.h> |
33 | # include <SDL2_image/SDL_image.h> |
||
34 | # ifdef USE_MIXER |
||
35 | # include <SDL2_mixer/SDL_mixer.h> |
||
36 | # endif |
||
7 | pmbaty | 37 | #endif |
1 | pmbaty | 38 | #else |
39 | # include <SDL.h> |
||
40 | # include <SDL_image.h> |
||
41 | # ifdef USE_MIXER |
||
42 | # include <SDL_mixer.h> |
||
43 | # endif |
||
44 | #endif |
||
45 | |||
46 | #if SDL_BYTEORDER != SDL_LIL_ENDIAN |
||
47 | #error This program is not (yet) prepared for big endian CPUs, please contact the author. |
||
48 | #endif |
||
49 | |||
50 | // This macro is from SDL_types.h / SDL_stdinc.h . |
||
51 | // It used to be #undefined at the end of that file, but since some time in 2006 it's kept available. |
||
52 | // And SDL's definition changed in SDL 2.0.6, which caused a warning at this redefinition. |
||
53 | // So we should just use the macro from SDL and not define our own. |
||
54 | /* Make sure the types really have the right sizes */ |
||
55 | /* |
||
56 | #define SDL_COMPILE_TIME_ASSERT(name, x) \ |
||
57 | typedef int SDL_dummy_ ## name[(x) * 2 - 1] |
||
58 | */ |
||
59 | |||
60 | // "far" and "near" makes sense only for 16-bit |
||
61 | #define far |
||
62 | #define near |
||
63 | #define __pascal |
||
64 | #define malloc_near malloc |
||
65 | #define malloc_far malloc |
||
66 | #define free_near free |
||
67 | #define free_far free |
||
68 | #define memset_near memset |
||
69 | #define memset_far memset |
||
70 | #define memcpy_near memcpy |
||
71 | #define memcpy_far memcpy |
||
72 | |||
7 | pmbaty | 73 | #ifndef Uint8 |
74 | #define Uint8 uint8_t |
||
75 | #endif // !Uint8 |
||
76 | #ifndef Sint8 |
||
77 | #define Sint8 int8_t |
||
78 | #endif // !Sint8 |
||
79 | #ifndef Uint16 |
||
80 | #define Uint16 uint16_t |
||
81 | #endif // !Uint16 |
||
82 | #ifndef Uint32 |
||
83 | #define Uint32 uint32_t |
||
84 | #endif // !Uint32 |
||
1 | pmbaty | 85 | typedef Uint8 byte; |
86 | typedef Sint8 sbyte; |
||
87 | typedef Uint16 word; |
||
88 | typedef Uint32 dword; |
||
89 | |||
90 | typedef struct rect_type { |
||
91 | short top,left,bottom,right; |
||
92 | } rect_type; |
||
93 | |||
94 | typedef struct piece { |
||
95 | byte base_id; |
||
96 | byte floor_left; |
||
97 | sbyte base_y; |
||
98 | byte right_id; |
||
99 | byte floor_right; |
||
100 | sbyte right_y; |
||
101 | byte stripe_id; |
||
102 | byte topright_id; |
||
103 | byte bottom_id; |
||
104 | byte fore_id; |
||
105 | byte fore_x; |
||
106 | sbyte fore_y; |
||
107 | } piece; |
||
108 | typedef struct tile_and_mod { |
||
109 | byte tiletype; |
||
110 | byte modifier; |
||
111 | } tile_and_mod; |
||
112 | |||
113 | typedef int __pascal far (*add_table_type)(short chtab_id, int id, sbyte xh, sbyte xl, int ybottom, byte blit, byte peel); |
||
114 | |||
115 | typedef struct back_table_type { |
||
116 | sbyte xh; |
||
117 | sbyte xl; |
||
118 | short y; |
||
119 | byte chtab_id; |
||
120 | byte id; |
||
121 | byte blit; |
||
122 | } back_table_type; |
||
123 | |||
124 | typedef struct midtable_type { |
||
125 | sbyte xh; |
||
126 | sbyte xl; |
||
127 | short y; |
||
128 | byte chtab_id; |
||
129 | byte id; |
||
130 | byte peel; |
||
131 | rect_type clip; |
||
132 | byte blit; |
||
133 | } midtable_type; |
||
134 | |||
135 | typedef struct wipetable_type { |
||
136 | short left; |
||
137 | short bottom; |
||
138 | sbyte height; |
||
139 | short width; |
||
140 | sbyte color; |
||
141 | sbyte layer; |
||
142 | } wipetable_type; |
||
143 | |||
144 | enum soundflags { sfDigi=1, sfMidi=2, soundflags_4=4, sfLoop=0x80 }; |
||
145 | |||
146 | enum tiles { |
||
147 | tiles_0_empty = 0, |
||
148 | tiles_1_floor = 1, |
||
149 | tiles_2_spike = 2, |
||
150 | tiles_3_pillar = 3, |
||
151 | tiles_4_gate = 4, |
||
152 | tiles_5_stuck = 5, |
||
153 | tiles_6_closer = 6, // a.k.a. drop button |
||
154 | tiles_7_doortop_with_floor = 7, // a.k.a. tapestry |
||
155 | tiles_8_bigpillar_bottom = 8, |
||
156 | tiles_9_bigpillar_top = 9, |
||
157 | tiles_10_potion = 10, |
||
158 | tiles_11_loose = 11, |
||
159 | tiles_12_doortop = 12, // a.k.a. tapestry top |
||
160 | tiles_13_mirror = 13, |
||
161 | tiles_14_debris = 14, // a.k.a. broken floor |
||
162 | tiles_15_opener = 15, // a.k.a. raise button |
||
163 | tiles_16_level_door_left = 16, // a.k.a. exit door |
||
164 | tiles_17_level_door_right = 17, |
||
165 | tiles_18_chomper = 18, |
||
166 | tiles_19_torch = 19, |
||
167 | tiles_20_wall = 20, |
||
168 | tiles_21_skeleton = 21, |
||
169 | tiles_22_sword = 22, |
||
170 | tiles_23_balcony_left = 23, |
||
171 | tiles_24_balcony_right = 24, |
||
172 | tiles_25_lattice_pillar = 25, |
||
173 | tiles_26_lattice_down = 26, // a.k.a. lattice support |
||
174 | tiles_27_lattice_small = 27, |
||
175 | tiles_28_lattice_left = 28, |
||
176 | tiles_29_lattice_right = 29, |
||
177 | tiles_30_torch_with_debris = 30 |
||
178 | }; |
||
179 | |||
180 | enum chtabs { |
||
181 | id_chtab_0_sword = 0, |
||
182 | id_chtab_1_flameswordpotion = 1, |
||
183 | id_chtab_2_kid = 2, |
||
184 | id_chtab_3_princessinstory = 3, |
||
185 | id_chtab_4_jaffarinstory_princessincutscenes = 4, |
||
186 | id_chtab_5_guard = 5, |
||
187 | id_chtab_6_environment = 6, |
||
188 | id_chtab_7_environmentwall = 7, |
||
189 | id_chtab_8_princessroom = 8, |
||
190 | id_chtab_9_princessbed = 9 |
||
191 | }; |
||
192 | |||
193 | enum blitters { |
||
194 | blitters_0_no_transp = 0, |
||
195 | // It seems to me that the "or" blitter can be safely replaced with the "transparent" blitter. |
||
196 | blitters_2_or = 2, |
||
197 | blitters_3_xor = 3, // used for the shadow |
||
198 | blitters_9_black = 9, |
||
199 | blitters_10h_transp = 0x10, |
||
200 | /* 0x40..0x4F will draw a monochrome image with color 0..15 */ |
||
201 | blitters_40h_mono = 0x40, |
||
202 | blitters_46h_mono_6 = 0x46, // used for palace wall patterns |
||
203 | blitters_4Ch_mono_12 = 0x4C // used for chomper blood |
||
204 | }; |
||
205 | |||
206 | enum grmodes { |
||
207 | gmCga = 1, |
||
208 | gmHgaHerc = 2, |
||
209 | gmEga = 3, |
||
210 | gmTga = 4, |
||
211 | gmMcgaVga = 5 |
||
212 | }; |
||
213 | |||
214 | enum sound_modes { |
||
215 | smAuto = 0, |
||
216 | smAdlib = 1, |
||
217 | smGblast = 2, |
||
218 | smSblast = 3, |
||
219 | smCovox = 4, |
||
220 | smIbmg = 5, |
||
221 | smTandy = 6 |
||
222 | }; |
||
223 | |||
224 | #pragma pack(push,1) |
||
225 | typedef struct link_type { |
||
226 | byte left,right,up,down; |
||
227 | } link_type; |
||
228 | |||
229 | typedef struct level_type { |
||
230 | byte fg[720]; |
||
231 | byte bg[720]; |
||
232 | byte doorlinks1[256]; |
||
233 | byte doorlinks2[256]; |
||
234 | link_type roomlinks[24]; |
||
235 | byte used_rooms; |
||
236 | byte roomxs[24]; |
||
237 | byte roomys[24]; |
||
238 | byte fill_1[15]; |
||
239 | byte start_room; |
||
240 | byte start_pos; |
||
241 | sbyte start_dir; |
||
242 | byte fill_2[4]; |
||
243 | byte guards_tile[24]; |
||
244 | byte guards_dir[24]; |
||
245 | byte guards_x[24]; |
||
246 | byte guards_seq_lo[24]; |
||
247 | byte guards_skill[24]; |
||
248 | byte guards_seq_hi[24]; |
||
249 | byte guards_color[24]; |
||
250 | byte fill_3[18]; |
||
251 | } level_type; |
||
252 | SDL_COMPILE_TIME_ASSERT(level_size, sizeof(level_type) == 2305); |
||
253 | #pragma pack(pop) |
||
254 | |||
255 | typedef SDL_Surface surface_type; |
||
256 | typedef SDL_Surface image_type; |
||
257 | typedef struct peel_type { |
||
258 | SDL_Surface* peel; |
||
259 | rect_type rect; |
||
260 | } peel_type; |
||
261 | |||
262 | typedef struct chtab_type { |
||
263 | word n_images; |
||
264 | word chtab_palette_bits; |
||
265 | word has_palette_bits; |
||
266 | // This is a variable-size array, with n_images elements. |
||
267 | image_type* far images[0]; |
||
268 | } chtab_type; |
||
269 | |||
270 | #pragma pack(push,1) |
||
271 | typedef struct rgb_type { |
||
272 | byte r,g,b; |
||
273 | } rgb_type; |
||
274 | typedef struct dat_pal_type { |
||
275 | word row_bits; |
||
276 | byte n_colors; |
||
277 | rgb_type vga[16]; |
||
278 | byte cga[16]; |
||
279 | byte ega[32]; |
||
280 | } dat_pal_type; |
||
281 | typedef struct dat_shpl_type { |
||
282 | byte n_images; |
||
283 | dat_pal_type palette; |
||
284 | } dat_shpl_type; |
||
285 | SDL_COMPILE_TIME_ASSERT(dat_shpl_size, sizeof(dat_shpl_type) == 100); |
||
286 | #pragma pack(pop) |
||
287 | |||
288 | typedef struct char_type { |
||
289 | byte frame; |
||
290 | byte x; |
||
291 | byte y; |
||
292 | sbyte direction; |
||
293 | sbyte curr_col; |
||
294 | sbyte curr_row; |
||
295 | byte action; |
||
296 | sbyte fall_x; |
||
297 | sbyte fall_y; |
||
298 | byte room; |
||
299 | byte repeat; |
||
300 | byte charid; |
||
301 | byte sword; |
||
302 | sbyte alive; |
||
303 | word curr_seq; |
||
304 | } char_type; |
||
305 | |||
306 | enum charids { |
||
307 | charid_0_kid = 0, |
||
308 | charid_1_shadow = 1, |
||
309 | charid_2_guard = 2, |
||
310 | charid_3 = 3, |
||
311 | charid_4_skeleton = 4, |
||
312 | charid_5_princess = 5, |
||
313 | charid_6_vizier = 6, |
||
314 | charid_24_mouse = 0x18 |
||
315 | }; |
||
316 | |||
317 | enum sword_status { |
||
318 | sword_0_sheathed = 0, |
||
319 | sword_2_drawn = 2 |
||
320 | }; |
||
321 | |||
322 | typedef struct auto_move_type { |
||
323 | short time,move; |
||
324 | } auto_move_type; |
||
325 | |||
326 | /* obj_type: |
||
327 | |||
328 | 1 = shadow |
||
329 | 2 = Guard |
||
330 | 3 = sword |
||
331 | 4 = mirror image |
||
332 | 5 = hurt splash |
||
333 | 0x80 = loose floor |
||
334 | */ |
||
335 | typedef struct objtable_type { |
||
336 | sbyte xh; |
||
337 | sbyte xl; |
||
338 | short y; |
||
339 | byte chtab_id; |
||
340 | byte id; |
||
341 | sbyte direction; |
||
342 | byte obj_type; |
||
343 | rect_type clip; |
||
344 | byte tilepos; |
||
345 | } objtable_type; |
||
346 | |||
347 | typedef struct frame_type { |
||
348 | byte image; |
||
349 | |||
350 | // 0x3F: sword image |
||
351 | // 0xC0: chtab |
||
352 | byte sword; |
||
353 | |||
354 | sbyte dx; |
||
355 | sbyte dy; |
||
356 | |||
357 | // 0x1F: weight x |
||
358 | // 0x20: thin |
||
359 | // 0x40: needs floor |
||
360 | // 0x80: even/odd pixel |
||
361 | byte flags; |
||
362 | } frame_type; |
||
363 | |||
364 | enum frame_flags { |
||
365 | FRAME_WEIGHT_X = 0x1F, |
||
366 | FRAME_THIN = 0x20, |
||
367 | FRAME_NEEDS_FLOOR = 0x40, |
||
368 | FRAME_EVEN_ODD_PIXEL = 0x80, |
||
369 | }; |
||
370 | |||
371 | typedef struct trob_type { |
||
372 | byte tilepos; |
||
373 | byte room; |
||
374 | sbyte type; |
||
375 | } trob_type; |
||
376 | |||
377 | typedef struct mob_type { |
||
378 | byte xh; |
||
379 | byte y; |
||
380 | byte room; |
||
381 | sbyte speed; |
||
382 | byte type; |
||
383 | byte row; |
||
384 | } mob_type; |
||
385 | |||
386 | enum directions { |
||
387 | dir_0_right = 0x00, |
||
388 | dir_56_none = 0x56, |
||
389 | dir_FF_left = -1 |
||
390 | }; |
||
391 | |||
392 | enum actions { |
||
393 | actions_0_stand = 0, |
||
394 | actions_1_run_jump = 1, |
||
395 | actions_2_hang_climb = 2, |
||
396 | actions_3_in_midair = 3, |
||
397 | actions_4_in_freefall = 4, |
||
398 | actions_5_bumped = 5, |
||
399 | actions_6_hang_straight = 6, |
||
400 | actions_7_turn = 7, |
||
401 | actions_99_hurt = 99, |
||
402 | }; |
||
403 | |||
404 | typedef struct sword_table_type { |
||
405 | byte id; |
||
406 | sbyte x; |
||
407 | sbyte y; |
||
408 | } sword_table_type; |
||
409 | |||
410 | #pragma pack(push,1) |
||
411 | typedef struct dat_header_type { |
||
412 | Uint32 table_offset; |
||
413 | Uint16 table_size; |
||
414 | } dat_header_type; |
||
415 | SDL_COMPILE_TIME_ASSERT(dat_header_size, sizeof(dat_header_type) == 6); |
||
416 | |||
417 | typedef struct dat_res_type { |
||
418 | Uint16 id; |
||
419 | Uint32 offset; |
||
420 | Uint16 size; |
||
421 | } dat_res_type; |
||
422 | SDL_COMPILE_TIME_ASSERT(dat_res_size, sizeof(dat_res_type) == 8); |
||
423 | |||
424 | typedef struct dat_table_type { |
||
425 | Uint16 res_count; |
||
426 | dat_res_type entries[0]; |
||
427 | } dat_table_type; |
||
428 | SDL_COMPILE_TIME_ASSERT(dat_table_size, sizeof(dat_table_type) == 2); |
||
429 | |||
430 | typedef struct image_data_type { |
||
431 | Uint16 height; |
||
432 | Uint16 width; |
||
433 | Uint16 flags; |
||
434 | byte data[0]; |
||
435 | } image_data_type; |
||
436 | SDL_COMPILE_TIME_ASSERT(image_data_size, sizeof(image_data_type) == 6); |
||
437 | #pragma pack(pop) |
||
438 | |||
439 | typedef struct dat_type { |
||
440 | struct dat_type* next_dat; |
||
441 | FILE* handle; |
||
442 | char filename[POP_MAX_PATH]; |
||
443 | dat_table_type* dat_table; |
||
444 | // handle and dat_table are NULL if the DAT is a directory. |
||
445 | } dat_type; |
||
446 | |||
447 | typedef void __pascal far (*cutscene_ptr_type)(); |
||
448 | |||
449 | #ifdef USE_FADE |
||
450 | typedef struct palette_fade_type { |
||
451 | word which_rows; |
||
452 | word wait_time; |
||
453 | word fade_pos; |
||
454 | rgb_type original_pal[256]; |
||
455 | rgb_type faded_pal[256]; |
||
456 | int __pascal far (*proc_fade_frame)(struct palette_fade_type far *palette_buffer); |
||
457 | void __pascal far (*proc_restore_free)(struct palette_fade_type far *palette_buffer); |
||
458 | } palette_fade_type; |
||
459 | #endif |
||
460 | |||
461 | #ifndef O_BINARY |
||
462 | #define O_BINARY 0 |
||
463 | #endif |
||
464 | |||
465 | #ifdef USE_TEXT |
||
466 | typedef struct font_type { |
||
467 | byte first_char; |
||
468 | byte last_char; |
||
469 | short height_above_baseline; |
||
470 | short height_below_baseline; |
||
471 | short space_between_lines; |
||
472 | short space_between_chars; |
||
473 | chtab_type* chtab; |
||
474 | } font_type; |
||
475 | |||
476 | typedef struct textstate_type { |
||
477 | short current_x; |
||
478 | short current_y; |
||
479 | short textblit; |
||
480 | short textcolor; |
||
481 | font_type* ptr_font; |
||
482 | } textstate_type; |
||
483 | |||
484 | #pragma pack(push,1) |
||
485 | typedef struct rawfont_type { |
||
486 | byte first_char; |
||
487 | byte last_char; |
||
488 | short height_above_baseline; |
||
489 | short height_below_baseline; |
||
490 | short space_between_lines; |
||
491 | short space_between_chars; |
||
492 | word offsets[0]; |
||
493 | } rawfont_type; |
||
494 | SDL_COMPILE_TIME_ASSERT(rawfont_type, sizeof(rawfont_type) == 10); |
||
495 | #pragma pack(pop) |
||
496 | |||
497 | #endif |
||
498 | |||
499 | typedef enum data_location { |
||
500 | data_none = 0, |
||
501 | data_DAT = 1, |
||
502 | data_directory = 2 |
||
503 | } data_location; |
||
504 | |||
505 | enum sound_type { |
||
506 | #ifdef USE_MIXER |
||
507 | sound_chunk = 3, |
||
508 | sound_music = 4, |
||
509 | #endif |
||
510 | sound_speaker = 0, |
||
511 | sound_digi = 1, |
||
512 | sound_midi = 2 |
||
513 | }; |
||
514 | #pragma pack(push,1) |
||
515 | typedef struct note_type { |
||
516 | word frequency; // 0x00 or 0x01 = rest, 0x12 = end |
||
517 | byte length; |
||
518 | } note_type; |
||
519 | SDL_COMPILE_TIME_ASSERT(note_type, sizeof(note_type) == 3); |
||
520 | typedef struct speaker_type { // IBM |
||
521 | word tempo; |
||
522 | note_type notes[0]; |
||
523 | } speaker_type; |
||
524 | SDL_COMPILE_TIME_ASSERT(speaker_type, sizeof(speaker_type) == 2); |
||
525 | |||
526 | typedef struct digi_type { // wave in 1.0 and 1.1 |
||
527 | word sample_rate; |
||
528 | word sample_count; |
||
529 | word unknown; |
||
530 | byte sample_size; // =8 |
||
531 | byte samples[0]; |
||
532 | } digi_type; |
||
533 | SDL_COMPILE_TIME_ASSERT(digi_type, sizeof(digi_type) == 7); |
||
534 | |||
535 | typedef struct digi_new_type { // wave in 1.3 and 1.4 (and PoP2) |
||
536 | word sample_rate; |
||
537 | byte sample_size; // =8 |
||
538 | word sample_count; |
||
539 | word unknown; |
||
540 | word unknown2; |
||
541 | byte samples[0]; |
||
542 | } digi_new_type; |
||
543 | SDL_COMPILE_TIME_ASSERT(digi_new_type, sizeof(digi_new_type) == 9); |
||
544 | |||
545 | typedef struct midi_type { |
||
546 | byte data[0]; |
||
547 | } midi_type; |
||
548 | |||
549 | typedef struct sound_buffer_type { |
||
550 | byte type; |
||
551 | union { |
||
552 | speaker_type speaker; |
||
553 | digi_type digi; |
||
554 | digi_new_type digi_new; |
||
555 | midi_type midi; |
||
556 | #ifdef USE_MIXER |
||
557 | Mix_Chunk *chunk; |
||
558 | Mix_Music *music; |
||
559 | #endif |
||
560 | }; |
||
561 | } sound_buffer_type; |
||
562 | |||
563 | #ifdef USE_MIXER |
||
564 | typedef struct WAV_header_type { |
||
565 | Uint32 ChunkID; // fourcc |
||
566 | Uint32 ChunkSize; |
||
567 | Uint32 Format; // fourcc |
||
568 | Uint32 Subchunk1ID; // fourcc |
||
569 | Uint32 Subchunk1Size; |
||
570 | Uint16 AudioFormat; |
||
571 | Uint16 NumChannels; |
||
572 | Uint32 SampleRate; |
||
573 | Uint32 ByteRate; |
||
574 | Uint16 BlockAlign; |
||
575 | Uint16 BitsPerSample; |
||
576 | Uint32 Subchunk2ID; // fourcc |
||
577 | Uint32 Subchunk2Size; |
||
578 | byte Data[0]; |
||
579 | } WAV_header_type; |
||
580 | #endif |
||
581 | |||
582 | struct dialog_type; // (declaration only) |
||
583 | typedef struct dialog_settings_type { |
||
584 | void (* method_1) (struct dialog_type *dialog); |
||
585 | void (* method_2_frame) (struct dialog_type *dialog); |
||
586 | short top_border; |
||
587 | short left_border; |
||
588 | short bottom_border; |
||
589 | short right_border; |
||
590 | short shadow_bottom; |
||
591 | short shadow_right; |
||
592 | short outer_border; |
||
593 | } dialog_settings_type; |
||
594 | |||
595 | typedef struct dialog_type { |
||
596 | dialog_settings_type* settings; |
||
597 | rect_type text_rect; |
||
598 | rect_type peel_rect; |
||
599 | word has_peel; |
||
600 | peel_type* peel; |
||
601 | } dialog_type; |
||
602 | |||
603 | #pragma pack(pop) |
||
604 | |||
605 | enum soundids { |
||
606 | sound_0_fell_to_death = 0, |
||
607 | sound_1_falling = 1, |
||
608 | sound_2_tile_crashing = 2, |
||
609 | sound_3_button_pressed = 3, |
||
610 | sound_4_gate_closing = 4, |
||
611 | sound_5_gate_opening = 5, |
||
612 | sound_6_gate_closing_fast = 6, |
||
613 | sound_7_gate_stop = 7, |
||
614 | sound_8_bumped = 8, |
||
615 | sound_9_grab = 9, |
||
616 | sound_10_sword_vs_sword = 10, |
||
617 | sound_11_sword_moving = 11, |
||
618 | sound_12_guard_hurt = 12, |
||
619 | sound_13_kid_hurt = 13, |
||
620 | sound_14_leveldoor_closing = 14, |
||
621 | sound_15_leveldoor_sliding = 15, |
||
622 | sound_16_medium_land = 16, |
||
623 | sound_17_soft_land = 17, |
||
624 | sound_18_drink = 18, |
||
625 | sound_19_draw_sword = 19, |
||
626 | sound_20_loose_shake_1 = 20, |
||
627 | sound_21_loose_shake_2 = 21, |
||
628 | sound_22_loose_shake_3 = 22, |
||
629 | sound_23_footstep = 23, |
||
630 | sound_24_death_regular = 24, |
||
631 | sound_25_presentation = 25, |
||
632 | sound_26_embrace = 26, |
||
633 | sound_27_cutscene_2_4_6_12 = 27, |
||
634 | sound_28_death_in_fight = 28, |
||
635 | sound_29_meet_Jaffar = 29, |
||
636 | sound_30_big_potion = 30, |
||
637 | //sound_31 = 31, |
||
638 | sound_32_shadow_music = 32, |
||
639 | sound_33_small_potion = 33, |
||
640 | //sound_34 = 34, |
||
641 | sound_35_cutscene_8_9 = 35, |
||
642 | sound_36_out_of_time = 36, |
||
643 | sound_37_victory = 37, |
||
644 | sound_38_blink = 38, |
||
645 | sound_39_low_weight = 39, |
||
646 | sound_40_cutscene_12_short_time = 40, |
||
647 | sound_41_end_level_music = 41, |
||
648 | //sound_42 = 42, |
||
649 | sound_43_victory_Jaffar = 43, |
||
650 | sound_44_skel_alive = 44, |
||
651 | sound_45_jump_through_mirror = 45, |
||
652 | sound_46_chomped = 46, |
||
653 | sound_47_chomper = 47, |
||
654 | sound_48_spiked = 48, |
||
655 | sound_49_spikes = 49, |
||
656 | sound_50_story_2_princess = 50, |
||
657 | sound_51_princess_door_opening = 51, |
||
658 | sound_52_story_4_Jaffar_leaves = 52, |
||
659 | sound_53_story_3_Jaffar_comes = 53, |
||
660 | sound_54_intro_music = 54, |
||
661 | sound_55_story_1_absence = 55, |
||
662 | sound_56_ending_music = 56, |
||
663 | }; |
||
664 | |||
665 | enum timerids { |
||
666 | timer_0 = 0, |
||
667 | timer_1 = 1, |
||
668 | }; |
||
669 | |||
670 | enum frameids { |
||
671 | frame_0 = 0, |
||
672 | frame_1_start_run = 1, |
||
673 | frame_2_start_run = 2, |
||
674 | frame_3_start_run = 3, |
||
675 | frame_4_start_run = 4, |
||
676 | frame_5_start_run = 5, |
||
677 | frame_6_start_run = 6, |
||
678 | frame_7_run = 7, |
||
679 | frame_8_run = 8, |
||
680 | frame_9_run = 9, |
||
681 | frame_10_run = 10, |
||
682 | frame_11_run = 11, |
||
683 | frame_12_run = 12, |
||
684 | frame_13_run = 13, |
||
685 | frame_14_run = 14, |
||
686 | frame_15_stand = 15, |
||
687 | frame_16_standing_jump_1 = 16, |
||
688 | frame_17_standing_jump_2 = 17, |
||
689 | frame_18_standing_jump_3 = 18, |
||
690 | frame_19_standing_jump_4 = 19, |
||
691 | frame_20_standing_jump_5 = 20, |
||
692 | frame_21_standing_jump_6 = 21, |
||
693 | frame_22_standing_jump_7 = 22, |
||
694 | frame_23_standing_jump_8 = 23, |
||
695 | frame_24_standing_jump_9 = 24, |
||
696 | frame_25_standing_jump_10 = 25, |
||
697 | frame_26_standing_jump_11 = 26, |
||
698 | frame_27_standing_jump_12 = 27, |
||
699 | frame_28_standing_jump_13 = 28, |
||
700 | frame_29_standing_jump_14 = 29, |
||
701 | frame_30_standing_jump_15 = 30, |
||
702 | frame_31_standing_jump_16 = 31, |
||
703 | frame_32_standing_jump_17 = 32, |
||
704 | frame_33_standing_jump_18 = 33, |
||
705 | frame_34_start_run_jump_1 = 34, |
||
706 | frame_35_start_run_jump_2 = 35, |
||
707 | frame_36_start_run_jump_3 = 36, |
||
708 | frame_37_start_run_jump_4 = 37, |
||
709 | frame_38_start_run_jump_5 = 38, |
||
710 | frame_39_start_run_jump_6 = 39, |
||
711 | frame_40_running_jump_1 = 40, |
||
712 | frame_41_running_jump_2 = 41, |
||
713 | frame_42_running_jump_3 = 42, |
||
714 | frame_43_running_jump_4 = 43, |
||
715 | frame_44_running_jump_5 = 44, |
||
716 | frame_45_turn = 45, |
||
717 | frame_46_turn = 46, |
||
718 | frame_47_turn = 47, |
||
719 | frame_48_turn = 48, |
||
720 | frame_49_turn = 49, |
||
721 | frame_50_turn = 50, |
||
722 | frame_51_turn = 51, |
||
723 | frame_52_turn = 52, |
||
724 | frame_53_runturn = 53, |
||
725 | frame_54_runturn = 54, |
||
726 | frame_55_runturn = 55, |
||
727 | frame_56_runturn = 56, |
||
728 | frame_57_runturn = 57, |
||
729 | frame_58_runturn = 58, |
||
730 | frame_59_runturn = 59, |
||
731 | frame_60_runturn = 60, |
||
732 | frame_61_runturn = 61, |
||
733 | frame_62_runturn = 62, |
||
734 | frame_63_runturn = 63, |
||
735 | frame_64_runturn = 64, |
||
736 | frame_65_runturn = 65, |
||
737 | frame_67_start_jump_up_1 = 67, |
||
738 | frame_68_start_jump_up_2 = 68, |
||
739 | frame_69_start_jump_up_3 = 69, |
||
740 | frame_70_jumphang = 70, |
||
741 | frame_71_jumphang = 71, |
||
742 | frame_72_jumphang = 72, |
||
743 | frame_73_jumphang = 73, |
||
744 | frame_74_jumphang = 74, |
||
745 | frame_75_jumphang = 75, |
||
746 | frame_76_jumphang = 76, |
||
747 | frame_77_jumphang = 77, |
||
748 | frame_78_jumphang = 78, |
||
749 | frame_79_jumphang = 79, |
||
750 | frame_80_jumphang = 80, |
||
751 | frame_81_hangdrop_1 = 81, |
||
752 | frame_82_hangdrop_2 = 82, |
||
753 | frame_83_hangdrop_3 = 83, |
||
754 | frame_84_hangdrop_4 = 84, |
||
755 | frame_85_hangdrop_5 = 85, |
||
756 | frame_86_test_foot = 86, |
||
757 | frame_87_hanging_1 = 87, |
||
758 | frame_88_hanging_2 = 88, |
||
759 | frame_89_hanging_3 = 89, |
||
760 | frame_90_hanging_4 = 90, |
||
761 | frame_91_hanging_5 = 91, |
||
762 | frame_92_hanging_6 = 92, |
||
763 | frame_93_hanging_7 = 93, |
||
764 | frame_94_hanging_8 = 94, |
||
765 | frame_95_hanging_9 = 95, |
||
766 | frame_96_hanging_10 = 96, |
||
767 | frame_97_hanging_11 = 97, |
||
768 | frame_98_hanging_12 = 98, |
||
769 | frame_99_hanging_13 = 99, |
||
770 | frame_102_start_fall_1 = 102, |
||
771 | frame_103_start_fall_2 = 103, |
||
772 | frame_104_start_fall_3 = 104, |
||
773 | frame_105_start_fall_4 = 105, |
||
774 | frame_106_fall = 106, |
||
775 | frame_107_fall_land_1 = 107, |
||
776 | frame_108_fall_land_2 = 108, |
||
777 | frame_109_crouch = 109, |
||
778 | frame_110_stand_up_from_crouch_1 = 110, |
||
779 | frame_111_stand_up_from_crouch_2 = 111, |
||
780 | frame_112_stand_up_from_crouch_3 = 112, |
||
781 | frame_113_stand_up_from_crouch_4 = 113, |
||
782 | frame_114_stand_up_from_crouch_5 = 114, |
||
783 | frame_115_stand_up_from_crouch_6 = 115, |
||
784 | frame_116_stand_up_from_crouch_7 = 116, |
||
785 | frame_117_stand_up_from_crouch_8 = 117, |
||
786 | frame_118_stand_up_from_crouch_9 = 118, |
||
787 | frame_119_stand_up_from_crouch_10 = 119, |
||
788 | frame_121_stepping_1 = 121, |
||
789 | frame_122_stepping_2 = 122, |
||
790 | frame_123_stepping_3 = 123, |
||
791 | frame_124_stepping_4 = 124, |
||
792 | frame_125_stepping_5 = 125, |
||
793 | frame_126_stepping_6 = 126, |
||
794 | frame_127_stepping_7 = 127, |
||
795 | frame_128_stepping_8 = 128, |
||
796 | frame_129_stepping_9 = 129, |
||
797 | frame_130_stepping_10 = 130, |
||
798 | frame_131_stepping_11 = 131, |
||
799 | frame_132_stepping_12 = 132, |
||
800 | frame_133_sheathe = 133, |
||
801 | frame_134_sheathe = 134, |
||
802 | frame_135_climbing_1 = 135, |
||
803 | frame_136_climbing_2 = 136, |
||
804 | frame_137_climbing_3 = 137, |
||
805 | frame_138_climbing_4 = 138, |
||
806 | frame_139_climbing_5 = 139, |
||
807 | frame_140_climbing_6 = 140, |
||
808 | frame_141_climbing_7 = 141, |
||
809 | frame_142_climbing_8 = 142, |
||
810 | frame_143_climbing_9 = 143, |
||
811 | frame_144_climbing_10 = 144, |
||
812 | frame_145_climbing_11 = 145, |
||
813 | frame_146_climbing_12 = 146, |
||
814 | frame_147_climbing_13 = 147, |
||
815 | frame_148_climbing_14 = 148, |
||
816 | frame_149_climbing_15 = 149, |
||
817 | frame_150_parry = 150, |
||
818 | frame_151_strike_1 = 151, |
||
819 | frame_152_strike_2 = 152, |
||
820 | frame_153_strike_3 = 153, |
||
821 | frame_154_poking = 154, |
||
822 | frame_155_guy_7 = 155, |
||
823 | frame_156_guy_8 = 156, |
||
824 | frame_157_walk_with_sword = 157, |
||
825 | frame_158_stand_with_sword = 158, |
||
826 | frame_159_fighting = 159, |
||
827 | frame_160_fighting = 160, |
||
828 | frame_161_parry = 161, |
||
829 | frame_162_block_to_strike = 162, |
||
830 | frame_163_fighting = 163, |
||
831 | frame_164_fighting = 164, |
||
832 | frame_165_walk_with_sword = 165, |
||
833 | frame_166_stand_inactive = 166, |
||
834 | frame_167_blocked = 167, |
||
835 | frame_168_back = 168, |
||
836 | frame_169_begin_block = 169, |
||
837 | frame_170_stand_with_sword = 170, |
||
838 | frame_171_stand_with_sword = 171, |
||
839 | frame_172_jumpfall_2 = 172, |
||
840 | frame_173_jumpfall_3 = 173, |
||
841 | frame_174_jumpfall_4 = 174, |
||
842 | frame_175_jumpfall_5 = 175, |
||
843 | frame_177_spiked = 177, |
||
844 | frame_178_chomped = 178, |
||
845 | frame_179_collapse_1 = 179, |
||
846 | frame_180_collapse_2 = 180, |
||
847 | frame_181_collapse_3 = 181, |
||
848 | frame_182_collapse_4 = 182, |
||
849 | frame_183_collapse_5 = 183, |
||
850 | frame_185_dead = 185, |
||
851 | frame_186_mouse_1 = 186, |
||
852 | frame_187_mouse_2 = 187, |
||
853 | frame_188_mouse_stand = 188, |
||
854 | frame_191_drink = 191, |
||
855 | frame_192_drink = 192, |
||
856 | frame_193_drink = 193, |
||
857 | frame_194_drink = 194, |
||
858 | frame_195_drink = 195, |
||
859 | frame_196_drink = 196, |
||
860 | frame_197_drink = 197, |
||
861 | frame_198_drink = 198, |
||
862 | frame_199_drink = 199, |
||
863 | frame_200_drink = 200, |
||
864 | frame_201_drink = 201, |
||
865 | frame_202_drink = 202, |
||
866 | frame_203_drink = 203, |
||
867 | frame_204_drink = 204, |
||
868 | frame_205_drink = 205, |
||
869 | frame_207_draw_1 = 207, |
||
870 | frame_208_draw_2 = 208, |
||
871 | frame_209_draw_3 = 209, |
||
872 | frame_210_draw_4 = 210, |
||
873 | frame_217_exit_stairs_1 = 217, |
||
874 | frame_218_exit_stairs_2 = 218, |
||
875 | frame_219_exit_stairs_3 = 219, |
||
876 | frame_220_exit_stairs_4 = 220, |
||
877 | frame_221_exit_stairs_5 = 221, |
||
878 | frame_222_exit_stairs_6 = 222, |
||
879 | frame_223_exit_stairs_7 = 223, |
||
880 | frame_224_exit_stairs_8 = 224, |
||
881 | frame_225_exit_stairs_9 = 225, |
||
882 | frame_226_exit_stairs_10 = 226, |
||
883 | frame_227_exit_stairs_11 = 227, |
||
884 | frame_228_exit_stairs_12 = 228, |
||
885 | frame_229_found_sword = 229, |
||
886 | frame_230_sheathe = 230, |
||
887 | frame_231_sheathe = 231, |
||
888 | frame_232_sheathe = 232, |
||
889 | frame_233_sheathe = 233, |
||
890 | frame_234_sheathe = 234, |
||
891 | frame_235_sheathe = 235, |
||
892 | frame_236_sheathe = 236, |
||
893 | frame_237_sheathe = 237, |
||
894 | frame_238_sheathe = 238, |
||
895 | frame_239_sheathe = 239, |
||
896 | frame_240_sheathe = 240, |
||
897 | }; |
||
898 | |||
899 | enum altset2ids { |
||
900 | alt2frame_54_Vstand = 54, |
||
901 | //... incomplete |
||
902 | }; |
||
903 | |||
904 | enum seqids { |
||
905 | seq_1_start_run = 1, |
||
906 | seq_2_stand = 2, |
||
907 | seq_3_standing_jump = 3, |
||
908 | seq_4_run_jump = 4, |
||
909 | seq_5_turn = 5, |
||
910 | seq_6_run_turn = 6, |
||
911 | seq_7_fall = 7, |
||
912 | seq_8_jump_up_and_grab_straight = 8, |
||
913 | seq_10_climb_up = 10, |
||
914 | seq_11_release_ledge_and_land = 11, |
||
915 | seq_13_stop_run = 13, |
||
916 | seq_14_jump_up_into_ceiling = 14, |
||
917 | seq_15_grab_ledge_midair = 15, |
||
918 | seq_16_jump_up_and_grab = 16, |
||
919 | seq_17_soft_land = 17, |
||
920 | seq_18_fall_after_standing_jump = 18, |
||
921 | seq_19_fall = 19, |
||
922 | seq_20_medium_land = 20, |
||
923 | seq_21_fall_after_running_jump = 21, |
||
924 | seq_22_crushed = 22, |
||
925 | seq_23_release_ledge_and_fall = 23, |
||
926 | seq_24_jump_up_and_grab_forward = 24, |
||
927 | seq_25_hang_against_wall = 25, |
||
928 | seq_26_crouch_while_running = 26, |
||
929 | seq_28_jump_up_with_nothing_above = 28, |
||
930 | seq_29_safe_step_1 = 29, |
||
931 | seq_30_safe_step_2 = 30, |
||
932 | seq_31_safe_step_3 = 31, |
||
933 | seq_32_safe_step_4 = 32, |
||
934 | seq_33_safe_step_5 = 33, |
||
935 | seq_34_safe_step_6 = 34, |
||
936 | seq_35_safe_step_7 = 35, |
||
937 | seq_36_safe_step_8 = 36, |
||
938 | seq_37_safe_step_9 = 37, |
||
939 | seq_38_safe_step_10 = 38, |
||
940 | seq_39_safe_step_11 = 39, |
||
941 | seq_40_safe_step_12 = 40, |
||
942 | seq_41_safe_step_13 = 41, |
||
943 | seq_42_safe_step_14 = 42, |
||
944 | seq_43_start_run_after_turn = 43, |
||
945 | seq_44_step_on_edge = 44, |
||
946 | seq_45_bumpfall = 45, |
||
947 | seq_46_hardbump = 46, |
||
948 | seq_47_bump = 47, |
||
949 | seq_49_stand_up_from_crouch = 49, |
||
950 | seq_50_crouch = 50, |
||
951 | seq_51_spiked = 51, |
||
952 | seq_52_loose_floor_fell_on_kid = 52, |
||
953 | seq_54_chomped = 54, |
||
954 | seq_55_draw_sword = 55, |
||
955 | seq_56_guard_forward_with_sword = 56, |
||
956 | seq_57_back_with_sword = 57, |
||
957 | seq_58_guard_strike = 58, |
||
958 | seq_60_turn_with_sword = 60, |
||
959 | seq_61_parry_after_strike = 61, |
||
960 | seq_62_parry = 62, |
||
961 | seq_63_guard_stand_active = 63, |
||
962 | seq_64_pushed_back_with_sword = 64, |
||
963 | seq_65_bump_forward_with_sword = 65, |
||
964 | seq_66_strike_after_parry = 66, |
||
965 | seq_68_climb_down = 68, |
||
966 | seq_69_attack_was_parried = 69, |
||
967 | seq_70_go_up_on_level_door = 70, |
||
968 | seq_71_dying = 71, |
||
969 | seq_73_climb_up_to_closed_gate = 73, |
||
970 | seq_74_hit_by_sword = 74, |
||
971 | seq_75_strike = 75, |
||
972 | seq_77_guard_stand_inactive = 77, |
||
973 | seq_78_drink = 78, |
||
974 | seq_79_crouch_hop = 79, |
||
975 | seq_80_stand_flipped = 80, |
||
976 | seq_81_kid_pushed_off_ledge = 81, |
||
977 | seq_82_guard_pushed_off_ledge = 82, |
||
978 | seq_83_guard_fall = 83, |
||
979 | seq_84_run = 84, |
||
980 | seq_85_stabbed_to_death = 85, |
||
981 | seq_86_forward_with_sword = 86, |
||
982 | seq_87_guard_become_inactive = 87, |
||
983 | seq_88_skel_wake_up = 88, |
||
984 | seq_89_turn_draw_sword = 89, |
||
985 | seq_90_en_garde = 90, |
||
986 | seq_91_get_sword = 91, |
||
987 | seq_92_put_sword_away = 92, |
||
988 | seq_93_put_sword_away_fast = 93, |
||
989 | seq_94_princess_stand_PV1 = 94, |
||
990 | seq_95_Jaffar_stand_PV1 = 95, |
||
991 | seq_101_mouse_stands_up = 101, |
||
992 | seq_103_princess_lying_PV2 = 103, |
||
993 | seq_104_start_fall_in_front_of_wall = 104, |
||
994 | seq_105_mouse_forward = 105, |
||
995 | seq_106_mouse = 106, |
||
996 | seq_107_mouse_stand_up_and_go = 107, |
||
997 | seq_108_princess_turn_and_hug = 108, |
||
998 | seq_109_princess_stand_PV2 = 109, |
||
999 | seq_110_princess_crouching_PV2 = 110, |
||
1000 | seq_111_princess_stand_up_PV2 = 111, |
||
1001 | seq_112_princess_crouch_down_PV2 = 112, |
||
1002 | seq_114_mouse_stand = 114, |
||
1003 | }; |
||
1004 | |||
1005 | enum seqtbl_instructions { |
||
1006 | SEQ_DX = 0xFB, |
||
1007 | SEQ_DY = 0xFA, |
||
1008 | SEQ_FLIP = 0xFE, |
||
1009 | SEQ_JMP_IF_FEATHER = 0xF7, |
||
1010 | SEQ_JMP = 0xFF, |
||
1011 | SEQ_UP = 0xFD, |
||
1012 | SEQ_DOWN = 0xFC, |
||
1013 | SEQ_ACTION = 0xF9, |
||
1014 | SEQ_SET_FALL = 0xF8, |
||
1015 | SEQ_KNOCK_UP = 0xF5, |
||
1016 | SEQ_KNOCK_DOWN = 0xF4, |
||
1017 | SEQ_SOUND = 0xF2, |
||
1018 | SEQ_END_LEVEL = 0xF1, |
||
1019 | SEQ_GET_ITEM = 0xF3, |
||
1020 | SEQ_DIE = 0xF6, |
||
1021 | }; |
||
1022 | |||
1023 | enum seqtbl_sounds { |
||
1024 | SND_SILENT = 0, |
||
1025 | SND_FOOTSTEP = 1, |
||
1026 | SND_BUMP = 2, |
||
1027 | SND_DRINK = 3, |
||
1028 | SND_LEVEL = 4, |
||
1029 | }; |
||
1030 | |||
1031 | enum colorids { |
||
1032 | color_0_black = 0, |
||
1033 | color_1_blue = 1, |
||
1034 | color_2_green = 2, |
||
1035 | color_3_cyan = 3, |
||
1036 | color_4_red = 4, |
||
1037 | color_5_magenta = 5, |
||
1038 | color_6_brown = 6, |
||
1039 | color_7_lightgray = 7, |
||
1040 | color_8_darkgray = 8, |
||
1041 | color_9_brightblue = 9, |
||
1042 | color_10_brightgreen = 10, |
||
1043 | color_11_brightcyan = 11, |
||
1044 | color_12_brightred = 12, |
||
1045 | color_13_brightmagenta = 13, |
||
1046 | color_14_brightyellow = 14, |
||
1047 | color_15_brightwhite = 15, |
||
1048 | }; |
||
1049 | |||
1050 | #ifdef USE_REPLAY |
||
1051 | enum replay_special_moves { |
||
1052 | MOVE_RESTART_LEVEL = 1, // player pressed Ctrl+A |
||
1053 | MOVE_EFFECT_END = 2, // music stops, causing the end of feather effect or level 1 crouch immobilization |
||
1054 | }; |
||
1055 | |||
1056 | enum replay_seek_targets { |
||
1057 | replay_seek_0_next_room = 0, |
||
1058 | replay_seek_1_next_level = 1, |
||
1059 | replay_seek_2_end = 2, |
||
1060 | }; |
||
1061 | #endif |
||
1062 | |||
1063 | #define COUNT(array) (sizeof(array)/sizeof(array[0])) |
||
1064 | |||
1065 | // These are or'ed with SDL_SCANCODE_* constants in last_key_scancode. |
||
1066 | enum key_modifiers { |
||
1067 | WITH_SHIFT = 0x8000, |
||
1068 | WITH_CTRL = 0x4000, |
||
1069 | WITH_ALT = 0x2000, |
||
1070 | }; |
||
1071 | |||
1072 | #endif |