From: Holger Schemel Date: Sat, 9 Jan 2021 16:47:11 +0000 (+0100) Subject: added setup option to disable counting score after the game X-Git-Tag: 4.2.3.0~47 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b55729ffeba9da45b5ae83abfd3460a5c0609e94;p=rocksndiamonds.git added setup option to disable counting score after the game --- diff --git a/src/files.c b/src/files.c index 0218bbf4..409ede25 100644 --- a/src/files.c +++ b/src/files.c @@ -8543,6 +8543,10 @@ static struct TokenInfo global_setup_tokens[] = TYPE_SWITCH, &setup.auto_play_next_level, "auto_play_next_level" }, + { + TYPE_SWITCH, + &setup.count_score_after_game, "count_score_after_game" + }, { TYPE_SWITCH, &setup.show_scores_after_game, "show_scores_after_game" @@ -9264,6 +9268,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->skip_levels = TRUE; si->increment_levels = TRUE; si->auto_play_next_level = TRUE; + si->count_score_after_game = TRUE; si->show_scores_after_game = TRUE; si->time_limit = TRUE; si->fullscreen = FALSE; diff --git a/src/game.c b/src/game.c index 7f5405cc..c1af8631 100644 --- a/src/game.c +++ b/src/game.c @@ -4792,7 +4792,7 @@ void GameWon(void) game.health_final = health_final; } - if (level_editor_test_game) + if (level_editor_test_game || !setup.count_score_after_game) { time = time_final; score = score_final; @@ -4856,76 +4856,79 @@ void GameWon(void) PlaySound(SND_GAME_WINNING); } - if (game_over_delay_1 > 0) + if (setup.count_score_after_game) { - game_over_delay_1--; + if (game_over_delay_1 > 0) + { + game_over_delay_1--; - return; - } + return; + } - if (time != time_final) - { - int time_to_go = ABS(time_final - time); - int time_count_dir = (time < time_final ? +1 : -1); + if (time != time_final) + { + int time_to_go = ABS(time_final - time); + int time_count_dir = (time < time_final ? +1 : -1); - if (time_to_go < time_count_steps) - time_count_steps = 1; + if (time_to_go < time_count_steps) + time_count_steps = 1; - time += time_count_steps * time_count_dir; - score += time_count_steps * time_score; + time += time_count_steps * time_count_dir; + score += time_count_steps * time_score; - // set final score to correct rounding differences after counting score - if (time == time_final) - score = score_final; + // set final score to correct rounding differences after counting score + if (time == time_final) + score = score_final; - game.LevelSolved_CountingTime = time; - game.LevelSolved_CountingScore = score; + game.LevelSolved_CountingTime = time; + game.LevelSolved_CountingScore = score; - game_panel_controls[GAME_PANEL_TIME].value = time; - game_panel_controls[GAME_PANEL_SCORE].value = score; + game_panel_controls[GAME_PANEL_TIME].value = time; + game_panel_controls[GAME_PANEL_SCORE].value = score; - DisplayGameControlValues(); + DisplayGameControlValues(); - if (time == time_final) - StopSound(SND_GAME_LEVELTIME_BONUS); - else if (setup.sound_loops) - PlaySoundLoop(SND_GAME_LEVELTIME_BONUS); - else - PlaySound(SND_GAME_LEVELTIME_BONUS); + if (time == time_final) + StopSound(SND_GAME_LEVELTIME_BONUS); + else if (setup.sound_loops) + PlaySoundLoop(SND_GAME_LEVELTIME_BONUS); + else + PlaySound(SND_GAME_LEVELTIME_BONUS); - return; - } + return; + } - if (game_over_delay_2 > 0) - { - game_over_delay_2--; + if (game_over_delay_2 > 0) + { + game_over_delay_2--; - return; - } + return; + } - if (health != health_final) - { - int health_count_dir = (health < health_final ? +1 : -1); + if (health != health_final) + { + int health_count_dir = (health < health_final ? +1 : -1); - health += health_count_dir; - score += time_score; + health += health_count_dir; + score += time_score; - game.LevelSolved_CountingHealth = health; - game.LevelSolved_CountingScore = score; + game.LevelSolved_CountingHealth = health; + game.LevelSolved_CountingScore = score; - game_panel_controls[GAME_PANEL_HEALTH].value = health; - game_panel_controls[GAME_PANEL_SCORE].value = score; + game_panel_controls[GAME_PANEL_HEALTH].value = health; + game_panel_controls[GAME_PANEL_SCORE].value = score; - DisplayGameControlValues(); + DisplayGameControlValues(); - if (health == health_final) - StopSound(SND_GAME_LEVELTIME_BONUS); - else if (setup.sound_loops) - PlaySoundLoop(SND_GAME_LEVELTIME_BONUS); - else - PlaySound(SND_GAME_LEVELTIME_BONUS); + if (health == health_final) + StopSound(SND_GAME_LEVELTIME_BONUS); + else if (setup.sound_loops) + PlaySoundLoop(SND_GAME_LEVELTIME_BONUS); + else + PlaySound(SND_GAME_LEVELTIME_BONUS); - return; + return; + } } game.panel.active = FALSE; diff --git a/src/libgame/system.h b/src/libgame/system.h index 0a6c35e1..598fbfef 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1427,6 +1427,7 @@ struct SetupInfo boolean skip_levels; boolean increment_levels; boolean auto_play_next_level; + boolean count_score_after_game; boolean show_scores_after_game; boolean time_limit; boolean fullscreen; diff --git a/src/screens.c b/src/screens.c index 84b890f6..9cf65da0 100644 --- a/src/screens.c +++ b/src/screens.c @@ -6671,6 +6671,7 @@ static struct TokenInfo setup_info_game[] = { 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.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_SWITCH, &setup.autorecord, "Auto-Record Tapes:" },