- fixed: "take armor" cheat should only deplete the armor, not destroy it.

- fixed: Hexen armor cannot be depleted by the common function, it needs an override to achieve that.
This commit is contained in:
Christoph Oelckers 2016-02-24 10:50:42 +01:00
parent 8ba6f6ced5
commit 21c55a090a
3 changed files with 12 additions and 3 deletions

View file

@ -550,3 +550,11 @@ void AHexenArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
} }
} }
void AHexenArmor::DepleteOrDestroy()
{
for (int i = 0; i < 4; i++)
{
Slots[i] = 0;
}
}

View file

@ -508,6 +508,7 @@ public:
virtual AInventory *CreateTossable (); virtual AInventory *CreateTossable ();
virtual bool HandlePickup (AInventory *item); virtual bool HandlePickup (AInventory *item);
virtual void AbsorbDamage (int damage, FName damageType, int &newdamage); virtual void AbsorbDamage (int damage, FName damageType, int &newdamage);
void DepleteOrDestroy();
fixed_t Slots[5]; fixed_t Slots[5];
fixed_t SlotsIncrement[4]; fixed_t SlotsIncrement[4];

View file

@ -927,7 +927,7 @@ void cht_Take (player_t *player, const char *name, int amount)
AInventory *ammo = player->mo->FindInventory(static_cast<PClassActor *>(type)); AInventory *ammo = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (ammo) if (ammo)
ammo->Amount = 0; ammo->DepleteOrDestroy();
} }
} }
@ -943,10 +943,10 @@ void cht_Take (player_t *player, const char *name, int amount)
if (type->IsDescendantOf (RUNTIME_CLASS (AArmor))) if (type->IsDescendantOf (RUNTIME_CLASS (AArmor)))
{ {
AActor *armor = player->mo->FindInventory(static_cast<PClassActor *>(type)); AInventory *armor = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (armor) if (armor)
armor->Destroy (); armor->DepleteOrDestroy();
} }
} }