From: Mario Date: Sun, 22 May 2016 01:51:24 +0000 (+1000) Subject: Fix up some more questionable setself's X-Git-Tag: xonotic-v0.8.2~909 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2ab7f29e53941efefd1ac43f1cf3e92e7b51501a;p=xonotic%2Fxonotic-data.pk3dir.git Fix up some more questionable setself's --- diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index c3c0861e9..aa69550a2 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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)) { diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index eedb0644b..16b6eb874 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -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); } } diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 0881da496..d8effdeb8 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -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; } diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 9670dbda8..960e1d4a7 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -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); }