Revert "- re-added P_SetPSrite."

This reverts commit e6d89b9f71.
This commit is contained in:
Leonard2 2016-05-29 23:21:49 +02:00
parent d933f77bf5
commit 8668719bbc
15 changed files with 48 additions and 55 deletions

View file

@ -81,7 +81,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePistol)
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1)) if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
return 0; return 0;
P_SetPsprite(self->player, PSP_FLASH, weapon->FindState(NAME_Flash), true); self->player->GetPSprite(PSP_FLASH)->SetState(weapon->FindState(NAME_Flash), true);
} }
self->player->mo->PlayAttacking2 (); self->player->mo->PlayAttacking2 ();
@ -273,7 +273,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1)) if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
return 0; return 0;
P_SetPsprite(player, PSP_FLASH, weapon->FindState(NAME_Flash), true); player->GetPSprite(PSP_FLASH)->SetState(weapon->FindState(NAME_Flash), true);
} }
player->mo->PlayAttacking2 (); player->mo->PlayAttacking2 ();
@ -309,7 +309,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2)
{ {
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 2)) if (!weapon->DepleteAmmo (weapon->bAltFire, true, 2))
return 0; return 0;
P_SetPsprite(player, PSP_FLASH, weapon->FindState(NAME_Flash), true); player->GetPSprite(PSP_FLASH)->SetState(weapon->FindState(NAME_Flash), true);
} }
player->mo->PlayAttacking2 (); player->mo->PlayAttacking2 ();
@ -381,13 +381,13 @@ void P_SetSafeFlash(AWeapon *weapon, player_t *player, FState *flashstate, int i
if (flashstate + index < cls->OwnedStates + cls->NumOwnedStates) if (flashstate + index < cls->OwnedStates + cls->NumOwnedStates)
{ {
// we're ok so set the state // we're ok so set the state
P_SetPsprite(player, PSP_FLASH, flashstate + index, true); player->GetPSprite(PSP_FLASH)->SetState(flashstate + index, true);
return; return;
} }
else else
{ {
// oh, no! The state is beyond the end of the state table so use the original flash state. // oh, no! The state is beyond the end of the state table so use the original flash state.
P_SetPsprite(player, PSP_FLASH, flashstate, true); player->GetPSprite(PSP_FLASH)->SetState(flashstate, true);
return; return;
} }
} }
@ -403,7 +403,7 @@ void P_SetSafeFlash(AWeapon *weapon, player_t *player, FState *flashstate, int i
{ // Invalid state. With no index offset, it should at least be valid. { // Invalid state. With no index offset, it should at least be valid.
index = 0; index = 0;
} }
P_SetPsprite(player, PSP_FLASH, flashstate + index, true); player->GetPSprite(PSP_FLASH)->SetState(flashstate + index, true);
} }
// //

View file

@ -146,7 +146,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakRaise)
return 0; return 0;
} }
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP; player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP;
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetReadyState()); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetReadyState());
return 0; return 0;
} }

View file

@ -1158,7 +1158,7 @@ IMPLEMENT_CLASS (APhoenixRodPowered)
void APhoenixRodPowered::EndPowerup () void APhoenixRodPowered::EndPowerup ()
{ {
P_SetPsprite(Owner->player, PSP_WEAPON, SisterWeapon->GetReadyState()); Owner->player->GetPSprite(PSP_WEAPON)->SetState(SisterWeapon->GetReadyState());
DepleteAmmo (bAltFire); DepleteAmmo (bAltFire);
Owner->player->refire = 0; Owner->player->refire = 0;
S_StopSound (Owner, CHAN_WEAPON); S_StopSound (Owner, CHAN_WEAPON);
@ -1308,7 +1308,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2)
flamethrower = static_cast<APhoenixRod *> (player->ReadyWeapon); flamethrower = static_cast<APhoenixRod *> (player->ReadyWeapon);
if (flamethrower == nullptr || --flamethrower->FlameCount == 0) if (flamethrower == nullptr || --flamethrower->FlameCount == 0)
{ // Out of flame { // Out of flame
P_SetPsprite(player, PSP_WEAPON, flamethrower->FindState("Powerdown")); player->GetPSprite(PSP_WEAPON)->SetState(flamethrower->FindState("Powerdown"));
player->refire = 0; player->refire = 0;
S_StopSound (self, CHAN_WEAPON); S_StopSound (self, CHAN_WEAPON);
return 0; return 0;

View file

@ -92,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
if (weapon != nullptr) if (weapon != nullptr)
{ {
FState * newstate = weapon->FindState("Drain"); FState * newstate = weapon->FindState("Drain");
if (newstate != nullptr) P_SetPsprite(player, PSP_WEAPON, newstate); if (newstate != nullptr) player->GetPSprite(PSP_WEAPON)->SetState(newstate);
} }
} }
if (weapon != nullptr) if (weapon != nullptr)
@ -187,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheckBlink)
{ {
if (!--self->weaponspecial) if (!--self->weaponspecial)
{ {
P_SetPsprite(self->player, PSP_WEAPON, self->player->ReadyWeapon->FindState ("Blink")); self->player->GetPSprite(PSP_WEAPON)->SetState(self->player->ReadyWeapon->FindState ("Blink"));
self->weaponspecial = (pr_blink()+50)>>2; self->weaponspecial = (pr_blink()+50)>>2;
} }
else else

View file

@ -76,7 +76,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady)
} }
if (player->ReadyWeapon->Ammo1->Amount) if (player->ReadyWeapon->Ammo1->Amount)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("ReadyGlow")); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("ReadyGlow"));
} }
else else
{ {
@ -103,7 +103,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG)
} }
if (player->ReadyWeapon->Ammo1->Amount <= 0) if (player->ReadyWeapon->Ammo1->Amount <= 0)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("Ready")); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("Ready"));
} }
else else
{ {
@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUp)
} }
if (player->ReadyWeapon->Ammo1->Amount) if (player->ReadyWeapon->Ammo1->Amount)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("SelectGlow")); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("SelectGlow"));
} }
else else
{ {
@ -157,7 +157,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUpG)
} }
if (player->ReadyWeapon->Ammo1->Amount <= 0) if (player->ReadyWeapon->Ammo1->Amount <= 0)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("Select")); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("Select"));
} }
else else
{ {
@ -184,7 +184,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckAtk)
} }
if (player->ReadyWeapon->Ammo1->Amount) if (player->ReadyWeapon->Ammo1->Amount)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("FireGlow")); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("FireGlow"));
} }
return 0; return 0;
} }
@ -273,7 +273,7 @@ axedone:
(!(weapon->WeaponFlags & WIF_PRIMARY_USES_BOTH) || (!(weapon->WeaponFlags & WIF_PRIMARY_USES_BOTH) ||
weapon->Ammo2 == nullptr || weapon->Ammo2->Amount == 0)) weapon->Ammo2 == nullptr || weapon->Ammo2->Amount == 0))
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("Fire") + 5); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("Fire") + 5);
} }
} }
} }

View file

@ -120,7 +120,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
if (pmo->weaponspecial >= 3) if (pmo->weaponspecial >= 3)
{ {
pmo->weaponspecial = 0; pmo->weaponspecial = 0;
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState("Fire2")); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState("Fire2"));
S_Sound (pmo, CHAN_VOICE, "*fistgrunt", 1, ATTN_NORM); S_Sound (pmo, CHAN_VOICE, "*fistgrunt", 1, ATTN_NORM);
} }
return 0; return 0;

View file

@ -39,7 +39,7 @@ void APigPlayer::MorphPlayerThink ()
{ // Snout sniff { // Snout sniff
if (player->ReadyWeapon != nullptr) if (player->ReadyWeapon != nullptr)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState("Grunt")); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState("Grunt"));
} }
S_Sound (this, CHAN_VOICE, "PigActive1", 1, ATTN_NORM); // snort S_Sound (this, CHAN_VOICE, "PigActive1", 1, ATTN_NORM); // snort
return; return;

View file

@ -1131,7 +1131,7 @@ void APowerWeaponLevel2::InitEffect ()
if (weapon->GetReadyState() != sister->GetReadyState()) if (weapon->GetReadyState() != sister->GetReadyState())
{ {
P_SetPsprite(Owner->player, PSP_WEAPON, sister->GetReadyState()); Owner->player->GetPSprite(PSP_WEAPON)->SetState(sister->GetReadyState());
} }
} }
@ -1305,9 +1305,9 @@ void APowerTargeter::InitEffect ()
if (state != nullptr) if (state != nullptr)
{ {
P_SetPsprite(player, PSP_TARGETCENTER, state + 0); player->GetPSprite(PSP_TARGETCENTER)->SetState(state + 0);
P_SetPsprite(player, PSP_TARGETLEFT, state + 1); player->GetPSprite(PSP_TARGETLEFT)->SetState(state + 1);
P_SetPsprite(player, PSP_TARGETRIGHT, state + 2); player->GetPSprite(PSP_TARGETRIGHT)->SetState(state + 2);
} }
player->GetPSprite(PSP_TARGETCENTER)->x = (160-3); player->GetPSprite(PSP_TARGETCENTER)->x = (160-3);
@ -1346,13 +1346,13 @@ void APowerTargeter::DoEffect ()
{ {
if (EffectTics & 32) if (EffectTics & 32)
{ {
P_SetPsprite(player, PSP_TARGETRIGHT, nullptr); player->GetPSprite(PSP_TARGETRIGHT)->SetState(nullptr);
P_SetPsprite(player, PSP_TARGETLEFT, state + 1); player->GetPSprite(PSP_TARGETLEFT)->SetState(state + 1);
} }
else if (EffectTics & 16) else if (EffectTics & 16)
{ {
P_SetPsprite(player, PSP_TARGETRIGHT, state + 2); player->GetPSprite(PSP_TARGETRIGHT)->SetState(state + 2);
P_SetPsprite(player, PSP_TARGETLEFT, nullptr); player->GetPSprite(PSP_TARGETLEFT)->SetState(nullptr);
} }
} }
} }
@ -1364,9 +1364,9 @@ void APowerTargeter::EndEffect ()
Super::EndEffect(); Super::EndEffect();
if (Owner != nullptr && Owner->player != nullptr) if (Owner != nullptr && Owner->player != nullptr)
{ {
P_SetPsprite (Owner->player, PSP_TARGETCENTER, nullptr); Owner->player->GetPSprite(PSP_TARGETCENTER)->SetState(nullptr);
P_SetPsprite (Owner->player, PSP_TARGETLEFT, nullptr); Owner->player->GetPSprite(PSP_TARGETLEFT)->SetState(nullptr);
P_SetPsprite (Owner->player, PSP_TARGETRIGHT, nullptr); Owner->player->GetPSprite(PSP_TARGETRIGHT)->SetState(nullptr);
} }
} }

View file

@ -352,8 +352,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns)
if (self->player != nullptr && self->player->mo == self) if (self->player != nullptr && self->player->mo == self)
{ {
P_SetPsprite(self->player, PSP_WEAPON, self->FindState("FireHands")); self->player->GetPSprite(PSP_WEAPON)->SetState(self->FindState("FireHands"));
P_SetPsprite(self->player, PSP_FLASH, nullptr); self->player->GetPSprite(PSP_FLASH)->SetState(nullptr);
self->player->ReadyWeapon = nullptr; self->player->ReadyWeapon = nullptr;
self->player->PendingWeapon = WP_NOCHANGE; self->player->PendingWeapon = WP_NOCHANGE;
self->player->playerstate = PST_LIVE; self->player->playerstate = PST_LIVE;

View file

@ -219,7 +219,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearFlash)
if (player == nullptr) if (player == nullptr)
return 0; return 0;
P_SetPsprite (player, PSP_FLASH, nullptr); player->GetPSprite(PSP_FLASH)->SetState(nullptr);
return 0; return 0;
} }
@ -235,7 +235,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShowElectricFlash)
if (self->player != nullptr) if (self->player != nullptr)
{ {
P_SetPsprite (self->player, PSP_FLASH, self->player->ReadyWeapon->FindState(NAME_Flash)); self->player->GetPSprite(PSP_FLASH)->SetState(self->player->ReadyWeapon->FindState(NAME_Flash));
} }
return 0; return 0;
} }
@ -707,7 +707,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade)
if (!weapon->DepleteAmmo (weapon->bAltFire)) if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0; return 0;
P_SetPsprite (player, PSP_FLASH, flash, true); player->GetPSprite(PSP_FLASH)->SetState(flash, true);
if (grenadetype != nullptr) if (grenadetype != nullptr)
{ {

View file

@ -345,7 +345,7 @@ void cht_DoCheat (player_t *player, int cheat)
player->mo->DamageType = NAME_None; player->mo->DamageType = NAME_None;
if (player->ReadyWeapon != nullptr) if (player->ReadyWeapon != nullptr)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetUpState()); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetUpState());
} }
if (player->morphTics > 0) if (player->morphTics > 0)
@ -934,8 +934,8 @@ void cht_Take (player_t *player, const char *name, int amount)
player->ReadyWeapon = nullptr; player->ReadyWeapon = nullptr;
player->PendingWeapon = WP_NOCHANGE; player->PendingWeapon = WP_NOCHANGE;
P_SetPsprite(player, PSP_WEAPON, nullptr); player->GetPSprite(PSP_WEAPON)->SetState(nullptr);
P_SetPsprite(player, PSP_FLASH, nullptr); player->GetPSprite(PSP_FLASH)->SetState(nullptr);
} }
} }

View file

@ -1001,8 +1001,8 @@ void AActor::ClearInventory()
{ {
player->ReadyWeapon = nullptr; player->ReadyWeapon = nullptr;
player->PendingWeapon = WP_NOCHANGE; player->PendingWeapon = WP_NOCHANGE;
P_SetPsprite(player, PSP_WEAPON, nullptr); player->GetPSprite(PSP_WEAPON)->SetState(nullptr);
P_SetPsprite(player, PSP_FLASH, nullptr); player->GetPSprite(PSP_FLASH)->SetState(nullptr);
} }
} }

View file

@ -311,12 +311,6 @@ void DPSprite::SetState(FState *newstate, bool pending)
return; return;
} }
void P_SetPsprite(player_t *player, PSPLayers id, FState *state, bool pending)
{
if (player == nullptr) return;
player->GetPSprite(id)->SetState(state, pending);
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// PROC P_BringUpWeapon // PROC P_BringUpWeapon
@ -373,7 +367,7 @@ void P_BringUpWeapon (player_t *player)
? 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.
P_SetPsprite(player, PSP_FLASH, nullptr); player->GetPSprite(PSP_FLASH)->SetState(nullptr);
psweapon->SetState(newstate); psweapon->SetState(newstate);
player->mo->weaponspecial = 0; player->mo->weaponspecial = 0;
} }
@ -407,7 +401,7 @@ void P_FireWeapon (player_t *player, FState *state)
{ {
state = weapon->GetAtkState(!!player->refire); state = weapon->GetAtkState(!!player->refire);
} }
P_SetPsprite(player, PSP_WEAPON, state); player->GetPSprite(PSP_WEAPON)->SetState(state);
if (!(weapon->WeaponFlags & WIF_NOALERT)) if (!(weapon->WeaponFlags & WIF_NOALERT))
{ {
P_NoiseAlert (player->mo, player->mo, false); P_NoiseAlert (player->mo, player->mo, false);
@ -445,7 +439,7 @@ void P_FireWeaponAlt (player_t *player, FState *state)
state = weapon->GetAltAtkState(!!player->refire); state = weapon->GetAltAtkState(!!player->refire);
} }
P_SetPsprite(player, PSP_WEAPON, state); player->GetPSprite(PSP_WEAPON)->SetState(state);
if (!(weapon->WeaponFlags & WIF_NOALERT)) if (!(weapon->WeaponFlags & WIF_NOALERT))
{ {
P_NoiseAlert (player->mo, player->mo, false); P_NoiseAlert (player->mo, player->mo, false);
@ -470,7 +464,7 @@ void P_DropWeapon (player_t *player)
player->WeaponState &= ~WF_DISABLESWITCH; player->WeaponState &= ~WF_DISABLESWITCH;
if (player->ReadyWeapon != nullptr) if (player->ReadyWeapon != nullptr)
{ {
P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetDownState()); player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetDownState());
} }
} }
@ -814,7 +808,7 @@ static void P_CheckWeaponButtons (player_t *player)
// state, the weapon won't disappear. ;) // state, the weapon won't disappear. ;)
if (state != nullptr) if (state != nullptr)
{ {
P_SetPsprite(player, PSP_WEAPON, state); player->GetPSprite(PSP_WEAPON)->SetState(state);
return; return;
} }
} }
@ -1045,7 +1039,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
return 0; return 0;
} }
// [RH] Clear the flash state. Only needed for Strife. // [RH] Clear the flash state. Only needed for Strife.
P_SetPsprite(player, PSP_FLASH, nullptr); player->GetPSprite(PSP_FLASH)->SetState(nullptr);
P_BringUpWeapon (player); P_BringUpWeapon (player);
return 0; return 0;
} }
@ -1152,7 +1146,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash)
flash = player->ReadyWeapon->FindState(NAME_Flash); flash = player->ReadyWeapon->FindState(NAME_Flash);
} }
} }
P_SetPsprite(player, PSP_FLASH, flash); player->GetPSprite(PSP_FLASH)->SetState(flash);
return 0; return 0;
} }

View file

@ -102,7 +102,6 @@ private:
void P_NewPspriteTick(); void P_NewPspriteTick();
void P_CalcSwing (player_t *player); void P_CalcSwing (player_t *player);
void P_SetPsprite(player_t *player, PSPLayers id, FState *state, bool pending = false);
void P_BringUpWeapon (player_t *player); void P_BringUpWeapon (player_t *player);
void P_FireWeapon (player_t *player); void P_FireWeapon (player_t *player);
void P_DropWeapon (player_t *player); void P_DropWeapon (player_t *player);

View file

@ -1405,7 +1405,7 @@ void APlayerPawn::ActivateMorphWeapon ()
pspr->SetState(nullptr); pspr->SetState(nullptr);
} }
} }
P_SetPsprite(player, PSP_FLASH, nullptr); player->GetPSprite(PSP_FLASH)->SetState(nullptr);
player->PendingWeapon = WP_NOCHANGE; player->PendingWeapon = WP_NOCHANGE;
} }