mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- fixed: When changing weapons due to starting or ending a Tome of Power effect, the PSprite's caller needs to be changed.
In this case the PSprite animation won't be changed, only the ReadyWeapon. But in order to work, the PSprite's caller needs to change as well so that the next weapon check does not fail.
This commit is contained in:
parent
7544adfc91
commit
c150116f79
3 changed files with 29 additions and 2 deletions
|
@ -1127,12 +1127,27 @@ void APowerWeaponLevel2::InitEffect ()
|
|||
|
||||
assert (sister->SisterWeapon == weapon);
|
||||
|
||||
Owner->player->ReadyWeapon = sister;
|
||||
|
||||
if (weapon->GetReadyState() != sister->GetReadyState())
|
||||
{
|
||||
Owner->player->ReadyWeapon = sister;
|
||||
P_SetPsprite(Owner->player, PSP_WEAPON, sister->GetReadyState());
|
||||
}
|
||||
else
|
||||
{
|
||||
DPSprite *psp = Owner->player->FindPSprite(PSP_WEAPON);
|
||||
if (psp != nullptr && psp->GetCaller() == Owner->player->ReadyWeapon)
|
||||
{
|
||||
// If the weapon changes but the state does not, we have to manually change the PSprite's caller here.
|
||||
psp->SetCaller(sister);
|
||||
Owner->player->ReadyWeapon = sister;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something went wrong. Initiate a regular weapon change.
|
||||
Owner->player->PendingWeapon = sister;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -642,7 +642,18 @@ void AWeapon::EndPowerup ()
|
|||
}
|
||||
else
|
||||
{
|
||||
Owner->player->ReadyWeapon = SisterWeapon;
|
||||
DPSprite *psp = Owner->player->FindPSprite(PSP_WEAPON);
|
||||
if (psp != nullptr && psp->GetCaller() == Owner->player->ReadyWeapon)
|
||||
{
|
||||
// If the weapon changes but the state does not, we have to manually change the PSprite's caller here.
|
||||
psp->SetCaller(SisterWeapon);
|
||||
Owner->player->ReadyWeapon = SisterWeapon;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something went wrong. Initiate a regular weapon change.
|
||||
Owner->player->PendingWeapon = SisterWeapon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ public:
|
|||
FState* GetState() const { return State; }
|
||||
DPSprite* GetNext() { return Next; }
|
||||
AActor* GetCaller() { return Caller; }
|
||||
void SetCaller(AActor *newcaller) { Caller = newcaller; }
|
||||
|
||||
double x, y;
|
||||
double oldx, oldy;
|
||||
|
|
Loading…
Reference in a new issue