From 587a51a95786d982d65dd22f2ea1741cb0a5e519 Mon Sep 17 00:00:00 2001
From: mazmazz <mar.marcoz@outlook.com>
Date: Fri, 15 Mar 2019 03:47:30 -0400
Subject: [PATCH] Fix end-of-level fading for cv_playersforexit

(Code in p_user.c was from 2.2, where cv_playersforexit has different values so that the player exit check works differently)
---
 src/p_user.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/p_user.c b/src/p_user.c
index 97ee04a28b..edc4d8a586 100644
--- a/src/p_user.c
+++ b/src/p_user.c
@@ -8836,7 +8836,7 @@ void P_PlayerThink(player_t *player)
 	{
 		if (cv_playersforexit.value)
 		{
-			INT32 i, total = 0, exiting = 0;
+			INT32 i;
 
 			for (i = 0; i < MAXPLAYERS; i++)
 			{
@@ -8845,12 +8845,11 @@ void P_PlayerThink(player_t *player)
 				if (players[i].lives <= 0)
 					continue;
 
-				total++;
-				if (players[i].exiting && players[i].exiting < 1*TICRATE+1)
-					exiting++;
+				if (!players[i].exiting || players[i].exiting > 1*TICRATE)
+					break;
 			}
 
-			if (!total || ((4*exiting)/total) >= cv_playersforexit.value)
+			if (i == MAXPLAYERS)
 			{
 				exitfadestarted = true;
 				S_FadeOutStopMusic(1*MUSICRATE);
-- 
GitLab