Allow the Spreadgun, Wallbuster and Silver Bullet to auto-reload.
This will be made toggleable for ALL weapons in 1.4.
This commit is contained in:
parent
9983b82613
commit
008ccd7bd4
5 changed files with 28 additions and 8 deletions
|
|
@ -151,6 +151,20 @@ Class Wallbuster : SWWMWeapon
|
|||
}
|
||||
action void A_FireShells( int num = 1 )
|
||||
{
|
||||
// auto-reload if we're fully empty and there's ammo to use
|
||||
bool isloaded = false;
|
||||
for ( int i=0; i<25; i++ )
|
||||
{
|
||||
if ( !invoker.loaded[i] || invoker.fired[i] )
|
||||
continue;
|
||||
isloaded = true;
|
||||
break;
|
||||
}
|
||||
if ( !isloaded && (GetShellsToLoad() > 0) )
|
||||
{
|
||||
player.SetPSprite(PSP_WEAPON,ResolveState("Reload"));
|
||||
return;
|
||||
}
|
||||
// speen
|
||||
if ( num == 1 ) invoker.whichspin = 1;
|
||||
else if ( num == 5 ) invoker.whichspin = 2;
|
||||
|
|
|
|||
|
|
@ -381,11 +381,12 @@ Class Spreadgun : SWWMWeapon
|
|||
action State A_SpreadgunReady()
|
||||
{
|
||||
int flg = WRF_ALLOWZOOM|WRF_ALLOWUSER1|WRF_NOSECONDARY;
|
||||
if ( ((invoker.Ammo1.Amount > 0) || sv_infiniteammo && FindInventory('PowerInfiniteAmmo',true)) && (invoker.fired || !invoker.chambered || invoker.goldload) )
|
||||
if ( ((invoker.Ammo1.Amount > 0) || sv_infiniteammo || FindInventory('PowerInfiniteAmmo',true)) && (invoker.fired || !invoker.chambered || invoker.goldload) )
|
||||
flg |= WRF_ALLOWRELOAD;
|
||||
if ( ((invoker.Ammo2.Amount > 0) || sv_infiniteammo && FindInventory('PowerInfiniteAmmo',true)) && (invoker.fired || !invoker.chambered || !invoker.goldload) )
|
||||
if ( ((invoker.Ammo2.Amount > 0) || sv_infiniteammo || FindInventory('PowerInfiniteAmmo',true)) && (invoker.fired || !invoker.chambered || !invoker.goldload) )
|
||||
flg &= ~WRF_NOSECONDARY;
|
||||
if ( invoker.fired || !invoker.chambered ) flg |= WRF_NOPRIMARY; // until 1.4, dry-fire animation not implemented
|
||||
if ( ((invoker.Ammo1.Amount <= 0) && !sv_infiniteammo && !FindInventory('PowerInfiniteAmmo',true)) && (invoker.fired || !invoker.chambered) )
|
||||
flg |= WRF_NOPRIMARY;
|
||||
A_WeaponReady(flg);
|
||||
if ( player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK) )
|
||||
invoker.CheckAmmo(EitherFire,true);
|
||||
|
|
@ -530,6 +531,7 @@ Class Spreadgun : SWWMWeapon
|
|||
Fire:
|
||||
XZW2 A 1
|
||||
{
|
||||
if ( invoker.fired || !invoker.chambered ) return ResolveState("Reload");
|
||||
A_FireShell();
|
||||
return ResolveState(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -785,7 +785,6 @@ Class SilverBullet : SWWMWeapon
|
|||
XZW2 A 1
|
||||
{
|
||||
int flg = WRF_ALLOWRELOAD|WRF_ALLOWZOOM|WRF_ALLOWUSER1;
|
||||
if ( !invoker.chambered || invoker.fired ) flg |= WRF_NOPRIMARY; // no dry-fire yet
|
||||
A_WeaponReady(flg);
|
||||
if ( player.cmd.buttons&BT_ATTACK )
|
||||
invoker.CheckAmmo(EitherFire,true);
|
||||
|
|
@ -795,7 +794,6 @@ Class SilverBullet : SWWMWeapon
|
|||
TNT1 A 1
|
||||
{
|
||||
int flg = WRF_ALLOWRELOAD|WRF_ALLOWUSER1;
|
||||
if ( !invoker.chambered || invoker.fired ) flg |= WRF_NOPRIMARY; // no dry-fire yet
|
||||
if ( invoker.rezoom > 0 ) invoker.rezoom--;
|
||||
else flg |= WRF_ALLOWZOOM;
|
||||
A_WeaponReady(flg);
|
||||
|
|
@ -806,6 +804,12 @@ Class SilverBullet : SWWMWeapon
|
|||
Fire:
|
||||
XZW2 A 1
|
||||
{
|
||||
if ( !invoker.chambered || invoker.fired )
|
||||
{
|
||||
if ( !invoker.fired && (invoker.clipcount <= 0) && (sv_infiniteammo || FindInventory('PowerInfiniteAmmo',true) || (invoker.Ammo1.Amount > 0) || (CountInv("SilverBullets") > 0)) )
|
||||
return ResolveState("Reload");
|
||||
return ResolveState("AltFire");
|
||||
}
|
||||
A_SilverFire();
|
||||
invoker.fired = true;
|
||||
return A_JumpIf(invoker.zoomed,"ZoomFire");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue