- eliminated the native PowerupGiver class.

- scriptified the respawn invulnerability code into a virtual OnRespawn function for PlayerPawn so that custom effects can be implemented.
This commit is contained in:
Christoph Oelckers 2017-01-18 00:11:04 +01:00
parent 98f9219334
commit 232b64d332
17 changed files with 138 additions and 130 deletions

View file

@ -5381,15 +5381,13 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
oldactor->DestroyAllInventory();
}
// [BC] Handle temporary invulnerability when respawned
if ((state == PST_REBORN || state == PST_ENTER) &&
(dmflags2 & DF2_YES_RESPAWN_INVUL) &&
(multiplayer || alwaysapplydmflags))
if (state == PST_REBORN || state == PST_ENTER)
{
APowerup *invul = static_cast<APowerup*>(p->mo->GiveInventoryType (PClass::FindActor(NAME_PowerInvulnerable)));
invul->EffectTics = 3*TICRATE;
invul->BlendColor = 0; // don't mess with the view
invul->ItemFlags |= IF_UNDROPPABLE; // Don't drop this
p->mo->effects |= FX_RESPAWNINVUL; // [RH] special effect
IFVIRTUALPTR(p->mo, APlayerPawn, OnRespawn)
{
VMValue param = p->mo;
GlobalVMStack.Call(func, &param, 1, nullptr, 0);
}
}
if (StatusBar != NULL && (playernum == consoleplayer || StatusBar->GetPlayer() == playernum))