- added TIHan's ArmorFactor submission.

SVN r2465 (trunk)
This commit is contained in:
Christoph Oelckers 2010-07-27 18:32:10 +00:00
commit 6f4ed40496
3 changed files with 39 additions and 2 deletions

View file

@ -5,6 +5,7 @@
#include "r_data.h"
#include "a_pickups.h"
#include "templates.h"
#include "g_level.h"
IMPLEMENT_CLASS (AArmor)
@ -84,6 +85,18 @@ bool ABasicArmor::HandlePickup (AInventory *item)
// You shouldn't be picking up BasicArmor anyway.
return true;
}
if (item->IsKindOf(RUNTIME_CLASS(ABasicArmorBonus)) && !(item->ItemFlags & IF_IGNORESKILL))
{
ABasicArmorBonus *armor = static_cast<ABasicArmorBonus*>(item);
armor->SaveAmount = FixedMul(armor->SaveAmount, G_SkillProperty(SKILLP_ArmorFactor));
}
else if (item->IsKindOf(RUNTIME_CLASS(ABasicArmorPickup)) && !(item->ItemFlags & IF_IGNORESKILL))
{
ABasicArmorPickup *armor = static_cast<ABasicArmorPickup*>(item);
armor->SaveAmount = FixedMul(armor->SaveAmount, G_SkillProperty(SKILLP_ArmorFactor));
}
if (Inventory != NULL)
{
return Inventory->HandlePickup (item);
@ -202,6 +215,12 @@ AInventory *ABasicArmorPickup::CreateCopy (AActor *other)
copy->SaveAmount = SaveAmount;
copy->MaxAbsorb = MaxAbsorb;
copy->MaxFullAbsorb = MaxFullAbsorb;
if (!(ItemFlags & IF_IGNORESKILL))
{ // extra ammo in baby mode and nightmare mode
SaveAmount = FixedMul(SaveAmount, G_SkillProperty(SKILLP_ArmorFactor));
}
return copy;
}
@ -279,6 +298,11 @@ AInventory *ABasicArmorBonus::CreateCopy (AActor *other)
copy->BonusMax = BonusMax;
copy->MaxAbsorb = MaxAbsorb;
copy->MaxFullAbsorb = MaxFullAbsorb;
if (!(ItemFlags & IF_IGNORESKILL))
{ // extra ammo in baby mode and nightmare mode
SaveAmount = FixedMul(SaveAmount, G_SkillProperty(SKILLP_ArmorFactor));
}
return copy;
}