]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Kill more setself
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 04:32:22 +0000 (14:32 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 22 May 2016 04:32:22 +0000 (14:32 +1000)
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/triggers/func/door.qc

index 2acc4faf6d061c60d322ac13a1acc5cd3af30817..21ebc33b942d01f4048b8fe9cfbe3db4c69e4f18 100644 (file)
@@ -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)
index c4844b4df90bc908dd68ef95c176708d4236f303..1b77131e71ef7910ac601107f5e8574932549bab 100644 (file)
@@ -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)