fixed bug that prevents playing levels without time limit in MM engine
authorHolger Schemel <info@artsoft.org>
Mon, 2 Jan 2023 11:45:35 +0000 (12:45 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 2 Jan 2023 11:45:45 +0000 (12:45 +0100)
src/game_mm/mm_game.c

index 01c490a9948e376639cec4d4b602b45518b9d1da..d001df011b9c3bcc5e3ffe9294122ca767746e5d 100644 (file)
@@ -3202,22 +3202,21 @@ static void GameActions_MM_Ext(void)
   if (game_mm.game_over)
     return;
 
+  if (game_mm.energy_left == 0 && !game.no_level_time_limit && game.time_limit)
+  {
+    FadeOutLaser();
+
+    GameOver_MM(GAME_OVER_NO_ENERGY);
+
+    return;
+  }
+
   if (FrameReached(&energy_delay))
   {
     if (game_mm.energy_left > 0)
-    {
       game_mm.energy_left--;
 
-      redraw_mask |= REDRAW_DOOR_1;
-    }
-    else if (game.time_limit && !game_mm.game_over)
-    {
-      FadeOutLaser();
-
-      GameOver_MM(GAME_OVER_NO_ENERGY);
-
-      return;
-    }
+    // when out of energy, wait another frame to play "out of time" sound
   }
 
   element = laser.dest_element;