X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Fbutton.qc;h=916ff8ca1f1434c4f5053f995484df4bcb43cec2;hb=c8cba34547bb620888522dc96d387f2a2068816b;hp=ecc1fdf8e631bab2b5d25a074cba602b2cc1f92b;hpb=301702fff6cd39f10c89eef9880cd9a85fe5c53e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index ecc1fdf8e..916ff8ca1 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -1,52 +1,53 @@ +#include "button.qh" #ifdef SVQC // button and multiple button -void() button_wait; -void() button_return; +void button_wait(entity this); +void button_return(entity this); -void button_wait() -{SELFPARAM(); - self.state = STATE_TOP; - self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; - self.SUB_THINK = button_return; - SUB_UseTargets(self, self.enemy, NULL); - self.frame = 1; // use alternate textures +void button_wait(entity this) +{ + this.state = STATE_TOP; + this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait; + SUB_THINK(this, button_return); + SUB_UseTargets(this, this.enemy, NULL); + this.frame = 1; // use alternate textures } -void button_done() -{SELFPARAM(); - self.state = STATE_BOTTOM; +void button_done(entity this) +{ + this.state = STATE_BOTTOM; } -void button_return() -{SELFPARAM(); - self.state = STATE_DOWN; - SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done); - self.frame = 0; // use normal textures - if (self.health) - self.takedamage = DAMAGE_YES; // can be shot again +void button_return(entity this) +{ + this.state = STATE_DOWN; + SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, button_done); + this.frame = 0; // use normal textures + if (this.health) + this.takedamage = DAMAGE_YES; // can be shot again } -void button_blocked() +void button_blocked(entity this, entity blocker) { // do nothing, just don't come all the way back out } -void button_fire() -{SELFPARAM(); - self.health = self.max_health; - self.takedamage = DAMAGE_NO; // will be reset upon return +void button_fire(entity this) +{ + this.health = this.max_health; + this.takedamage = DAMAGE_NO; // will be reset upon return - if (self.state == STATE_UP || self.state == STATE_TOP) + if (this.state == STATE_UP || this.state == STATE_TOP) return; - if (self.noise != "") - _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM); + if (this.noise != "") + _sound (this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM); - self.state = STATE_UP; - SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, button_wait); + this.state = STATE_UP; + SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, button_wait); } void button_reset(entity this) @@ -65,21 +66,21 @@ void button_use(entity this, entity actor, entity trigger) return; this.enemy = actor; - WITHSELF(this, button_fire()); + button_fire(this); } -void button_touch() -{SELFPARAM(); - if (!other) +void button_touch(entity this, entity toucher) +{ + if (!toucher) return; - if (!other.iscreature) + if (!toucher.iscreature) return; - if(other.velocity * self.movedir < 0) + if(toucher.velocity * this.movedir < 0) return; - self.enemy = other; - if (other.owner) - self.enemy = other.owner; - button_fire (); + this.enemy = toucher; + if (toucher.owner) + this.enemy = toucher.owner; + button_fire (this); } void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -91,7 +92,7 @@ void button_damage(entity this, entity inflictor, entity attacker, float damage, if (this.health <= 0) { this.enemy = damage_attacker; - WITHSELF(this, button_fire()); + button_fire(this); } } @@ -119,7 +120,7 @@ spawnfunc(func_button) return; this.effects |= EF_LOWPRECISION; - this.blocked = button_blocked; + setblocked(this, button_blocked); this.use = button_use; // if (this.health == 0) // all buttons are now shootable @@ -131,7 +132,7 @@ spawnfunc(func_button) this.takedamage = DAMAGE_YES; } else - this.touch = button_touch; + settouch(this, button_touch); if (!this.speed) this.speed = 40;