added setup option to directly play the next level after solving a level
authorHolger Schemel <info@artsoft.org>
Thu, 21 Jun 2018 06:41:31 +0000 (08:41 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 21 Jun 2018 06:47:44 +0000 (08:47 +0200)
Before, the program returned to the main menu after the player solved
a level (and the high score table was displayed). From there, the next
level could be played by starting the game with the incremented level.

Now, the program automatically starts playing the next level after the
previous level was successfully solved.

This new setup option is enabled by default now, changing the previous
default behaviour of the program.

src/files.c
src/game.c
src/libgame/system.h
src/screens.c

index 8a65cee4ef8806b7c67d8821c0e9ba7ccec0df06..c074f9586897786431b0678d7d4702d19eb34e38 100644 (file)
@@ -8281,6 +8281,7 @@ enum
   SETUP_TOKEN_HANDICAP,
   SETUP_TOKEN_SKIP_LEVELS,
   SETUP_TOKEN_INCREMENT_LEVELS,
+  SETUP_TOKEN_AUTO_PLAY_NEXT_LEVEL,
   SETUP_TOKEN_TIME_LIMIT,
   SETUP_TOKEN_FULLSCREEN,
   SETUP_TOKEN_WINDOW_SCALING_PERCENT,
@@ -8520,6 +8521,7 @@ static struct TokenInfo global_setup_tokens[] =
   { TYPE_SWITCH, &si.handicap,                "handicap"               },
   { TYPE_SWITCH, &si.skip_levels,             "skip_levels"            },
   { TYPE_SWITCH, &si.increment_levels,        "increment_levels"       },
+  { TYPE_SWITCH, &si.auto_play_next_level,    "auto_play_next_level"   },
   { TYPE_SWITCH, &si.time_limit,              "time_limit"             },
   { TYPE_SWITCH, &si.fullscreen,              "fullscreen"             },
   { TYPE_INTEGER,&si.window_scaling_percent,  "window_scaling_percent" },
@@ -8738,6 +8740,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->handicap = TRUE;
   si->skip_levels = TRUE;
   si->increment_levels = TRUE;
+  si->auto_play_next_level = TRUE;
   si->time_limit = TRUE;
   si->fullscreen = FALSE;
   si->window_scaling_percent = STD_WINDOW_SCALING_PERCENT;
index 5a97b201b510b71676ae0f3a64253e5d8a5098ba..8340553f0af9059e4e58c9175b55cb9a067c61b4 100644 (file)
@@ -4696,6 +4696,13 @@ void GameEnd()
   {
     level_nr++;                /* advance to next level */
     TapeErase();       /* start with empty tape */
+
+    if (setup.auto_play_next_level)
+    {
+      LoadLevel(level_nr);
+
+      SaveLevelSetup_SeriesInfo();
+    }
   }
 
   hi_pos = NewHiScore(last_level_nr);
@@ -4706,12 +4713,16 @@ void GameEnd()
 
     DrawHallOfFame(last_level_nr, hi_pos);
   }
-  else
+  else if (!setup.auto_play_next_level || !setup.increment_levels)
   {
     SetGameStatus(GAME_MODE_MAIN);
 
     DrawMainMenu();
   }
+  else
+  {
+    StartGameActions(network.enabled, setup.autorecord, level.random_seed);
+  }
 }
 
 int NewHiScore(int level_nr)
index d2a8d2874234b5c605632c845cb22fb77ad2bc61..4dfe8d668ea0318efcb4772348dada308e456915 100644 (file)
@@ -1257,6 +1257,7 @@ struct SetupInfo
   boolean handicap;
   boolean skip_levels;
   boolean increment_levels;
+  boolean auto_play_next_level;
   boolean time_limit;
   boolean fullscreen;
   int window_scaling_percent;
index 1318bde16e80a2a079b41caab99c452ef8714d78..6d29aec8e1ace3e32b27251a1fd38d512ce7600b 100644 (file)
@@ -4625,9 +4625,17 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
 
     FadeSound(SND_BACKGROUND_SCORES);
 
-    SetGameStatus(GAME_MODE_MAIN);
+    if (game_status_last_screen != GAME_MODE_PLAYING ||
+       !setup.auto_play_next_level || !setup.increment_levels)
+    {
+      SetGameStatus(GAME_MODE_MAIN);
 
-    DrawMainMenu();
+      DrawMainMenu();
+    }
+    else
+    {
+      StartGameActions(network.enabled, setup.autorecord, level.random_seed);
+    }
   }
 
   if (game_status == GAME_MODE_SCORES)
@@ -5878,6 +5886,7 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_SWITCH,       &setup.handicap,        "Handicap:"             },
   { TYPE_SWITCH,       &setup.skip_levels,     "Skip Unsolved Levels:" },
   { TYPE_SWITCH,       &setup.increment_levels,"Increment Solved Levels:" },
+  { TYPE_SWITCH,       &setup.auto_play_next_level,"Auto-play Next Level:" },
   { TYPE_SWITCH,       &setup.autorecord,      "Auto-Record Tapes:"    },
   { TYPE_ENTER_LIST,   execSetupChooseGameSpeed, "Game Speed:"         },
   { TYPE_STRING,       &game_speed_text,       ""                      },