p_spec.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #ifndef __P_SPEC__
  21. #define __P_SPEC__
  22. //
  23. // End-level timer (-TIMER option)
  24. //
  25. extern qboolean levelTimer;
  26. extern int levelTimeCount;
  27. // Define values for map objects
  28. #define MO_TELEPORTMAN 14
  29. // at game start
  30. void P_InitPicAnims (void);
  31. // at map load
  32. void P_SpawnSpecials (void);
  33. // every tic
  34. void P_UpdateSpecials (void);
  35. // when needed
  36. qboolean
  37. P_UseSpecialLine
  38. ( mobj_t* thing,
  39. line_t* line,
  40. int side );
  41. void
  42. P_ShootSpecialLine
  43. ( mobj_t* thing,
  44. line_t* line );
  45. void
  46. P_CrossSpecialLine
  47. ( int linenum,
  48. int side,
  49. mobj_t* thing );
  50. void P_PlayerInSpecialSector (player_t* player);
  51. int
  52. twoSided
  53. ( int sector,
  54. int line );
  55. sector_t*
  56. getSector
  57. ( int currentSector,
  58. int line,
  59. int side );
  60. side_t*
  61. getSide
  62. ( int currentSector,
  63. int line,
  64. int side );
  65. fixed_t P_FindLowestFloorSurrounding(sector_t* sec);
  66. fixed_t P_FindHighestFloorSurrounding(sector_t* sec);
  67. fixed_t
  68. P_FindNextHighestFloor
  69. ( sector_t* sec,
  70. int currentheight );
  71. fixed_t P_FindLowestCeilingSurrounding(sector_t* sec);
  72. fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);
  73. int
  74. P_FindSectorFromLineTag
  75. ( line_t* line,
  76. int start );
  77. int
  78. P_FindMinSurroundingLight
  79. ( sector_t* sector,
  80. int max );
  81. sector_t*
  82. getNextSector
  83. ( line_t* line,
  84. sector_t* sec );
  85. //
  86. // SPECIAL
  87. //
  88. int EV_DoDonut(line_t* line);
  89. //
  90. // P_LIGHTS
  91. //
  92. typedef struct
  93. {
  94. thinker_t thinker;
  95. sector_t* sector;
  96. int count;
  97. int maxlight;
  98. int minlight;
  99. } fireflicker_t;
  100. typedef struct
  101. {
  102. thinker_t thinker;
  103. sector_t* sector;
  104. int count;
  105. int maxlight;
  106. int minlight;
  107. int maxtime;
  108. int mintime;
  109. } lightflash_t;
  110. typedef struct
  111. {
  112. thinker_t thinker;
  113. sector_t* sector;
  114. int count;
  115. int minlight;
  116. int maxlight;
  117. int darktime;
  118. int brighttime;
  119. } strobe_t;
  120. typedef struct
  121. {
  122. thinker_t thinker;
  123. sector_t* sector;
  124. int minlight;
  125. int maxlight;
  126. int direction;
  127. } glow_t;
  128. #define GLOWSPEED 8
  129. #define STROBEBRIGHT 5
  130. #define FASTDARK 15
  131. #define SLOWDARK 35
  132. void T_FireFlicker (fireflicker_t* flick);
  133. void P_SpawnFireFlicker (sector_t* sector);
  134. void T_LightFlash (lightflash_t* flash);
  135. void P_SpawnLightFlash (sector_t* sector);
  136. void T_StrobeFlash (strobe_t* flash);
  137. void
  138. P_SpawnStrobeFlash
  139. ( sector_t* sector,
  140. int fastOrSlow,
  141. int inSync );
  142. void EV_StartLightStrobing(line_t* line);
  143. void EV_TurnTagLightsOff(line_t* line);
  144. void
  145. EV_LightTurnOn
  146. ( line_t* line,
  147. int bright );
  148. void T_Glow(glow_t* g);
  149. void P_SpawnGlowingLight(sector_t* sector);
  150. //
  151. // P_SWITCH
  152. //
  153. typedef struct
  154. {
  155. char name1[9];
  156. char name2[9];
  157. short episode;
  158. } switchlist_t;
  159. typedef enum
  160. {
  161. top,
  162. middle,
  163. bottom
  164. } bwhere_e;
  165. typedef struct
  166. {
  167. line_t* line;
  168. bwhere_e where;
  169. int btexture;
  170. int btimer;
  171. union {
  172. mobj_t * soundorg;
  173. degenmobj_t * degensoundorg;
  174. };
  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 TICRATE
  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. qboolean 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. closed,
  243. opened,
  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 TICRATE*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. qboolean 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. qboolean 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. qboolean 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