]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/vaporizer.qc
Weapons: store activeweapon as direct weapon reference
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / vaporizer.qc
index eb461380616ced1de1f5d070842977d03d23101c..529435d3562086831bd84746772a3caae59e2c46 100644 (file)
@@ -245,10 +245,10 @@ void W_RocketMinsta_Attack2()
        float spread = autocvar_g_rm_laser_spread;
        float rndspread = autocvar_g_rm_laser_spread_random;
 
-       float w = self.weapon;
-       self.weapon = WEP_ELECTRO.m_id;
+       Weapon w = PS(self).m_weapon;
+       PS(self).m_weapon = WEP_ELECTRO;
        W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, autocvar_g_rm_laser_damage);
-       self.weapon = w;
+       PS(self).m_weapon = w;
 
        Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -297,10 +297,10 @@ void W_RocketMinsta_Attack3 ()
        float counter = 0;
        float total = 1;
 
-       int w = self.weapon;
-       self.weapon = WEP_ELECTRO.m_id;
+       Weapon w = PS(self).m_weapon;
+       PS(self).m_weapon = WEP_ELECTRO;
        W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(ELECTRO_FIRE2), CH_WEAPON_A, autocvar_g_rm_laser_damage);
-       self.weapon = w;
+       PS(self).m_weapon = w;
 
        Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -396,8 +396,8 @@ void W_RocketMinsta_Attack3 ()
 
                                        // ugly instagib hack to reuse the fire mode of the laser
                                        makevectors(actor.v_angle);
-                                       int oldwep = actor.weapon; // we can't avoid this hack
-                                       actor.weapon = WEP_BLASTER.m_id;
+                                       Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
+                                       PS(actor).m_weapon = WEP_BLASTER;
                                        W_Blaster_Attack(
                                                actor,
                                                WEP_BLASTER.m_id | HITTYPE_SECONDARY,
@@ -411,7 +411,7 @@ void W_RocketMinsta_Attack3 ()
                                                WEP_CVAR_SEC(vaporizer, delay),
                                                WEP_CVAR_SEC(vaporizer, lifetime)
                                        );
-                                       actor.weapon = oldwep;
+                                       PS(actor).m_weapon = oldwep;
 
                                        // now do normal refire
                                        weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);