added setup option to disable counting score after the game
authorHolger Schemel <info@artsoft.org>
Sat, 9 Jan 2021 16:47:11 +0000 (17:47 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 20 Jan 2021 18:19:53 +0000 (19:19 +0100)
src/files.c
src/game.c
src/libgame/system.h
src/screens.c

index 0218bbf4c62641f7692b0a6971300b1bd9604bab..409ede257fb8e6dc9322ec7b6943bb928b087b56 100644 (file)
@@ -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;
index 7f5405cc014840076b71e8e54cd0f8f2e4375236..c1af86314e0a12c979d32a8efac9f0488d844026 100644 (file)
@@ -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;
index 0a6c35e16755dfc94706fcec31b618d49d67e842..598fbfef447e9ee781b03b1ee425244249d220ce 100644 (file)
@@ -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;
index 84b890f6e9bb6c0d05e2d519a36ba4ed89e91f15..9cf65da03fffe6811ed530840199bdae0cfac9dc 100644 (file)
@@ -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:"    },