From e7c16a13b70d4847b840b3ce00aeb3729de3d44f Mon Sep 17 00:00:00 2001
From: Eidolon <furyhunter600@gmail.com>
Date: Wed, 26 Oct 2022 03:04:51 +0000
Subject: [PATCH] Merge branch 'splitscreen-hudhook-fix' into 'next'

Clear and draw all game hud hook calls to 1 list

See merge request KartKrew/Kart-Public!318

(cherry picked from commit 7e17eb8591afa9487fd311a6f111bd2ed42b67e0)

2cffc9b4 Clear and draw all game hud hook calls to 1 list
---
 src/st_stuff.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/st_stuff.c b/src/st_stuff.c
index 4a9accf0e..0c91ad717 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -1967,12 +1967,10 @@ static void ST_overlayDrawer(void)
 	{
 		if (renderisnewtic)
 		{
-			LUA_HUD_ClearDrawList(luahuddrawlist_game);
 			LUAh_GameHUD(stplyr, luahuddrawlist_game);
 		}
-		LUA_HUD_DrawList(luahuddrawlist_game);
 	}
-#endif
+#endif // HAVE_BLUA
 
 	// draw level title Tails
 	if (*mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer) && !mapreset)
@@ -2166,6 +2164,12 @@ void ST_Drawer(void)
 
 	if (st_overlay)
 	{
+#ifdef HAVE_BLUA
+		if (renderisnewtic)
+		{
+			LUA_HUD_ClearDrawList(luahuddrawlist_game);
+		}
+#endif // HAVE_BLUA
 		// No deadview!
 		for (i = 0; i <= splitscreen; i++)
 		{
@@ -2173,6 +2177,10 @@ void ST_Drawer(void)
 			ST_overlayDrawer();
 		}
 
+#ifdef HAVE_BLUA
+		LUA_HUD_DrawList(luahuddrawlist_game);
+#endif // HAVE_BLUA
+
 		// draw Midnight Channel's overlay ontop
 		if (mapheaderinfo[gamemap-1]->typeoflevel & TOL_TV)	// Very specific Midnight Channel stuff.
 			ST_MayonakaStatic();
-- 
GitLab