added GIC flag to keep game panel door open when restarting game
authorHolger Schemel <holger.schemel@virtion.de>
Mon, 13 Jan 2025 22:17:54 +0000 (23:17 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Mon, 13 Jan 2025 22:17:57 +0000 (23:17 +0100)
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
src/game.c
src/game.h

index 60f8969e0a85b171a5a040f8141051783f10958e..6f3bfd7b23cded668df56f66e33313735da861ac 100644 (file)
@@ -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"                          },
index 305af811a04eaee9b9a6a52015aa960f413efa45..f931600887696a134a21ff984cc0a24fb1c48753 100644 (file)
@@ -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)
index 713eb8c96cb60bd53d49b7d4bc4e3516acbf825f..aefb1682f12415b541a2e50398d368ad590fa1f6 100644 (file)
@@ -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;