added separate game variable to check for time limit setup option
authorHolger Schemel <info@artsoft.org>
Fri, 24 Jun 2022 14:48:04 +0000 (16:48 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 24 Jun 2022 14:48:04 +0000 (16:48 +0200)
src/game.c
src/game.h
src/game_em/logic.c
src/game_mm/mm_game.c

index 01bea5abca7918ca1fa5e0f9f3d5a0d90b179c1d..e650f4d3a6c6d867fa9573eb1a67a65fdf3f6be1 100644 (file)
@@ -3819,6 +3819,7 @@ void InitGame(void)
   game.panel.active = TRUE;
 
   game.no_level_time_limit = (level.time == 0);
+  game.time_limit = (setup.time_limit);
 
   game.yamyam_content_nr = 0;
   game.robot_wheel_active = FALSE;
@@ -10227,7 +10228,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
 
        DisplayGameControlValues();
 
-       if (!TimeLeft && setup.time_limit)
+       if (!TimeLeft && game.time_limit)
          for (i = 0; i < MAX_PLAYERS; i++)
            KillPlayer(&stored_player[i]);
       }
@@ -11637,14 +11638,14 @@ static void CheckLevelTime_StepCounter(void)
   {
     TimeLeft--;
 
-    if (TimeLeft <= 10 && setup.time_limit && !game.LevelSolved)
+    if (TimeLeft <= 10 && game.time_limit && !game.LevelSolved)
       PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
 
     game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
 
     DisplayGameControlValues();
 
-    if (!TimeLeft && setup.time_limit && !game.LevelSolved)
+    if (!TimeLeft && game.time_limit && !game.LevelSolved)
       for (i = 0; i < MAX_PLAYERS; i++)
        KillPlayer(&stored_player[i]);
   }
@@ -11686,7 +11687,7 @@ static void CheckLevelTime(void)
       {
        TimeLeft--;
 
-       if (TimeLeft <= 10 && setup.time_limit)
+       if (TimeLeft <= 10 && game.time_limit)
          PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
 
        /* this does not make sense: game_panel_controls[GAME_PANEL_TIME].value
@@ -11694,7 +11695,7 @@ static void CheckLevelTime(void)
 
        game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
 
-       if (!TimeLeft && setup.time_limit)
+       if (!TimeLeft && game.time_limit)
        {
          if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
            game_em.lev->killed_out_of_time = TRUE;
index dee0f9cd0a1a7d427199d9393c57cda4117cd788..e96f7f9386c8acd2158fc35206b34ba3ba38179a 100644 (file)
@@ -204,6 +204,7 @@ struct GameInfo
   boolean explosions_delayed;
   boolean envelope_active;
   boolean no_level_time_limit; // (variable only in very special case)
+  boolean time_limit;          // forced by setup option
 
   int time_final;              // time (in seconds) or steps left or played
   int score_time_final;                // time (in frames) or steps played
index 1eaefcfc93421c0303f66dd66f7792a73c202206..61f3237c98727d3faf59b09a032954befe854406 100644 (file)
@@ -293,7 +293,7 @@ static boolean player_killed(struct PLAYER *ply)
   if (!ply->alive)
     return FALSE;
 
-  if (lev.killed_out_of_time && setup.time_limit)
+  if (lev.killed_out_of_time && game.time_limit)
     return TRUE;
 
   switch (cave[x][y-1])
index 52f0b01e7d0c373a8d8ce012fbc71b2ca25a7824..c97a7d3b09f0583080681e20d6bf168b080d077d 100644 (file)
@@ -3119,7 +3119,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       redraw_mask |= REDRAW_DOOR_1;
     }
-    else if (setup.time_limit && !game_mm.game_over)
+    else if (game.time_limit && !game_mm.game_over)
     {
       int i;