From 03fe312490ced52b35fa73338e8652119d3ef6bc Mon Sep 17 00:00:00 2001
From: toasterbabe <rollerorbital@gmail.com>
Date: Fri, 15 Jul 2016 17:30:52 +0100
Subject: [PATCH] On MI's reccomendation, a skin flag to disable the effects of
 FF_MIDDLESTARTCHANCE for specific characters whose animations might not be
 symmetrical.

---
 src/d_player.h | 1 +
 src/p_mobj.c   | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/d_player.h b/src/d_player.h
index 5097be68d7..ef1c1219fe 100644
--- a/src/d_player.h
+++ b/src/d_player.h
@@ -43,6 +43,7 @@ typedef enum
 	SF_NOJUMPDAMAGE     = 1<<8, // Don't damage enemies, etc whilst jumping?
 	SF_STOMPDAMAGE      = 1<<9, // Always damage enemies, etc by landing on them, no matter your vunerability?
 	SF_MARIODAMAGE      = SF_NOJUMPDAMAGE|SF_STOMPDAMAGE, // The Mario method of being able to damage enemies, etc.
+	SF_NOMIDDLESTART    = 1<<10, // Some animations can randomly start you halfway through. Disable this?
 } skinflags_t;
 
 //Primary and secondary skin abilities
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 61049d9e15..c260391f77 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -462,7 +462,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
 			}
 			else if (mobj->sprite2 != spr2)
 			{
-				if ((st->frame & FF_MIDDLESTARTCHANCE) && numframes && P_RandomChance(FRACUNIT/2))
+				if ((st->frame & FF_MIDDLESTARTCHANCE) && !(player->charflags & SF_NOMIDDLESTART) && numframes && P_RandomChance(FRACUNIT/2))
 					frame = numframes/2;
 				else
 					frame = 0;
@@ -582,7 +582,7 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
 			}
 			else if (mobj->sprite2 != spr2)
 			{
-				if ((st->frame & FF_MIDDLESTARTCHANCE) && numframes && P_RandomChance(FRACUNIT/2))
+				if ((st->frame & FF_MIDDLESTARTCHANCE) && !(player->charflags & SF_NOMIDDLESTART) && numframes && P_RandomChance(FRACUNIT/2))
 					frame = numframes/2;
 				else
 					frame = 0;
-- 
GitLab