]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix up some more questionable setself's
authorMario <mario@smbclan.net>
Sun, 22 May 2016 01:51:24 +0000 (11:51 +1000)
committerMario <mario@smbclan.net>
Sun, 22 May 2016 01:51:24 +0000 (11:51 +1000)
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/minelayer.qc

index c3c0861e95ef257187904119fc0a3938a0e604ac..aa69550a2be32d6d85622c429f26c63bc4f3c606 100644 (file)
@@ -747,65 +747,51 @@ METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
         entity oldself = self;
         if(self.gunner1)
         {
-            setself(self.gunner1);
-            oldself.gun1.vehicle_exit(VHEF_EJECT);
-            entity oldother = other;
-            other = self;
-            setself(oldself);
-            self.phase = 0;
-            self.touch();
-            other = oldother;
-            return;
+               entity e = self.gunner1;
+               WITHSELF(e, self.gun1.vehicle_exit(VHEF_EJECT));
+               entity oldother = other;
+               other = e;
+               self.phase = 0;
+               self.touch();
+               other = oldother;
+               return;
         }
 
         if(self.gunner2)
         {
-            setself(self.gunner2);
-            oldself.gun2.vehicle_exit(VHEF_EJECT);
-            entity oldother = other;
-            other = self;
-            setself(oldself);
-            self.phase = 0;
-            self.touch();
-            other = oldother;
+               entity e = self.gunner2;
+               WITHSELF(e, self.gun2.vehicle_exit(VHEF_EJECT));
+               entity oldother = other;
+               other = e;
+               self.phase = 0;
+               self.touch();
+               other = oldother;
             return;
         }
     }
 }
 METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
 {
-    SELFPARAM();
-    entity oldself = self;
-    setself(instance);
+       CSQCModel_UnlinkEntity(instance);
 
-    CSQCModel_UnlinkEntity(self);
+       // hide beam
+       if(instance.gun3.enemy || !wasfreed(instance.gun3.enemy))
+               instance.gun3.enemy.effects |= EF_NODRAW;
 
-    // Hide beam
-    if(self.gun3.enemy || !wasfreed(self.gun3.enemy))
-        self.gun3.enemy.effects |= EF_NODRAW;
+       if(instance.gunner1)
+               WITHSELF(instance.gunner1, instance.gun1.vehicle_exit(VHEF_EJECT));
 
-    if(self.gunner1)
-    {
-        setself(self.gunner1);
-        oldself.gun1.vehicle_exit(VHEF_EJECT);
-        setself(oldself);
-    }
-
-    if(self.gunner2)
-    {
-        setself(self.gunner2);
-        oldself.gun2.vehicle_exit(VHEF_EJECT);
-        setself(oldself);
-    }
+       if(instance.gunner2)
+               WITHSELF(instance.gunner2, instance.gun2.vehicle_exit(VHEF_EJECT));
 
-    self.vehicle_exit(VHEF_EJECT);
+       WITHSELF(instance, instance.vehicle_exit(VHEF_EJECT));
 
-    fixedmakevectors(self.angles);
-    vehicle_tossgib(instance, self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
-    vehicle_tossgib(instance, self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
-    vehicle_tossgib(instance, self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
+    fixedmakevectors(instance.angles);
+    vehicle_tossgib(instance, instance.gun1, instance.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(instance, instance.gun2, instance.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
+    vehicle_tossgib(instance, instance.gun3, instance.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
 
-    entity _body = vehicle_tossgib(instance, self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
+    entity _body = vehicle_tossgib(instance, instance, instance.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
 
     if(random() > 0.5)
         _body.touch = bumblebee_blowup;
@@ -815,29 +801,27 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
     _body.think = bumblebee_diethink;
     _body.nextthink = time;
     _body.wait = time + 2 + (random() * 8);
-    _body.owner = self;
-    _body.enemy = self.enemy;
+    _body.owner = instance;
+    _body.enemy = instance.enemy;
     _body.scale = 1.5;
-    _body.angles = self.angles;
-
-    Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(self.origin, 16), '0 0 0', 1);
-
-    self.health                        = 0;
-    self.event_damage  = func_null;
-    self.solid                 = SOLID_NOT;
-    self.takedamage            = DAMAGE_NO;
-    self.deadflag              = DEAD_DYING;
-    self.movetype              = MOVETYPE_NONE;
-    self.effects               = EF_NODRAW;
-    self.colormod              = '0 0 0';
-    self.avelocity             = '0 0 0';
-    self.velocity              = '0 0 0';
-    self.touch                         = func_null;
-    self.nextthink             = 0;
-
-    setorigin(self, self.pos1);
-
-    setself(oldself);
+    _body.angles = instance.angles;
+
+    Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(instance.origin, 16), '0 0 0', 1);
+
+    instance.health                    = 0;
+    instance.event_damage      = func_null;
+    instance.solid                     = SOLID_NOT;
+    instance.takedamage                = DAMAGE_NO;
+    instance.deadflag          = DEAD_DYING;
+    instance.movetype          = MOVETYPE_NONE;
+    instance.effects           = EF_NODRAW;
+    instance.colormod          = '0 0 0';
+    instance.avelocity         = '0 0 0';
+    instance.velocity          = '0 0 0';
+    instance.touch                     = func_null;
+    instance.nextthink                 = 0;
+
+    setorigin(instance, instance.pos1);
 }
 METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
 {
index eedb0644bdae11265cf71cee19a359a3573525f2..16b6eb8740ffd1b397ec6a06203432f7aa1b4a1a 100644 (file)
@@ -45,8 +45,8 @@ METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponen
     entity veh = player.vehicle;
     if (fire & 2)
     if (!isPlayer || weapon_prepareattack(thiswep, player, weaponentity, true, autocvar_g_vehicle_raptor_bombs_refire)) {
-        if (veh) setself(veh);
-        raptor_bombdrop();
+        entity e = (veh) ? veh : player;
+        WITHSELF(e, raptor_bombdrop());
         weapon_thinkf(player, weaponentity, WFRAME_FIRE2, 0, w_ready);
     }
 }
index 0881da496323b6cdb1bdb8487714bc7e6919aec5..d8effdeb80953eed8bbb4af41c166600cc56fa53 100644 (file)
@@ -372,15 +372,14 @@ void W_Arc_Beam_Think()
                }
 
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
-               setself(self.owner);
+               entity own = self.owner;
                Weapon w = WEP_ARC;
-               if(!w.wr_checkammo1(w, self) && !w.wr_checkammo2(w, self))
-               if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+               if(!w.wr_checkammo1(w, own) && !w.wr_checkammo2(w, own))
+               if(!(own.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
-                       W_SwitchToOtherWeapon(self);
+                       W_SwitchToOtherWeapon(own);
                }
-               setself(this);
                remove(self);
                return;
        }
index 9670dbda898f06f93316af574bbeab93fa1a46bf..960e1d4a7547c6155f51dcf718a7734af7448e2d 100644 (file)
@@ -103,10 +103,9 @@ void W_MineLayer_Stick(entity to)
        newmine.flags = self.flags;
 
        remove(self);
-       setself(newmine);
 
        if(to)
-               SetMovetypeFollow(self, to);
+               SetMovetypeFollow(newmine, to);
 }
 
 void W_MineLayer_Explode()
@@ -125,16 +124,15 @@ void W_MineLayer_Explode()
 
        if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
        {
-               setself(self.realowner);
+               entity own = this.realowner;
                Weapon w = WEP_MINE_LAYER;
-               if(!w.wr_checkammo1(w, self))
+               if(!w.wr_checkammo1(w, own))
                {
-                       self.cnt = WEP_MINE_LAYER.m_id;
+                       own.cnt = WEP_MINE_LAYER.m_id;
                        int slot = 0; // TODO: unhardcode
-                       ATTACK_FINISHED(self, slot) = time;
-                       PS(self).m_switchweapon = w_getbestweapon(self);
+                       ATTACK_FINISHED(own, slot) = time;
+                       PS(own).m_switchweapon = w_getbestweapon(own);
                }
-               setself(this);
        }
        self.realowner.minelayer_mines -= 1;
        remove(self);
@@ -152,18 +150,17 @@ void W_MineLayer_DoRemoteExplode()
 
        if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
        {
-               setself(self.realowner);
+               entity own = this.realowner;
                Weapon w = WEP_MINE_LAYER;
-               if(!w.wr_checkammo1(w, self))
+               if(!w.wr_checkammo1(w, own))
                {
-                       self.cnt = WEP_MINE_LAYER.m_id;
+                       own.cnt = WEP_MINE_LAYER.m_id;
                        int slot = 0; // TODO: unhardcode
-                       ATTACK_FINISHED(self, slot) = time;
-                       PS(self).m_switchweapon = w_getbestweapon(self);
+                       ATTACK_FINISHED(own, slot) = time;
+                       PS(own).m_switchweapon = w_getbestweapon(own);
                }
-               setself(this);
        }
-       self.realowner.minelayer_mines -= 1;
+       this.realowner.minelayer_mines -= 1;
        remove(self);
 }