p_spec.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. // Emacs style mode select -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION: none
  18. // Implements special effects:
  19. // Texture animation, height or lighting changes
  20. // according to adjacent sectors, respective
  21. // utility functions, etc.
  22. //
  23. //-----------------------------------------------------------------------------
  24. #ifndef __P_SPEC__
  25. #define __P_SPEC__
  26. //
  27. // End-level timer (-TIMER option)
  28. //
  29. extern boolean levelTimer;
  30. extern int levelTimeCount;
  31. // Define values for map objects
  32. #define MO_TELEPORTMAN 14
  33. // at game start
  34. void P_InitPicAnims (void);
  35. // at map load
  36. void P_SpawnSpecials (void);
  37. // every tic
  38. void P_UpdateSpecials (void);
  39. // when needed
  40. boolean
  41. P_UseSpecialLine
  42. ( mobj_t* thing,
  43. line_t* line,
  44. int side );
  45. void
  46. P_ShootSpecialLine
  47. ( mobj_t* thing,
  48. line_t* line );
  49. void
  50. P_CrossSpecialLine
  51. ( int linenum,
  52. int side,
  53. mobj_t* thing );
  54. void P_PlayerInSpecialSector (player_t* player);
  55. int
  56. twoSided
  57. ( int sector,
  58. int line );
  59. sector_t*
  60. getSector
  61. ( int currentSector,
  62. int line,
  63. int side );
  64. side_t*
  65. getSide
  66. ( int currentSector,
  67. int line,
  68. int side );
  69. fixed_t P_FindLowestFloorSurrounding(sector_t* sec);
  70. fixed_t P_FindHighestFloorSurrounding(sector_t* sec);
  71. fixed_t
  72. P_FindNextHighestFloor
  73. ( sector_t* sec,
  74. int currentheight );
  75. fixed_t P_FindLowestCeilingSurrounding(sector_t* sec);
  76. fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);
  77. int
  78. P_FindSectorFromLineTag
  79. ( line_t* line,
  80. int start );
  81. int
  82. P_FindMinSurroundingLight
  83. ( sector_t* sector,
  84. int max );
  85. sector_t*
  86. getNextSector
  87. ( line_t* line,
  88. sector_t* sec );
  89. //
  90. // SPECIAL
  91. //
  92. int EV_DoDonut(line_t* line);
  93. //
  94. // P_LIGHTS
  95. //
  96. typedef struct
  97. {
  98. thinker_t thinker;
  99. sector_t* sector;
  100. int count;
  101. int maxlight;
  102. int minlight;
  103. } fireflicker_t;
  104. typedef struct
  105. {
  106. thinker_t thinker;
  107. sector_t* sector;
  108. int count;
  109. int maxlight;
  110. int minlight;
  111. int maxtime;
  112. int mintime;
  113. } lightflash_t;
  114. typedef struct
  115. {
  116. thinker_t thinker;
  117. sector_t* sector;
  118. int count;
  119. int minlight;
  120. int maxlight;
  121. int darktime;
  122. int brighttime;
  123. } strobe_t;
  124. typedef struct
  125. {
  126. thinker_t thinker;
  127. sector_t* sector;
  128. int minlight;
  129. int maxlight;
  130. int direction;
  131. } glow_t;
  132. #define GLOWSPEED 8
  133. #define STROBEBRIGHT 5
  134. #define FASTDARK 15
  135. #define SLOWDARK 35
  136. void P_SpawnFireFlicker (sector_t* sector);
  137. void T_LightFlash (lightflash_t* flash);
  138. void P_SpawnLightFlash (sector_t* sector);
  139. void T_StrobeFlash (strobe_t* flash);
  140. void
  141. P_SpawnStrobeFlash
  142. ( sector_t* sector,
  143. int fastOrSlow,
  144. int inSync );
  145. void EV_StartLightStrobing(line_t* line);
  146. void EV_TurnTagLightsOff(line_t* line);
  147. void
  148. EV_LightTurnOn
  149. ( line_t* line,
  150. int bright );
  151. void T_Glow(glow_t* g);
  152. void P_SpawnGlowingLight(sector_t* sector);
  153. //
  154. // P_SWITCH
  155. //
  156. typedef struct
  157. {
  158. char name1[9];
  159. char name2[9];
  160. short episode;
  161. } switchlist_t;
  162. typedef enum
  163. {
  164. top,
  165. middle,
  166. bottom
  167. } bwhere_e;
  168. typedef struct
  169. {
  170. line_t* line;
  171. bwhere_e where;
  172. int btexture;
  173. int btimer;
  174. mobj_t* soundorg;
  175. } button_t;
  176. // max # of wall switches in a level
  177. #define MAXSWITCHES 50
  178. // 4 players, 4 buttons each at once, max.
  179. #define MAXBUTTONS 16
  180. // 1 second, in ticks.
  181. #define BUTTONTIME 35
  182. extern button_t buttonlist[MAXBUTTONS];
  183. void
  184. P_ChangeSwitchTexture
  185. ( line_t* line,
  186. int useAgain );
  187. void P_InitSwitchList(void);
  188. //
  189. // P_PLATS
  190. //
  191. typedef enum
  192. {
  193. up,
  194. down,
  195. waiting,
  196. in_stasis
  197. } plat_e;
  198. typedef enum
  199. {
  200. perpetualRaise,
  201. downWaitUpStay,
  202. raiseAndChange,
  203. raiseToNearestAndChange,
  204. blazeDWUS
  205. } plattype_e;
  206. typedef struct
  207. {
  208. thinker_t thinker;
  209. sector_t* sector;
  210. fixed_t speed;
  211. fixed_t low;
  212. fixed_t high;
  213. int wait;
  214. int count;
  215. plat_e status;
  216. plat_e oldstatus;
  217. boolean crush;
  218. int tag;
  219. plattype_e type;
  220. } plat_t;
  221. #define PLATWAIT 3
  222. #define PLATSPEED FRACUNIT
  223. #define MAXPLATS 30
  224. extern plat_t* activeplats[MAXPLATS];
  225. void T_PlatRaise(plat_t* plat);
  226. int
  227. EV_DoPlat
  228. ( line_t* line,
  229. plattype_e type,
  230. int amount );
  231. void P_AddActivePlat(plat_t* plat);
  232. void P_RemoveActivePlat(plat_t* plat);
  233. void EV_StopPlat(line_t* line);
  234. void P_ActivateInStasis(int tag);
  235. //
  236. // P_DOORS
  237. //
  238. typedef enum
  239. {
  240. normal,
  241. close30ThenOpen,
  242. close,
  243. open,
  244. raiseIn5Mins,
  245. blazeRaise,
  246. blazeOpen,
  247. blazeClose
  248. } vldoor_e;
  249. typedef struct
  250. {
  251. thinker_t thinker;
  252. vldoor_e type;
  253. sector_t* sector;
  254. fixed_t topheight;
  255. fixed_t speed;
  256. // 1 = up, 0 = waiting at top, -1 = down
  257. int direction;
  258. // tics to wait at the top
  259. int topwait;
  260. // (keep in case a door going down is reset)
  261. // when it reaches 0, start going down
  262. int topcountdown;
  263. } vldoor_t;
  264. #define VDOORSPEED FRACUNIT*2
  265. #define VDOORWAIT 150
  266. void
  267. EV_VerticalDoor
  268. ( line_t* line,
  269. mobj_t* thing );
  270. int
  271. EV_DoDoor
  272. ( line_t* line,
  273. vldoor_e type );
  274. int
  275. EV_DoLockedDoor
  276. ( line_t* line,
  277. vldoor_e type,
  278. mobj_t* thing );
  279. void T_VerticalDoor (vldoor_t* door);
  280. void P_SpawnDoorCloseIn30 (sector_t* sec);
  281. void
  282. P_SpawnDoorRaiseIn5Mins
  283. ( sector_t* sec,
  284. int secnum );
  285. #if 0 // UNUSED
  286. //
  287. // Sliding doors...
  288. //
  289. typedef enum
  290. {
  291. sd_opening,
  292. sd_waiting,
  293. sd_closing
  294. } sd_e;
  295. typedef enum
  296. {
  297. sdt_openOnly,
  298. sdt_closeOnly,
  299. sdt_openAndClose
  300. } sdt_e;
  301. typedef struct
  302. {
  303. thinker_t thinker;
  304. sdt_e type;
  305. line_t* line;
  306. int frame;
  307. int whichDoorIndex;
  308. int timer;
  309. sector_t* frontsector;
  310. sector_t* backsector;
  311. sd_e status;
  312. } slidedoor_t;
  313. typedef struct
  314. {
  315. char frontFrame1[9];
  316. char frontFrame2[9];
  317. char frontFrame3[9];
  318. char frontFrame4[9];
  319. char backFrame1[9];
  320. char backFrame2[9];
  321. char backFrame3[9];
  322. char backFrame4[9];
  323. } slidename_t;
  324. typedef struct
  325. {
  326. int frontFrames[4];
  327. int backFrames[4];
  328. } slideframe_t;
  329. // how many frames of animation
  330. #define SNUMFRAMES 4
  331. #define SDOORWAIT 35*3
  332. #define SWAITTICS 4
  333. // how many diff. types of anims
  334. #define MAXSLIDEDOORS 5
  335. void P_InitSlidingDoorFrames(void);
  336. void
  337. EV_SlidingDoor
  338. ( line_t* line,
  339. mobj_t* thing );
  340. #endif
  341. //
  342. // P_CEILNG
  343. //
  344. typedef enum
  345. {
  346. lowerToFloor,
  347. raiseToHighest,
  348. lowerAndCrush,
  349. crushAndRaise,
  350. fastCrushAndRaise,
  351. silentCrushAndRaise
  352. } ceiling_e;
  353. typedef struct
  354. {
  355. thinker_t thinker;
  356. ceiling_e type;
  357. sector_t* sector;
  358. fixed_t bottomheight;
  359. fixed_t topheight;
  360. fixed_t speed;
  361. boolean crush;
  362. // 1 = up, 0 = waiting, -1 = down
  363. int direction;
  364. // ID
  365. int tag;
  366. int olddirection;
  367. } ceiling_t;
  368. #define CEILSPEED FRACUNIT
  369. #define CEILWAIT 150
  370. #define MAXCEILINGS 30
  371. extern ceiling_t* activeceilings[MAXCEILINGS];
  372. int
  373. EV_DoCeiling
  374. ( line_t* line,
  375. ceiling_e type );
  376. void T_MoveCeiling (ceiling_t* ceiling);
  377. void P_AddActiveCeiling(ceiling_t* c);
  378. void P_RemoveActiveCeiling(ceiling_t* c);
  379. int EV_CeilingCrushStop(line_t* line);
  380. void P_ActivateInStasisCeiling(line_t* line);
  381. //
  382. // P_FLOOR
  383. //
  384. typedef enum
  385. {
  386. // lower floor to highest surrounding floor
  387. lowerFloor,
  388. // lower floor to lowest surrounding floor
  389. lowerFloorToLowest,
  390. // lower floor to highest surrounding floor VERY FAST
  391. turboLower,
  392. // raise floor to lowest surrounding CEILING
  393. raiseFloor,
  394. // raise floor to next highest surrounding floor
  395. raiseFloorToNearest,
  396. // raise floor to shortest height texture around it
  397. raiseToTexture,
  398. // lower floor to lowest surrounding floor
  399. // and change floorpic
  400. lowerAndChange,
  401. raiseFloor24,
  402. raiseFloor24AndChange,
  403. raiseFloorCrush,
  404. // raise to next highest floor, turbo-speed
  405. raiseFloorTurbo,
  406. donutRaise,
  407. raiseFloor512
  408. } floor_e;
  409. typedef enum
  410. {
  411. build8, // slowly build by 8
  412. turbo16 // quickly build by 16
  413. } stair_e;
  414. typedef struct
  415. {
  416. thinker_t thinker;
  417. floor_e type;
  418. boolean crush;
  419. sector_t* sector;
  420. int direction;
  421. int newspecial;
  422. short texture;
  423. fixed_t floordestheight;
  424. fixed_t speed;
  425. } floormove_t;
  426. #define FLOORSPEED FRACUNIT
  427. typedef enum
  428. {
  429. ok,
  430. crushed,
  431. pastdest
  432. } result_e;
  433. result_e
  434. T_MovePlane
  435. ( sector_t* sector,
  436. fixed_t speed,
  437. fixed_t dest,
  438. boolean crush,
  439. int floorOrCeiling,
  440. int direction );
  441. int
  442. EV_BuildStairs
  443. ( line_t* line,
  444. stair_e type );
  445. int
  446. EV_DoFloor
  447. ( line_t* line,
  448. floor_e floortype );
  449. void T_MoveFloor( floormove_t* floor);
  450. //
  451. // P_TELEPT
  452. //
  453. int
  454. EV_Teleport
  455. ( line_t* line,
  456. int side,
  457. mobj_t* thing );
  458. #endif
  459. //-----------------------------------------------------------------------------
  460. //
  461. // $Log:$
  462. //
  463. //-----------------------------------------------------------------------------