]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hagar.qc
Weapons: remove many direct references to `self`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hagar.qc
index 3feeb0b32a39c4170d7108457ca5c4897a6e45f2..af62d534d9cb4cb5197a4e0358a4d15cb30c3b93 100644 (file)
@@ -127,7 +127,7 @@ void W_Hagar_Attack(Weapon thiswep)
 {SELFPARAM();
        entity missile;
 
-       W_DecreaseAmmo(thiswep, WEP_CVAR_PRI(hagar, ammo));
+       W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo));
 
        W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
 
@@ -170,7 +170,7 @@ void W_Hagar_Attack2(Weapon thiswep)
 {SELFPARAM();
        entity missile;
 
-       W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo));
+       W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
 
        W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
 
@@ -223,7 +223,7 @@ void W_Hagar_Attack2_Load_Release(void)
        if(!self.hagar_load)
                return;
 
-       weapon_prepareattack_do(true, WEP_CVAR_SEC(hagar, refire));
+       weapon_prepareattack_do(self, true, WEP_CVAR_SEC(hagar, refire));
 
        W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
        Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
@@ -286,7 +286,7 @@ void W_Hagar_Attack2_Load_Release(void)
                MUTATOR_CALLHOOK(EditProjectile, self, missile);
        }
 
-       weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
+       weapon_thinkf(self, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
        self.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor();
        self.hagar_load = 0;
 }
@@ -319,7 +319,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                        {
                                // if we pressed primary fire while loading, unload all rockets and abort
                                self.weaponentity.state = WS_READY;
-                               W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
+                               W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo
                                self.hagar_load = 0;
                                sound(self, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
 
@@ -337,7 +337,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                        {
                                if(!self.hagar_loadblock && self.hagar_loadstep < time)
                                {
-                                       W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo));
+                                       W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
                                        self.weaponentity.state = WS_INUSE;
                                        self.hagar_load += 1;
                                        sound(self, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
@@ -407,30 +407,30 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                        else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
                                self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
                }
-               METHOD(Hagar, wr_think, void(entity thiswep, bool fire1, bool fire2))
+               METHOD(Hagar, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
                {
                        float loadable_secondary;
                        loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
 
                        if(loadable_secondary)
                                W_Hagar_Attack2_Load(thiswep); // must always run each frame
-                       if(autocvar_g_balance_hagar_reload_ammo && self.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
-                               Weapon w = get_weaponinfo(self.weapon);
+                       if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
+                               Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
-                       } else if(fire1 && !self.hagar_load && !self.hagar_loadblock) // not while secondary is loaded or awaiting reset
+                       } else if(fire1 && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
                        {
-                               if(weapon_prepareattack(false, WEP_CVAR_PRI(hagar, refire)))
+                               if(weapon_prepareattack(actor, false, WEP_CVAR_PRI(hagar, refire)))
                                {
                                        W_Hagar_Attack(thiswep);
-                                       weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
+                                       weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
                                }
                        }
                        else if(fire2 && !loadable_secondary && WEP_CVAR(hagar, secondary))
                        {
-                               if(weapon_prepareattack(true, WEP_CVAR_SEC(hagar, refire)))
+                               if(weapon_prepareattack(actor, true, WEP_CVAR_SEC(hagar, refire)))
                                {
                                        W_Hagar_Attack2(thiswep);
-                                       weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
+                                       weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, refire), w_ready);
                                }
                        }
                }
@@ -453,7 +453,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
 
                        if(self.hagar_load)
                        {
-                               W_DecreaseAmmo(thiswep, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
+                               W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary
                                self.hagar_load = 0;
                        }
                }
@@ -486,7 +486,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep)
                METHOD(Hagar, wr_reload, void(entity thiswep))
                {
                        if(!self.hagar_load) // require releasing loaded rockets first
-                               W_Reload(min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
+                               W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
                }
                METHOD(Hagar, wr_suicidemessage, int(entity thiswep))
                {