X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Fdoor.qc;h=0546b2eae009f83316d4b83448dc8aa09bcad15e;hb=f438b415278f56c0cf86e2018b45fb3e6972259c;hp=99ee91f827c0673f4496244eab15704853ab897d;hpb=f41d9f31538bef0259d2b2c74536bb977901f99d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 99ee91f82..0546b2eae 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -141,7 +141,7 @@ void door_go_up() string oldmessage; oldmessage = self.message; self.message = ""; - SUB_UseTargets(); + SUB_UseTargets(self, NULL, NULL); self.message = oldmessage; } @@ -206,16 +206,15 @@ bool door_check_keys(entity door, entity player) return false; } -void door_fire() -{SELFPARAM(); - entity starte; - - if (self.owner != self) - objerror ("door_fire: self.owner != self"); +void door_fire(entity this, entity actor, entity trigger) +{ + entity starte; + if (this.owner != this) + objerror ("door_fire: this.owner != this"); - if (self.spawnflags & DOOR_TOGGLE) + if (this.spawnflags & DOOR_TOGGLE) { - if (self.state == STATE_UP || self.state == STATE_TOP) + if (this.state == STATE_UP || this.state == STATE_TOP) { starte = self; do @@ -262,34 +261,32 @@ void door_fire() setself(this); } -void door_use() -{SELFPARAM(); +void door_use(entity this, entity actor, entity trigger) +{ //dprint("door_use (model: ");dprint(self.model);dprint(")\n"); - if (self.owner) - { - WITH(entity, self, self.owner, door_fire()); - } + if (this.owner) + WITHSELF(this.owner, door_fire(this.owner, actor, trigger)); } -void door_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{SELFPARAM(); - if(self.spawnflags & DOOR_NOSPLASH) +void door_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +{ + if(this.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) return; - self.health = self.health - damage; + this.health = this.health - damage; - if (self.itemkeys) + if (this.itemkeys) { // don't allow opening doors through damage if keys are required return; } - if (self.health <= 0) + if (this.health <= 0) { - self.owner.health = self.owner.max_health; - self.owner.takedamage = DAMAGE_NO; // wil be reset upon return - WITH(entity, self, self.owner, door_use()); + this.owner.health = this.owner.max_health; + this.owner.takedamage = DAMAGE_NO; // wil be reset upon return + door_use(this.owner, NULL, NULL); } } @@ -415,7 +412,7 @@ void door_rotating_go_up() string oldmessage; oldmessage = self.message; self.message = ""; - SUB_UseTargets(); + SUB_UseTargets(self, NULL, other); // TODO: is other needed here? self.message = oldmessage; } @@ -447,10 +444,7 @@ void door_trigger_touch() self.door_finished = time + 1; - activator = other; - - setself(self.owner); - door_use (); + door_use(this.owner, other, NULL); } void door_spawnfield(vector fmins, vector fmaxs) @@ -506,8 +500,8 @@ bool LinkDoors_isconnected(entity e1, entity e2, entity pass) #ifdef SVQC void door_link(); #endif -void LinkDoors() -{SELFPARAM(); +void LinkDoors(entity this) +{ entity t; vector cmins, cmaxs; @@ -693,8 +687,8 @@ void door_link() } #endif -void door_init_startopen() -{SELFPARAM(); +void door_init_startopen(entity this) +{ SUB_SETORIGIN(self, self.pos2); self.pos2 = self.pos1; self.pos1 = self.origin; @@ -744,7 +738,7 @@ spawnfunc(func_door) precache_sound(self.noise3); self.blocked = door_blocked; - self.use = door_use; + self.use1 = door_use; if(self.dmg && (self.message == "")) self.message = "was squished"; @@ -848,12 +842,12 @@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew) this.trigger_touch = door_touch; this.draw = door_draw; this.drawmask = MASK_NORMAL; - this.use = door_use; + this.use1 = door_use; - LinkDoors(); + LinkDoors(this); if(this.spawnflags & DOOR_START_OPEN) - door_init_startopen(); + door_init_startopen(this); this.move_time = time; this.move_origin = this.origin;