fixed name of element 'beamer' to 'teleporter'
[rocksndiamonds.git] / src / game_mm / mm_game.c
index ec206faf8f0452278fffed98d8d9e6c14126992e..0a9d2da6fe061ecab630719923aba7ca3cf565ce 100644 (file)
@@ -1541,6 +1541,8 @@ boolean HitElement(int element, int hit_mask)
       if (game_mm.kettles_still_needed > 0)
        game_mm.kettles_still_needed--;
 
+      game.snapshot.collected_item = TRUE;
+
       if (game_mm.kettles_still_needed == 0)
       {
        CheckExitMM();
@@ -2488,6 +2490,8 @@ static void Explode_MM(int x, int y, int phase, int mode)
     else if (IS_MCDUFFIN(Store[x][y]))
     {
       Store[x][y] = EL_EMPTY;
+
+      game.restart_game_message = "Bomb killed Mc Duffin ! Play it again ?";
     }
 
     Feld[x][y] = Store[x][y];
@@ -2731,11 +2735,12 @@ static void ContinueMoving_MM(int x, int y)
   laser.redraw = TRUE;
 }
 
-void ClickElement(int x, int y, int button)
+boolean ClickElement(int x, int y, int button)
 {
   static unsigned int click_delay = 0;
   static int click_delay_value = CLICK_DELAY;
   static boolean new_button = TRUE;
+  boolean element_clicked = FALSE;
   int element;
 
   if (button == -1)
@@ -2745,12 +2750,12 @@ void ClickElement(int x, int y, int button)
     click_delay_value = CLICK_DELAY;
     new_button = TRUE;
 
-    return;
+    return FALSE;
   }
 
   /* do not rotate objects hit by the laser after the game was solved */
   if (game_mm.level_solved && Hit[x][y])
-    return;
+    return FALSE;
 
   if (button == MB_RELEASED)
   {
@@ -2760,20 +2765,20 @@ void ClickElement(int x, int y, int button)
     /* release eventually hold auto-rotating mirror */
     RotateMirror(x, y, MB_RELEASED);
 
-    return;
+    return FALSE;
   }
 
   if (!FrameReached(&click_delay, click_delay_value) && !new_button)
-    return;
+    return FALSE;
 
   if (button == MB_MIDDLEBUTTON)       /* middle button has no function */
-    return;
+    return FALSE;
 
   if (!IN_LEV_FIELD(x, y))
-    return;
+    return FALSE;
 
   if (Feld[x][y] == EL_EMPTY)
-    return;
+    return FALSE;
 
   element = Feld[x][y];
 
@@ -2785,6 +2790,8 @@ void ClickElement(int x, int y, int button)
       IS_DF_MIRROR_AUTO(element))
   {
     RotateMirror(x, y, button);
+
+    element_clicked = TRUE;
   }
   else if (IS_MCDUFFIN(element))
   {
@@ -2811,17 +2818,21 @@ void ClickElement(int x, int y, int button)
 
     if (!laser.fuse_off)
       ScanLaser();
+
+    element_clicked = TRUE;
   }
   else if (element == EL_FUSE_ON && laser.fuse_off)
   {
     if (x != laser.fuse_x || y != laser.fuse_y)
-      return;
+      return FALSE;
 
     laser.fuse_off = FALSE;
     laser.fuse_x = laser.fuse_y = -1;
 
     DrawGraphic_MM(x, y, IMG_MM_FUSE_ACTIVE);
     ScanLaser();
+
+    element_clicked = TRUE;
   }
   else if (element == EL_FUSE_ON && !laser.fuse_off && new_button)
   {
@@ -2832,16 +2843,22 @@ void ClickElement(int x, int y, int button)
 
     DrawLaser(0, DL_LASER_DISABLED);
     DrawGraphic_MM(x, y, IMG_MM_FUSE);
+
+    element_clicked = TRUE;
   }
   else if (element == EL_LIGHTBALL)
   {
     Bang_MM(x, y);
     RaiseScoreElement_MM(element);
     DrawLaser(0, DL_LASER_ENABLED);
+
+    element_clicked = TRUE;
   }
 
   click_delay_value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY);
   new_button = FALSE;
+
+  return element_clicked;
 }
 
 void RotateMirror(int x, int y, int button)
@@ -3166,6 +3183,8 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       SetTileCursorActive(FALSE);
 
+      game.restart_game_message = "Out of magic energy ! Play it again ?";
+
 #if 0
       if (Request("Out of magic energy ! Play it again ?",
                  REQ_ASK | REQ_STAY_CLOSED))
@@ -3298,6 +3317,8 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       SetTileCursorActive(FALSE);
 
+      game.restart_game_message = "Magic spell hit Mc Duffin ! Play it again ?";
+
 #if 0
       if (Request("Magic spell hit Mc Duffin ! Play it again ?",
                  REQ_ASK | REQ_STAY_CLOSED))
@@ -3744,9 +3765,12 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
 void GameActions_MM(struct MouseActionInfo action, boolean warp_mode)
 {
-  ClickElement(action.lx, action.ly, action.button);
+  boolean element_clicked = ClickElement(action.lx, action.ly, action.button);
+  boolean button_released = (action.button == MB_RELEASED);
 
   GameActions_MM_Ext(action, warp_mode);
+
+  CheckSingleStepMode_MM(element_clicked, button_released);
 }
 
 void MovePacMen()