mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 22:42:57 +00:00
Fixed crashes with the A_CrispyPlayer and A_HandLower action functions
Simply using FindPSprite in those functions wouldn't be enough because if a mod is using the firehands layer when they are called this would go very wrong
This commit is contained in:
parent
3ea70980f9
commit
05d1df3571
2 changed files with 23 additions and 5 deletions
|
@ -378,14 +378,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_CrispyPlayer)
|
|||
|
||||
if (self->player != nullptr && self->player->mo == self)
|
||||
{
|
||||
self->player->playerstate = PST_DEAD;
|
||||
|
||||
DPSprite *psp;
|
||||
psp = self->player->GetPSprite(PSP_STRIFEHANDS);
|
||||
|
||||
FState *firehandslower = self->FindState("FireHandsLower");
|
||||
FState *firehands = self->FindState("FireHands");
|
||||
if (firehandslower != NULL && firehands != NULL && firehands < firehandslower)
|
||||
psp->SetState(psp->GetState() + (firehandslower - firehands));
|
||||
FState *state = psp->GetState();
|
||||
|
||||
if (state != nullptr && firehandslower != nullptr && firehands != nullptr && firehands < firehandslower)
|
||||
{
|
||||
self->player->playerstate = PST_DEAD;
|
||||
psp->SetState(state + (firehandslower - firehands));
|
||||
}
|
||||
else if (state == nullptr)
|
||||
{
|
||||
psp->SetState(nullptr);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -397,13 +405,20 @@ DEFINE_ACTION_FUNCTION(AActor, A_HandLower)
|
|||
if (self->player != nullptr)
|
||||
{
|
||||
DPSprite *psp = self->player->GetPSprite(PSP_STRIFEHANDS);
|
||||
|
||||
if (psp->GetState() == nullptr)
|
||||
{
|
||||
psp->SetState(nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
psp->y += 9;
|
||||
if (psp->y > WEAPONBOTTOM*2)
|
||||
{
|
||||
psp->SetState(nullptr);
|
||||
}
|
||||
|
||||
if (self->player->extralight > 0) self->player->extralight--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -231,6 +231,9 @@ DPSprite *player_t::GetPSprite(PSPLayers layer)
|
|||
}
|
||||
if (layer == PSP_STRIFEHANDS)
|
||||
{
|
||||
// Some of the old hacks rely on this layer coming from the FireHands state.
|
||||
// This is the ONLY time a psprite's state is actually null.
|
||||
pspr->State = nullptr;
|
||||
pspr->y = WEAPONTOP;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue