p_doors.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. /* Emacs style mode select -*- C++ -*-
  2. *-----------------------------------------------------------------------------
  3. *
  4. *
  5. * PrBoom: a Doom port merged with LxDoom and LSDLDoom
  6. * based on BOOM, a modified and improved DOOM engine
  7. * Copyright (C) 1999 by
  8. * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
  9. * Copyright (C) 1999-2000 by
  10. * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
  11. * Copyright 2005, 2006 by
  12. * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License
  16. * as published by the Free Software Foundation; either version 2
  17. * of the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  27. * 02111-1307, USA.
  28. *
  29. * DESCRIPTION:
  30. * Door animation code (opening/closing)
  31. *
  32. *-----------------------------------------------------------------------------*/
  33. #include "doomstat.h"
  34. #include "p_spec.h"
  35. #include "p_tick.h"
  36. #include "s_sound.h"
  37. #include "sounds.h"
  38. #include "r_main.h"
  39. #include "dstrings.h"
  40. #include "d_deh.h" // Ty 03/27/98 - externalized
  41. #include "lprintf.h"
  42. ///////////////////////////////////////////////////////////////
  43. //
  44. // Door action routines, called once per tick
  45. //
  46. ///////////////////////////////////////////////////////////////
  47. //
  48. // T_VerticalDoor
  49. //
  50. // Passed a door structure containing all info about the door.
  51. // See P_SPEC.H for fields.
  52. // Returns nothing.
  53. //
  54. // jff 02/08/98 all cases with labels beginning with gen added to support
  55. // generalized line type behaviors.
  56. void T_VerticalDoor (vldoor_t* door)
  57. {
  58. result_e res;
  59. // Is the door waiting, going up, or going down?
  60. switch(door->direction)
  61. {
  62. case 0:
  63. // Door is waiting
  64. if (!--door->topcountdown) // downcount and check
  65. {
  66. switch(door->type)
  67. {
  68. case blazeRaise:
  69. case genBlazeRaise:
  70. door->direction = -1; // time to go back down
  71. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls);
  72. break;
  73. case normal:
  74. case genRaise:
  75. door->direction = -1; // time to go back down
  76. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
  77. break;
  78. case close30ThenOpen:
  79. case genCdO:
  80. door->direction = 1; // time to go back up
  81. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
  82. break;
  83. case genBlazeCdO:
  84. door->direction = 1; // time to go back up
  85. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn);
  86. break;
  87. default:
  88. break;
  89. }
  90. }
  91. break;
  92. case 2:
  93. // Special case for sector type door that opens in 5 mins
  94. if (!--door->topcountdown) // 5 minutes up?
  95. {
  96. switch(door->type)
  97. {
  98. case raiseIn5Mins:
  99. door->direction = 1; // time to raise then
  100. door->type = normal; // door acts just like normal 1 DR door now
  101. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
  102. break;
  103. default:
  104. break;
  105. }
  106. }
  107. break;
  108. case -1:
  109. // Door is moving down
  110. res = T_MovePlane
  111. (
  112. door->sector,
  113. door->speed,
  114. door->sector->floorheight,
  115. false,
  116. 1,
  117. door->direction
  118. );
  119. /* killough 10/98: implement gradual lighting effects */
  120. // e6y: "Tagged doors don't trigger special lighting" handled wrong
  121. // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943
  122. // Old code: if (door->lighttag && door->topheight - door->sector->floorheight)
  123. if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level >= mbf_compatibility)
  124. EV_LightTurnOnPartway(door->line,
  125. FixedDiv(door->sector->ceilingheight -
  126. door->sector->floorheight,
  127. door->topheight -
  128. door->sector->floorheight));
  129. // handle door reaching bottom
  130. if (res == pastdest)
  131. {
  132. switch(door->type)
  133. {
  134. // regular open and close doors are all done, remove them
  135. case blazeRaise:
  136. case blazeClose:
  137. case genBlazeRaise:
  138. case genBlazeClose:
  139. door->sector->ceilingdata = NULL; //jff 2/22/98
  140. P_RemoveThinker (&door->thinker); // unlink and free
  141. // killough 4/15/98: remove double-closing sound of blazing doors
  142. if (comp[comp_blazing])
  143. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls);
  144. break;
  145. case normal:
  146. case close:
  147. case genRaise:
  148. case genClose:
  149. door->sector->ceilingdata = NULL; //jff 2/22/98
  150. P_RemoveThinker (&door->thinker); // unlink and free
  151. break;
  152. // close then open doors start waiting
  153. case close30ThenOpen:
  154. door->direction = 0;
  155. door->topcountdown = TICRATE*30;
  156. break;
  157. case genCdO:
  158. case genBlazeCdO:
  159. door->direction = 0;
  160. door->topcountdown = door->topwait; // jff 5/8/98 insert delay
  161. break;
  162. default:
  163. break;
  164. }
  165. // e6y: "Tagged doors don't trigger special lighting" handled wrong
  166. // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943
  167. if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level < mbf_compatibility)
  168. EV_LightTurnOnPartway(door->line,0);
  169. }
  170. /* jff 1/31/98 turn lighting off in tagged sectors of manual doors
  171. * killough 10/98: replaced with gradual lighting code
  172. */
  173. else if (res == crushed) // handle door meeting obstruction on way down
  174. {
  175. switch(door->type)
  176. {
  177. case genClose:
  178. case genBlazeClose:
  179. case blazeClose:
  180. case close: // Close types do not bounce, merely wait
  181. break;
  182. case blazeRaise:
  183. case genBlazeRaise:
  184. door->direction = 1;
  185. if (!comp[comp_blazing]) {
  186. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn);
  187. break;
  188. }
  189. default: // other types bounce off the obstruction
  190. door->direction = 1;
  191. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
  192. break;
  193. }
  194. }
  195. break;
  196. case 1:
  197. // Door is moving up
  198. res = T_MovePlane
  199. (
  200. door->sector,
  201. door->speed,
  202. door->topheight,
  203. false,
  204. 1,
  205. door->direction
  206. );
  207. /* killough 10/98: implement gradual lighting effects */
  208. // e6y: "Tagged doors don't trigger special lighting" handled wrong
  209. // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943
  210. // Old code: if (door->lighttag && door->topheight - door->sector->floorheight)
  211. if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level >= mbf_compatibility)
  212. EV_LightTurnOnPartway(door->line,
  213. FixedDiv(door->sector->ceilingheight -
  214. door->sector->floorheight,
  215. door->topheight -
  216. door->sector->floorheight));
  217. // handle door reaching the top
  218. if (res == pastdest)
  219. {
  220. switch(door->type)
  221. {
  222. case blazeRaise: // regular open/close doors start waiting
  223. case normal:
  224. case genRaise:
  225. case genBlazeRaise:
  226. door->direction = 0; // wait at top with delay
  227. door->topcountdown = door->topwait;
  228. break;
  229. case close30ThenOpen: // close and close/open doors are done
  230. case blazeOpen:
  231. case open:
  232. case genBlazeOpen:
  233. case genOpen:
  234. case genCdO:
  235. case genBlazeCdO:
  236. door->sector->ceilingdata = NULL; //jff 2/22/98
  237. P_RemoveThinker (&door->thinker); // unlink and free
  238. break;
  239. default:
  240. break;
  241. }
  242. /* jff 1/31/98 turn lighting on in tagged sectors of manual doors
  243. * killough 10/98: replaced with gradual lighting code */
  244. // e6y: "Tagged doors don't trigger special lighting" handled wrong
  245. // http://sourceforge.net/tracker/index.php?func=detail&aid=1411400&group_id=148658&atid=772943
  246. if (door->lighttag && door->topheight - door->sector->floorheight && compatibility_level < mbf_compatibility)
  247. EV_LightTurnOnPartway(door->line,FRACUNIT);
  248. }
  249. break;
  250. }
  251. }
  252. ///////////////////////////////////////////////////////////////
  253. //
  254. // Door linedef handlers
  255. //
  256. ///////////////////////////////////////////////////////////////
  257. //
  258. // EV_DoLockedDoor
  259. //
  260. // Handle opening a tagged locked door
  261. //
  262. // Passed the line activating the door, the type of door,
  263. // and the thing that activated the line
  264. // Returns true if a thinker created
  265. //
  266. int EV_DoLockedDoor
  267. ( line_t* line,
  268. vldoor_e type,
  269. mobj_t* thing )
  270. {
  271. player_t* p;
  272. // only players can open locked doors
  273. p = thing->player;
  274. if (!p)
  275. return 0;
  276. // check type of linedef, and if key is possessed to open it
  277. switch(line->special)
  278. {
  279. case 99: // Blue Lock
  280. case 133:
  281. if (!p->cards[it_bluecard] && !p->cards[it_blueskull])
  282. {
  283. p->message = s_PD_BLUEO; // Ty 03/27/98 - externalized
  284. S_StartSound(p->mo,sfx_oof); // killough 3/20/98
  285. return 0;
  286. }
  287. break;
  288. case 134: // Red Lock
  289. case 135:
  290. if (!p->cards[it_redcard] && !p->cards[it_redskull])
  291. {
  292. p->message = s_PD_REDO; // Ty 03/27/98 - externalized
  293. S_StartSound(p->mo,sfx_oof); // killough 3/20/98
  294. return 0;
  295. }
  296. break;
  297. case 136: // Yellow Lock
  298. case 137:
  299. if (!p->cards[it_yellowcard] && !p->cards[it_yellowskull])
  300. {
  301. p->message = s_PD_YELLOWO; // Ty 03/27/98 - externalized
  302. S_StartSound(p->mo,sfx_oof); // killough 3/20/98
  303. return 0;
  304. }
  305. break;
  306. }
  307. // got the key, so open the door
  308. return EV_DoDoor(line,type);
  309. }
  310. //
  311. // EV_DoDoor
  312. //
  313. // Handle opening a tagged door
  314. //
  315. // Passed the line activating the door and the type of door
  316. // Returns true if a thinker created
  317. //
  318. int EV_DoDoor
  319. ( line_t* line,
  320. vldoor_e type )
  321. {
  322. int secnum,rtn;
  323. sector_t* sec;
  324. vldoor_t* door;
  325. secnum = -1;
  326. rtn = 0;
  327. // open all doors with the same tag as the activating line
  328. while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
  329. {
  330. sec = &sectors[secnum];
  331. // if the ceiling already moving, don't start the door action
  332. if (P_SectorActive(ceiling_special,sec)) //jff 2/22/98
  333. continue;
  334. // new door thinker
  335. rtn = 1;
  336. door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
  337. memset(door, 0, sizeof(*door));
  338. P_AddThinker (&door->thinker);
  339. sec->ceilingdata = door; //jff 2/22/98
  340. door->thinker.function = T_VerticalDoor;
  341. door->sector = sec;
  342. door->type = type;
  343. door->topwait = VDOORWAIT;
  344. door->speed = VDOORSPEED;
  345. door->line = line; // jff 1/31/98 remember line that triggered us
  346. door->lighttag = 0; /* killough 10/98: no light effects with tagged doors */
  347. // setup door parameters according to type of door
  348. switch(type)
  349. {
  350. case blazeClose:
  351. door->topheight = P_FindLowestCeilingSurrounding(sec);
  352. door->topheight -= 4*FRACUNIT;
  353. door->direction = -1;
  354. door->speed = VDOORSPEED * 4;
  355. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdcls);
  356. break;
  357. case close:
  358. door->topheight = P_FindLowestCeilingSurrounding(sec);
  359. door->topheight -= 4*FRACUNIT;
  360. door->direction = -1;
  361. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
  362. break;
  363. case close30ThenOpen:
  364. door->topheight = sec->ceilingheight;
  365. door->direction = -1;
  366. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_dorcls);
  367. break;
  368. case blazeRaise:
  369. case blazeOpen:
  370. door->direction = 1;
  371. door->topheight = P_FindLowestCeilingSurrounding(sec);
  372. door->topheight -= 4*FRACUNIT;
  373. door->speed = VDOORSPEED * 4;
  374. if (door->topheight != sec->ceilingheight)
  375. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_bdopn);
  376. break;
  377. case normal:
  378. case open:
  379. door->direction = 1;
  380. door->topheight = P_FindLowestCeilingSurrounding(sec);
  381. door->topheight -= 4*FRACUNIT;
  382. if (door->topheight != sec->ceilingheight)
  383. S_StartSound((mobj_t *)&door->sector->soundorg,sfx_doropn);
  384. break;
  385. default:
  386. break;
  387. }
  388. }
  389. return rtn;
  390. }
  391. //
  392. // EV_VerticalDoor
  393. //
  394. // Handle opening a door manually, no tag value
  395. //
  396. // Passed the line activating the door and the thing activating it
  397. // Returns true if a thinker created
  398. //
  399. // jff 2/12/98 added int return value, fixed all returns
  400. //
  401. int EV_VerticalDoor
  402. ( line_t* line,
  403. mobj_t* thing )
  404. {
  405. player_t* player;
  406. int secnum;
  407. sector_t* sec;
  408. vldoor_t* door;
  409. // Check for locks
  410. player = thing->player;
  411. switch(line->special)
  412. {
  413. case 26: // Blue Lock
  414. case 32:
  415. if ( !player )
  416. return 0;
  417. if (!player->cards[it_bluecard] && !player->cards[it_blueskull])
  418. {
  419. player->message = s_PD_BLUEK; // Ty 03/27/98 - externalized
  420. S_StartSound(player->mo,sfx_oof); // killough 3/20/98
  421. return 0;
  422. }
  423. break;
  424. case 27: // Yellow Lock
  425. case 34:
  426. if ( !player )
  427. return 0;
  428. if (!player->cards[it_yellowcard] && !player->cards[it_yellowskull])
  429. {
  430. player->message = s_PD_YELLOWK; // Ty 03/27/98 - externalized
  431. S_StartSound(player->mo,sfx_oof); // killough 3/20/98
  432. return 0;
  433. }
  434. break;
  435. case 28: // Red Lock
  436. case 33:
  437. if ( !player )
  438. return 0;
  439. if (!player->cards[it_redcard] && !player->cards[it_redskull])
  440. {
  441. player->message = s_PD_REDK; // Ty 03/27/98 - externalized
  442. S_StartSound(player->mo,sfx_oof); // killough 3/20/98
  443. return 0;
  444. }
  445. break;
  446. default:
  447. break;
  448. }
  449. // if the wrong side of door is pushed, give oof sound
  450. if (line->sidenum[1]==NO_INDEX) // killough
  451. {
  452. S_StartSound(player->mo,sfx_oof); // killough 3/20/98
  453. return 0;
  454. }
  455. // get the sector on the second side of activating linedef
  456. sec = sides[line->sidenum[1]].sector;
  457. secnum = sec-sectors;
  458. /* if door already has a thinker, use it
  459. * cph 2001/04/05 -
  460. * Ok, this is a disaster area. We're assuming that sec->ceilingdata
  461. * is a vldoor_t! What if this door is controlled by both DR lines
  462. * and by switches? I don't know how to fix that.
  463. * Secondly, original Doom didn't distinguish floor/lighting/ceiling
  464. * actions, so we need to do the same in demo compatibility mode.
  465. */
  466. door = sec->ceilingdata;
  467. if (demo_compatibility) {
  468. if (!door) door = sec->floordata;
  469. if (!door) door = sec->lightingdata;
  470. }
  471. /* If this is a repeatable line, and the door is already moving, then we can just reverse the current action. Note that in prboom 2.3.0 I erroneously removed the if-this-is-repeatable check, hence the prboom_4_compatibility clause below (foolishly assumed that already moving implies repeatable - but it could be moving due to another switch, e.g. lv19-509) */
  472. if (door &&
  473. ((compatibility_level == prboom_4_compatibility) ||
  474. (line->special == 1) || (line->special == 117) || (line->special == 26) || (line->special == 27) || (line->special == 28)
  475. )
  476. ) {
  477. /* For old demos we have to emulate the old buggy behavior and
  478. * mess up non-T_VerticalDoor actions.
  479. */
  480. if (compatibility_level < prboom_4_compatibility ||
  481. door->thinker.function == T_VerticalDoor) {
  482. /* cph - we are writing outval to door->direction iff it is non-zero */
  483. signed int outval = 0;
  484. /* An already moving repeatable door which is being re-pressed, or a
  485. * monster is trying to open a closing door - so change direction
  486. * DEMOSYNC: we only read door->direction now if it really is a door.
  487. */
  488. if (door->thinker.function == T_VerticalDoor && door->direction == -1) {
  489. outval = 1; /* go back up */
  490. } else if (player) {
  491. outval = -1; /* go back down */
  492. }
  493. /* Write this to the thinker. In demo compatibility mode, we might be
  494. * overwriting a field of a non-vldoor_t thinker - we need to add any
  495. * other thinker types here if any demos depend on specific fields
  496. * being corrupted by this.
  497. */
  498. if (outval) {
  499. if (door->thinker.function == T_VerticalDoor) {
  500. door->direction = outval;
  501. } else if (door->thinker.function == T_PlatRaise) {
  502. plat_t* p = (plat_t*)door;
  503. p->wait = outval;
  504. } else {
  505. lprintf(LO_DEBUG, "EV_VerticalDoor: unknown thinker.function in thinker corruption emulation");
  506. }
  507. return 1;
  508. }
  509. }
  510. /* Either we're in prboom >=v2.3 and it's not a door, or it's a door but
  511. * we're a monster and don't want to shut it; exit with no action.
  512. */
  513. return 0;
  514. }
  515. // emit proper sound
  516. switch(line->special)
  517. {
  518. case 117: // blazing door raise
  519. case 118: // blazing door open
  520. S_StartSound((mobj_t *)&sec->soundorg,sfx_bdopn);
  521. break;
  522. default: // normal or locked door sound
  523. S_StartSound((mobj_t *)&sec->soundorg,sfx_doropn);
  524. break;
  525. }
  526. // new door thinker
  527. door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0);
  528. memset(door, 0, sizeof(*door));
  529. P_AddThinker (&door->thinker);
  530. sec->ceilingdata = door; //jff 2/22/98
  531. door->thinker.function = T_VerticalDoor;
  532. door->sector = sec;
  533. door->direction = 1;
  534. door->speed = VDOORSPEED;
  535. door->topwait = VDOORWAIT;
  536. door->line = line; // jff 1/31/98 remember line that triggered us
  537. /* killough 10/98: use gradual lighting changes if nonzero tag given */
  538. door->lighttag = comp[comp_doorlight] ? 0 : line->tag;
  539. // set the type of door from the activating linedef type
  540. switch(line->special)
  541. {
  542. case 1:
  543. case 26:
  544. case 27:
  545. case 28:
  546. door->type = normal;
  547. break;
  548. case 31:
  549. case 32:
  550. case 33:
  551. case 34:
  552. door->type = open;
  553. line->special = 0;
  554. break;
  555. case 117: // blazing door raise
  556. door->type = blazeRaise;
  557. door->speed = VDOORSPEED*4;
  558. break;
  559. case 118: // blazing door open
  560. door->type = blazeOpen;
  561. line->special = 0;
  562. door->speed = VDOORSPEED*4;
  563. break;
  564. default:
  565. door->lighttag = 0; // killough 10/98
  566. break;
  567. }
  568. // find the top and bottom of the movement range
  569. door->topheight = P_FindLowestCeilingSurrounding(sec);
  570. door->topheight -= 4*FRACUNIT;
  571. return 1;
  572. }
  573. ///////////////////////////////////////////////////////////////
  574. //
  575. // Sector type door spawners
  576. //
  577. ///////////////////////////////////////////////////////////////
  578. //
  579. // P_SpawnDoorCloseIn30()
  580. //
  581. // Spawn a door that closes after 30 seconds (called at level init)
  582. //
  583. // Passed the sector of the door, whose type specified the door action
  584. // Returns nothing
  585. //
  586. void P_SpawnDoorCloseIn30 (sector_t* sec)
  587. {
  588. vldoor_t* door;
  589. door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
  590. memset(door, 0, sizeof(*door));
  591. P_AddThinker (&door->thinker);
  592. sec->ceilingdata = door; //jff 2/22/98
  593. sec->special = 0;
  594. door->thinker.function = T_VerticalDoor;
  595. door->sector = sec;
  596. door->direction = 0;
  597. door->type = normal;
  598. door->speed = VDOORSPEED;
  599. door->topcountdown = 30 * 35;
  600. door->line = NULL; // jff 1/31/98 remember line that triggered us
  601. door->lighttag = 0; /* killough 10/98: no lighting changes */
  602. }
  603. //
  604. // P_SpawnDoorRaiseIn5Mins()
  605. //
  606. // Spawn a door that opens after 5 minutes (called at level init)
  607. //
  608. // Passed the sector of the door, whose type specified the door action
  609. // Returns nothing
  610. //
  611. void P_SpawnDoorRaiseIn5Mins
  612. ( sector_t* sec,
  613. int secnum )
  614. {
  615. vldoor_t* door;
  616. door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0);
  617. memset(door, 0, sizeof(*door));
  618. P_AddThinker (&door->thinker);
  619. sec->ceilingdata = door; //jff 2/22/98
  620. sec->special = 0;
  621. door->thinker.function = T_VerticalDoor;
  622. door->sector = sec;
  623. door->direction = 2;
  624. door->type = raiseIn5Mins;
  625. door->speed = VDOORSPEED;
  626. door->topheight = P_FindLowestCeilingSurrounding(sec);
  627. door->topheight -= 4*FRACUNIT;
  628. door->topwait = VDOORWAIT;
  629. door->topcountdown = 5 * 60 * 35;
  630. door->line = NULL; // jff 1/31/98 remember line that triggered us
  631. door->lighttag = 0; /* killough 10/98: no lighting changes */
  632. }