mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
Make sure never to call GetPSprite when the ReadyWeapon is null
This commit is contained in:
parent
9ee5e57340
commit
8244d2c844
5 changed files with 28 additions and 26 deletions
|
@ -271,9 +271,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
|
|||
{
|
||||
if (!weapon->DepleteAmmo (weapon->bAltFire))
|
||||
return 0;
|
||||
|
||||
player->GetPSprite(PSP_WEAPON)->x = ((pr_gatk() & 3) - 2);
|
||||
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP + (pr_gatk() & 3);
|
||||
}
|
||||
player->GetPSprite(PSP_WEAPON)->x = ((pr_gatk()&3)-2);
|
||||
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP + (pr_gatk()&3);
|
||||
Angle = self->Angles.Yaw;
|
||||
if (power)
|
||||
{
|
||||
|
@ -440,9 +441,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1)
|
|||
{
|
||||
if (!weapon->DepleteAmmo(weapon->bAltFire))
|
||||
return 0;
|
||||
|
||||
player->GetPSprite(PSP_WEAPON)->x = ((pr_maceatk() & 3) - 2);
|
||||
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP + (pr_maceatk() & 3);
|
||||
}
|
||||
player->GetPSprite(PSP_WEAPON)->x = ((pr_maceatk() & 3) - 2);
|
||||
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP + (pr_maceatk() & 3);
|
||||
ball = P_SpawnPlayerMissile(self, PClass::FindActor("MaceFX1"), self->Angles.Yaw + (((pr_maceatk() & 7) - 4) * (360. / 256)));
|
||||
if (ball)
|
||||
{
|
||||
|
@ -1158,11 +1160,11 @@ IMPLEMENT_CLASS (APhoenixRodPowered)
|
|||
|
||||
void APhoenixRodPowered::EndPowerup ()
|
||||
{
|
||||
Owner->player->GetPSprite(PSP_WEAPON)->SetState(SisterWeapon->GetReadyState());
|
||||
DepleteAmmo (bAltFire);
|
||||
Owner->player->refire = 0;
|
||||
S_StopSound (Owner, CHAN_WEAPON);
|
||||
Owner->player->ReadyWeapon = SisterWeapon;
|
||||
Owner->player->GetPSprite(PSP_WEAPON)->SetState(SisterWeapon->GetReadyState());
|
||||
}
|
||||
|
||||
class APhoenixFX1 : public AActor
|
||||
|
|
|
@ -934,8 +934,6 @@ void cht_Take (player_t *player, const char *name, int amount)
|
|||
|
||||
player->ReadyWeapon = nullptr;
|
||||
player->PendingWeapon = WP_NOCHANGE;
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(nullptr);
|
||||
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1001,8 +1001,6 @@ void AActor::ClearInventory()
|
|||
{
|
||||
player->ReadyWeapon = nullptr;
|
||||
player->PendingWeapon = WP_NOCHANGE;
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(nullptr);
|
||||
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1031,6 +1031,11 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
if (nullptr == player->ReadyWeapon)
|
||||
{
|
||||
P_BringUpWeapon(player);
|
||||
return 0;
|
||||
}
|
||||
psp = player->GetPSprite(PSP_WEAPON);
|
||||
if (player->morphTics || player->cheats & CF_INSTANTWEAPSWITCH)
|
||||
{
|
||||
|
@ -1084,6 +1089,10 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
|
|||
P_DropWeapon(player);
|
||||
return 0;
|
||||
}
|
||||
if (player->ReadyWeapon == nullptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
psp = player->GetPSprite(PSP_WEAPON);
|
||||
psp->y -= RAISESPEED;
|
||||
if (psp->y > WEAPONTOP)
|
||||
|
@ -1091,14 +1100,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
|
|||
return 0;
|
||||
}
|
||||
psp->y = WEAPONTOP;
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
psp->SetState(player->ReadyWeapon->GetReadyState());
|
||||
}
|
||||
else
|
||||
{
|
||||
psp->SetState(nullptr);
|
||||
}
|
||||
psp->SetState(player->ReadyWeapon->GetReadyState());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1376,14 +1376,16 @@ void APlayerPawn::MorphPlayerThink ()
|
|||
void APlayerPawn::ActivateMorphWeapon ()
|
||||
{
|
||||
PClassActor *morphweapon = PClass::FindActor (MorphWeapon);
|
||||
DPSprite *pspr = player->GetPSprite(PSP_WEAPON);
|
||||
player->PendingWeapon = WP_NOCHANGE;
|
||||
pspr->y = WEAPONTOP;
|
||||
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP;
|
||||
}
|
||||
|
||||
if (morphweapon == nullptr || !morphweapon->IsDescendantOf (RUNTIME_CLASS(AWeapon)))
|
||||
{ // No weapon at all while morphed!
|
||||
player->ReadyWeapon = nullptr;
|
||||
pspr->SetState(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1398,14 +1400,14 @@ void APlayerPawn::ActivateMorphWeapon ()
|
|||
}
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
pspr->SetState(player->ReadyWeapon->GetReadyState());
|
||||
}
|
||||
else
|
||||
{
|
||||
pspr->SetState(nullptr);
|
||||
player->GetPSprite(PSP_WEAPON)->SetState(player->ReadyWeapon->GetReadyState());
|
||||
}
|
||||
}
|
||||
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
||||
|
||||
if (player->ReadyWeapon != nullptr)
|
||||
{
|
||||
player->GetPSprite(PSP_FLASH)->SetState(nullptr);
|
||||
}
|
||||
|
||||
player->PendingWeapon = WP_NOCHANGE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue