X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Fdoor_secret.qc;h=e32ed7e50c308c66627c434bc8eebfaf66bc081a;hb=068324d293df795dbc41de75f38256b8c6c35607;hp=a0a44bbb92d417dcad7a46b4f63c9bf4475bbc9f;hpb=98e1375c9938f3d86d6f8e28f44cd6af74d2fc0e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index a0a44bbb9..e32ed7e50 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -14,7 +14,7 @@ const float SECRET_NO_SHOOT = 8; // only opened by trigger const float SECRET_YES_SHOOT = 16; // shootable even if targeted void fd_secret_use() -{ +{SELFPARAM(); float temp; string message_save; @@ -35,7 +35,7 @@ void fd_secret_use() // Make a sound, wait a little... if (self.noise1 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1; temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1 @@ -60,36 +60,36 @@ void fd_secret_use() self.dest2 = self.dest1 + v_forward * self.t_length; SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move1); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); } -void fd_secret_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) { - fd_secret_use(); + WITH(entity, self, this, fd_secret_use()); } // Wait after first movement... void fd_secret_move1() -{ +{SELFPARAM(); self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; self.think = fd_secret_move2; if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); } // Start moving sideways w/sound... void fd_secret_move2() -{ +{SELFPARAM(); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3); } // Wait here until time to go back... void fd_secret_move3() -{ +{SELFPARAM(); if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); if (!(self.spawnflags & SECRET_OPEN_ONCE)) { self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; @@ -99,30 +99,30 @@ void fd_secret_move3() // Move backward... void fd_secret_move4() -{ +{SELFPARAM(); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5); } // Wait 1 second... void fd_secret_move5() -{ +{SELFPARAM(); self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; self.think = fd_secret_move6; if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); } void fd_secret_move6() -{ +{SELFPARAM(); if (self.noise2 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done); } void fd_secret_done() -{ +{SELFPARAM(); if (self.spawnflags&SECRET_YES_SHOOT) { self.health = 10000; @@ -130,14 +130,16 @@ void fd_secret_done() //self.th_pain = fd_secret_use; } if (self.noise3 != "") - sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); + _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); } +.float door_finished; + void secret_blocked() -{ - if (time < self.attack_finished_single) +{SELFPARAM(); + if (time < self.door_finished) return; - self.attack_finished_single = time + 0.5; + self.door_finished = time + 0.5; //T_Damage (other, self, self, self.dmg, self.dmg, self.deathtype, DT_IMPACT, (self.absmin + self.absmax) * 0.5, '0 0 0', Obituary_Generic); } @@ -149,32 +151,32 @@ Prints messages ================ */ void secret_touch() -{ +{SELFPARAM(); if (!other.iscreature) return; - if (self.attack_finished_single > time) + if (self.door_finished > time) return; - self.attack_finished_single = time + 2; + self.door_finished = time + 2; if (self.message) { if (IS_CLIENT(other)) centerprint(other, self.message); - play2(other, "misc/talk.wav"); + play2(other, self.noise); } } -void secret_reset() +void secret_reset(entity this) { - if (self.spawnflags&SECRET_YES_SHOOT) + if (this.spawnflags & SECRET_YES_SHOOT) { - self.health = 10000; - self.takedamage = DAMAGE_YES; + this.health = 10000; + this.takedamage = DAMAGE_YES; } - setorigin(self, self.oldorigin); - self.think = func_null; - self.SUB_NEXTTHINK = 0; + setorigin(this, this.oldorigin); + this.think = func_null; + this.SUB_NEXTTHINK = 0; } /*QUAKED spawnfunc_func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot @@ -194,43 +196,43 @@ If a secret door has a targetname, it will only be opened by it's botton or trig 3) base */ -void spawnfunc_func_door_secret() +spawnfunc(func_door_secret) { - /*if (!self.deathtype) // map makers can override this - self.deathtype = " got in the way";*/ + /*if (!this.deathtype) // map makers can override this + this.deathtype = " got in the way";*/ - if (!self.dmg) - self.dmg = 2; + if (!this.dmg) this.dmg = 2; // Magic formula... - self.mangle = self.angles; - self.angles = '0 0 0'; - self.classname = "door"; - if (!InitMovingBrushTrigger()) - return; - self.effects |= EF_LOWPRECISION; - - self.touch = secret_touch; - self.blocked = secret_blocked; - self.speed = 50; - self.use = fd_secret_use; + this.mangle = this.angles; + this.angles = '0 0 0'; + this.classname = "door"; + if (!InitMovingBrushTrigger()) return; + this.effects |= EF_LOWPRECISION; + + if (this.noise == "") this.noise = "misc/talk.wav"; + precache_sound(this.noise); + + this.touch = secret_touch; + this.blocked = secret_blocked; + this.speed = 50; + this.use = fd_secret_use; IFTARGETED { } else - self.spawnflags |= SECRET_YES_SHOOT; + this.spawnflags |= SECRET_YES_SHOOT; - if(self.spawnflags&SECRET_YES_SHOOT) + if (this.spawnflags & SECRET_YES_SHOOT) { - self.health = 10000; - self.takedamage = DAMAGE_YES; - self.event_damage = fd_secret_damage; + this.health = 10000; + this.takedamage = DAMAGE_YES; + this.event_damage = fd_secret_damage; } - self.oldorigin = self.origin; - if (!self.wait) - self.wait = 5; // 5 seconds before closing + this.oldorigin = this.origin; + if (!this.wait) this.wait = 5; // seconds before closing - self.reset = secret_reset; - secret_reset(); + this.reset = secret_reset; + this.reset(this); } #endif