Reimplemented P_SetPsprite.
This commit is contained in:
parent
0b88bae458
commit
c9f4620702
14 changed files with 50 additions and 43 deletions
|
|
@ -175,6 +175,12 @@ DPSprite *player_t::FindPSprite(int layer)
|
|||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void P_SetPsprite(player_t *player, PSPLayers id, FState *state, bool pending)
|
||||
{
|
||||
if (player == nullptr) return;
|
||||
player->GetPSprite(id)->SetState(state, pending);
|
||||
}
|
||||
|
||||
DPSprite *player_t::GetPSprite(PSPLayers layer)
|
||||
{
|
||||
AActor *oldcaller = nullptr;
|
||||
|
|
@ -360,7 +366,7 @@ void P_BringUpWeapon (player_t *player)
|
|||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP;
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetReadyState());
|
||||
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetReadyState());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -393,8 +399,8 @@ void P_BringUpWeapon (player_t *player)
|
|||
? WEAPONTOP : WEAPONBOTTOM;
|
||||
// make sure that the previous weapon's flash state is terminated.
|
||||
// When coming here from a weapon drop it may still be active.
|
||||
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(weapon->GetUpState());
|
||||
P_SetPsprite(player, PSP_FLASH, nullptr);
|
||||
P_SetPsprite(player, PSP_WEAPON, weapon->GetUpState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -427,7 +433,7 @@ void P_FireWeapon (player_t *player, FState *state)
|
|||
{
|
||||
state = weapon->GetAtkState(!!player->refire);
|
||||
}
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(state);
|
||||
P_SetPsprite(player, PSP_WEAPON, state);
|
||||
if (!(weapon->WeaponFlags & WIF_NOALERT))
|
||||
{
|
||||
P_NoiseAlert (player->mo, player->mo, false);
|
||||
|
|
@ -465,7 +471,7 @@ void P_FireWeaponAlt (player_t *player, FState *state)
|
|||
state = weapon->GetAltAtkState(!!player->refire);
|
||||
}
|
||||
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(state);
|
||||
P_SetPsprite(player, PSP_WEAPON, state);
|
||||
if (!(weapon->WeaponFlags & WIF_NOALERT))
|
||||
{
|
||||
P_NoiseAlert (player->mo, player->mo, false);
|
||||
|
|
@ -490,7 +496,7 @@ void P_DropWeapon (player_t *player)
|
|||
player->WeaponState &= ~WF_DISABLESWITCH;
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetDownState());
|
||||
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetDownState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -834,7 +840,7 @@ static void P_CheckWeaponButtons (player_t *player)
|
|||
// state, the weapon won't disappear. ;)
|
||||
if (state != nullptr)
|
||||
{
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(state);
|
||||
P_SetPsprite(player, PSP_WEAPON, state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1070,7 +1076,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
|
|||
return 0;
|
||||
}
|
||||
// [RH] Clear the flash state. Only needed for Strife.
|
||||
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
||||
P_SetPsprite(player, PSP_FLASH, nullptr);
|
||||
P_BringUpWeapon (player);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1174,7 +1180,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash)
|
|||
flash = player->ReadyWeapon->FindState(NAME_Flash);
|
||||
}
|
||||
}
|
||||
player->GetPSprite(PSP_FLASH)->SetState(flash);
|
||||
P_SetPsprite(player, PSP_FLASH, flash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue