Adjusted how Spreadgun ammo autoswitch is handled.
This commit is contained in:
parent
13f508ac5d
commit
1fa1e4c722
1 changed files with 29 additions and 14 deletions
|
|
@ -2409,7 +2409,6 @@ Class Spreadgun : SWWMWeapon
|
|||
A_StartSound("spreadgun/hammer",CHAN_WEAPON,CHANF_OVERLAP);
|
||||
invoker.fired = false;
|
||||
}
|
||||
if ( CountInv(invoker.nextammo) <= 0 ) A_SwitchAmmoType(true);
|
||||
}
|
||||
|
||||
override void AttachToOwner( Actor other )
|
||||
|
|
@ -2437,23 +2436,37 @@ Class Spreadgun : SWWMWeapon
|
|||
cur = i;
|
||||
break;
|
||||
}
|
||||
for ( int i=0; i<7; i++ )
|
||||
int ridx = -1;
|
||||
if ( rev )
|
||||
{
|
||||
int ridx;
|
||||
if ( rev )
|
||||
// check backwards from what we currently had
|
||||
for ( int i=cur; i>=0; i-- )
|
||||
{
|
||||
ridx = cur-i;
|
||||
if ( ridx < 0 ) break;
|
||||
if ( CountInv(types[i]) <= 0 ) continue;
|
||||
ridx = i;
|
||||
break;
|
||||
}
|
||||
else ridx = (i+cur+1)%7;
|
||||
if ( CountInv(types[ridx]) <= 0 ) continue;
|
||||
next = ridx;
|
||||
break;
|
||||
if ( ridx == -1 )
|
||||
{
|
||||
// check forwards instead, but avoid golden shells
|
||||
for ( int i=0; i<6; i++ )
|
||||
{
|
||||
if ( CountInv(types[i]) <= 0 ) continue;
|
||||
ridx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( ridx != -1 ) next = ridx;
|
||||
}
|
||||
if ( rev && ((invoker.nextammo == types[next]) || (CountInv(invoker.nextammo) <= 0)) )
|
||||
else
|
||||
{
|
||||
A_SwitchAmmoType(false); // recheck forward
|
||||
return;
|
||||
for ( int i=0; i<7; i++ )
|
||||
{
|
||||
ridx = (i+cur+1)%7;
|
||||
if ( CountInv(types[ridx]) <= 0 ) continue;
|
||||
next = ridx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( invoker.nextammo != types[next] ) A_StartSound("misc/invchange",CHAN_WEAPONEXTRA,CHANF_UI|CHANF_LOCAL);
|
||||
invoker.nextammo = types[next];
|
||||
|
|
@ -2522,8 +2535,9 @@ Class Spreadgun : SWWMWeapon
|
|||
Ready:
|
||||
XZW2 A 1
|
||||
{
|
||||
if ( CountInv(invoker.nextammo) <= 0 ) A_SwitchAmmoType(true);
|
||||
int flg = WRF_ALLOWZOOM|WRF_ALLOWUSER1;
|
||||
if ( invoker.nextammo && (CountInv(invoker.nextammo) > 0) )
|
||||
if ( invoker.nextammo && (CountInv(invoker.nextammo) > 0) && (invoker.loadammo != invoker.nextammo) )
|
||||
flg |= WRF_ALLOWRELOAD;
|
||||
A_WeaponReady(flg);
|
||||
}
|
||||
|
|
@ -2531,6 +2545,7 @@ Class Spreadgun : SWWMWeapon
|
|||
ReadyFired:
|
||||
XZW2 Z 1
|
||||
{
|
||||
if ( CountInv(invoker.nextammo) <= 0 ) A_SwitchAmmoType(true);
|
||||
int flg = WRF_ALLOWZOOM|WRF_ALLOWUSER1;
|
||||
if ( invoker.nextammo && (CountInv(invoker.nextammo) > 0) )
|
||||
flg |= WRF_ALLOWRELOAD;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue