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