- Fixed: Morphed players did not regain their innate armor when unmorphing.

(Only Hexen has players with innate armor, under normal conditions.)


SVN r504 (trunk)
This commit is contained in:
Randy Heit 2007-03-14 01:48:19 +00:00
parent b49d4333b0
commit 38c821a96e
3 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,7 @@
March 13, 2007
- Fixed: Morphed players did not regain their innate armor when unmorphing.
(Only Hexen has players with innate armor.)
March 12, 2007 March 12, 2007
- Changed the default player.startitem amount from 0 to 1. - Changed the default player.startitem amount from 0 to 1.

View File

@ -88,7 +88,25 @@ bool P_MorphPlayer (player_t *p, const PClass *spawntype)
AInventory *next = item->Inventory; AInventory *next = item->Inventory;
if (item->IsKindOf (RUNTIME_CLASS(AArmor))) if (item->IsKindOf (RUNTIME_CLASS(AArmor)))
{ {
item->Destroy (); if (item->IsKindOf (RUNTIME_CLASS(AHexenArmor)))
{
// Set the HexenArmor slots to 0, except the class slot.
AHexenArmor *hxarmor = static_cast<AHexenArmor *>(item);
hxarmor->Slots[0] = 0;
hxarmor->Slots[1] = 0;
hxarmor->Slots[2] = 0;
hxarmor->Slots[3] = 0;
hxarmor->Slots[4] = spawntype->Meta.GetMetaFixed (APMETA_Hexenarmor0);
}
else if (item->ItemFlags & IF_KEEPDEPLETED)
{
// Set depletable armor to 0 (this includes BasicArmor).
item->Amount = 0;
}
else
{
item->Destroy ();
}
} }
item = next; item = next;
} }
@ -186,6 +204,12 @@ bool P_UndoPlayerMorph (player_t *player, bool force)
} }
pmo->tracer = NULL; pmo->tracer = NULL;
pmo->Destroy (); pmo->Destroy ();
// Restore playerclass armor to its normal amount.
AHexenArmor *hxarmor = mo->FindInventory<AHexenArmor>();
if (hxarmor != NULL)
{
hxarmor->Slots[4] = mo->GetClass()->Meta.GetMetaFixed (APMETA_Hexenarmor0);
}
return true; return true;
} }

View File

@ -883,6 +883,8 @@ void AActor::CopyFriendliness (const AActor *other, bool changeTarget)
void AActor::ObtainInventory (AActor *other) void AActor::ObtainInventory (AActor *other)
{ {
assert (Inventory == NULL);
Inventory = other->Inventory; Inventory = other->Inventory;
InventoryID = other->InventoryID; InventoryID = other->InventoryID;
other->Inventory = NULL; other->Inventory = NULL;