]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/hmg.qc
Weapons: use bitflags for fire modes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / hmg.qc
index 6707a7c32e960cc0eac5c9a01c68eb8bc42f0dd7..fc9811713fcaaf5e3347792a02e271b41a719c28 100644 (file)
@@ -45,11 +45,11 @@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 
 spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(WEP_HMG.m_id); }
 
-void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, bool fire2)
+void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, int fire)
 {
        if (!actor.BUTTON_ATCK)
        {
-               w_ready(thiswep, actor, fire1, fire2);
+               w_ready(thiswep, actor, fire);
                return;
        }
 
@@ -58,7 +58,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, boo
        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;
        }
 
@@ -96,18 +96,18 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, bool fire1, boo
                        else
                                self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false);
                }
-               METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
+               METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, int fire))
                {
                        if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
                                Weapon w = get_weaponinfo(actor.weapon);
                                w.wr_reload(w);
                        } else
                        {
-                               if (fire1)
+                               if (fire & 1)
                                if (weapon_prepareattack(thiswep, actor, false, 0))
                                {
                                        actor.misc_bulletcounter = 0;
-                                       W_HeavyMachineGun_Attack_Auto(thiswep, actor, fire1, fire2);
+                                       W_HeavyMachineGun_Attack_Auto(thiswep, actor, fire);
                                }
                        }
                }