diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 07071daa6..b5ac970ca 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -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; + } + } } //=========================================================================== diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index e7ebfc77b..575914fe8 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -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; + } } } } diff --git a/src/p_pspr.h b/src/p_pspr.h index a7cf49f8c..41d258df8 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -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;