added setup options to disable asking on quit game and on quit program
authorHolger Schemel <info@artsoft.org>
Fri, 19 Feb 2021 01:49:37 +0000 (02:49 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 19 Feb 2021 01:49:37 +0000 (02:49 +0100)
src/files.c
src/game.c
src/libgame/system.h
src/screens.c

index 5cca0e3055b97595d87e418087e9dac35b3be83a..6c26bb013a101bfff4cc2820dd27f6720f181889 100644 (file)
@@ -8604,6 +8604,14 @@ static struct TokenInfo global_setup_tokens[] =
     TYPE_SWITCH,
     &setup.ask_on_game_over,                   "ask_on_game_over"
   },
+  {
+    TYPE_SWITCH,
+    &setup.ask_on_quit_game,                   "ask_on_quit_game"
+  },
+  {
+    TYPE_SWITCH,
+    &setup.ask_on_quit_program,                        "ask_on_quit_program"
+  },
   {
     TYPE_SWITCH,
     &setup.quick_switch,                       "quick_player_switch"
@@ -9296,6 +9304,8 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->ask_on_escape = TRUE;
   si->ask_on_escape_editor = TRUE;
   si->ask_on_game_over = TRUE;
+  si->ask_on_quit_game = TRUE;
+  si->ask_on_quit_program = TRUE;
   si->quick_switch = FALSE;
   si->input_on_focus = FALSE;
   si->prefer_aga_graphics = TRUE;
index 476b67b049b34db5f50c3f57a4ece155f0b99a72..07df1fe52a4f6676eb3713d170144b032a45a448 100644 (file)
@@ -15373,12 +15373,12 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message)
 {
   if (skip_request || Request(message, REQ_ASK | REQ_STAY_CLOSED))
   {
-    // closing door required in case of envelope style request dialogs
-    if (!skip_request)
+    if (!quick_quit)
     {
       // prevent short reactivation of overlay buttons while closing door
       SetOverlayActive(FALSE);
 
+      // door may still be open due to skipped or envelope style request
       CloseDoor(DOOR_CLOSE_1);
     }
 
@@ -15408,9 +15408,11 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message)
 
 void RequestQuitGame(boolean escape_key_pressed)
 {
-  boolean quick_quit = ((escape_key_pressed && !setup.ask_on_escape) ||
+  boolean ask_on_escape = (setup.ask_on_escape && setup.ask_on_quit_game);
+  boolean quick_quit = ((escape_key_pressed && !ask_on_escape) ||
                        level_editor_test_game);
-  boolean skip_request = game.all_players_gone || quick_quit;
+  boolean skip_request = (game.all_players_gone || !setup.ask_on_quit_game ||
+                         quick_quit);
 
   RequestQuitGameExt(skip_request, quick_quit,
                     "Do you really want to quit the game?");
index 8ebd43dca41d15a869e75c98871f6ed1000c3636..ca8494bc46868c4b4d95c673260440ff6c02d77d 100644 (file)
@@ -1461,6 +1461,8 @@ struct SetupInfo
   boolean ask_on_escape;
   boolean ask_on_escape_editor;
   boolean ask_on_game_over;
+  boolean ask_on_quit_game;
+  boolean ask_on_quit_program;
   boolean quick_switch;
   boolean input_on_focus;
   boolean prefer_aga_graphics;
index e9eaf40f8f22c8be3e1cd9f9007d656e3d045b65..c82f2a962d6d5463c2d85565ac4d90dddf276286 100644 (file)
@@ -2223,7 +2223,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
        SaveLevelSetup_LastSeries();
        SaveLevelSetup_SeriesInfo();
 
-        if (Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED))
+       if (!setup.ask_on_quit_program ||
+           Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED))
          SetGameStatus(GAME_MODE_QUIT);
       }
     }
@@ -6732,6 +6733,8 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_SWITCH,       &setup.count_score_after_game,"Count Score After Game:" },
   { TYPE_SWITCH,       &setup.show_scores_after_game,"Show Scores After Game:" },
   { TYPE_YES_NO,       &setup.ask_on_game_over, "Ask on Game Over:"    },
+  { TYPE_YES_NO,       &setup.ask_on_quit_game, "Ask on Quit Game:"    },
+  { TYPE_YES_NO,       &setup.ask_on_quit_program, "Ask on Quit Program:" },
   { TYPE_SWITCH,       &setup.autorecord,      "Auto-Record Tapes:"    },
   { TYPE_ENTER_LIST,   execSetupChooseGameSpeed, "Game Speed:"         },
   { TYPE_STRING,       &game_speed_text,       ""                      },