The targeter layers now use a proper Caller
This will avoid having to check for certain stuff and also allow them to not be destroyed when the ReadyWeapon is null like before
This commit is contained in:
parent
8244d2c844
commit
e1f139ddcd
4 changed files with 33 additions and 19 deletions
|
|
@ -1364,9 +1364,15 @@ void APowerTargeter::EndEffect ()
|
|||
Super::EndEffect();
|
||||
if (Owner != nullptr && Owner->player != nullptr)
|
||||
{
|
||||
Owner->player->GetPSprite(PSP_TARGETCENTER)->SetState(nullptr);
|
||||
Owner->player->GetPSprite(PSP_TARGETLEFT)->SetState(nullptr);
|
||||
Owner->player->GetPSprite(PSP_TARGETRIGHT)->SetState(nullptr);
|
||||
// Calling GetPSprite here could crash if we're creating a new game.
|
||||
// This is because P_SetupLevel nulls the player's mo before destroying
|
||||
// every DThinker which in turn ends up calling this.
|
||||
// However P_SetupLevel is only called after G_NewInit which calls
|
||||
// every player's dtor which destroys all their psprites.
|
||||
DPSprite *pspr;
|
||||
if ((pspr = Owner->player->FindPSprite(PSP_TARGETCENTER)) != nullptr) pspr->SetState(nullptr);
|
||||
if ((pspr = Owner->player->FindPSprite(PSP_TARGETLEFT)) != nullptr) pspr->SetState(nullptr);
|
||||
if ((pspr = Owner->player->FindPSprite(PSP_TARGETRIGHT)) != nullptr) pspr->SetState(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue