mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- allow specifying infighting through skills.
This commit is contained in:
parent
1a0faf4761
commit
1ad02a6ce8
4 changed files with 22 additions and 8 deletions
|
@ -565,6 +565,7 @@ enum ESkillProperty
|
|||
SKILLP_ArmorFactor,
|
||||
SKILLP_EasyKey,
|
||||
SKILLP_SlowMonsters,
|
||||
SKILLP_Infight,
|
||||
};
|
||||
int G_SkillProperty(ESkillProperty prop);
|
||||
const char * G_SkillName();
|
||||
|
@ -602,6 +603,7 @@ struct FSkillInfo
|
|||
fixed_t MonsterHealth;
|
||||
fixed_t FriendlyHealth;
|
||||
bool NoPain;
|
||||
int Infighting;
|
||||
fixed_t ArmorFactor;
|
||||
|
||||
FSkillInfo() {}
|
||||
|
|
|
@ -83,6 +83,7 @@ void FMapInfoParser::ParseSkill ()
|
|||
skill.FriendlyHealth = FRACUNIT;
|
||||
skill.NoPain = false;
|
||||
skill.ArmorFactor = FRACUNIT;
|
||||
skill.Infighting = 0;
|
||||
|
||||
sc.MustGetString();
|
||||
skill.Name = sc.String;
|
||||
|
@ -266,6 +267,14 @@ void FMapInfoParser::ParseSkill ()
|
|||
sc.MustGetFloat();
|
||||
skill.ArmorFactor = FLOAT2FIXED(sc.Float);
|
||||
}
|
||||
else if (sc.Compare("NoInfighting"))
|
||||
{
|
||||
skill.Infighting = LEVEL2_NOINFIGHTING;
|
||||
}
|
||||
else if (sc.Compare("TotalInfighting"))
|
||||
{
|
||||
skill.Infighting = LEVEL2_TOTALINFIGHTING;
|
||||
}
|
||||
else if (sc.Compare("DefaultSkill"))
|
||||
{
|
||||
if (DefaultSkill >= 0)
|
||||
|
@ -384,6 +393,14 @@ int G_SkillProperty(ESkillProperty prop)
|
|||
|
||||
case SKILLP_ArmorFactor:
|
||||
return AllSkills[gameskill].ArmorFactor;
|
||||
|
||||
case SKILLP_Infight:
|
||||
// This property also needs to consider the level flags for the same info.
|
||||
if (level.flags2 & LEVEL2_TOTALINFIGHTING) return 1;
|
||||
if (level.flags2 & LEVEL2_NOINFIGHTING) return -1;
|
||||
if (AllSkills[gameskill].Infighting == LEVEL2_TOTALINFIGHTING) return 1;
|
||||
if (AllSkills[gameskill].Infighting == LEVEL2_NOINFIGHTING) return -1;
|
||||
return infighting;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1639,10 +1639,8 @@ bool AActor::OkayToSwitchTarget (AActor *other)
|
|||
|
||||
int infight;
|
||||
if (flags5 & MF5_NOINFIGHTING) infight=-1;
|
||||
else if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight=1;
|
||||
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight=-1;
|
||||
else infight = infighting;
|
||||
|
||||
else infight = G_SkillProperty(SKILLP_Infight);
|
||||
|
||||
if (infight < 0 && other->player == NULL && !IsHostile (other))
|
||||
{
|
||||
return false; // infighting off: Non-friendlies don't target other non-friendlies
|
||||
|
|
|
@ -938,10 +938,7 @@ static bool CanAttackHurt(AActor *victim, AActor *shooter)
|
|||
// to harm / be harmed by anything.
|
||||
if (!victim->player && !shooter->player)
|
||||
{
|
||||
int infight;
|
||||
if (level.flags2 & LEVEL2_TOTALINFIGHTING) infight = 1;
|
||||
else if (level.flags2 & LEVEL2_NOINFIGHTING) infight = -1;
|
||||
else infight = infighting;
|
||||
int infight = G_SkillProperty(SKILLP_Infight);
|
||||
|
||||
if (infight < 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue