]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hlac.qc
Weapons: use bitflags for fire modes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hlac.qc
index 616939d1e80abd1a83c259d626f91d699ff931ed..d738c81d314b12a06262cc9291eed869c0906269 100644 (file)
@@ -161,11 +161,11 @@ void W_HLAC_Attack2(void)
 }
 
 // weapon frames
-void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, int fire)
 {
        if(actor.weapon != actor.switchweapon) // abort immediately if switching
        {
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -176,7 +176,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, bool fire1, bool fire2)
                if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
-                       w_ready(thiswep, actor, fire1, fire2);
+                       w_ready(thiswep, actor, fire);
                        return;
                }
 
@@ -211,12 +211,12 @@ 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, bool fire1, bool fire2))
+               METHOD(HLAC, wr_think, void(entity thiswep, entity actor, 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(fire1)
+                       } else if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(hlac, refire)))
                                {
@@ -226,7 +226,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                                }
                        }
 
-                       else if(fire2 && WEP_CVAR(hlac, secondary))
+                       else if((fire & 2) && WEP_CVAR(hlac, secondary))
                        {
                                if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(hlac, refire)))
                                {