From ff2578578100211be6d05810131c5b8f840128b8 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@zdoom.fake>
Date: Sat, 16 Jun 2012 08:35:51 +0000
Subject: [PATCH] - removed the MF5_FASTER and MF5_FASTMELEE flags and replaced
 them with a 'Fast' state flag.

SVN r3692 (trunk)
---
 src/actor.h                         |  4 ++--
 src/info.h                          |  7 ++++---
 src/p_mobj.cpp                      | 17 ++++-------------
 src/thingdef/thingdef_data.cpp      |  8 +++++---
 src/thingdef/thingdef_states.cpp    |  7 ++++++-
 wadsrc/static/actors/doom/demon.txt | 12 ++++++------
 6 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/src/actor.h b/src/actor.h
index ac51b6836..dc2ee0510 100644
--- a/src/actor.h
+++ b/src/actor.h
@@ -266,8 +266,8 @@ enum
 	
 // --- mobj.flags5 ---
 
-	MF5_FASTER			= 0x00000001,	// moves faster when DF_FAST_MONSTERS or nightmare is on.
-	MF5_FASTMELEE		= 0x00000002,	// has a faster melee attack when DF_FAST_MONSTERS or nightmare is on.
+	/*					= 0x00000001,	*/
+	/*					= 0x00000002,	*/
 	MF5_NODROPOFF		= 0x00000004,	// cannot drop off under any circumstances.
 	/*					= 0x00000008,	*/
 	MF5_COUNTSECRET		= 0x00000010,	// From Doom 64: actor acts like a secret
diff --git a/src/info.h b/src/info.h
index 03f285000..b6da1ccd8 100644
--- a/src/info.h
+++ b/src/info.h
@@ -65,11 +65,12 @@ struct FState
 	SWORD		Tics;
 	int			Misc1;			// Was changed to SBYTE, reverted to long for MBF compat
 	int			Misc2;			// Was changed to BYTE, reverted to long for MBF compat
-	BYTE		Frame:6;
-	BYTE		Fullbright:1;	// State is fullbright
-	BYTE		SameFrame:1;	// Ignore Frame (except when spawning actor)
+	BYTE		Frame;
 	BYTE		DefineFlags;	// Unused byte so let's use it during state creation.
 	short		Light;
+	BYTE		Fullbright:1;	// State is fullbright
+	BYTE		SameFrame:1;	// Ignore Frame (except when spawning actor)
+	BYTE		Fast:1;
 	FState		*NextState;
 	actionf_p	ActionFunc;
 	int			ParameterIndex;
diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp
index a014aa5f8..56b0edbd8 100644
--- a/src/p_mobj.cpp
+++ b/src/p_mobj.cpp
@@ -434,26 +434,17 @@ bool AActor::InStateSequence(FState * newstate, FState * basestate)
 // AActor::GetTics
 //
 // Get the actual duration of the next state
-// This is a more generalized attempt to make the Demon faster in
-// nightmare mode. Actually changing the states' durations has to
-// be considered highly problematic.
+// We are using a state flag now to indicate a state that should be
+// accelerated in Fast mode.
 //
 //==========================================================================
 
 int AActor::GetTics(FState * newstate)
 {
 	int tics = newstate->GetTics();
-	
-	if (isFast())
+	if (isFast() && newstate->Fast)
 	{
-		if (flags5 & MF5_FASTER)
-		{
-			if (InStateSequence(newstate, SeeState)) return tics - (tics>>1);
-		}
-		if (flags5 & MF5_FASTMELEE)
-		{
-			if (InStateSequence(newstate, MeleeState)) return tics - (tics>>1);
-		}
+		return tics - (tics>>1);
 	}
 	return tics;
 }
diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp
index f4ee1eeda..5db3f3ff1 100644
--- a/src/thingdef/thingdef_data.cpp
+++ b/src/thingdef/thingdef_data.cpp
@@ -182,8 +182,6 @@ static FFlagDef ActorFlags[]=
 	DEFINE_FLAG(MF4, NOSKIN, AActor, flags4),
 	DEFINE_FLAG(MF4, BOSSDEATH, AActor, flags4),
 
-	DEFINE_FLAG(MF5, FASTER, AActor, flags5),
-	DEFINE_FLAG(MF5, FASTMELEE, AActor, flags5),
 	DEFINE_FLAG(MF5, NODROPOFF, AActor, flags5),
 	DEFINE_FLAG(MF5, COUNTSECRET, AActor, flags5),
 	DEFINE_FLAG(MF5, NODAMAGE, AActor, flags5),
@@ -270,7 +268,11 @@ static FFlagDef ActorFlags[]=
 	DEFINE_DEPRECATED_FLAG(HEXENBOUNCE),
 	DEFINE_DEPRECATED_FLAG(DOOMBOUNCE),
 
-// Various Skulltag flags that are quite irrelevant to ZDoom
+	// Deprecated flags with no more existing functionality.
+	DEFINE_DUMMY_FLAG(FASTER),				// obsolete, replaced by 'Fast' state flag
+	DEFINE_DUMMY_FLAG(FASTMELEE),			// obsolete, replaced by 'Fast' state flag
+
+	// Various Skulltag flags that are quite irrelevant to ZDoom
 	DEFINE_DUMMY_FLAG(NONETID),				// netcode-based
 	DEFINE_DUMMY_FLAG(ALLOWCLIENTSPAWN),	// netcode-based
 	DEFINE_DUMMY_FLAG(CLIENTSIDEONLY),	    // netcode-based
diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp
index 7e2c11259..31d49db5d 100644
--- a/src/thingdef/thingdef_states.cpp
+++ b/src/thingdef/thingdef_states.cpp
@@ -247,6 +247,11 @@ do_stop:
 					state.Fullbright = true;
 					continue;
 				}
+				if (sc.Compare("FAST")) 
+				{
+					state.Fast = true;
+					continue;
+				}
 				if (sc.Compare("OFFSET"))
 				{
 					// specify a weapon offset
@@ -274,7 +279,7 @@ do_stop:
 					continue;
 				}
 
-				// Make the action name lowercase to satisfy the gperf hashers
+				// Make the action name lowercase
 				strlwr (sc.String);
 
 				if (DoActionSpecials(sc, state, bag))
diff --git a/wadsrc/static/actors/doom/demon.txt b/wadsrc/static/actors/doom/demon.txt
index 1090348ee..ecd6fa8a6 100644
--- a/wadsrc/static/actors/doom/demon.txt
+++ b/wadsrc/static/actors/doom/demon.txt
@@ -14,7 +14,7 @@ ACTOR Demon 3002
 	Height 56
 	Mass 400
 	Monster
-	+FLOORCLIP +FASTER +FASTMELEE
+	+FLOORCLIP
 	SeeSound "demon/sight"
 	AttackSound "demon/melee"
 	PainSound "demon/pain"
@@ -27,15 +27,15 @@ ACTOR Demon 3002
 		SARG AB 10 A_Look
 		Loop
 	See:
-		SARG AABBCCDD 2 A_Chase
+		SARG AABBCCDD 2 Fast A_Chase
 		Loop
 	Melee:
-		SARG EF 8 A_FaceTarget
-		SARG G 8 A_SargAttack
+		SARG EF 8 Fast A_FaceTarget
+		SARG G 8 Fast A_SargAttack
 		Goto See
 	Pain:
-		SARG H 2
-		SARG H 2 A_Pain
+		SARG H 2 Fast
+		SARG H 2 Fast A_Pain
 		Goto See
 	Death:
 		SARG I 8