Added to CreateTossable and PowerWeaponLevel2
This commit is contained in:
parent
977b5acbe1
commit
ba9e127e9f
2 changed files with 20 additions and 2 deletions
|
|
@ -1104,6 +1104,7 @@ class PowerWeaponLevel2 : Powerup
|
|||
if (weap.GetReadyState() != ready)
|
||||
{
|
||||
player.ReadyWeapon = sister;
|
||||
player.ReadyWeapon.OnSelect(fromPowerup: true);
|
||||
player.SetPsprite(PSP_WEAPON, ready);
|
||||
}
|
||||
else
|
||||
|
|
@ -1114,11 +1115,13 @@ class PowerWeaponLevel2 : Powerup
|
|||
// If the weapon changes but the state does not, we have to manually change the PSprite's caller here.
|
||||
psp.Caller = sister;
|
||||
player.ReadyWeapon = sister;
|
||||
player.ReadyWeapon.OnSelect(fromPowerup: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something went wrong. Initiate a regular weapon change.
|
||||
player.PendingWeapon = sister;
|
||||
player.PendingWeapon.OnSelect(fromPowerup: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,9 +144,14 @@ class Weapon : StateProvider
|
|||
return -1, 0;
|
||||
}
|
||||
|
||||
virtual void OnSelect() {}
|
||||
|
||||
virtual void OnDeselect() {}
|
||||
// [AA] Called when the weapon is selected, including
|
||||
// PowerWeaponLevel2 activation:
|
||||
virtual void OnSelect(bool fromPowerup = false) {}
|
||||
|
||||
// [AA] Called when the weapon is deselected, including
|
||||
// PowerWeaponLevel2 running out or being tossed:
|
||||
virtual void OnDeselect(bool fromPowerup = false, bool onToss = false) {}
|
||||
|
||||
virtual State GetReadyState ()
|
||||
{
|
||||
|
|
@ -694,6 +699,13 @@ class Weapon : StateProvider
|
|||
{
|
||||
return SisterWeapon.CreateTossable (amt);
|
||||
}
|
||||
|
||||
// [AA] This weapon was selected and its amount is about to become 0:
|
||||
if (Amount == 1 && Owner != NULL && Owner.Player != NULL && Owner.Player.ReadyWeapon == self)
|
||||
{
|
||||
OnDeselect(onToss: true);
|
||||
}
|
||||
|
||||
let copy = Weapon(Super.CreateTossable (-1));
|
||||
|
||||
if (copy != NULL)
|
||||
|
|
@ -872,6 +884,7 @@ class Weapon : StateProvider
|
|||
if (player.PendingWeapon == NULL || player.PendingWeapon == WP_NOCHANGE)
|
||||
{
|
||||
player.refire = 0;
|
||||
OnDeselect(fromPowerup: true);
|
||||
player.ReadyWeapon = SisterWeapon;
|
||||
player.SetPsprite(PSP_WEAPON, SisterWeapon.GetReadyState());
|
||||
}
|
||||
|
|
@ -882,6 +895,7 @@ class Weapon : StateProvider
|
|||
if (psp != null && psp.Caller == player.ReadyWeapon && psp.CurState.InStateSequence(ready))
|
||||
{
|
||||
// If the weapon changes but the state does not, we have to manually change the PSprite's caller here.
|
||||
OnDeselect(fromPowerup: true);
|
||||
psp.Caller = SisterWeapon;
|
||||
player.ReadyWeapon = SisterWeapon;
|
||||
}
|
||||
|
|
@ -890,6 +904,7 @@ class Weapon : StateProvider
|
|||
if (player.PendingWeapon == NULL || player.PendingWeapon == WP_NOCHANGE)
|
||||
{
|
||||
// Something went wrong. Initiate a regular weapon change.
|
||||
OnDeselect(fromPowerup: true);
|
||||
player.refire = 0;
|
||||
player.ReadyWeapon = SisterWeapon;
|
||||
player.SetPsprite(PSP_WEAPON, SisterWeapon.GetReadyState());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue