From 8668719bbcfaeac16438bd529ab61f696cb562c0 Mon Sep 17 00:00:00 2001 From: Leonard2 Date: Sun, 29 May 2016 23:21:49 +0200 Subject: [PATCH] Revert "- re-added P_SetPSrite." This reverts commit e6d89b9f71aa840a2995ff00d40d5541be6ed25a. --- src/g_doom/a_doomweaps.cpp | 12 ++++++------ src/g_heretic/a_chicken.cpp | 2 +- src/g_heretic/a_hereticweaps.cpp | 4 ++-- src/g_hexen/a_clericstaff.cpp | 4 ++-- src/g_hexen/a_fighteraxe.cpp | 12 ++++++------ src/g_hexen/a_fighterplayer.cpp | 2 +- src/g_hexen/a_pig.cpp | 2 +- src/g_shared/a_artifacts.cpp | 22 +++++++++++----------- src/g_strife/a_strifestuff.cpp | 4 ++-- src/g_strife/a_strifeweapons.cpp | 6 +++--- src/m_cheat.cpp | 6 +++--- src/p_mobj.cpp | 4 ++-- src/p_pspr.cpp | 20 +++++++------------- src/p_pspr.h | 1 - src/p_user.cpp | 2 +- 15 files changed, 48 insertions(+), 55 deletions(-) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index c5eb9f1a8..7f1f578ca 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -81,7 +81,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePistol) if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1)) 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 (); @@ -273,7 +273,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun) { if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1)) 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 (); @@ -309,7 +309,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2) { if (!weapon->DepleteAmmo (weapon->bAltFire, true, 2)) 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 (); @@ -381,13 +381,13 @@ void P_SetSafeFlash(AWeapon *weapon, player_t *player, FState *flashstate, int i if (flashstate + index < cls->OwnedStates + cls->NumOwnedStates) { // we're ok so set the state - P_SetPsprite(player, PSP_FLASH, flashstate + index, true); + player->GetPSprite(PSP_FLASH)->SetState(flashstate + index, true); return; } else { // 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; } } @@ -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. index = 0; } - P_SetPsprite(player, PSP_FLASH, flashstate + index, true); + player->GetPSprite(PSP_FLASH)->SetState(flashstate + index, true); } // diff --git a/src/g_heretic/a_chicken.cpp b/src/g_heretic/a_chicken.cpp index b70e4ff08..4e496bb44 100644 --- a/src/g_heretic/a_chicken.cpp +++ b/src/g_heretic/a_chicken.cpp @@ -146,7 +146,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakRaise) return 0; } player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP; - P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetReadyState()); + player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetReadyState()); return 0; } diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 5283c9884..fba33e257 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -1158,7 +1158,7 @@ IMPLEMENT_CLASS (APhoenixRodPowered) void APhoenixRodPowered::EndPowerup () { - P_SetPsprite(Owner->player, PSP_WEAPON, SisterWeapon->GetReadyState()); + Owner->player->GetPSprite(PSP_WEAPON)->SetState(SisterWeapon->GetReadyState()); DepleteAmmo (bAltFire); Owner->player->refire = 0; S_StopSound (Owner, CHAN_WEAPON); @@ -1308,7 +1308,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2) flamethrower = static_cast (player->ReadyWeapon); if (flamethrower == nullptr || --flamethrower->FlameCount == 0) { // Out of flame - P_SetPsprite(player, PSP_WEAPON, flamethrower->FindState("Powerdown")); + player->GetPSprite(PSP_WEAPON)->SetState(flamethrower->FindState("Powerdown")); player->refire = 0; S_StopSound (self, CHAN_WEAPON); return 0; diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index de4e1d75f..c278d8893 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -92,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) if (weapon != nullptr) { 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) @@ -187,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheckBlink) { 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; } else diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index f47ad6a9d..3813e9c3e 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -76,7 +76,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady) } if (player->ReadyWeapon->Ammo1->Amount) { - P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("ReadyGlow")); + player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("ReadyGlow")); } else { @@ -103,7 +103,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG) } 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 { @@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUp) } if (player->ReadyWeapon->Ammo1->Amount) { - P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->FindState ("SelectGlow")); + player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->FindState ("SelectGlow")); } else { @@ -157,7 +157,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUpG) } 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 { @@ -184,7 +184,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckAtk) } 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; } @@ -273,7 +273,7 @@ axedone: (!(weapon->WeaponFlags & WIF_PRIMARY_USES_BOTH) || 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); } } } diff --git a/src/g_hexen/a_fighterplayer.cpp b/src/g_hexen/a_fighterplayer.cpp index 3624ed625..a8e26773b 100644 --- a/src/g_hexen/a_fighterplayer.cpp +++ b/src/g_hexen/a_fighterplayer.cpp @@ -120,7 +120,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack) if (pmo->weaponspecial >= 3) { 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); } return 0; diff --git a/src/g_hexen/a_pig.cpp b/src/g_hexen/a_pig.cpp index ea767dccd..22c83ef3a 100644 --- a/src/g_hexen/a_pig.cpp +++ b/src/g_hexen/a_pig.cpp @@ -39,7 +39,7 @@ void APigPlayer::MorphPlayerThink () { // Snout sniff 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 return; diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index f89c1360d..48214c4c7 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -1131,7 +1131,7 @@ void APowerWeaponLevel2::InitEffect () 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) { - P_SetPsprite(player, PSP_TARGETCENTER, state + 0); - P_SetPsprite(player, PSP_TARGETLEFT, state + 1); - P_SetPsprite(player, PSP_TARGETRIGHT, state + 2); + player->GetPSprite(PSP_TARGETCENTER)->SetState(state + 0); + player->GetPSprite(PSP_TARGETLEFT)->SetState(state + 1); + player->GetPSprite(PSP_TARGETRIGHT)->SetState(state + 2); } player->GetPSprite(PSP_TARGETCENTER)->x = (160-3); @@ -1346,13 +1346,13 @@ void APowerTargeter::DoEffect () { if (EffectTics & 32) { - P_SetPsprite(player, PSP_TARGETRIGHT, nullptr); - P_SetPsprite(player, PSP_TARGETLEFT, state + 1); + player->GetPSprite(PSP_TARGETRIGHT)->SetState(nullptr); + player->GetPSprite(PSP_TARGETLEFT)->SetState(state + 1); } else if (EffectTics & 16) { - P_SetPsprite(player, PSP_TARGETRIGHT, state + 2); - P_SetPsprite(player, PSP_TARGETLEFT, nullptr); + player->GetPSprite(PSP_TARGETRIGHT)->SetState(state + 2); + player->GetPSprite(PSP_TARGETLEFT)->SetState(nullptr); } } } @@ -1364,9 +1364,9 @@ void APowerTargeter::EndEffect () Super::EndEffect(); if (Owner != nullptr && Owner->player != nullptr) { - P_SetPsprite (Owner->player, PSP_TARGETCENTER, nullptr); - P_SetPsprite (Owner->player, PSP_TARGETLEFT, nullptr); - P_SetPsprite (Owner->player, PSP_TARGETRIGHT, nullptr); + Owner->player->GetPSprite(PSP_TARGETCENTER)->SetState(nullptr); + Owner->player->GetPSprite(PSP_TARGETLEFT)->SetState(nullptr); + Owner->player->GetPSprite(PSP_TARGETRIGHT)->SetState(nullptr); } } diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index fd8b797fb..3f444c39b 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -352,8 +352,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns) if (self->player != nullptr && self->player->mo == self) { - P_SetPsprite(self->player, PSP_WEAPON, self->FindState("FireHands")); - P_SetPsprite(self->player, PSP_FLASH, nullptr); + self->player->GetPSprite(PSP_WEAPON)->SetState(self->FindState("FireHands")); + self->player->GetPSprite(PSP_FLASH)->SetState(nullptr); self->player->ReadyWeapon = nullptr; self->player->PendingWeapon = WP_NOCHANGE; self->player->playerstate = PST_LIVE; diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index f81ca79f7..006bc76fa 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -219,7 +219,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearFlash) if (player == nullptr) return 0; - P_SetPsprite (player, PSP_FLASH, nullptr); + player->GetPSprite(PSP_FLASH)->SetState(nullptr); return 0; } @@ -235,7 +235,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShowElectricFlash) 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; } @@ -707,7 +707,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) if (!weapon->DepleteAmmo (weapon->bAltFire)) return 0; - P_SetPsprite (player, PSP_FLASH, flash, true); + player->GetPSprite(PSP_FLASH)->SetState(flash, true); if (grenadetype != nullptr) { diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index d4b0e980f..4197c79b1 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -345,7 +345,7 @@ void cht_DoCheat (player_t *player, int cheat) player->mo->DamageType = NAME_None; if (player->ReadyWeapon != nullptr) { - P_SetPsprite(player, PSP_WEAPON, player->ReadyWeapon->GetUpState()); + player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetUpState()); } if (player->morphTics > 0) @@ -934,8 +934,8 @@ void cht_Take (player_t *player, const char *name, int amount) player->ReadyWeapon = nullptr; player->PendingWeapon = WP_NOCHANGE; - P_SetPsprite(player, PSP_WEAPON, nullptr); - P_SetPsprite(player, PSP_FLASH, nullptr); + player->GetPSprite(PSP_WEAPON)->SetState(nullptr); + player->GetPSprite(PSP_FLASH)->SetState(nullptr); } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 0087d25de..78ee5928c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1001,8 +1001,8 @@ void AActor::ClearInventory() { player->ReadyWeapon = nullptr; player->PendingWeapon = WP_NOCHANGE; - P_SetPsprite(player, PSP_WEAPON, nullptr); - P_SetPsprite(player, PSP_FLASH, nullptr); + player->GetPSprite(PSP_WEAPON)->SetState(nullptr); + player->GetPSprite(PSP_FLASH)->SetState(nullptr); } } diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 02ba29180..84d44c348 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -311,12 +311,6 @@ void DPSprite::SetState(FState *newstate, bool pending) 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 @@ -373,7 +367,7 @@ 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. - P_SetPsprite(player, PSP_FLASH, nullptr); + player->GetPSprite(PSP_FLASH)->SetState(nullptr); psweapon->SetState(newstate); player->mo->weaponspecial = 0; } @@ -407,7 +401,7 @@ void P_FireWeapon (player_t *player, FState *state) { state = weapon->GetAtkState(!!player->refire); } - P_SetPsprite(player, PSP_WEAPON, state); + player->GetPSprite(PSP_WEAPON)->SetState(state); if (!(weapon->WeaponFlags & WIF_NOALERT)) { P_NoiseAlert (player->mo, player->mo, false); @@ -445,7 +439,7 @@ void P_FireWeaponAlt (player_t *player, FState *state) state = weapon->GetAltAtkState(!!player->refire); } - P_SetPsprite(player, PSP_WEAPON, state); + player->GetPSprite(PSP_WEAPON)->SetState(state); if (!(weapon->WeaponFlags & WIF_NOALERT)) { P_NoiseAlert (player->mo, player->mo, false); @@ -470,7 +464,7 @@ void P_DropWeapon (player_t *player) player->WeaponState &= ~WF_DISABLESWITCH; 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. ;) if (state != nullptr) { - P_SetPsprite(player, PSP_WEAPON, state); + player->GetPSprite(PSP_WEAPON)->SetState(state); return; } } @@ -1045,7 +1039,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower) return 0; } // [RH] Clear the flash state. Only needed for Strife. - P_SetPsprite(player, PSP_FLASH, nullptr); + player->GetPSprite(PSP_FLASH)->SetState(nullptr); P_BringUpWeapon (player); return 0; } @@ -1152,7 +1146,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash) flash = player->ReadyWeapon->FindState(NAME_Flash); } } - P_SetPsprite(player, PSP_FLASH, flash); + player->GetPSprite(PSP_FLASH)->SetState(flash); return 0; } diff --git a/src/p_pspr.h b/src/p_pspr.h index edcad9dd6..c3400f43d 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -102,7 +102,6 @@ private: void P_NewPspriteTick(); 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_FireWeapon (player_t *player); void P_DropWeapon (player_t *player); diff --git a/src/p_user.cpp b/src/p_user.cpp index 921702388..8a8f2c6d4 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1405,7 +1405,7 @@ void APlayerPawn::ActivateMorphWeapon () pspr->SetState(nullptr); } } - P_SetPsprite(player, PSP_FLASH, nullptr); + player->GetPSprite(PSP_FLASH)->SetState(nullptr); player->PendingWeapon = WP_NOCHANGE; }