]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/shotgun.qc
Weapons: add a second .weaponentity
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / shotgun.qc
index 42b99969a6505de82d3d78155e6ce40a9d4d85fe..e3f85daa1b8e43c7e32d482801045be7c2d2b985 100644 (file)
@@ -184,7 +184,7 @@ void W_Shotgun_Melee_Think(void)
 void W_Shotgun_Attack2(Weapon thiswep, entity actor, int slot, int fire)
 {
        sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTEN_NORM);
-       weapon_thinkf(actor, WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready);
+       weapon_thinkf(actor, slot, WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready);
 
        entity meleetemp;
        meleetemp = spawn();
@@ -208,7 +208,7 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, int slot, int fire)
 
        sound(actor, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound
        W_Shotgun_Attack(WEP_SHOTGUN, true); // actually is secondary, but we trick the last shot into playing full reload sound
-       weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
+       weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
 }
 void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int slot, int fire)
 {
@@ -222,7 +222,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int slot, int fire)
        }
 
        W_Shotgun_Attack(WEP_SHOTGUN, false);
-       weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
+       weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2);
 }
 
 .float shotgun_primarytime;
@@ -250,11 +250,11 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int slot, int fire)
                                {
                                        if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
                                        {
-                                               if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_PRI(shotgun, animtime)))
+                                               if(weapon_prepareattack(thiswep, actor, slot, false, WEP_CVAR_PRI(shotgun, animtime)))
                                                {
                                                        W_Shotgun_Attack(thiswep, true);
                                                        actor.shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor();
-                                                       weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
+                                                       weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready);
                                                }
                                        }
                                }
@@ -262,11 +262,11 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int slot, int fire)
                                {
                                        if(time >= actor.shotgun_primarytime) // handle refire separately so the secondary can be fired straight after a primary
                                        {
-                                               if(weapon_prepareattack(thiswep, actor, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
+                                               if(weapon_prepareattack(thiswep, actor, slot, false, WEP_CVAR_SEC(shotgun, alt_animtime)))
                                                {
                                                        W_Shotgun_Attack(thiswep, false);
                                                        actor.shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor();
-                                                       weapon_thinkf(actor, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
+                                                       weapon_thinkf(actor, slot, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1);
                                                }
                                        }
                                }
@@ -275,10 +275,10 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, int slot, int fire)
                        if(!actor.crouch) // no crouchmelee please
                        if(WEP_CVAR(shotgun, secondary) == 1)
                        if(((fire & 1) && actor.WEP_AMMO(SHOTGUN) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
-                       if(weapon_prepareattack(thiswep, actor, true, WEP_CVAR_SEC(shotgun, refire)))
+                       if(weapon_prepareattack(thiswep, actor, slot, true, WEP_CVAR_SEC(shotgun, refire)))
                        {
                                // attempt forcing playback of the anim by switching to another anim (that we never play) here...
-                               weapon_thinkf(actor, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
+                               weapon_thinkf(actor, slot, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
                        }
                }
                METHOD(Shotgun, wr_init, void(entity thiswep))