Allow refire of pulsegun and minigun during cooldown/unwind.

This commit is contained in:
Marisa the Magician 2018-06-09 14:49:55 +02:00
commit c1e21988bb
2 changed files with 36 additions and 9 deletions

View file

@ -100,9 +100,8 @@ Class Minigun : UTWeapon
A_Overlay(-2,"MuzzleFlash",true); A_Overlay(-2,"MuzzleFlash",true);
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-2,STYLE_Add); A_OverlayRenderstyle(-2,STYLE_Add);
if ( alt ) invoker.bcnt = min(invoker.bcnt,3); if ( (alt && (invoker.bcnt++ < 3)) || (invoker.bcnt++ < 5) ) return;
if ( invoker.bcnt-- > 0 ) return; invoker.bcnt = 0;
invoker.bcnt = alt?3:5;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return; if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
invoker.FireEffect(); invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,255,255,0),1); UTMainHandler.DoFlash(self,Color(32,255,255,0),1);
@ -166,16 +165,30 @@ Class Minigun : UTWeapon
c.Scale *= 0.5; c.Scale *= 0.5;
} }
action void A_MinigunRefire( statelabel flash = null ) action void A_MinigunRefire( statelabel flash = null, bool nounwind = false )
{ {
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap || !player ) return; if ( !weap || !player ) return;
if ( weap.Ammo1.Amount <= 0 ) if ( weap.Ammo1.Amount <= 0 )
{ {
if ( nounwind ) return;
A_ClearRefire(); A_ClearRefire();
player.setpsprite(PSP_WEAPON,weap.FindState("Unwind")); player.setpsprite(PSP_WEAPON,weap.FindState("Unwind"));
return; return;
} }
if ( nounwind )
{
if ( player.cmd.buttons&BT_ALTATTACK )
{
weap.bAltFire = true;
flash = "AltFire";
}
else
{
weap.bAltFire = false;
flash = "Fire";
}
}
A_Refire(flash); A_Refire(flash);
} }
@ -403,8 +416,8 @@ Class Minigun : UTWeapon
Goto Unwind; Goto Unwind;
Unwind: Unwind:
MGNU A 0 A_PlaySound("minigun/unwind",CHAN_WEAPON); MGNU A 0 A_PlaySound("minigun/unwind",CHAN_WEAPON);
MGNU ABCDEFGHIJKLMNOPQRSTUVWXYZ 1; MGNU ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_MinigunRefire(null,true);
MGU2 ABCDEFGHIJKLM 1; MGU2 ABCDEFGHIJKLM 1 A_MinigunRefire(null,true);
Goto Idle; Goto Idle;
Deselect: Deselect:
MGND A 1 A_StopSound(CHAN_WEAPON); MGND A 1 A_StopSound(CHAN_WEAPON);

View file

@ -497,17 +497,31 @@ Class PulseGun : UTWeapon
s.vel = pvel; s.vel = pvel;
} }
} }
action void A_PulseRefire( statelabel flash = null ) action void A_PulseRefire( statelabel flash = null, bool noreload = false )
{ {
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap || !player ) return; if ( !weap || !player ) return;
if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) ) if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) )
{ {
if ( noreload ) return;
A_ClearRefire(); A_ClearRefire();
if ( weap.bAltFire ) player.setpsprite(PSP_WEAPON,weap.FindState("AltRelease")); if ( weap.bAltFire ) player.setpsprite(PSP_WEAPON,weap.FindState("AltRelease"));
else player.setpsprite(PSP_WEAPON,weap.FindState("Release")); else player.setpsprite(PSP_WEAPON,weap.FindState("Release"));
return; return;
} }
if ( noreload )
{
if ( player.cmd.buttons&BT_ALTATTACK )
{
weap.bAltFire = true;
flash = "AltFire";
}
else
{
weap.bAltFire = false;
flash = "Fire";
}
}
A_Refire(flash); A_Refire(flash);
} }
action void A_PulseFire() action void A_PulseFire()
@ -646,7 +660,7 @@ Class PulseGun : UTWeapon
Goto Release; Goto Release;
Release: Release:
PGNC A 0 A_PlaySound("pulse/down",CHAN_WEAPON); PGNC A 0 A_PlaySound("pulse/down",CHAN_WEAPON);
PGNC ABCDEFGHIJKLMNOPQRSTUVWXY 1; PGNC ABCDEFGHIJKLMNOPQRSTUVWXY 1 A_PulseRefire(null,true);
PGNC Y 0; PGNC Y 0;
Goto Idle; Goto Idle;
AltFire: AltFire:
@ -684,7 +698,7 @@ Class PulseGun : UTWeapon
PGBL A 0 A_PulseRefire(); PGBL A 0 A_PulseRefire();
AltRelease: AltRelease:
PGBE A 0 A_StopBeam(); PGBE A 0 A_StopBeam();
PGBE ABCDE 1; PGBE ABCDE 1 A_PulseRefire(null,true);
Goto Idle; Goto Idle;
Reload: Reload:
PGNI A 1; PGNI A 1;