mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Call GetPSprite here to update the ReadyWeapon but avoid doing so if it
is null TickPSprites will take care of destroying the weapon/flash layers if the ReadyWeapon is null
This commit is contained in:
parent
f14a840777
commit
9ee5e57340
1 changed files with 13 additions and 18 deletions
|
@ -341,16 +341,14 @@ void DPSprite::SetState(FState *newstate, bool pending)
|
||||||
|
|
||||||
void P_BringUpWeapon (player_t *player)
|
void P_BringUpWeapon (player_t *player)
|
||||||
{
|
{
|
||||||
FState *newstate;
|
|
||||||
AWeapon *weapon;
|
AWeapon *weapon;
|
||||||
DPSprite *psweapon = player->GetPSprite(PSP_WEAPON);
|
|
||||||
|
|
||||||
if (player->PendingWeapon == WP_NOCHANGE)
|
if (player->PendingWeapon == WP_NOCHANGE)
|
||||||
{
|
{
|
||||||
if (player->ReadyWeapon != nullptr)
|
if (player->ReadyWeapon != nullptr)
|
||||||
{
|
{
|
||||||
psweapon->y = WEAPONTOP;
|
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP;
|
||||||
psweapon->SetState(player->ReadyWeapon->GetReadyState());
|
player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetReadyState());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -367,28 +365,25 @@ void P_BringUpWeapon (player_t *player)
|
||||||
weapon = weapon->SisterWeapon;
|
weapon = weapon->SisterWeapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player->PendingWeapon = WP_NOCHANGE;
|
||||||
|
player->ReadyWeapon = weapon;
|
||||||
|
player->mo->weaponspecial = 0;
|
||||||
|
|
||||||
if (weapon != nullptr)
|
if (weapon != nullptr)
|
||||||
{
|
{
|
||||||
if (weapon->UpSound)
|
if (weapon->UpSound)
|
||||||
{
|
{
|
||||||
S_Sound (player->mo, CHAN_WEAPON, weapon->UpSound, 1, ATTN_NORM);
|
S_Sound (player->mo, CHAN_WEAPON, weapon->UpSound, 1, ATTN_NORM);
|
||||||
}
|
}
|
||||||
newstate = weapon->GetUpState ();
|
|
||||||
player->refire = 0;
|
player->refire = 0;
|
||||||
}
|
|
||||||
else
|
player->GetPSprite(PSP_WEAPON)->y = player->cheats & CF_INSTANTWEAPSWITCH
|
||||||
{
|
|
||||||
newstate = nullptr;
|
|
||||||
}
|
|
||||||
player->PendingWeapon = WP_NOCHANGE;
|
|
||||||
player->ReadyWeapon = weapon;
|
|
||||||
psweapon->y = player->cheats & CF_INSTANTWEAPSWITCH
|
|
||||||
? WEAPONTOP : WEAPONBOTTOM;
|
? WEAPONTOP : WEAPONBOTTOM;
|
||||||
// make sure that the previous weapon's flash state is terminated.
|
// make sure that the previous weapon's flash state is terminated.
|
||||||
// When coming here from a weapon drop it may still be active.
|
// When coming here from a weapon drop it may still be active.
|
||||||
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
||||||
psweapon->SetState(newstate);
|
player->GetPSprite(PSP_WEAPON)->SetState(weapon->GetUpState());
|
||||||
player->mo->weaponspecial = 0;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue