doors.qc 18 KB

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