From 29dc1119e5450d3ad9f140e987a161883b3243c9 Mon Sep 17 00:00:00 2001
From: Jaime Passos <lazymyuutsu@gmail.com>
Date: Mon, 19 Aug 2019 14:43:48 -0300
Subject: [PATCH] uh

---
 src/d_main.c   |  2 +-
 src/f_finale.c |  1 +
 src/f_finale.h |  1 +
 src/m_menu.c   | 26 ++++++++++++++++++++------
 4 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/d_main.c b/src/d_main.c
index eaeae4b10f..3838f168d9 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -358,7 +358,7 @@ static void D_Display(void)
 
 		// clean up border stuff
 		// see if the border needs to be initially drawn
-		if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide))
+		if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap)))
 		{
 			// draw the view directly
 
diff --git a/src/f_finale.c b/src/f_finale.c
index 4dee32e962..d2fc7a1e7e 100644
--- a/src/f_finale.c
+++ b/src/f_finale.c
@@ -75,6 +75,7 @@ INT32 curbgcolor;
 INT32 curbgxspeed;
 INT32 curbgyspeed;
 boolean curbghide;
+boolean hidetitlemap;		// WARNING: set to false by M_SetupNextMenu and M_ClearMenus
 
 static UINT8  curDemo = 0;
 static UINT32 demoDelayLeft;
diff --git a/src/f_finale.h b/src/f_finale.h
index d640abc8a4..58c492c3d9 100644
--- a/src/f_finale.h
+++ b/src/f_finale.h
@@ -94,6 +94,7 @@ extern INT32 curbgcolor;
 extern INT32 curbgxspeed;
 extern INT32 curbgyspeed;
 extern boolean curbghide;
+extern boolean hidetitlemap;
 
 #define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0])
 
diff --git a/src/m_menu.c b/src/m_menu.c
index 3daf1185cb..90d0791c01 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -3418,6 +3418,7 @@ void M_ClearMenus(boolean callexitmenufunc)
 	if (currentMenu == &MessageDef) // Oh sod off!
 		currentMenu = &MainDef; // Not like it matters
 	menuactive = false;
+	hidetitlemap = false;
 }
 
 //
@@ -3456,6 +3457,8 @@ void M_SetupNextMenu(menu_t *menudef)
 			}
 		}
 	}
+
+	hidetitlemap = false;
 }
 
 //
@@ -7714,10 +7717,6 @@ static void M_SetupChoosePlayer(INT32 choice)
 	if (Playing() == false)
 		M_ChangeMenuMusic("_chsel", true);
 
-	charseltimer = 0;
-	charselscrollx = charselfadescrollamt;
-	//wipegamestate = -1;
-
 	SP_PlayerDef.prevMenu = currentMenu;
 	M_SetupNextMenu(&SP_PlayerDef);
 	if (!allowed)
@@ -7730,7 +7729,12 @@ static void M_SetupChoosePlayer(INT32 choice)
 				char_on = description[char_on].next;
 		}
 	}
-	char_scroll = 0; // finish scrolling the menu
+
+	// finish scrolling the menu
+	char_scroll = 0;
+	charseltimer = 0;
+	charselscrollx = charselfadescrollamt;
+
 	Z_Free(char_notes);
 	char_notes = V_WordWrap(0, 21*8, V_ALLOWLOWERCASE, description[char_on].notes);
 }
@@ -7880,7 +7884,17 @@ static void M_DrawSetupChoosePlayerMenu(void)
 	// Yes.
 	if (thismenu)
 	{
-		M_DrawLoadGameData();
+		if (charselscrollx)
+		{
+			// Don't hide the title map yet
+			hidetitlemap = false;
+			M_DrawLoadGameData();
+		}
+		else
+		{
+			// Okay, fine, now you can
+			hidetitlemap = true;
+		}
 		charseltimer++;
 	}
 	else if (charseltimer > 0)
-- 
GitLab