2 void() fd_secret_move1;
3 void() fd_secret_move2;
4 void() fd_secret_move3;
5 void() fd_secret_move4;
6 void() fd_secret_move5;
7 void() fd_secret_move6;
10 const float SECRET_OPEN_ONCE = 1; // stays open
11 const float SECRET_1ST_LEFT = 2; // 1st move is left of arrow
12 const float SECRET_1ST_DOWN = 4; // 1st move is down from arrow
13 const float SECRET_NO_SHOOT = 8; // only opened by trigger
14 const float SECRET_YES_SHOOT = 16; // shootable even if targeted
22 self.bot_attack = true;
24 // exit if still moving around...
25 if (self.origin != self.oldorigin)
28 message_save = self.message;
29 self.message = ""; // no more message
30 SUB_UseTargets(); // fire all targets / killtargets
31 self.message = message_save;
33 self.velocity = '0 0 0';
35 // Make a sound, wait a little...
37 if (self.noise1 != "")
38 sound(self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
39 self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1;
41 temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
42 makevectors(self.mangle);
46 if (self.spawnflags & SECRET_1ST_DOWN)
47 self.t_width = fabs(v_up * self.size);
49 self.t_width = fabs(v_right * self.size);
53 self.t_length = fabs(v_forward * self.size);
55 if (self.spawnflags & SECRET_1ST_DOWN)
56 self.dest1 = self.origin - v_up * self.t_width;
58 self.dest1 = self.origin + v_right * (self.t_width * temp);
60 self.dest2 = self.dest1 + v_forward * self.t_length;
61 SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move1);
62 if (self.noise2 != "")
63 sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
66 void fd_secret_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
71 // Wait after first movement...
72 void fd_secret_move1()
74 self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
75 self.think = fd_secret_move2;
76 if (self.noise3 != "")
77 sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
80 // Start moving sideways w/sound...
81 void fd_secret_move2()
83 if (self.noise2 != "")
84 sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
85 SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3);
88 // Wait here until time to go back...
89 void fd_secret_move3()
91 if (self.noise3 != "")
92 sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
93 if (!(self.spawnflags & SECRET_OPEN_ONCE))
95 self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
96 self.think = fd_secret_move4;
101 void fd_secret_move4()
103 if (self.noise2 != "")
104 sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
105 SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5);
109 void fd_secret_move5()
111 self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
112 self.think = fd_secret_move6;
113 if (self.noise3 != "")
114 sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
117 void fd_secret_move6()
119 if (self.noise2 != "")
120 sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
121 SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done);
124 void fd_secret_done()
126 if (self.spawnflags&SECRET_YES_SHOOT)
129 self.takedamage = DAMAGE_YES;
130 //self.th_pain = fd_secret_use;
132 if (self.noise3 != "")
133 sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
136 void secret_blocked()
138 if (time < self.attack_finished_single)
140 self.attack_finished_single = time + 0.5;
141 //T_Damage (other, self, self, self.dmg, self.dmg, self.deathtype, DT_IMPACT, (self.absmin + self.absmax) * 0.5, '0 0 0', Obituary_Generic);
153 if (!other.iscreature)
155 if (self.attack_finished_single > time)
158 self.attack_finished_single = time + 2;
162 if (IS_CLIENT(other))
163 centerprint(other, self.message);
164 play2(other, "misc/talk.wav");
170 if (self.spawnflags&SECRET_YES_SHOOT)
173 self.takedamage = DAMAGE_YES;
175 setorigin(self, self.oldorigin);
176 self.think = func_null;
177 self.SUB_NEXTTHINK = 0;
180 /*QUAKED spawnfunc_func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
181 Basic secret door. Slides back, then to the side. Angle determines direction.
182 wait = # of seconds before coming back
183 1st_left = 1st move is left of arrow
184 1st_down = 1st move is down from arrow
185 always_shoot = even if targeted, keep shootable
186 t_width = override WIDTH to move back (or height if going down)
187 t_length = override LENGTH to move sideways
188 "dmg" damage to inflict when blocked (2 default)
190 If a secret door has a targetname, it will only be opened by it's botton or trigger, not by damage.
197 void spawnfunc_func_door_secret()
199 /*if (!self.deathtype) // map makers can override this
200 self.deathtype = " got in the way";*/
206 self.mangle = self.angles;
207 self.angles = '0 0 0';
208 self.classname = "door";
209 if (!InitMovingBrushTrigger())
211 self.effects |= EF_LOWPRECISION;
213 self.touch = secret_touch;
214 self.blocked = secret_blocked;
216 self.use = fd_secret_use;
221 self.spawnflags |= SECRET_YES_SHOOT;
223 if(self.spawnflags&SECRET_YES_SHOOT)
226 self.takedamage = DAMAGE_YES;
227 self.event_damage = fd_secret_damage;
229 self.oldorigin = self.origin;
231 self.wait = 5; // 5 seconds before closing
233 self.reset = secret_reset;