Subversion Repositories Kolibri OS

Rev

Rev 8557 | Rev 9213 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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