P_SPEC.H 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. // P_spec.h
  2. /*
  3. ===============================================================================
  4. P_SPEC
  5. ===============================================================================
  6. */
  7. //
  8. // Animating textures and planes
  9. //
  10. typedef struct
  11. {
  12. boolean istexture;
  13. int picnum;
  14. int basepic;
  15. int numpics;
  16. int speed;
  17. } anim_t;
  18. //
  19. // source animation definition
  20. //
  21. typedef struct
  22. {
  23. boolean istexture; // if false, it's a flat
  24. char endname[9];
  25. char startname[9];
  26. int speed;
  27. } animdef_t;
  28. #define MAXANIMS 32
  29. extern anim_t anims[MAXANIMS], *lastanim;
  30. extern int *TerrainTypes;
  31. //
  32. // Animating line specials
  33. //
  34. #define MAXLINEANIMS 64
  35. extern short numlinespecials;
  36. extern line_t *linespeciallist[MAXLINEANIMS];
  37. // Define values for map objects
  38. #define MO_TELEPORTMAN 14
  39. // at game start
  40. void P_InitPicAnims(void);
  41. void P_InitTerrainTypes(void);
  42. void P_InitLava(void);
  43. // at map load
  44. void P_SpawnSpecials(void);
  45. void P_InitAmbientSound(void);
  46. void P_AddAmbientSfx(int sequence);
  47. // every tic
  48. void P_UpdateSpecials(void);
  49. void P_AmbientSound(void);
  50. // when needed
  51. boolean P_UseSpecialLine ( mobj_t *thing, line_t *line);
  52. void P_ShootSpecialLine ( mobj_t *thing, line_t *line);
  53. void P_CrossSpecialLine (int linenum, int side, mobj_t *thing);
  54. void P_PlayerInSpecialSector (player_t *player);
  55. int twoSided(int sector,int line);
  56. sector_t *getSector(int currentSector,int line,int side);
  57. side_t *getSide(int currentSector,int line, int side);
  58. fixed_t P_FindLowestFloorSurrounding(sector_t *sec);
  59. fixed_t P_FindHighestFloorSurrounding(sector_t *sec);
  60. fixed_t P_FindNextHighestFloor(sector_t *sec,int currentheight);
  61. fixed_t P_FindLowestCeilingSurrounding(sector_t *sec);
  62. fixed_t P_FindHighestCeilingSurrounding(sector_t *sec);
  63. int P_FindSectorFromLineTag(line_t *line,int start);
  64. int P_FindMinSurroundingLight(sector_t *sector,int max);
  65. sector_t *getNextSector(line_t *line,sector_t *sec);
  66. //
  67. // SPECIAL
  68. //
  69. int EV_DoDonut(line_t *line);
  70. /*
  71. ===============================================================================
  72. P_LIGHTS
  73. ===============================================================================
  74. */
  75. typedef struct
  76. {
  77. thinker_t thinker;
  78. sector_t *sector;
  79. int count;
  80. int maxlight;
  81. int minlight;
  82. int maxtime;
  83. int mintime;
  84. } lightflash_t;
  85. typedef struct
  86. {
  87. thinker_t thinker;
  88. sector_t *sector;
  89. int count;
  90. int minlight;
  91. int maxlight;
  92. int darktime;
  93. int brighttime;
  94. } strobe_t;
  95. typedef struct
  96. {
  97. thinker_t thinker;
  98. sector_t *sector;
  99. int minlight;
  100. int maxlight;
  101. int direction;
  102. } glow_t;
  103. #define GLOWSPEED 8
  104. #define STROBEBRIGHT 5
  105. #define FASTDARK 15
  106. #define SLOWDARK 35
  107. void T_LightFlash (lightflash_t *flash);
  108. void P_SpawnLightFlash (sector_t *sector);
  109. void T_StrobeFlash (strobe_t *flash);
  110. void P_SpawnStrobeFlash (sector_t *sector, int fastOrSlow, int inSync);
  111. void EV_StartLightStrobing(line_t *line);
  112. void EV_TurnTagLightsOff(line_t *line);
  113. void EV_LightTurnOn(line_t *line, int bright);
  114. void T_Glow(glow_t *g);
  115. void P_SpawnGlowingLight(sector_t *sector);
  116. /*
  117. ===============================================================================
  118. P_SWITCH
  119. ===============================================================================
  120. */
  121. typedef struct
  122. {
  123. char name1[9];
  124. char name2[9];
  125. short episode;
  126. } switchlist_t;
  127. typedef enum
  128. {
  129. top,
  130. middle,
  131. bottom
  132. } bwhere_e;
  133. typedef struct
  134. {
  135. line_t *line;
  136. bwhere_e where;
  137. int btexture;
  138. int btimer;
  139. mobj_t *soundorg;
  140. } button_t;
  141. #define MAXSWITCHES 50 // max # of wall switches in a level
  142. #define MAXBUTTONS 16 // 4 players, 4 buttons each at once, max.
  143. #define BUTTONTIME 35 // 1 second
  144. extern button_t buttonlist[MAXBUTTONS];
  145. void P_ChangeSwitchTexture(line_t *line,int useAgain);
  146. void P_InitSwitchList(void);
  147. /*
  148. ===============================================================================
  149. P_PLATS
  150. ===============================================================================
  151. */
  152. typedef enum
  153. {
  154. up,
  155. down,
  156. waiting,
  157. in_stasis
  158. } plat_e;
  159. typedef enum
  160. {
  161. perpetualRaise,
  162. downWaitUpStay,
  163. raiseAndChange,
  164. raiseToNearestAndChange
  165. } plattype_e;
  166. typedef struct
  167. {
  168. thinker_t thinker;
  169. sector_t *sector;
  170. fixed_t speed;
  171. fixed_t low;
  172. fixed_t high;
  173. int wait;
  174. int count;
  175. plat_e status;
  176. plat_e oldstatus;
  177. boolean crush;
  178. int tag;
  179. plattype_e type;
  180. } plat_t;
  181. #define PLATWAIT 3
  182. #define PLATSPEED FRACUNIT
  183. #define MAXPLATS 30
  184. extern plat_t *activeplats[MAXPLATS];
  185. void T_PlatRaise(plat_t *plat);
  186. int EV_DoPlat(line_t *line,plattype_e type,int amount);
  187. void P_AddActivePlat(plat_t *plat);
  188. void P_RemoveActivePlat(plat_t *plat);
  189. void EV_StopPlat(line_t *line);
  190. void P_ActivateInStasis(int tag);
  191. /*
  192. ===============================================================================
  193. P_DOORS
  194. ===============================================================================
  195. */
  196. typedef enum
  197. {
  198. normal,
  199. close30ThenOpen,
  200. close,
  201. open,
  202. raiseIn5Mins
  203. } vldoor_e;
  204. typedef struct
  205. {
  206. thinker_t thinker;
  207. vldoor_e type;
  208. sector_t *sector;
  209. fixed_t topheight;
  210. fixed_t speed;
  211. int direction; // 1 = up, 0 = waiting at top, -1 = down
  212. int topwait; // tics to wait at the top
  213. // (keep in case a door going down is reset)
  214. int topcountdown; // when it reaches 0, start going down
  215. } vldoor_t;
  216. #define VDOORSPEED FRACUNIT*2
  217. #define VDOORWAIT 150
  218. void EV_VerticalDoor (line_t *line, mobj_t *thing);
  219. int EV_DoDoor (line_t *line, vldoor_e type, fixed_t speed);
  220. void T_VerticalDoor (vldoor_t *door);
  221. void P_SpawnDoorCloseIn30 (sector_t *sec);
  222. void P_SpawnDoorRaiseIn5Mins (sector_t *sec, int secnum);
  223. /*
  224. ===============================================================================
  225. P_CEILNG
  226. ===============================================================================
  227. */
  228. typedef enum
  229. {
  230. lowerToFloor,
  231. raiseToHighest,
  232. lowerAndCrush,
  233. crushAndRaise,
  234. fastCrushAndRaise
  235. } ceiling_e;
  236. typedef struct
  237. {
  238. thinker_t thinker;
  239. ceiling_e type;
  240. sector_t *sector;
  241. fixed_t bottomheight, topheight;
  242. fixed_t speed;
  243. boolean crush;
  244. int direction; // 1 = up, 0 = waiting, -1 = down
  245. int tag; // ID
  246. int olddirection;
  247. } ceiling_t;
  248. #define CEILSPEED FRACUNIT
  249. #define CEILWAIT 150
  250. #define MAXCEILINGS 30
  251. extern ceiling_t *activeceilings[MAXCEILINGS];
  252. int EV_DoCeiling (line_t *line, ceiling_e type);
  253. void T_MoveCeiling (ceiling_t *ceiling);
  254. void P_AddActiveCeiling(ceiling_t *c);
  255. void P_RemoveActiveCeiling(ceiling_t *c);
  256. int EV_CeilingCrushStop(line_t *line);
  257. void P_ActivateInStasisCeiling(line_t *line);
  258. /*
  259. ===============================================================================
  260. P_FLOOR
  261. ===============================================================================
  262. */
  263. typedef enum
  264. {
  265. lowerFloor, // lower floor to highest surrounding floor
  266. lowerFloorToLowest, // lower floor to lowest surrounding floor
  267. turboLower, // lower floor to highest surrounding floor VERY FAST
  268. raiseFloor, // raise floor to lowest surrounding CEILING
  269. raiseFloorToNearest, // raise floor to next highest surrounding floor
  270. raiseToTexture, // raise floor to shortest height texture around it
  271. lowerAndChange, // lower floor to lowest surrounding floor and change
  272. // floorpic
  273. raiseFloor24,
  274. raiseFloor24AndChange,
  275. raiseFloorCrush,
  276. donutRaise,
  277. raiseBuildStep // One step of a staircase
  278. } floor_e;
  279. typedef struct
  280. {
  281. thinker_t thinker;
  282. floor_e type;
  283. boolean crush;
  284. sector_t *sector;
  285. int direction;
  286. int newspecial;
  287. short texture;
  288. fixed_t floordestheight;
  289. fixed_t speed;
  290. } floormove_t;
  291. #define FLOORSPEED FRACUNIT
  292. typedef enum
  293. {
  294. ok,
  295. crushed,
  296. pastdest
  297. } result_e;
  298. result_e T_MovePlane(sector_t *sector,fixed_t speed,
  299. fixed_t dest,boolean crush,int floorOrCeiling,int direction);
  300. int EV_BuildStairs(line_t *line, fixed_t stepDelta);
  301. int EV_DoFloor(line_t *line,floor_e floortype);
  302. void T_MoveFloor(floormove_t *floor);
  303. /*
  304. ===============================================================================
  305. P_TELEPT
  306. ===============================================================================
  307. */
  308. boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle);
  309. boolean EV_Teleport(line_t *line, int side, mobj_t *thing);