]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix a few weapons
authorMario <mario@smbclan.net>
Thu, 29 Sep 2016 09:33:17 +0000 (19:33 +1000)
committerMario <mario@smbclan.net>
Thu, 29 Sep 2016 09:33:17 +0000 (19:33 +1000)
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc

index ff9bbf93187b5273dcca4673ddf172678238c478..732f4f43fd225e6def1f16681d650ed4af516cd7 100644 (file)
@@ -37,10 +37,10 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
                actor.punchangle_y = random () - 0.5;
        }
 
-       float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
+       float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR(hmg, spread_max));
        fireBullet(actor, weaponentity, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
 
-       actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
+       actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -75,7 +75,7 @@ METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity wea
         if (fire & 1)
         if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
         {
-            actor.misc_bulletcounter = 0;
+            actor.(weaponentity).misc_bulletcounter = 0;
             W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
         }
     }
index 35435abb55b187af0b144ea6469d3ee0db3c42c5..160971b1434bd79f00649f5795577dd6b0a961f5 100644 (file)
@@ -115,14 +115,14 @@ void W_Devastator_Explode(entity this, entity directhitentity)
        );
 
        Weapon thiswep = WEP_DEVASTATOR;
-       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+       .entity weaponentity = this.weaponentity_fld;
        if(this.realowner.(weaponentity).m_weapon == thiswep)
        {
                if(this.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
                if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        this.realowner.cnt = WEP_DEVASTATOR.m_id;
-                       int slot = 0; // TODO: unhardcode
+                       int slot = weaponslot(weaponentity);
                        ATTACK_FINISHED(this.realowner, slot) = time;
                        this.realowner.(weaponentity).m_switchweapon = w_getbestweapon(this.realowner);
                }
@@ -283,9 +283,9 @@ void W_Devastator_Think(entity this)
                this.velocity = this.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor(this.realowner) * frametime, velspeed);
 
        // laser guided, or remote detonation
-       if(PS(this.realowner).m_weapon == WEP_DEVASTATOR)
+       .entity weaponentity = this.weaponentity_fld;
+       if(this.realowner.(weaponentity).m_weapon == WEP_DEVASTATOR)
        {
-               .entity weaponentity = this.weaponentity_fld;
                int slot = weaponslot(weaponentity);
 
                if(this == this.realowner.(weaponentity).lastrocket)
index b5ee5305d05c1d55e473e76fb5972f1865bfa79f..79f6cadf3784b1e79fc5d7590b7158bf33a180fa 100644 (file)
@@ -473,12 +473,12 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity)
 
 void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if(actor.electro_count > 1)
+       if(actor.(weaponentity).electro_count > 1)
        if(PHYS_INPUT_BUTTON_ATCK2(actor))
        if(weapon_prepareattack(thiswep, actor, weaponentity, true, -1))
        {
                W_Electro_Attack_Orb(WEP_ELECTRO, actor, weaponentity);
-               actor.electro_count -= 1;
+               actor.(weaponentity).electro_count -= 1;
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
                return;
        }
@@ -543,13 +543,13 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit
     }
     else if(fire & 2)
     {
-        if(time >= actor.electro_secondarytime)
+        if(time >= actor.(weaponentity).electro_secondarytime)
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
         {
             W_Electro_Attack_Orb(thiswep, actor, weaponentity);
-            actor.electro_count = WEP_CVAR_SEC(electro, count);
+            actor.(weaponentity).electro_count = WEP_CVAR_SEC(electro, count);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
-            actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor);
+            actor.(weaponentity).electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor);
         }
     }
 }
@@ -576,7 +576,11 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor))
 }
 METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor))
 {
-    actor.electro_secondarytime = time;
+    for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+    {
+       .entity weaponentity = weaponentities[slot];
+       actor.(weaponentity).electro_secondarytime = time;
+    }
 }
 METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
index 5bc2994915b401c3f3cd46b391fbcb02fd8999f6..d819a479c390cb861b917787df4857d6176da9e6 100644 (file)
@@ -234,7 +234,7 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
        vector s;
        vector forward, right, up;
 
-       if(!actor.hagar_load)
+       if(!actor.(weaponentity).hagar_load)
                return;
 
        weapon_prepareattack_do(actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire));
@@ -246,7 +246,7 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
        right = v_right;
        up = v_up;
 
-       shots = actor.hagar_load;
+       shots = actor.(weaponentity).hagar_load;
        missile = NULL;
        for(counter = 0; counter < shots; ++counter)
        {
@@ -302,8 +302,11 @@ void W_Hagar_Attack2_Load_Release(entity actor, .entity weaponentity)
        }
 
        weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(hagar, load_animtime), w_ready);
-       actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor);
-       actor.hagar_load = 0;
+       actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, refire) * W_WeaponRateFactor(actor);
+       actor.(weaponentity).hagar_load = 0;
+
+       if(weaponslot(weaponentity) == 0)
+               actor.hagar_load = 0;
 }
 
 void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
@@ -313,7 +316,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
        if(time < game_starttime)
                return;
 
-       bool loaded = actor.hagar_load >= WEP_CVAR_SEC(hagar, load_max);
+       bool loaded = actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max);
 
        // this is different than WR_CHECKAMMO when it comes to reloading
        bool enough_ammo;
@@ -330,19 +333,21 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
        {
                if(PHYS_INPUT_BUTTON_ATCK(actor) && WEP_CVAR_SEC(hagar, load_abort))
                {
-                       if(actor.hagar_load)
+                       if(actor.(weaponentity).hagar_load)
                        {
                                // if we pressed primary fire while loading, unload all rockets and abort
                                actor.(weaponentity).state = WS_READY;
-                               W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.hagar_load * -1, weaponentity); // give back ammo
-                               actor.hagar_load = 0;
+                               W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo
+                               actor.(weaponentity).hagar_load = 0;
+                               if(weaponslot(weaponentity) == 0)
+                                       actor.hagar_load = 0;
                                sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
 
                                // pause until we can load rockets again, once we re-press the alt fire button
-                               actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
+                               actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
 
                                // require letting go of the alt fire button before we can load again
-                               actor.hagar_loadblock = true;
+                               actor.(weaponentity).hagar_loadblock = true;
                        }
                }
                else
@@ -350,49 +355,49 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
                        // check if we can attempt to load another rocket
                        if(!stopped)
                        {
-                               if(!actor.hagar_loadblock && actor.hagar_loadstep < time)
+                               if(!actor.(weaponentity).hagar_loadblock && actor.(weaponentity).hagar_loadstep < time)
                                {
                                        W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo), weaponentity);
                                        actor.(weaponentity).state = WS_INUSE;
-                                       actor.hagar_load += 1;
+                                       actor.(weaponentity).hagar_load += 1;
                                        sound(actor, CH_WEAPON_B, SND_HAGAR_LOAD, VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most
 
-                                       if(actor.hagar_load >= WEP_CVAR_SEC(hagar, load_max))
+                                       if(actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max))
                                                stopped = true;
                                        else
-                                               actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
+                                               actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_speed) * W_WeaponRateFactor(actor);
                                }
                        }
-                       if(stopped && !actor.hagar_loadbeep && actor.hagar_load) // prevents the beep from playing each frame
+                       if(stopped && !actor.(weaponentity).hagar_loadbeep && actor.(weaponentity).hagar_load) // prevents the beep from playing each frame
                        {
                                // if this is the last rocket we can load, play a beep sound to notify the player
                                sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
-                               actor.hagar_loadbeep = true;
-                               actor.hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor);
+                               actor.(weaponentity).hagar_loadbeep = true;
+                               actor.(weaponentity).hagar_loadstep = time + WEP_CVAR_SEC(hagar, load_hold) * W_WeaponRateFactor(actor);
                        }
                }
        }
-       else if(actor.hagar_loadblock)
+       else if(actor.(weaponentity).hagar_loadblock)
        {
                // the alt fire button has been released, so re-enable loading if blocked
-               actor.hagar_loadblock = false;
+               actor.(weaponentity).hagar_loadblock = false;
        }
 
-       if(actor.hagar_load)
+       if(actor.(weaponentity).hagar_load)
        {
                // play warning sound if we're about to release
-               if(stopped && actor.hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)
+               if(stopped && actor.(weaponentity).hagar_loadstep - 0.5 < time && WEP_CVAR_SEC(hagar, load_hold) >= 0)
                {
-                       if(!actor.hagar_warning) // prevents the beep from playing each frame
+                       if(!actor.(weaponentity).hagar_warning) // prevents the beep from playing each frame
                        {
                                // we're about to automatically release after holding time, play a beep sound to notify the player
                                sound(actor, CH_WEAPON_A, SND_HAGAR_BEEP, VOL_BASE, ATTN_NORM);
-                               actor.hagar_warning = true;
+                               actor.(weaponentity).hagar_warning = true;
                        }
                }
 
                // release if player let go of button or if they've held it in too long
-               if(!PHYS_INPUT_BUTTON_ATCK2(actor) || (stopped && actor.hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
+               if(!PHYS_INPUT_BUTTON_ATCK2(actor) || (stopped && actor.(weaponentity).hagar_loadstep < time && WEP_CVAR_SEC(hagar, load_hold) >= 0))
                {
                        actor.(weaponentity).state = WS_READY;
                        W_Hagar_Attack2_Load_Release(actor, weaponentity);
@@ -400,8 +405,8 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
        }
        else
        {
-               actor.hagar_loadbeep = false;
-               actor.hagar_warning = false;
+               actor.(weaponentity).hagar_loadbeep = false;
+               actor.(weaponentity).hagar_warning = false;
 
                // we aren't checking ammo during an attack, so we must do it here
                if(!(thiswep.wr_checkammo1(thiswep, actor) + thiswep.wr_checkammo2(thiswep, actor)))
@@ -416,7 +421,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
 
 void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
 {
-       if(!(fire & 1) || actor.hagar_load || actor.hagar_loadblock)
+       if(!(fire & 1) || actor.(weaponentity).hagar_load || actor.(weaponentity).hagar_loadblock)
        {
                w_ready(thiswep, actor, weaponentity, fire);
                return;
@@ -455,13 +460,15 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 {
     float loadable_secondary;
     loadable_secondary = (WEP_CVAR_SEC(hagar, load) && WEP_CVAR(hagar, secondary));
+    if(weaponslot(weaponentity) == 0)
+       actor.hagar_load = actor.(weaponentity).hagar_load;
 
     if(loadable_secondary)
         W_Hagar_Attack2_Load(thiswep, actor, weaponentity); // must always run each frame
     if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
         thiswep.wr_reload(thiswep, actor, weaponentity);
     }
-    else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
+    else if((fire & 1) && !actor.(weaponentity).hagar_load && !actor.(weaponentity).hagar_loadblock) // not while secondary is loaded or awaiting reset
        {
                if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
                        W_Hagar_Attack_Auto(thiswep, actor, weaponentity, fire);
@@ -478,7 +485,7 @@ METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor, .entity weaponentity))
 {
     // we lost the weapon and want to prepare switching away
-    if(actor.hagar_load)
+    if(actor.(weaponentity).hagar_load)
     {
        actor.(weaponentity).state = WS_READY;
        W_Hagar_Attack2_Load_Release(actor, weaponentity);
@@ -486,13 +493,16 @@ METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor, .entity weaponent
 }
 METHOD(Hagar, wr_setup, void(entity thiswep, entity actor))
 {
-    actor.hagar_loadblock = false;
-
-    if(actor.hagar_load)
+       actor.hagar_load = 0;
+    for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
     {
-       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-        W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.hagar_load * -1, weaponentity); // give back ammo if necessary
-        actor.hagar_load = 0;
+       .entity weaponentity = weaponentities[slot];
+       actor.(weaponentity).hagar_loadblock = false;
+       if(actor.(weaponentity).hagar_load)
+       {
+               W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hagar, ammo) * actor.(weaponentity).hagar_load * -1, weaponentity); // give back ammo if necessary
+               actor.(weaponentity).hagar_load = 0;
+       }
     }
 }
 METHOD(Hagar, wr_checkammo1, bool(entity thiswep, entity actor))
@@ -510,16 +520,21 @@ METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor))
 METHOD(Hagar, wr_resetplayer, void(entity thiswep, entity actor))
 {
     actor.hagar_load = 0;
+    for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+    {
+       .entity weaponentity = weaponentities[slot];
+       actor.(weaponentity).hagar_load = 0;
+    }
 }
 METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor, .entity weaponentity))
 {
     // if we have any rockets loaded when we die, release them
-    if(actor.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
+    if(actor.(weaponentity).hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
        W_Hagar_Attack2_Load_Release(actor, weaponentity);
 }
 METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    if(!actor.hagar_load) // require releasing loaded rockets first
+    if(!actor.(weaponentity).hagar_load) // require releasing loaded rockets first
         W_Reload(actor, weaponentity, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD);
 }
 METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
index beb42d5f680ded545c7e3c722d77717efc5d7961..e77944076bdeb57e235b847d902e0f210229afb2 100644 (file)
@@ -77,7 +77,7 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(hlac, ammo), weaponentity);
 
-    spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * actor.misc_bulletcounter);
+    spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * actor.(weaponentity).misc_bulletcounter);
     spread = min(spread,WEP_CVAR_PRI(hlac, spread_max));
     if(actor.crouch)
         spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
@@ -187,7 +187,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int
                int slot = weaponslot(weaponentity);
                ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hlac, refire) * W_WeaponRateFactor(actor);
                W_HLAC_Attack(WEP_HLAC, actor, weaponentity);
-               actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
+               actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
         weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
        }
        else
@@ -224,7 +224,7 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
         {
-            actor.misc_bulletcounter = 0;
+            actor.(weaponentity).misc_bulletcounter = 0;
             W_HLAC_Attack(thiswep, actor, weaponentity);
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hlac, refire), W_HLAC_Attack_Frame);
         }
index c24db6583e6a25c06a8a63c18610155db08079a3..716aa247cc5160d9763c2de71a323d5bf205200a 100644 (file)
@@ -382,7 +382,7 @@ void Draw_GrapplingHook(entity this)
 
        InterpolateOrigin_Do(this);
 
-       int s = W_GunAlign(NULL, STAT(GUNALIGN));
+       int s = viewmodels[this.cnt].m_gunalign; //W_GunAlign(NULL, STAT(GUNALIGN));
 
        switch(this.HookType)
        {
index dc6d28ad337333644d30720bb3e5f03beb11235b..4b2941648404fe976b7d83786a5980a1ff6312bc 100644 (file)
@@ -111,7 +111,7 @@ void W_MachineGun_MuzzleFlash(entity actor, .entity weaponentity)
 
 void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity weaponentity)
 {
-       W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
+       W_SetupShot(actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((actor.(weaponentity).misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
        if(!autocvar_g_norecoil)
        {
                actor.punchangle_x = random() - 0.5;
@@ -121,7 +121,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we
        // this attack_finished just enforces a cooldown at the end of a burst
        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor(actor);
 
-       if(actor.misc_bulletcounter == 1)
+       if(actor.(weaponentity).misc_bulletcounter == 1)
                fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
        else
                fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
@@ -138,7 +138,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we
                SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity);
        }
 
-       if(actor.misc_bulletcounter == 1)
+       if(actor.(weaponentity).misc_bulletcounter == 1)
                W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, first_ammo), weaponentity);
        else
                W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, sustained_ammo), weaponentity);
@@ -161,7 +161,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentit
                        w_ready(thiswep, actor, weaponentity, fire);
                        return;
                }
-               actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
+               actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
                W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity);
                weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
        }
@@ -197,10 +197,10 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
                actor.punchangle_y = random() - 0.5;
        }
 
-       machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
+       machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
        fireBullet(actor, weaponentity, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
 
-       actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
+       actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
 
        Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
 
@@ -240,8 +240,8 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, actor, weaponentity);
        }
 
-       actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
-       if(actor.misc_bulletcounter == 0)
+       actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
+       if(actor.(weaponentity).misc_bulletcounter == 0)
        {
                int slot = weaponslot(weaponentity);
                ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(machinegun, burst_refire2) * W_WeaponRateFactor(actor);
@@ -271,7 +271,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if(fire & 1)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
         {
-            actor.misc_bulletcounter = 0;
+            actor.(weaponentity).misc_bulletcounter = 0;
             W_MachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
         }
 
@@ -288,7 +288,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
 
             W_DecreaseAmmo(thiswep, actor, WEP_CVAR(machinegun, burst_ammo), weaponentity);
 
-            actor.misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
+            actor.(weaponentity).misc_bulletcounter = WEP_CVAR(machinegun, burst) * -1;
             W_MachineGun_Attack_Burst(thiswep, actor, weaponentity, fire);
         }
     }
@@ -298,7 +298,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if(fire & 1)
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
         {
-            actor.misc_bulletcounter = 1;
+            actor.(weaponentity).misc_bulletcounter = 1;
             W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id, actor, weaponentity); // sets attack_finished
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(machinegun, sustained_refire), W_MachineGun_Attack_Frame);
         }
@@ -306,7 +306,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if((fire & 2) && WEP_CVAR(machinegun, first))
         if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0))
         {
-            actor.misc_bulletcounter = 1;
+            actor.(weaponentity).misc_bulletcounter = 1;
             W_MachineGun_Attack(WEP_MACHINEGUN, WEP_MACHINEGUN.m_id | HITTYPE_SECONDARY, actor, weaponentity); // sets attack_finished
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(machinegun, first_refire), w_ready);
         }