From: Holger Schemel Date: Thu, 21 Jun 2018 06:41:31 +0000 (+0200) Subject: added setup option to directly play the next level after solving a level X-Git-Tag: 4.1.1.0~105 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=9e08928735ed2195ecceb20747e705cfd3c7c5d2;p=rocksndiamonds.git added setup option to directly play the next level after solving a level 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. --- diff --git a/src/files.c b/src/files.c index 8a65cee4..c074f958 100644 --- a/src/files.c +++ b/src/files.c @@ -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; diff --git a/src/game.c b/src/game.c index 5a97b201..8340553f 100644 --- a/src/game.c +++ b/src/game.c @@ -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) diff --git a/src/libgame/system.h b/src/libgame/system.h index d2a8d287..4dfe8d66 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -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; diff --git a/src/screens.c b/src/screens.c index 1318bde1..6d29aec8 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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, "" },