From c3ee63c98d8052ff02b472a88f6f168c089ae689 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 22 May 2016 14:32:22 +1000 Subject: [PATCH] Kill more setself --- .../gamemodes/gamemode/nexball/nexball.qc | 24 ++++----- qcsrc/common/triggers/func/door.qc | 53 ++++++++----------- 2 files changed, 31 insertions(+), 46 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 2acc4faf6..21ebc33b9 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -89,19 +89,17 @@ void ball_restart(entity this) void nexball_setstatus() {SELFPARAM(); - self.items &= ~IT_KEY1; - if(self.ballcarried) + this.items &= ~IT_KEY1; + if(this.ballcarried) { - if(self.ballcarried.teamtime && (self.ballcarried.teamtime < time)) + if(this.ballcarried.teamtime && (this.ballcarried.teamtime < time)) { - bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n"); - setself(self.ballcarried); - DropBall(self, self.owner.origin, '0 0 0'); - ResetBall(); - setself(this); + bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n"); + DropBall(this.ballcarried, this.ballcarried.owner.origin, '0 0 0'); + WITHSELF(this.ballcarried, ResetBall()); } else - self.items |= IT_KEY1; + this.items |= IT_KEY1; } } @@ -133,7 +131,7 @@ void DropOwner() } void GiveBall(entity plyr, entity ball) -{SELFPARAM(); +{ .entity weaponentity = weaponentities[0]; // TODO: find ballstealer entity ownr = ball.owner; if(ownr) @@ -184,12 +182,10 @@ void GiveBall(entity plyr, entity ball) plyr.(weaponentity).weapons = plyr.weapons; plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon; plyr.weapons = WEPSET(NEXBALL); - setself(plyr); Weapon w = WEP_NEXBALL; - w.wr_resetplayer(w); + WITHSELF(plyr, w.wr_resetplayer(w)); PS(plyr).m_switchweapon = WEP_NEXBALL; - W_SwitchWeapon(plyr, WEP_NEXBALL); - setself(this); + WITHSELF(plyr, W_SwitchWeapon(plyr, WEP_NEXBALL)); } void DropBall(entity ball, vector org, vector vel) diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index c4844b4df..1b77131e7 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -208,7 +208,6 @@ bool door_check_keys(entity door, entity player) void door_fire(entity this, entity actor, entity trigger) { - entity starte; if (this.owner != this) objerror ("door_fire: this.owner != this"); @@ -216,49 +215,39 @@ void door_fire(entity this, entity actor, entity trigger) { if (this.state == STATE_UP || this.state == STATE_TOP) { - starte = self; - do - { - if (self.classname == "door") - { - door_go_down (); + entity e = this; + do { + if (e.classname == "door") { + WITHSELF(e, door_go_down()); + } else { + WITHSELF(e, door_rotating_go_down()); } - else - { - door_rotating_go_down (); - } - setself(self.enemy); - } while ( (self != starte) && (self != world) ); - setself(this); + e = e.enemy; + } while ((e != this) && (e != NULL)); return; } } // trigger all paired doors - starte = self; - do - { - if (self.classname == "door") - { - door_go_up (); - } else - { + entity e = this; + do { + if (e.classname == "door") { + WITHSELF(e, door_go_up()); + } else { // if the BIDIR spawnflag (==2) is set and the trigger has set trigger_reverse, reverse the opening direction - if ((self.spawnflags & 2) && other.trigger_reverse!=0 && self.lip!=666 && self.state == STATE_BOTTOM) - { - self.lip = 666; // self.lip is used to remember reverse opening direction for door_rotating - self.pos2 = '0 0 0' - self.pos2; + if ((e.spawnflags & 2) && other.trigger_reverse!=0 && e.lip != 666 && e.state == STATE_BOTTOM) { + e.lip = 666; // e.lip is used to remember reverse opening direction for door_rotating + e.pos2 = '0 0 0' - e.pos2; } // if BIDIR_IN_DOWN (==8) is set, prevent the door from reoping during closing if it is triggered from the wrong side - if (!((self.spawnflags & 2) && (self.spawnflags & 8) && self.state == STATE_DOWN - && (((self.lip==666) && (other.trigger_reverse==0)) || ((self.lip!=666) && (other.trigger_reverse!=0))))) + if (!((e.spawnflags & 2) && (e.spawnflags & 8) && e.state == STATE_DOWN + && (((e.lip == 666) && (other.trigger_reverse == 0)) || ((e.lip != 666) && (other.trigger_reverse != 0))))) { - door_rotating_go_up (); + WITHSELF(e, door_rotating_go_up()); } } - setself(self.enemy); - } while ( (self != starte) && (self != world) ); - setself(this); + e = e.enemy; + } while ((e != this) && (e != NULL)); } void door_use(entity this, entity actor, entity trigger) -- 2.39.2