mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-07 09:01:57 +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_ACSReturn,
|
||||||
SKILLP_MonsterHealth,
|
SKILLP_MonsterHealth,
|
||||||
SKILLP_FriendlyHealth,
|
SKILLP_FriendlyHealth,
|
||||||
SKILLP_NoPain
|
SKILLP_NoPain,
|
||||||
|
SKILLP_ArmorFactor
|
||||||
};
|
};
|
||||||
int G_SkillProperty(ESkillProperty prop);
|
int G_SkillProperty(ESkillProperty prop);
|
||||||
const char * G_SkillName();
|
const char * G_SkillName();
|
||||||
|
@ -583,6 +584,7 @@ struct FSkillInfo
|
||||||
fixed_t MonsterHealth;
|
fixed_t MonsterHealth;
|
||||||
fixed_t FriendlyHealth;
|
fixed_t FriendlyHealth;
|
||||||
bool NoPain;
|
bool NoPain;
|
||||||
|
fixed_t ArmorFactor;
|
||||||
|
|
||||||
FSkillInfo() {}
|
FSkillInfo() {}
|
||||||
FSkillInfo(const FSkillInfo &other)
|
FSkillInfo(const FSkillInfo &other)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "a_pickups.h"
|
#include "a_pickups.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
|
#include "g_level.h"
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS (AArmor)
|
IMPLEMENT_CLASS (AArmor)
|
||||||
|
@ -84,6 +85,18 @@ bool ABasicArmor::HandlePickup (AInventory *item)
|
||||||
// You shouldn't be picking up BasicArmor anyway.
|
// You shouldn't be picking up BasicArmor anyway.
|
||||||
return true;
|
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)
|
if (Inventory != NULL)
|
||||||
{
|
{
|
||||||
return Inventory->HandlePickup (item);
|
return Inventory->HandlePickup (item);
|
||||||
|
@ -202,6 +215,12 @@ AInventory *ABasicArmorPickup::CreateCopy (AActor *other)
|
||||||
copy->SaveAmount = SaveAmount;
|
copy->SaveAmount = SaveAmount;
|
||||||
copy->MaxAbsorb = MaxAbsorb;
|
copy->MaxAbsorb = MaxAbsorb;
|
||||||
copy->MaxFullAbsorb = MaxFullAbsorb;
|
copy->MaxFullAbsorb = MaxFullAbsorb;
|
||||||
|
|
||||||
|
if (!(ItemFlags & IF_IGNORESKILL))
|
||||||
|
{ // extra ammo in baby mode and nightmare mode
|
||||||
|
SaveAmount = FixedMul(SaveAmount, G_SkillProperty(SKILLP_ArmorFactor));
|
||||||
|
}
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,6 +298,11 @@ AInventory *ABasicArmorBonus::CreateCopy (AActor *other)
|
||||||
copy->BonusMax = BonusMax;
|
copy->BonusMax = BonusMax;
|
||||||
copy->MaxAbsorb = MaxAbsorb;
|
copy->MaxAbsorb = MaxAbsorb;
|
||||||
copy->MaxFullAbsorb = MaxFullAbsorb;
|
copy->MaxFullAbsorb = MaxFullAbsorb;
|
||||||
|
|
||||||
|
if (!(ItemFlags & IF_IGNORESKILL))
|
||||||
|
{ // extra ammo in baby mode and nightmare mode
|
||||||
|
SaveAmount = FixedMul(SaveAmount, G_SkillProperty(SKILLP_ArmorFactor));
|
||||||
|
}
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@ void FMapInfoParser::ParseSkill ()
|
||||||
skill.MonsterHealth = FRACUNIT;
|
skill.MonsterHealth = FRACUNIT;
|
||||||
skill.FriendlyHealth = FRACUNIT;
|
skill.FriendlyHealth = FRACUNIT;
|
||||||
skill.NoPain = false;
|
skill.NoPain = false;
|
||||||
|
skill.ArmorFactor = FRACUNIT;
|
||||||
|
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
skill.Name = sc.String;
|
skill.Name = sc.String;
|
||||||
|
@ -249,6 +250,12 @@ void FMapInfoParser::ParseSkill ()
|
||||||
{
|
{
|
||||||
skill.NoPain = true;
|
skill.NoPain = true;
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("ArmorFactor"))
|
||||||
|
{
|
||||||
|
ParseAssign();
|
||||||
|
sc.MustGetFloat();
|
||||||
|
skill.ArmorFactor = FLOAT2FIXED(sc.Float);
|
||||||
|
}
|
||||||
else if (sc.Compare("DefaultSkill"))
|
else if (sc.Compare("DefaultSkill"))
|
||||||
{
|
{
|
||||||
if (DefaultSkill >= 0)
|
if (DefaultSkill >= 0)
|
||||||
|
@ -358,6 +365,9 @@ int G_SkillProperty(ESkillProperty prop)
|
||||||
|
|
||||||
case SKILLP_NoPain:
|
case SKILLP_NoPain:
|
||||||
return AllSkills[gameskill].NoPain;
|
return AllSkills[gameskill].NoPain;
|
||||||
|
|
||||||
|
case SKILLP_ArmorFactor:
|
||||||
|
return AllSkills[gameskill].ArmorFactor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -435,6 +445,7 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
|
||||||
MonsterHealth = other.MonsterHealth;
|
MonsterHealth = other.MonsterHealth;
|
||||||
FriendlyHealth = other.FriendlyHealth;
|
FriendlyHealth = other.FriendlyHealth;
|
||||||
NoPain = other.NoPain;
|
NoPain = other.NoPain;
|
||||||
|
ArmorFactor = other.ArmorFactor;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue