Added slow monsters, the inverse of fast monsters

This is a skill setting only, no "always slow" or "never slow" actor
flags, and no DM flags.
This commit is contained in:
Gaerzi 2014-04-15 21:01:49 +02:00
parent 4e683d360d
commit 83182b703d
6 changed files with 28 additions and 1 deletions

View File

@ -1008,6 +1008,7 @@ public:
bool SetState (FState *newstate, bool nofunction=false); bool SetState (FState *newstate, bool nofunction=false);
virtual bool UpdateWaterLevel (fixed_t oldz, bool splash=true); virtual bool UpdateWaterLevel (fixed_t oldz, bool splash=true);
bool isFast(); bool isFast();
bool isSlow();
void SetIdle(); void SetIdle();
void ClearCounters(); void ClearCounters();

View File

@ -554,6 +554,7 @@ enum ESkillProperty
SKILLP_NoPain, SKILLP_NoPain,
SKILLP_ArmorFactor, SKILLP_ArmorFactor,
SKILLP_EasyKey, SKILLP_EasyKey,
SKILLP_SlowMonsters,
}; };
int G_SkillProperty(ESkillProperty prop); int G_SkillProperty(ESkillProperty prop);
const char * G_SkillName(); const char * G_SkillName();
@ -568,6 +569,7 @@ struct FSkillInfo
fixed_t AmmoFactor, DoubleAmmoFactor, DropAmmoFactor; fixed_t AmmoFactor, DoubleAmmoFactor, DropAmmoFactor;
fixed_t DamageFactor; fixed_t DamageFactor;
bool FastMonsters; bool FastMonsters;
bool SlowMonsters;
bool DisableCheats; bool DisableCheats;
bool AutoUseHealth; bool AutoUseHealth;

View File

@ -64,6 +64,7 @@ void FMapInfoParser::ParseSkill ()
skill.DropAmmoFactor = -1; skill.DropAmmoFactor = -1;
skill.DamageFactor = FRACUNIT; skill.DamageFactor = FRACUNIT;
skill.FastMonsters = false; skill.FastMonsters = false;
skill.SlowMonsters = false;
skill.DisableCheats = false; skill.DisableCheats = false;
skill.EasyBossBrain = false; skill.EasyBossBrain = false;
skill.EasyKey = false; skill.EasyKey = false;
@ -118,6 +119,10 @@ void FMapInfoParser::ParseSkill ()
{ {
skill.FastMonsters = true; skill.FastMonsters = true;
} }
else if (sc.Compare ("slowmonsters"))
{
skill.SlowMonsters = true;
}
else if (sc.Compare ("disablecheats")) else if (sc.Compare ("disablecheats"))
{ {
skill.DisableCheats = true; skill.DisableCheats = true;
@ -336,6 +341,9 @@ int G_SkillProperty(ESkillProperty prop)
case SKILLP_FastMonsters: case SKILLP_FastMonsters:
return AllSkills[gameskill].FastMonsters || (dmflags & DF_FAST_MONSTERS); return AllSkills[gameskill].FastMonsters || (dmflags & DF_FAST_MONSTERS);
case SKILLP_SlowMonsters:
return AllSkills[gameskill].SlowMonsters;
case SKILLP_Respawn: case SKILLP_Respawn:
if (dmflags & DF_MONSTERS_RESPAWN && AllSkills[gameskill].RespawnCounter==0) if (dmflags & DF_MONSTERS_RESPAWN && AllSkills[gameskill].RespawnCounter==0)
return TICRATE * gameinfo.defaultrespawntime; return TICRATE * gameinfo.defaultrespawntime;
@ -433,6 +441,7 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
DropAmmoFactor = other.DropAmmoFactor; DropAmmoFactor = other.DropAmmoFactor;
DamageFactor = other.DamageFactor; DamageFactor = other.DamageFactor;
FastMonsters = other.FastMonsters; FastMonsters = other.FastMonsters;
SlowMonsters = other.SlowMonsters;
DisableCheats = other.DisableCheats; DisableCheats = other.DisableCheats;
AutoUseHealth = other.AutoUseHealth; AutoUseHealth = other.AutoUseHealth;
EasyBossBrain = other.EasyBossBrain; EasyBossBrain = other.EasyBossBrain;

View File

@ -77,6 +77,7 @@ struct FState
BYTE Fast:1; BYTE Fast:1;
BYTE NoDelay:1; // Spawn states executes its action normally BYTE NoDelay:1; // Spawn states executes its action normally
BYTE CanRaise:1; // Allows a monster to be resurrected without waiting for an infinate frame BYTE CanRaise:1; // Allows a monster to be resurrected without waiting for an infinate frame
BYTE Slow:1; // Inverse of fast
int ParameterIndex; int ParameterIndex;
inline int GetFrame() const inline int GetFrame() const

View File

@ -405,7 +405,7 @@ bool AActor::InStateSequence(FState * newstate, FState * basestate)
// //
// Get the actual duration of the next state // Get the actual duration of the next state
// We are using a state flag now to indicate a state that should be // We are using a state flag now to indicate a state that should be
// accelerated in Fast mode. // accelerated in Fast mode or slowed in Slow mode.
// //
//========================================================================== //==========================================================================
@ -416,6 +416,10 @@ int AActor::GetTics(FState * newstate)
{ {
return tics - (tics>>1); return tics - (tics>>1);
} }
else if (isSlow() && newstate->Slow)
{
return tics<<1;
}
return tics; return tics;
} }
@ -4082,6 +4086,11 @@ bool AActor::isFast()
return !!G_SkillProperty(SKILLP_FastMonsters); return !!G_SkillProperty(SKILLP_FastMonsters);
} }
bool AActor::isSlow()
{
return !!G_SkillProperty(SKILLP_SlowMonsters);
}
void AActor::Activate (AActor *activator) void AActor::Activate (AActor *activator)
{ {
if ((flags3 & MF3_ISMONSTER) && (health > 0 || (flags & MF_ICECORPSE))) if ((flags3 & MF3_ISMONSTER) && (health > 0 || (flags & MF_ICECORPSE)))

View File

@ -275,6 +275,11 @@ do_stop:
state.Fast = true; state.Fast = true;
continue; continue;
} }
if (sc.Compare("SLOW"))
{
state.Slow = true;
continue;
}
if (sc.Compare("NODELAY")) if (sc.Compare("NODELAY"))
{ {
if (bag.statedef.GetStateLabelIndex(NAME_Spawn) == bag.statedef.GetStateCount()) if (bag.statedef.GetStateLabelIndex(NAME_Spawn) == bag.statedef.GetStateCount())