Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
door_secret.qc File Reference
#include "door_secret.qh"
Include dependency graph for door_secret.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void fd_secret_damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void fd_secret_done (entity this)
void fd_secret_move1 (entity this)
void fd_secret_move2 (entity this)
void fd_secret_move3 (entity this)
void fd_secret_move4 (entity this)
void fd_secret_move5 (entity this)
void fd_secret_move6 (entity this)
void fd_secret_use (entity this, entity actor, entity trigger)
void secret_blocked (entity this, entity blocker)
void secret_reset (entity this)
void secret_touch (entity this, entity toucher)
 spawnfunc (func_door_secret)

Variables

float door_finished

Function Documentation

◆ fd_secret_damage()

void fd_secret_damage ( entity this,
entity inflictor,
entity attacker,
float damage,
int deathtype,
.entity weaponentity,
vector hitloc,
vector force )

Definition at line 63 of file door_secret.qc.

64{
65 fd_secret_use(this, NULL, NULL);
66}
void fd_secret_use(entity this, entity actor, entity trigger)
#define NULL
Definition post.qh:14

References entity(), fd_secret_use(), NULL, and vector.

Referenced by spawnfunc().

◆ fd_secret_done()

void fd_secret_done ( entity this)

Definition at line 121 of file door_secret.qc.

122{
124 {
125 SetResourceExplicit(this, RES_HEALTH, 10000);
126 this.takedamage = DAMAGE_YES;
127 //this.th_pain = fd_secret_use;
128 }
129 if (this.noise3 != "")
131}
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
int spawnflags
Definition ammo.qh:15
const int DOOR_SECRET_YES_SHOOT
Definition door_secret.qh:8
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const float VOL_BASE
Definition sound.qh:36
#define _sound(e, c, s, v, a)
Definition sound.qh:43
const float ATTEN_NORM
Definition sound.qh:30
const int DAMAGE_YES
Definition subs.qh:80
string noise3
Definition subs.qh:83
float takedamage
Definition subs.qh:78

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, DAMAGE_YES, DOOR_SECRET_YES_SHOOT, entity(), noise3, SetResourceExplicit(), spawnflags, takedamage, and VOL_BASE.

Referenced by fd_secret_move6().

◆ fd_secret_move1()

void fd_secret_move1 ( entity this)

Definition at line 69 of file door_secret.qc.

70{
71 this.nextthink = this.ltime + 1.0;
73 if (this.noise3 != "")
75}
float nextthink
void fd_secret_move2(entity this)
float ltime
Definition net.qc:10
#define setthink(e, f)

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, entity(), fd_secret_move2(), ltime, nextthink, noise3, setthink, and VOL_BASE.

Referenced by fd_secret_use().

◆ fd_secret_move2()

void fd_secret_move2 ( entity this)

Definition at line 78 of file door_secret.qc.

79{
80 if (this.noise2 != "")
83}
void fd_secret_move3(entity this)
float speed
Definition dynlight.qc:9
void SUB_CalcMove(entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
Definition subs.qc:267
vector dest2
Definition subs.qh:66
string noise2
Definition subs.qh:83
const int TSPEED_LINEAR
Definition subs.qh:71

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, dest2, entity(), fd_secret_move3(), noise2, speed, SUB_CalcMove(), TSPEED_LINEAR, and VOL_BASE.

Referenced by fd_secret_move1().

◆ fd_secret_move3()

void fd_secret_move3 ( entity this)

Definition at line 86 of file door_secret.qc.

87{
88 if (this.noise3 != "")
90 if (!(this.spawnflags & DOOR_SECRET_OPEN_ONCE) && this.wait >= 0)
91 {
92 this.nextthink = this.ltime + this.wait;
94 }
95}
float wait
Definition items.qc:17
void fd_secret_move4(entity this)
const int DOOR_SECRET_OPEN_ONCE
Definition door_secret.qh:4

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, DOOR_SECRET_OPEN_ONCE, entity(), fd_secret_move4(), ltime, nextthink, noise3, setthink, spawnflags, VOL_BASE, and wait.

Referenced by fd_secret_move2().

◆ fd_secret_move4()

void fd_secret_move4 ( entity this)

Definition at line 98 of file door_secret.qc.

99{
100 if (this.noise2 != "")
103}
void fd_secret_move5(entity this)
vector dest1
Definition subs.qh:66

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, dest1, entity(), fd_secret_move5(), noise2, speed, SUB_CalcMove(), TSPEED_LINEAR, and VOL_BASE.

Referenced by fd_secret_move3().

◆ fd_secret_move5()

void fd_secret_move5 ( entity this)

Definition at line 106 of file door_secret.qc.

107{
108 this.nextthink = this.ltime + 1.0;
110 if (this.noise3 != "")
112}
void fd_secret_move6(entity this)

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, entity(), fd_secret_move6(), ltime, nextthink, noise3, setthink, and VOL_BASE.

Referenced by fd_secret_move4().

◆ fd_secret_move6()

void fd_secret_move6 ( entity this)

Definition at line 114 of file door_secret.qc.

115{
116 if (this.noise2 != "")
119}
vector oldorigin
void fd_secret_done(entity this)

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, entity(), fd_secret_done(), noise2, oldorigin, speed, SUB_CalcMove(), TSPEED_LINEAR, and VOL_BASE.

Referenced by fd_secret_move5().

◆ fd_secret_use()

void fd_secret_use ( entity this,
entity actor,
entity trigger )

Definition at line 11 of file door_secret.qc.

12{
13 if(this.active != ACTIVE_ACTIVE)
14 return;
15
16 SetResourceExplicit(this, RES_HEALTH, 10000);
17 if(!this.bot_attack)
19 this.bot_attack = true;
20
21 // exit if still moving around...
22 if (this.origin != this.oldorigin)
23 return;
24
25 string message_save = this.message;
26 this.message = ""; // no more message
27 SUB_UseTargets(this, actor, trigger); // fire all targets / killtargets
28 this.message = message_save;
29
30 this.velocity = '0 0 0';
31
32 // Make a sound, wait a little...
33
34 if (this.noise1 != "")
36 this.nextthink = this.ltime + 0.1;
37
38 int temp = 1 - (this.spawnflags & DOOR_SECRET_1ST_LEFT); // 1 or -1
39 makevectors(this.mangle);
40
41 if (!this.t_width)
42 {
44 this.t_width = fabs(v_up * this.size);
45 else
46 this.t_width = fabs(v_right * this.size);
47 }
48
49 if (!this.t_length)
50 this.t_length = fabs(v_forward * this.size);
51
53 this.dest1 = this.origin - v_up * this.t_width;
54 else
55 this.dest1 = this.origin + v_right * (this.t_width * temp);
56
57 this.dest2 = this.dest1 + v_forward * this.t_length;
59 if (this.noise2 != "")
61}
float bot_attack
Definition api.qh:38
IntrusiveList g_bot_targets
Definition api.qh:149
string message
Definition powerups.qc:19
vector v_up
vector velocity
vector v_right
vector size
vector v_forward
vector origin
int active
Definition defs.qh:34
const int ACTIVE_ACTIVE
Definition defs.qh:37
void fd_secret_move1(entity this)
const int DOOR_SECRET_1ST_DOWN
Definition door_secret.qh:6
const int DOOR_SECRET_1ST_LEFT
Definition door_secret.qh:5
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition triggers.qc:344
float fabs(float f)
#define makevectors
Definition post.qh:21
string noise1
Definition subs.qh:83
vector mangle
Definition subs.qh:51
float t_width
Definition subs.qh:33
float t_length
Definition subs.qh:33

References _sound, active, ACTIVE_ACTIVE, ATTEN_NORM, bot_attack, CH_TRIGGER_SINGLE, dest1, dest2, DOOR_SECRET_1ST_DOWN, DOOR_SECRET_1ST_LEFT, entity(), fabs(), fd_secret_move1(), g_bot_targets, IL_PUSH(), ltime, makevectors, mangle, message, nextthink, noise1, noise2, oldorigin, origin, SetResourceExplicit(), size, spawnflags, speed, SUB_CalcMove(), SUB_UseTargets(), t_length, t_width, TSPEED_LINEAR, v_forward, v_right, v_up, velocity, and VOL_BASE.

Referenced by fd_secret_damage(), and spawnfunc().

◆ secret_blocked()

void secret_blocked ( entity this,
entity blocker )

Definition at line 135 of file door_secret.qc.

136{
137 if (time < this.door_finished)
138 return;
139 this.door_finished = time + 0.5;
140 //T_Damage (other, this, this, this.dmg, this.dmg, this.deathtype, DT_IMPACT, (this.absmin + this.absmax) * 0.5, '0 0 0', Obituary_Generic);
141}
float time
float door_finished
Definition door.qc:286

References door_finished, entity(), and time.

Referenced by spawnfunc().

◆ secret_reset()

void secret_reset ( entity this)

Definition at line 169 of file door_secret.qc.

170{
172 {
173 SetResourceExplicit(this, RES_HEALTH, 10000);
174 this.takedamage = DAMAGE_YES;
175 }
176 setorigin(this, this.oldorigin);
177 setthink(this, func_null);
178 this.nextthink = 0;
179 this.active = ACTIVE_ACTIVE;
180}
var void func_null()

References active, ACTIVE_ACTIVE, DAMAGE_YES, DOOR_SECRET_YES_SHOOT, entity(), func_null(), nextthink, oldorigin, SetResourceExplicit(), setthink, spawnflags, and takedamage.

Referenced by spawnfunc().

◆ secret_touch()

void secret_touch ( entity this,
entity toucher )

Definition at line 150 of file door_secret.qc.

151{
152 if (!toucher.iscreature)
153 return;
154 if (this.door_finished > time)
155 return;
156 if (this.active != ACTIVE_ACTIVE)
157 return;
158
159 this.door_finished = time + 2;
160
161 if (this.message)
162 {
163 if (IS_CLIENT(toucher))
165 play2(toucher, this.noise);
166 }
167}
#define IS_CLIENT(s)
Definition player.qh:242
void centerprint(string text,...)
entity entity toucher
Definition self.qh:72
void play2(entity e, string filename)
Definition all.qc:116
string noise
Definition subs.qh:83

References active, ACTIVE_ACTIVE, centerprint(), door_finished, entity(), IS_CLIENT, message, noise, play2(), time, and toucher.

Referenced by spawnfunc().

◆ spawnfunc()

spawnfunc ( func_door_secret )

Definition at line 199 of file door_secret.qc.

200{
201 /*if (!this.deathtype) // map makers can override this
202 this.deathtype = " got in the way";*/
203
204 if (!this.dmg)
205 {
206 this.dmg = 2;
207 }
208
209 // Magic formula...
210 this.mangle = this.angles;
211 this.angles = '0 0 0';
212 this.classname = "door";
213 if (!InitMovingBrushTrigger(this)) return;
214 this.effects |= EF_LOWPRECISION;
215
216 // TODO: other soundpacks
217 if (this.sounds > 0)
218 {
219 this.noise1 = "plats/medplat1.wav";
220 this.noise2 = "plats/medplat1.wav";
221 this.noise3 = "plats/medplat2.wav";
222 }
223
224 // sound on touch
225 if (this.noise == "")
226 {
227 this.noise = "misc/talk.wav";
228 }
229 precache_sound(this.noise);
230 // sound while moving backwards
231 if (this.noise1 && this.noise1 != "")
232 {
234 }
235 // sound while moving sideways
236 if (this.noise2 && this.noise2 != "")
237 {
239 }
240 // sound when door stops moving
241 if (this.noise3 && this.noise3 != "")
242 {
244 }
245
246 settouch(this, secret_touch);
248 this.speed = 50;
249 this.use = fd_secret_use;
250 this.active = ACTIVE_ACTIVE;
251 if(!this.targetname || this.targetname == "")
253
255 {
256 //this.canteamdamage = true; // TODO
257 SetResourceExplicit(this, RES_HEALTH, 10000);
258 this.takedamage = DAMAGE_YES;
259 this.event_damage = fd_secret_damage;
260 }
261 this.oldorigin = this.origin;
262 if (!this.wait) this.wait = 5; // seconds before closing
263
264 this.reset = secret_reset;
265 this.reset(this);
266}
float dmg
Definition breakable.qc:12
string classname
float effects
#define use
void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void secret_reset(entity this)
void secret_touch(entity this, entity toucher)
void secret_blocked(entity this, entity blocker)
float EF_LOWPRECISION
ent angles
Definition ent_cs.qc:121
string precache_sound(string sample)
#define settouch(e, f)
Definition self.qh:73
#define setblocked(e, f)
bool InitMovingBrushTrigger(entity this)
Definition subs.qc:577
float sounds
Definition subs.qh:42
string targetname
Definition triggers.qh:56

References active, ACTIVE_ACTIVE, angles, classname, DAMAGE_YES, dmg, DOOR_SECRET_YES_SHOOT, EF_LOWPRECISION, effects, fd_secret_damage(), fd_secret_use(), InitMovingBrushTrigger(), mangle, noise, noise1, noise2, noise3, oldorigin, origin, precache_sound(), secret_blocked(), secret_reset(), secret_touch(), setblocked, SetResourceExplicit(), settouch, sounds, spawnflags, speed, takedamage, targetname, use, and wait.

Variable Documentation

◆ door_finished

float door_finished

Definition at line 133 of file door_secret.qc.