From d198bc73e96cc00d42216c80cd1027b1b159d24a Mon Sep 17 00:00:00 2001
From: Lighto97 <lighto97@outlook.com>
Date: Fri, 7 Mar 2025 15:11:58 -0300
Subject: [PATCH 1/2] fix fault respawn bug

---
 src/p_user.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/p_user.c b/src/p_user.c
index 63f43bdab..7e0ef2060 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -4547,17 +4547,17 @@ void P_PlayerThink(player_t *player)
 
 	if (player->nocontrol && player->nocontrol < UINT16_MAX)
 	{
-		if (!(--player->nocontrol))
-		{
-			if (player->pflags & PF_FAULT)
-			{
-				player->pflags &= ~PF_FAULT;
-				player->mo->renderflags &= ~RF_DONTDRAW;
-				player->mo->flags &= ~MF_NOCLIPTHING;
-			}
-		}
+		player->nocontrol--;
 	}
 
+	// tic down the var normaly and remove the flag upon respawn so its guaranteed to be removed from the player
+	if (!player->nocontrol && player->respawn.state == RESPAWNST_DROP && (player->pflags & PF_FAULT))
+	{
+		player->pflags &= ~PF_FAULT;
+		player->mo->renderflags &= ~RF_DONTDRAW;
+		player->mo->flags &= ~MF_NOCLIPTHING;
+	}
+	
 	boolean deathcontrolled = (player->respawn.state != RESPAWNST_NONE && player->respawn.truedeath == true)
 		|| (player->pflags & PF_NOCONTEST) || (player->karmadelay);
 	boolean powercontrolled = (player->hyudorotimer) || (player->growshrinktimer > 0);
-- 
GitLab


From f907292383d75e2b34d5d6927d929bcbc465ecab Mon Sep 17 00:00:00 2001
From: Lighto97 <lighto97@outlook.com>
Date: Sat, 8 Mar 2025 23:10:36 -0300
Subject: [PATCH 2/2] wait for respawn timer to reach 0

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

diff --git a/src/p_user.c b/src/p_user.c
index 7e0ef2060..d41d503f9 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -4551,7 +4551,7 @@ void P_PlayerThink(player_t *player)
 	}
 
 	// tic down the var normaly and remove the flag upon respawn so its guaranteed to be removed from the player
-	if (!player->nocontrol && player->respawn.state == RESPAWNST_DROP && (player->pflags & PF_FAULT))
+	if (!player->nocontrol && !player->respawn.timer && player->respawn.state == RESPAWNST_DROP &&  (player->pflags & PF_FAULT))
 	{
 		player->pflags &= ~PF_FAULT;
 		player->mo->renderflags &= ~RF_DONTDRAW;
-- 
GitLab