doors.qc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. /* Copyright (C) 1996-1997 Id Software, Inc.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. float DOOR_START_OPEN = 1;
  16. float DOOR_DONT_LINK = 4;
  17. float DOOR_GOLD_KEY = 8;
  18. float DOOR_SILVER_KEY = 16;
  19. float DOOR_TOGGLE = 32;
  20. /*
  21. Doors are similar to buttons, but can spawn a fat trigger field around them
  22. to open without a touch, and they link together to form simultanious
  23. double/quad doors.
  24. Door.owner is the master door. If there is only one door, it points to itself.
  25. If multiple doors, all will point to a single one.
  26. Door.enemy chains from the master door through all doors linked in the chain.
  27. */
  28. /*
  29. =============================================================================
  30. THINK FUNCTIONS
  31. =============================================================================
  32. */
  33. void() door_go_down;
  34. void() door_go_up;
  35. void() door_blocked =
  36. {
  37. T_Damage (other, self, self, self.dmg);
  38. // if a door has a negative wait, it would never come back if blocked,
  39. // so let it just squash the object to death real fast
  40. if (self.wait >= 0)
  41. {
  42. if (self.state == STATE_DOWN)
  43. door_go_up ();
  44. else
  45. door_go_down ();
  46. }
  47. };
  48. void() door_hit_top =
  49. {
  50. sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
  51. self.state = STATE_TOP;
  52. if (self.spawnflags & DOOR_TOGGLE)
  53. return; // don't come down automatically
  54. self.think = door_go_down;
  55. self.nextthink = self.ltime + self.wait;
  56. };
  57. void() door_hit_bottom =
  58. {
  59. sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
  60. self.state = STATE_BOTTOM;
  61. };
  62. void() door_go_down =
  63. {
  64. sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
  65. if (self.max_health)
  66. {
  67. self.takedamage = DAMAGE_YES;
  68. self.health = self.max_health;
  69. }
  70. self.state = STATE_DOWN;
  71. SUB_CalcMove (self.pos1, self.speed, door_hit_bottom);
  72. };
  73. void() door_go_up =
  74. {
  75. if (self.state == STATE_UP)
  76. return; // allready going up
  77. if (self.state == STATE_TOP)
  78. { // reset top wait time
  79. self.nextthink = self.ltime + self.wait;
  80. return;
  81. }
  82. sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
  83. self.state = STATE_UP;
  84. SUB_CalcMove (self.pos2, self.speed, door_hit_top);
  85. SUB_UseTargets();
  86. };
  87. /*
  88. =============================================================================
  89. ACTIVATION FUNCTIONS
  90. =============================================================================
  91. */
  92. void() door_fire =
  93. {
  94. local entity oself;
  95. local entity starte;
  96. if (self.owner != self)
  97. objerror ("door_fire: self.owner != self");
  98. // play use key sound
  99. if (self.items)
  100. sound (self, CHAN_VOICE, self.noise4, 1, ATTN_NORM);
  101. self.message = string_null; // no more message
  102. oself = self;
  103. if (self.spawnflags & DOOR_TOGGLE)
  104. {
  105. if (self.state == STATE_UP || self.state == STATE_TOP)
  106. {
  107. starte = self;
  108. do
  109. {
  110. door_go_down ();
  111. self = self.enemy;
  112. } while ( (self != starte) && (self != world) );
  113. self = oself;
  114. return;
  115. }
  116. }
  117. // trigger all paired doors
  118. starte = self;
  119. do
  120. {
  121. door_go_up ();
  122. self = self.enemy;
  123. } while ( (self != starte) && (self != world) );
  124. self = oself;
  125. };
  126. void() door_use =
  127. {
  128. local entity oself;
  129. self.message = ""; // door message are for touch only
  130. self.owner.message = "";
  131. self.enemy.message = "";
  132. oself = self;
  133. self = self.owner;
  134. door_fire ();
  135. self = oself;
  136. };
  137. void() door_trigger_touch =
  138. {
  139. if (other.health <= 0)
  140. return;
  141. if (time < self.attack_finished)
  142. return;
  143. self.attack_finished = time + 1;
  144. activator = other;
  145. self = self.owner;
  146. door_use ();
  147. };
  148. void() door_killed =
  149. {
  150. local entity oself;
  151. oself = self;
  152. self = self.owner;
  153. self.health = self.max_health;
  154. self.takedamage = DAMAGE_NO; // wil be reset upon return
  155. door_use ();
  156. self = oself;
  157. };
  158. /*
  159. ================
  160. door_touch
  161. Prints messages and opens key doors
  162. ================
  163. */
  164. void() door_touch =
  165. {
  166. if (other.classname != "player")
  167. return;
  168. if (self.owner.attack_finished > time)
  169. return;
  170. self.owner.attack_finished = time + 2;
  171. if (self.owner.message != "")
  172. {
  173. centerprint (other, self.owner.message);
  174. sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
  175. }
  176. // key door stuff
  177. if (!self.items)
  178. return;
  179. // FIXME: blink key on player's status bar
  180. if ( (self.items & other.items) != self.items )
  181. {
  182. if (self.owner.items == IT_KEY1)
  183. {
  184. if (world.worldtype == 2)
  185. {
  186. centerprint (other, "You need the silver keycard");
  187. sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  188. }
  189. else if (world.worldtype == 1)
  190. {
  191. centerprint (other, "You need the silver runekey");
  192. sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  193. }
  194. else if (world.worldtype == 0)
  195. {
  196. centerprint (other, "You need the silver key");
  197. sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  198. }
  199. }
  200. else
  201. {
  202. if (world.worldtype == 2)
  203. {
  204. centerprint (other, "You need the gold keycard");
  205. sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  206. }
  207. else if (world.worldtype == 1)
  208. {
  209. centerprint (other, "You need the gold runekey");
  210. sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  211. }
  212. else if (world.worldtype == 0)
  213. {
  214. centerprint (other, "You need the gold key");
  215. sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  216. }
  217. }
  218. return;
  219. }
  220. other.items = other.items - self.items;
  221. self.touch = SUB_Null;
  222. if (self.enemy)
  223. self.enemy.touch = SUB_Null; // get paired door
  224. door_use ();
  225. };
  226. /*
  227. =============================================================================
  228. SPAWNING FUNCTIONS
  229. =============================================================================
  230. */
  231. entity(vector fmins, vector fmaxs) spawn_field =
  232. {
  233. local entity trigger;
  234. local vector t1, t2;
  235. trigger = spawn();
  236. trigger.movetype = MOVETYPE_NONE;
  237. trigger.solid = SOLID_TRIGGER;
  238. trigger.owner = self;
  239. trigger.touch = door_trigger_touch;
  240. t1 = fmins;
  241. t2 = fmaxs;
  242. setsize (trigger, t1 - '60 60 8', t2 + '60 60 8');
  243. return (trigger);
  244. };
  245. float (entity e1, entity e2) EntitiesTouching =
  246. {
  247. if (e1.mins_x > e2.maxs_x)
  248. return FALSE;
  249. if (e1.mins_y > e2.maxs_y)
  250. return FALSE;
  251. if (e1.mins_z > e2.maxs_z)
  252. return FALSE;
  253. if (e1.maxs_x < e2.mins_x)
  254. return FALSE;
  255. if (e1.maxs_y < e2.mins_y)
  256. return FALSE;
  257. if (e1.maxs_z < e2.mins_z)
  258. return FALSE;
  259. return TRUE;
  260. };
  261. /*
  262. =============
  263. LinkDoors
  264. =============
  265. */
  266. void() LinkDoors =
  267. {
  268. local entity t, starte;
  269. local vector cmins, cmaxs;
  270. if (self.enemy)
  271. return; // already linked by another door
  272. if (self.spawnflags & 4)
  273. {
  274. self.owner = self.enemy = self;
  275. return; // don't want to link this door
  276. }
  277. cmins = self.mins;
  278. cmaxs = self.maxs;
  279. starte = self;
  280. t = self;
  281. do
  282. {
  283. self.owner = starte; // master door
  284. if (self.health)
  285. starte.health = self.health;
  286. if (self.targetname)
  287. starte.targetname = self.targetname;
  288. if (self.message != "")
  289. starte.message = self.message;
  290. t = find (t, classname, self.classname);
  291. if (!t)
  292. {
  293. self.enemy = starte; // make the chain a loop
  294. // shootable, fired, or key doors just needed the owner/enemy links,
  295. // they don't spawn a field
  296. self = self.owner;
  297. if (self.health)
  298. return;
  299. if (self.targetname)
  300. return;
  301. if (self.items)
  302. return;
  303. self.owner.trigger_field = spawn_field(cmins, cmaxs);
  304. return;
  305. }
  306. if (EntitiesTouching(self,t))
  307. {
  308. if (t.enemy)
  309. objerror ("cross connected doors");
  310. self.enemy = t;
  311. self = t;
  312. if (t.mins_x < cmins_x)
  313. cmins_x = t.mins_x;
  314. if (t.mins_y < cmins_y)
  315. cmins_y = t.mins_y;
  316. if (t.mins_z < cmins_z)
  317. cmins_z = t.mins_z;
  318. if (t.maxs_x > cmaxs_x)
  319. cmaxs_x = t.maxs_x;
  320. if (t.maxs_y > cmaxs_y)
  321. cmaxs_y = t.maxs_y;
  322. if (t.maxs_z > cmaxs_z)
  323. cmaxs_z = t.maxs_z;
  324. }
  325. } while (1 );
  326. };
  327. /*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
  328. if two doors touch, they are assumed to be connected and operate as a unit.
  329. TOGGLE causes the door to wait in both the start and end states for a trigger event.
  330. START_OPEN causes the door to move to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors).
  331. Key doors are allways wait -1.
  332. "message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet
  333. "angle" determines the opening direction
  334. "targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door.
  335. "health" if set, door must be shot open
  336. "speed" movement speed (100 default)
  337. "wait" wait before returning (3 default, -1 = never return)
  338. "lip" lip remaining at end of move (8 default)
  339. "dmg" damage to inflict when blocked (2 default)
  340. "sounds"
  341. 0) no sound
  342. 1) stone
  343. 2) base
  344. 3) stone chain
  345. 4) screechy metal
  346. */
  347. void() func_door =
  348. {
  349. if (world.worldtype == 0)
  350. {
  351. precache_sound ("doors/medtry.wav");
  352. precache_sound ("doors/meduse.wav");
  353. self.noise3 = "doors/medtry.wav";
  354. self.noise4 = "doors/meduse.wav";
  355. }
  356. else if (world.worldtype == 1)
  357. {
  358. precache_sound ("doors/runetry.wav");
  359. precache_sound ("doors/runeuse.wav");
  360. self.noise3 = "doors/runetry.wav";
  361. self.noise4 = "doors/runeuse.wav";
  362. }
  363. else if (world.worldtype == 2)
  364. {
  365. precache_sound ("doors/basetry.wav");
  366. precache_sound ("doors/baseuse.wav");
  367. self.noise3 = "doors/basetry.wav";
  368. self.noise4 = "doors/baseuse.wav";
  369. }
  370. else
  371. {
  372. dprint ("no worldtype set!\n");
  373. }
  374. if (self.sounds == 0)
  375. {
  376. precache_sound ("misc/null.wav");
  377. precache_sound ("misc/null.wav");
  378. self.noise1 = "misc/null.wav";
  379. self.noise2 = "misc/null.wav";
  380. }
  381. if (self.sounds == 1)
  382. {
  383. precache_sound ("doors/drclos4.wav");
  384. precache_sound ("doors/doormv1.wav");
  385. self.noise1 = "doors/drclos4.wav";
  386. self.noise2 = "doors/doormv1.wav";
  387. }
  388. if (self.sounds == 2)
  389. {
  390. precache_sound ("doors/hydro1.wav");
  391. precache_sound ("doors/hydro2.wav");
  392. self.noise2 = "doors/hydro1.wav";
  393. self.noise1 = "doors/hydro2.wav";
  394. }
  395. if (self.sounds == 3)
  396. {
  397. precache_sound ("doors/stndr1.wav");
  398. precache_sound ("doors/stndr2.wav");
  399. self.noise2 = "doors/stndr1.wav";
  400. self.noise1 = "doors/stndr2.wav";
  401. }
  402. if (self.sounds == 4)
  403. {
  404. precache_sound ("doors/ddoor1.wav");
  405. precache_sound ("doors/ddoor2.wav");
  406. self.noise1 = "doors/ddoor2.wav";
  407. self.noise2 = "doors/ddoor1.wav";
  408. }
  409. SetMovedir ();
  410. self.max_health = self.health;
  411. self.solid = SOLID_BSP;
  412. self.movetype = MOVETYPE_PUSH;
  413. setorigin (self, self.origin);
  414. setmodel (self, self.model);
  415. self.classname = "door";
  416. self.blocked = door_blocked;
  417. self.use = door_use;
  418. if (self.spawnflags & DOOR_SILVER_KEY)
  419. self.items = IT_KEY1;
  420. if (self.spawnflags & DOOR_GOLD_KEY)
  421. self.items = IT_KEY2;
  422. if (!self.speed)
  423. self.speed = 100;
  424. if (!self.wait)
  425. self.wait = 3;
  426. if (!self.lip)
  427. self.lip = 8;
  428. if (!self.dmg)
  429. self.dmg = 2;
  430. self.pos1 = self.origin;
  431. self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
  432. // DOOR_START_OPEN is to allow an entity to be lighted in the closed position
  433. // but spawn in the open position
  434. if (self.spawnflags & DOOR_START_OPEN)
  435. {
  436. setorigin (self, self.pos2);
  437. self.pos2 = self.pos1;
  438. self.pos1 = self.origin;
  439. }
  440. self.state = STATE_BOTTOM;
  441. if (self.health)
  442. {
  443. self.takedamage = DAMAGE_YES;
  444. self.th_die = door_killed;
  445. }
  446. if (self.items)
  447. self.wait = -1;
  448. self.touch = door_touch;
  449. // LinkDoors can't be done until all of the doors have been spawned, so
  450. // the sizes can be detected properly.
  451. self.think = LinkDoors;
  452. self.nextthink = self.ltime + 0.1;
  453. };
  454. /*
  455. =============================================================================
  456. SECRET DOORS
  457. =============================================================================
  458. */
  459. void() fd_secret_move1;
  460. void() fd_secret_move2;
  461. void() fd_secret_move3;
  462. void() fd_secret_move4;
  463. void() fd_secret_move5;
  464. void() fd_secret_move6;
  465. void() fd_secret_done;
  466. float SECRET_OPEN_ONCE = 1; // stays open
  467. float SECRET_1ST_LEFT = 2; // 1st move is left of arrow
  468. float SECRET_1ST_DOWN = 4; // 1st move is down from arrow
  469. float SECRET_NO_SHOOT = 8; // only opened by trigger
  470. float SECRET_YES_SHOOT = 16; // shootable even if targeted
  471. void () fd_secret_use =
  472. {
  473. local float temp;
  474. self.health = 10000;
  475. // exit if still moving around...
  476. if (self.origin != self.oldorigin)
  477. return;
  478. self.message = string_null; // no more message
  479. SUB_UseTargets(); // fire all targets / killtargets
  480. if (!(self.spawnflags & SECRET_NO_SHOOT))
  481. {
  482. self.th_pain = SUB_Null;
  483. self.takedamage = DAMAGE_NO;
  484. }
  485. self.velocity = '0 0 0';
  486. // Make a sound, wait a little...
  487. sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
  488. self.nextthink = self.ltime + 0.1;
  489. temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
  490. makevectors(self.mangle);
  491. if (!self.t_width)
  492. {
  493. if (self.spawnflags & SECRET_1ST_DOWN)
  494. self. t_width = fabs(v_up * self.size);
  495. else
  496. self. t_width = fabs(v_right * self.size);
  497. }
  498. if (!self.t_length)
  499. self. t_length = fabs(v_forward * self.size);
  500. if (self.spawnflags & SECRET_1ST_DOWN)
  501. self.dest1 = self.origin - v_up * self.t_width;
  502. else
  503. self.dest1 = self.origin + v_right * (self.t_width * temp);
  504. self.dest2 = self.dest1 + v_forward * self.t_length;
  505. SUB_CalcMove(self.dest1, self.speed, fd_secret_move1);
  506. sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
  507. };
  508. // Wait after first movement...
  509. void () fd_secret_move1 =
  510. {
  511. self.nextthink = self.ltime + 1.0;
  512. self.think = fd_secret_move2;
  513. sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  514. };
  515. // Start moving sideways w/sound...
  516. void () fd_secret_move2 =
  517. {
  518. sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
  519. SUB_CalcMove(self.dest2, self.speed, fd_secret_move3);
  520. };
  521. // Wait here until time to go back...
  522. void () fd_secret_move3 =
  523. {
  524. sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  525. if (!(self.spawnflags & SECRET_OPEN_ONCE))
  526. {
  527. self.nextthink = self.ltime + self.wait;
  528. self.think = fd_secret_move4;
  529. }
  530. };
  531. // Move backward...
  532. void () fd_secret_move4 =
  533. {
  534. sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
  535. SUB_CalcMove(self.dest1, self.speed, fd_secret_move5);
  536. };
  537. // Wait 1 second...
  538. void () fd_secret_move5 =
  539. {
  540. self.nextthink = self.ltime + 1.0;
  541. self.think = fd_secret_move6;
  542. sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  543. };
  544. void () fd_secret_move6 =
  545. {
  546. sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
  547. SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done);
  548. };
  549. void () fd_secret_done =
  550. {
  551. if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT)
  552. {
  553. self.health = 10000;
  554. self.takedamage = DAMAGE_YES;
  555. self.th_pain = fd_secret_use;
  556. }
  557. sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
  558. };
  559. void () secret_blocked =
  560. {
  561. if (time < self.attack_finished)
  562. return;
  563. self.attack_finished = time + 0.5;
  564. T_Damage (other, self, self, self.dmg);
  565. };
  566. /*
  567. ================
  568. secret_touch
  569. Prints messages
  570. ================
  571. */
  572. void() secret_touch =
  573. {
  574. if (other.classname != "player")
  575. return;
  576. if (self.attack_finished > time)
  577. return;
  578. self.attack_finished = time + 2;
  579. if (self.message)
  580. {
  581. centerprint (other, self.message);
  582. sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
  583. }
  584. };
  585. /*QUAKED func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
  586. Basic secret door. Slides back, then to the side. Angle determines direction.
  587. wait = # of seconds before coming back
  588. 1st_left = 1st move is left of arrow
  589. 1st_down = 1st move is down from arrow
  590. always_shoot = even if targeted, keep shootable
  591. t_width = override WIDTH to move back (or height if going down)
  592. t_length = override LENGTH to move sideways
  593. "dmg" damage to inflict when blocked (2 default)
  594. If a secret door has a targetname, it will only be opened by it's botton or trigger, not by damage.
  595. "sounds"
  596. 1) medieval
  597. 2) metal
  598. 3) base
  599. */
  600. void () func_door_secret =
  601. {
  602. if (self.sounds == 0)
  603. self.sounds = 3;
  604. if (self.sounds == 1)
  605. {
  606. precache_sound ("doors/latch2.wav");
  607. precache_sound ("doors/winch2.wav");
  608. precache_sound ("doors/drclos4.wav");
  609. self.noise1 = "doors/latch2.wav";
  610. self.noise2 = "doors/winch2.wav";
  611. self.noise3 = "doors/drclos4.wav";
  612. }
  613. if (self.sounds == 2)
  614. {
  615. precache_sound ("doors/airdoor1.wav");
  616. precache_sound ("doors/airdoor2.wav");
  617. self.noise2 = "doors/airdoor1.wav";
  618. self.noise1 = "doors/airdoor2.wav";
  619. self.noise3 = "doors/airdoor2.wav";
  620. }
  621. if (self.sounds == 3)
  622. {
  623. precache_sound ("doors/basesec1.wav");
  624. precache_sound ("doors/basesec2.wav");
  625. self.noise2 = "doors/basesec1.wav";
  626. self.noise1 = "doors/basesec2.wav";
  627. self.noise3 = "doors/basesec2.wav";
  628. }
  629. if (!self.dmg)
  630. self.dmg = 2;
  631. // Magic formula...
  632. self.mangle = self.angles;
  633. self.angles = '0 0 0';
  634. self.solid = SOLID_BSP;
  635. self.movetype = MOVETYPE_PUSH;
  636. self.classname = "door";
  637. setmodel (self, self.model);
  638. setorigin (self, self.origin);
  639. self.touch = secret_touch;
  640. self.blocked = secret_blocked;
  641. self.speed = 50;
  642. self.use = fd_secret_use;
  643. if ( !self.targetname || self.spawnflags&SECRET_YES_SHOOT)
  644. {
  645. self.health = 10000;
  646. self.takedamage = DAMAGE_YES;
  647. self.th_pain = fd_secret_use;
  648. }
  649. self.oldorigin = self.origin;
  650. if (!self.wait)
  651. self.wait = 5; // 5 seconds before closing
  652. };