]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hlac.qc
Merge branch 'master' into TimePath/debug_draw
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hlac.qc
index 383c40f5de6edf461e25ba9172334d7e82c0ec50..6b6583f42531370beb960ab9b2e64f51998d395d 100644 (file)
@@ -159,11 +159,11 @@ void W_HLAC_Attack2(void)
 }
 
 // weapon frames
-void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int slot, int fire)
+void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
        if(actor.weapon != actor.switchweapon) // abort immediately if switching
        {
-               w_ready(thiswep, actor, slot, fire);
+               w_ready(thiswep, actor, weaponentity, fire);
                return;
        }
 
@@ -174,18 +174,19 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int slot, int fire)
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                       w_ready(thiswep, actor, slot, fire);
+                       w_ready(thiswep, actor, weaponentity, fire);
                        return;
                }
 
+               int slot = weaponslot(weaponentity);
                ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor();
                W_HLAC_Attack(WEP_HLAC);
                actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
-        weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+        weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
        }
        else
        {
-               weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
+               weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, animtime), w_ready);
        }
 }
 
@@ -209,27 +210,27 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                {
                        self.BUTTON_ATCK = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
                }
-               METHOD(HLAC, wr_think, void(entity thiswep, entity actor, int slot, int fire))
+               METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
                        } else if(fire & 1)
                        {
-                               if(weapon_prepareattack(thiswep, actor, slot, false, WEP_CVAR_PRI(hlac, refire)))
+                               if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
                                {
                                        actor.misc_bulletcounter = 0;
                                        W_HLAC_Attack(thiswep);
-                                       weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
+                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
                                }
                        }
 
                        else if((fire & 2) && WEP_CVAR(hlac, secondary))
                        {
-                               if(weapon_prepareattack(thiswep, actor, slot, true, WEP_CVAR_SEC(hlac, refire)))
+                               if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hlac, refire)))
                                {
                                        W_HLAC_Attack2_Frame(thiswep);
-                                       weapon_thinkf(actor, slot, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
+                                       weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hlac, animtime), w_ready);
                                }
                        }
                }