Some small swapweapon fixes.

This commit is contained in:
Mari the Deer 2022-09-11 12:35:46 +02:00
commit 136e339d53
2 changed files with 14 additions and 9 deletions

View file

@ -103,12 +103,19 @@ Class SWWMWeapon : Weapon abstract
// if the toucher owns our SwapWeapon, drop it before picking us up
bool swapto = false;
SWWMWeapon sw;
if ( swwm_swapweapons && (sw = HasSwapWeapon(user)) && (user.player.WeaponState&WF_WEAPONSWITCHOK) && !(user.player.WeaponState&WF_DISABLESWITCH) )
State ReadyState = FindState('Ready');
if ( swwm_swapweapons && (sw = HasSwapWeapon(user)) && (user.player.WeaponState&WF_WEAPONSWITCHOK) && !(user.player.WeaponState&WF_DISABLESWITCH) && ReadyState && ReadyState.ValidateSpriteFrame() )
{
// special case, otherwise candy gun won't drop itself
if ( sw is 'CandyGun' ) CandyGun(sw).swapdrop = true;
if ( (sw == user.player.ReadyWeapon) || (sw.SisterWeapon && (sw.SisterWeapon == user.player.ReadyWeapon)) )
swapto = true;
// don't autoswitch just yet (hacky)
if ( swapto )
{
user.player.ReadyWeapon = null;
user.player.PendingWeapon = WP_NOCHANGE;
}
int ngun = sw.Amount;
if ( ngun == 2 )
{
@ -124,6 +131,8 @@ Class SWWMWeapon : Weapon abstract
dg.giveme[1] = SWWMWeapon(sw.CreateTossable(1));
dg.giveme[1].AttachToOwner(dg);
dg.SetPickupState();
dg.bSPECIAL = false;
dg.DropTime = 30;
}
else
{
@ -134,12 +143,8 @@ Class SWWMWeapon : Weapon abstract
d.angle = angle;
d.vel = vel;
d.FloatBobPhase = FloatBobPhase;
}
// don't autoswitch just yet (hacky)
if ( swapto )
{
user.player.ReadyWeapon = null;
user.player.PendingWeapon = WP_NOCHANGE;
d.bSPECIAL = false;
d.DropTime = 30;
}
}
bUsePickup = true;