mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- re-added P_SetPSprite.
For debugging purposes it's better to have this as a function.
This commit is contained in:
parent
f184438032
commit
e6d89b9f71
15 changed files with 55 additions and 48 deletions
|
@ -81,7 +81,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePistol)
|
|||
if (!weapon->DepleteAmmo (weapon->bAltFire, true, 1))
|
||||
return 0;
|
||||
|
||||
self->player->GetPSprite(ps_flash)->SetState(weapon->FindState(NAME_Flash), true);
|
||||
P_SetPsprite(self->player, ps_flash, 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;
|
||||
player->GetPSprite(ps_flash)->SetState(weapon->FindState(NAME_Flash), true);
|
||||
P_SetPsprite(player, ps_flash, 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;
|
||||
player->GetPSprite(ps_flash)->SetState(weapon->FindState(NAME_Flash), true);
|
||||
P_SetPsprite(player, ps_flash, 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
|
||||
player->GetPSprite(ps_flash)->SetState(flashstate + index, true);
|
||||
P_SetPsprite(player, ps_flash, flashstate + index, true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// oh, no! The state is beyond the end of the state table so use the original flash state.
|
||||
player->GetPSprite(ps_flash)->SetState(flashstate, true);
|
||||
P_SetPsprite(player, ps_flash, 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;
|
||||
}
|
||||
player->GetPSprite(ps_flash)->SetState(flashstate + index, true);
|
||||
P_SetPsprite(player, ps_flash, flashstate + index, true);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -146,7 +146,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakRaise)
|
|||
return 0;
|
||||
}
|
||||
player->GetPSprite(ps_weapon)->y = WEAPONTOP;
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->GetReadyState());
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->GetReadyState());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1158,7 +1158,7 @@ IMPLEMENT_CLASS (APhoenixRodPowered)
|
|||
|
||||
void APhoenixRodPowered::EndPowerup ()
|
||||
{
|
||||
Owner->player->GetPSprite(ps_weapon)->SetState(SisterWeapon->GetReadyState());
|
||||
P_SetPsprite(Owner->player, ps_weapon, 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<APhoenixRod *> (player->ReadyWeapon);
|
||||
if (flamethrower == nullptr || --flamethrower->FlameCount == 0)
|
||||
{ // Out of flame
|
||||
player->GetPSprite(ps_weapon)->SetState(flamethrower->FindState("Powerdown"));
|
||||
P_SetPsprite(player, ps_weapon, flamethrower->FindState("Powerdown"));
|
||||
player->refire = 0;
|
||||
S_StopSound (self, CHAN_WEAPON);
|
||||
return 0;
|
||||
|
|
|
@ -92,7 +92,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
|
|||
if (weapon != nullptr)
|
||||
{
|
||||
FState * newstate = weapon->FindState("Drain");
|
||||
if (newstate != nullptr) player->GetPSprite(ps_weapon)->SetState(newstate);
|
||||
if (newstate != nullptr) P_SetPsprite(player, ps_weapon, newstate);
|
||||
}
|
||||
}
|
||||
if (weapon != nullptr)
|
||||
|
@ -187,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheckBlink)
|
|||
{
|
||||
if (!--self->weaponspecial)
|
||||
{
|
||||
self->player->GetPSprite(ps_weapon)->SetState(self->player->ReadyWeapon->FindState ("Blink"));
|
||||
P_SetPsprite(self->player, ps_weapon, self->player->ReadyWeapon->FindState ("Blink"));
|
||||
self->weaponspecial = (pr_blink()+50)>>2;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -76,7 +76,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady)
|
|||
}
|
||||
if (player->ReadyWeapon->Ammo1->Amount)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState ("ReadyGlow"));
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState ("ReadyGlow"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG)
|
|||
}
|
||||
if (player->ReadyWeapon->Ammo1->Amount <= 0)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState ("Ready"));
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState ("Ready"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUp)
|
|||
}
|
||||
if (player->ReadyWeapon->Ammo1->Amount)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState ("SelectGlow"));
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState ("SelectGlow"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUpG)
|
|||
}
|
||||
if (player->ReadyWeapon->Ammo1->Amount <= 0)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState ("Select"));
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState ("Select"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckAtk)
|
|||
}
|
||||
if (player->ReadyWeapon->Ammo1->Amount)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState ("FireGlow"));
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState ("FireGlow"));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ axedone:
|
|||
(!(weapon->WeaponFlags & WIF_PRIMARY_USES_BOTH) ||
|
||||
weapon->Ammo2 == nullptr || weapon->Ammo2->Amount == 0))
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState ("Fire") + 5);
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState ("Fire") + 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
|
|||
if (pmo->weaponspecial >= 3)
|
||||
{
|
||||
pmo->weaponspecial = 0;
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState("Fire2"));
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState("Fire2"));
|
||||
S_Sound (pmo, CHAN_VOICE, "*fistgrunt", 1, ATTN_NORM);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -39,7 +39,7 @@ void APigPlayer::MorphPlayerThink ()
|
|||
{ // Snout sniff
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->FindState("Grunt"));
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState("Grunt"));
|
||||
}
|
||||
S_Sound (this, CHAN_VOICE, "PigActive1", 1, ATTN_NORM); // snort
|
||||
return;
|
||||
|
|
|
@ -1131,7 +1131,7 @@ void APowerWeaponLevel2::InitEffect ()
|
|||
|
||||
if (weapon->GetReadyState() != sister->GetReadyState())
|
||||
{
|
||||
Owner->player->GetPSprite(ps_weapon)->SetState(sister->GetReadyState());
|
||||
P_SetPsprite(Owner->player, ps_weapon, sister->GetReadyState());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1305,9 +1305,9 @@ void APowerTargeter::InitEffect ()
|
|||
|
||||
if (state != nullptr)
|
||||
{
|
||||
player->GetPSprite(ps_targetcenter)->SetState(state + 0);
|
||||
player->GetPSprite(ps_targetleft)->SetState(state + 1);
|
||||
player->GetPSprite(ps_targetright)->SetState(state + 2);
|
||||
P_SetPsprite(player, ps_targetcenter, state + 0);
|
||||
P_SetPsprite(player, ps_targetleft, state + 1);
|
||||
P_SetPsprite(player, ps_targetright, state + 2);
|
||||
}
|
||||
|
||||
player->GetPSprite(ps_targetcenter)->x = (160-3);
|
||||
|
@ -1346,13 +1346,13 @@ void APowerTargeter::DoEffect ()
|
|||
{
|
||||
if (EffectTics & 32)
|
||||
{
|
||||
player->GetPSprite(ps_targetright)->SetState(nullptr);
|
||||
player->GetPSprite(ps_targetleft)->SetState(state + 1);
|
||||
P_SetPsprite(player, ps_targetright, nullptr);
|
||||
P_SetPsprite(player, ps_targetleft, state + 1);
|
||||
}
|
||||
else if (EffectTics & 16)
|
||||
{
|
||||
player->GetPSprite(ps_targetright)->SetState(state + 2);
|
||||
player->GetPSprite(ps_targetleft)->SetState(nullptr);
|
||||
P_SetPsprite(player, ps_targetright, state + 2);
|
||||
P_SetPsprite(player, ps_targetleft, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1364,9 +1364,9 @@ void APowerTargeter::EndEffect ()
|
|||
Super::EndEffect();
|
||||
if (Owner != nullptr && Owner->player != nullptr)
|
||||
{
|
||||
Owner->player->GetPSprite(ps_targetcenter)->SetState(nullptr);
|
||||
Owner->player->GetPSprite(ps_targetleft)->SetState(nullptr);
|
||||
Owner->player->GetPSprite(ps_targetright)->SetState(nullptr);
|
||||
P_SetPsprite (Owner->player, ps_targetcenter, nullptr);
|
||||
P_SetPsprite (Owner->player, ps_targetleft, nullptr);
|
||||
P_SetPsprite (Owner->player, ps_targetright, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -352,8 +352,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns)
|
|||
|
||||
if (self->player != nullptr && self->player->mo == self)
|
||||
{
|
||||
self->player->GetPSprite(ps_weapon)->SetState(self->FindState("FireHands"));
|
||||
self->player->GetPSprite(ps_flash)->SetState(nullptr);
|
||||
P_SetPsprite(self->player, ps_weapon, self->FindState("FireHands"));
|
||||
P_SetPsprite(self->player, ps_flash, nullptr);
|
||||
self->player->ReadyWeapon = nullptr;
|
||||
self->player->PendingWeapon = WP_NOCHANGE;
|
||||
self->player->playerstate = PST_LIVE;
|
||||
|
|
|
@ -219,7 +219,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearFlash)
|
|||
if (player == nullptr)
|
||||
return 0;
|
||||
|
||||
player->GetPSprite(ps_flash)->SetState(nullptr);
|
||||
P_SetPsprite (player, ps_flash, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShowElectricFlash)
|
|||
|
||||
if (self->player != nullptr)
|
||||
{
|
||||
self->player->GetPSprite(ps_flash)->SetState(self->player->ReadyWeapon->FindState(NAME_Flash));
|
||||
P_SetPsprite (self->player, ps_flash, 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;
|
||||
|
||||
player->GetPSprite(ps_flash)->SetState(flash, true);
|
||||
P_SetPsprite (player, ps_flash, flash, true);
|
||||
|
||||
if (grenadetype != nullptr)
|
||||
{
|
||||
|
|
|
@ -345,7 +345,7 @@ void cht_DoCheat (player_t *player, int cheat)
|
|||
player->mo->DamageType = NAME_None;
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->GetUpState());
|
||||
P_SetPsprite(player, ps_weapon, 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;
|
||||
player->GetPSprite(ps_weapon)->SetState(nullptr);
|
||||
player->GetPSprite(ps_flash)->SetState(nullptr);
|
||||
P_SetPsprite(player, ps_weapon, nullptr);
|
||||
P_SetPsprite(player, ps_flash, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1001,8 +1001,8 @@ void AActor::ClearInventory()
|
|||
{
|
||||
player->ReadyWeapon = nullptr;
|
||||
player->PendingWeapon = WP_NOCHANGE;
|
||||
player->GetPSprite(ps_weapon)->SetState(nullptr);
|
||||
player->GetPSprite(ps_flash)->SetState(nullptr);
|
||||
P_SetPsprite(player, ps_weapon, nullptr);
|
||||
P_SetPsprite(player, ps_flash, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -312,6 +312,12 @@ void DPSprite::SetState(FState *newstate, bool pending)
|
|||
return;
|
||||
}
|
||||
|
||||
void P_SetPsprite(player_t *player, psprnum_t id, FState *state, bool pending)
|
||||
{
|
||||
if (player == nullptr) return;
|
||||
player->GetPSprite(id)->SetState(state, pending);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// PROC P_BringUpWeapon
|
||||
|
@ -369,7 +375,7 @@ void P_BringUpWeapon (player_t *player)
|
|||
psweapon->SetState(newstate);
|
||||
// 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(ps_flash)->SetState(nullptr);
|
||||
P_SetPsprite(player, ps_flash, nullptr);
|
||||
player->mo->weaponspecial = 0;
|
||||
}
|
||||
|
||||
|
@ -402,7 +408,7 @@ void P_FireWeapon (player_t *player, FState *state)
|
|||
{
|
||||
state = weapon->GetAtkState(!!player->refire);
|
||||
}
|
||||
player->GetPSprite(ps_weapon)->SetState(state);
|
||||
P_SetPsprite(player, ps_weapon, state);
|
||||
if (!(weapon->WeaponFlags & WIF_NOALERT))
|
||||
{
|
||||
P_NoiseAlert (player->mo, player->mo, false);
|
||||
|
@ -440,7 +446,7 @@ void P_FireWeaponAlt (player_t *player, FState *state)
|
|||
state = weapon->GetAltAtkState(!!player->refire);
|
||||
}
|
||||
|
||||
player->GetPSprite(ps_weapon)->SetState(state);
|
||||
P_SetPsprite(player, ps_weapon, state);
|
||||
if (!(weapon->WeaponFlags & WIF_NOALERT))
|
||||
{
|
||||
P_NoiseAlert (player->mo, player->mo, false);
|
||||
|
@ -465,7 +471,7 @@ void P_DropWeapon (player_t *player)
|
|||
player->WeaponState &= ~WF_DISABLESWITCH;
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(player->ReadyWeapon->GetDownState());
|
||||
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->GetDownState());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -809,7 +815,7 @@ static void P_CheckWeaponButtons (player_t *player)
|
|||
// state, the weapon won't disappear. ;)
|
||||
if (state != nullptr)
|
||||
{
|
||||
player->GetPSprite(ps_weapon)->SetState(state);
|
||||
P_SetPsprite(player, ps_weapon, state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1011,7 +1017,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
|
|||
return 0;
|
||||
}
|
||||
// [RH] Clear the flash state. Only needed for Strife.
|
||||
player->GetPSprite(ps_flash)->SetState(nullptr);
|
||||
P_SetPsprite(player, ps_flash, nullptr);
|
||||
P_BringUpWeapon (player);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1118,7 +1124,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash)
|
|||
flash = player->ReadyWeapon->FindState(NAME_Flash);
|
||||
}
|
||||
}
|
||||
player->GetPSprite(ps_flash)->SetState(flash);
|
||||
P_SetPsprite(player, ps_flash, flash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ private:
|
|||
|
||||
void P_NewPspriteTick();
|
||||
void P_CalcSwing (player_t *player);
|
||||
void P_SetPsprite(player_t *player, psprnum_t id, FState *state, bool pending = false);
|
||||
void P_BringUpWeapon (player_t *player);
|
||||
void P_FireWeapon (player_t *player);
|
||||
void P_DropWeapon (player_t *player);
|
||||
|
|
|
@ -1405,7 +1405,7 @@ void APlayerPawn::ActivateMorphWeapon ()
|
|||
pspr->SetState(nullptr);
|
||||
}
|
||||
}
|
||||
player->GetPSprite(ps_flash)->SetState(nullptr);
|
||||
P_SetPsprite(player, ps_flash, nullptr);
|
||||
|
||||
player->PendingWeapon = WP_NOCHANGE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue