- scriptified APlayerPawn::Die and fixed a few things I encountered while doing it.

This commit is contained in:
Christoph Oelckers 2018-11-24 20:32:12 +01:00
commit fb91982da2
16 changed files with 117 additions and 102 deletions

View file

@ -1351,88 +1351,6 @@ void APlayerPawn::GiveDefaultInventory ()
}
}
//===========================================================================
//
// APlayerPawn :: Die
//
//===========================================================================
void APlayerPawn::Die (AActor *source, AActor *inflictor, int dmgflags, FName MeansOfDeath)
{
Super::Die (source, inflictor, dmgflags, MeansOfDeath);
if (player != NULL && player->mo == this) player->bonuscount = 0;
if (player != NULL && player->mo != this)
{ // Make the real player die, too
player->mo->CallDie (source, inflictor, dmgflags, MeansOfDeath);
}
else
{
if (player != NULL && (dmflags2 & DF2_YES_WEAPONDROP))
{ // Voodoo dolls don't drop weapons
AWeapon *weap = player->ReadyWeapon;
if (weap != NULL)
{
AInventory *item;
// kgDROP - start - modified copy from a_action.cpp
auto di = weap->GetDropItems();
if (di != NULL)
{
while (di != NULL)
{
if (di->Name != NAME_None)
{
PClassActor *ti = PClass::FindActor(di->Name);
if (ti) P_DropItem (player->mo, ti, di->Amount, di->Probability);
}
di = di->Next;
}
} else
// kgDROP - end
if (weap->SpawnState != NULL &&
weap->SpawnState != ::GetDefault<AActor>()->SpawnState)
{
item = P_DropItem (this, weap->GetClass(), -1, 256);
if (item != NULL && item->IsKindOf(NAME_Weapon))
{
if (weap->AmmoGive1 && weap->Ammo1)
{
static_cast<AWeapon *>(item)->AmmoGive1 = weap->Ammo1->Amount;
}
if (weap->AmmoGive2 && weap->Ammo2)
{
static_cast<AWeapon *>(item)->AmmoGive2 = weap->Ammo2->Amount;
}
item->ItemFlags |= IF_IGNORESKILL;
}
}
else
{
item = P_DropItem (this, weap->AmmoType1, -1, 256);
if (item != NULL)
{
item->Amount = weap->Ammo1->Amount;
item->ItemFlags |= IF_IGNORESKILL;
}
item = P_DropItem (this, weap->AmmoType2, -1, 256);
if (item != NULL)
{
item->Amount = weap->Ammo2->Amount;
item->ItemFlags |= IF_IGNORESKILL;
}
}
}
}
if (!multiplayer && level.info->deathsequence != NAME_None)
{
F_StartIntermission(level.info->deathsequence, FSTATE_EndingGame);
}
}
}
//===========================================================================
//
// A_PlayerScream