mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- added TIHan's ArmorFactor submission.
SVN r2465 (trunk)
This commit is contained in:
parent
2cf19f436a
commit
6f4ed40496
3 changed files with 39 additions and 2 deletions
|
@ -548,7 +548,8 @@ enum ESkillProperty
|
|||
SKILLP_ACSReturn,
|
||||
SKILLP_MonsterHealth,
|
||||
SKILLP_FriendlyHealth,
|
||||
SKILLP_NoPain
|
||||
SKILLP_NoPain,
|
||||
SKILLP_ArmorFactor
|
||||
};
|
||||
int G_SkillProperty(ESkillProperty prop);
|
||||
const char * G_SkillName();
|
||||
|
@ -583,6 +584,7 @@ struct FSkillInfo
|
|||
fixed_t MonsterHealth;
|
||||
fixed_t FriendlyHealth;
|
||||
bool NoPain;
|
||||
fixed_t ArmorFactor;
|
||||
|
||||
FSkillInfo() {}
|
||||
FSkillInfo(const FSkillInfo &other)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ void FMapInfoParser::ParseSkill ()
|
|||
skill.MonsterHealth = FRACUNIT;
|
||||
skill.FriendlyHealth = FRACUNIT;
|
||||
skill.NoPain = false;
|
||||
skill.ArmorFactor = FRACUNIT;
|
||||
|
||||
sc.MustGetString();
|
||||
skill.Name = sc.String;
|
||||
|
@ -249,6 +250,12 @@ void FMapInfoParser::ParseSkill ()
|
|||
{
|
||||
skill.NoPain = true;
|
||||
}
|
||||
else if (sc.Compare("ArmorFactor"))
|
||||
{
|
||||
ParseAssign();
|
||||
sc.MustGetFloat();
|
||||
skill.ArmorFactor = FLOAT2FIXED(sc.Float);
|
||||
}
|
||||
else if (sc.Compare("DefaultSkill"))
|
||||
{
|
||||
if (DefaultSkill >= 0)
|
||||
|
@ -357,7 +364,10 @@ int G_SkillProperty(ESkillProperty prop)
|
|||
return AllSkills[gameskill].FriendlyHealth;
|
||||
|
||||
case SKILLP_NoPain:
|
||||
return AllSkills[gameskill].NoPain;
|
||||
return AllSkills[gameskill].NoPain;
|
||||
|
||||
case SKILLP_ArmorFactor:
|
||||
return AllSkills[gameskill].ArmorFactor;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -435,6 +445,7 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
|
|||
MonsterHealth = other.MonsterHealth;
|
||||
FriendlyHealth = other.FriendlyHealth;
|
||||
NoPain = other.NoPain;
|
||||
ArmorFactor = other.ArmorFactor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue