From 8bd431689f7d93527e104ecef270b133775c314c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 13 Jan 2025 23:17:54 +0100 Subject: [PATCH] added GIC flag to keep game panel door open when restarting game Setting this flag to "true" in file "graphicsinfo.conf" prevents closing the game panel door when starting a game while already being in game mode "playing" (like restarting a level or playing the next level when not showing the hall of fame screen between two levels). This can be used to skip closing and opening the game panel door if nothing happens between closing and opening (besides updating the panel content), which can be the case with BD engine levels which use screen covering and uncovering instead of fading out and fading in. --- src/conf_gfx.c | 1 + src/game.c | 16 +++++++++++++++- src/game.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 60f8969e..6f3bfd7b 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -11437,6 +11437,7 @@ struct ConfigInfo image_config[] = { "game.use_native_sp_graphics_engine", "true" }, { "game.use_masked_pushing", "false" }, { "game.use_masked_elements", "false" }, + { "game.keep_panel_open_when_restarting", "false" }, { "game.tile_size", "32" }, { "[player].boring_delay_fixed", "1000" }, diff --git a/src/game.c b/src/game.c index 305af811..f9316008 100644 --- a/src/game.c +++ b/src/game.c @@ -3717,6 +3717,20 @@ static void DebugPrintPlayerStatus(char *message) } #endif +static boolean checkCloseGamePanelDoor(boolean restarting) +{ + // do not close game panel door if game restart was triggered by CE action + if (game.restart_level) + return FALSE; + + // do not close game panel door if configured to keep open when restarting game + if (restarting && game.keep_panel_open_when_restarting) + return FALSE; + + // always close game panel door in all other cases + return TRUE; +} + void InitGame(void) { static int last_level_nr = -1; @@ -3806,7 +3820,7 @@ void InitGame(void) // cover BD screen before closing game panel door CoverScreen(); - if (!game.restart_level) + if (checkCloseGamePanelDoor(restarting)) CloseDoor(DOOR_CLOSE_1); if (level_editor_test_game) diff --git a/src/game.h b/src/game.h index 713eb8c9..aefb1682 100644 --- a/src/game.h +++ b/src/game.h @@ -173,6 +173,7 @@ struct GameInfo boolean use_masked_pushing; boolean use_masked_elements; boolean use_masked_elements_initial; + boolean keep_panel_open_when_restarting; int forced_scroll_x; int forced_scroll_y; int forced_scroll_delay_value; -- 2.34.1