From 8605d77af6a5d213639a70b91d80c2bae15d5986 Mon Sep 17 00:00:00 2001
From: toaster <rollerorbital@gmail.com>
Date: Mon, 12 Aug 2019 18:49:58 +0100
Subject: [PATCH] Fix an issue with painstate-exiting detection in the boss1
 thinker.

---
 src/p_mobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/p_mobj.c b/src/p_mobj.c
index 60a4e9e638..a0ac38f5c4 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -4258,7 +4258,7 @@ static void P_GenericBossThinker(mobj_t *mobj)
 // AI for the first boss.
 static void P_Boss1Thinker(mobj_t *mobj)
 {
-	if (mobj->flags2 & MF2_FRET && (statenum_t)(mobj->state-states) < mobj->info->painstate) {
+	if (mobj->flags2 & MF2_FRET && mobj->state->nextstate == mobj->info->spawnstate && mobj->tics == 1) {
 		mobj->flags2 &= ~(MF2_FRET|MF2_SKULLFLY);
 		mobj->momx = mobj->momy = mobj->momz = 0;
 	}
-- 
GitLab