Skip to content

Commit 50183ce

Browse files
committed
fix: skip GFX loading screen on main menu return after first launch
The static s_mainMenuGfxLoadingShown flag was reset on every UI module reload (e.g. on map exit), causing the GFX loading screen to reappear when returning to the main menu. Replaced with a persistent cvar (ui_gfxLoadingShown) that survives UI reinitialization, so the screen is only shown once per session.
1 parent 0d32965 commit 50183ce

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

engine/code/q3_ui/ui_atoms.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,11 @@ qboolean UI_IsFullscreen( void ) {
12471247
return qfalse;
12481248
}
12491249

1250+
// NOTE: Not a static flag - persisted as a cvar so it survives UI module reloads on map exit.
1251+
// The GFX loading screen is only shown once per session (first game start), never when
1252+
// returning to the main menu after leaving a map.
1253+
#define CVAR_GFX_LOADING_SHOWN "ui_gfxLoadingShown"
1254+
12501255
static void NeedCDAction( qboolean result ) {
12511256
if ( !result ) {
12521257
trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n" );
@@ -1271,7 +1276,12 @@ void UI_SetActiveMenu( uiMenuCommand_t menu ) {
12711276
case UIMENU_MAIN:
12721277
// STONELANCE
12731278
// UI_MainMenu();
1274-
UI_GFX_Loading();
1279+
if ( !trap_Cvar_VariableValue( CVAR_GFX_LOADING_SHOWN ) ) {
1280+
trap_Cvar_Set( CVAR_GFX_LOADING_SHOWN, "1" );
1281+
UI_GFX_Loading();
1282+
} else {
1283+
UI_MainMenu();
1284+
}
12751285
// END
12761286
return;
12771287
case UIMENU_NEED_CD:
@@ -1286,6 +1296,12 @@ void UI_SetActiveMenu( uiMenuCommand_t menu ) {
12861296
UI_RankingsMenu();
12871297
return;
12881298
*/
1299+
/*
1300+
* If the player has already entered an active game, don't show the
1301+
* startup loading splash when returning to the main menu later
1302+
* (e.g. via LEAVE ARENA).
1303+
*/
1304+
trap_Cvar_Set( CVAR_GFX_LOADING_SHOWN, "1" );
12891305
trap_Cvar_Set( "cl_paused", "1" );
12901306
UI_InGameMenu();
12911307
return;

0 commit comments

Comments
 (0)