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

View file

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