removed unused code
[rocksndiamonds.git] / src / game_mm / mm_game.c
index 8583a9a7d7d056e43e13b3e2bcc80ffefe35af3a..652f05a43f281770666dd6b63b7c4c7fb2246c42 100644 (file)
@@ -463,7 +463,7 @@ static void InitMovDir_MM(int x, int y)
   }
 }
 
-static void InitField(int x, int y)
+static void InitField(int x, int y, boolean init_game)
 {
   int element = Tile[x][y];
 
@@ -475,7 +475,7 @@ static void InitField(int x, int y)
 
     case EL_KETTLE:
     case EL_CELL:
-      if (native_mm_level.auto_count_kettles)
+      if (init_game && native_mm_level.auto_count_kettles)
        game_mm.kettles_still_needed++;
       break;
 
@@ -535,9 +535,12 @@ static void InitField(int x, int y)
       }
       else if (IS_MCDUFFIN(element) || IS_LASER(element))
       {
-       laser.start_edge.x = x;
-       laser.start_edge.y = y;
-       laser.start_angle = get_element_angle(element);
+       if (init_game)
+       {
+         laser.start_edge.x = x;
+         laser.start_edge.y = y;
+         laser.start_angle = get_element_angle(element);
+       }
 
         if (IS_MCDUFFIN(element))
         {
@@ -644,8 +647,6 @@ void InitGameEngine_MM(void)
   game_mm.laser_green = FALSE;
   game_mm.laser_blue = TRUE;
 
-  game_mm.lightball_rnd = TRUE;
-
   game_mm.level_solved = FALSE;
   game_mm.game_over = FALSE;
   game_mm.game_over_cause = 0;
@@ -701,7 +702,7 @@ void InitGameEngine_MM(void)
       Store[x][y] = Store2[x][y] = 0;
       Stop[x][y] = FALSE;
 
-      InitField(x, y);
+      InitField(x, y, TRUE);
     }
   }
 
@@ -716,8 +717,6 @@ void InitGameActions_MM(void)
 
   InitLaser();
 
-  game_mm.lightball_rnd = FALSE;
-
   for (i = 0; i <= num_init_game_frames; i++)
   {
     if (i == num_init_game_frames)
@@ -745,16 +744,12 @@ void InitGameActions_MM(void)
 
     BackToFront();
 
-    ColorCycling();
-
 #ifdef DEBUG
     if (setup.quick_doors)
       continue;
 #endif
   }
 
-  game_mm.lightball_rnd = TRUE;
-
   ScanLaser();
 
   if (game_mm.kettles_still_needed == 0)
@@ -763,7 +758,11 @@ void InitGameActions_MM(void)
   SetTileCursorXY(laser.start_edge.x, laser.start_edge.y);
   SetTileCursorActive(TRUE);
 
+  // restart all delay counters after initially cycling game elements
+  ResetFrameCounter(&rotate_delay);
+  ResetFrameCounter(&pacman_delay);
   ResetFrameCounter(&energy_delay);
+  ResetFrameCounter(&overload_delay);
 }
 
 static void FadeOutLaser(void)
@@ -827,6 +826,13 @@ void AddLaserEdge(int lx, int ly)
 
 void AddDamagedField(int ex, int ey)
 {
+  // prevent adding the same field position again
+  if (laser.num_damages > 0 &&
+      laser.damage[laser.num_damages - 1].x == ex &&
+      laser.damage[laser.num_damages - 1].y == ey &&
+      laser.damage[laser.num_damages - 1].edge == laser.num_edges)
+    return;
+
   laser.damage[laser.num_damages].is_mirror = FALSE;
   laser.damage[laser.num_damages].angle = laser.current_angle;
   laser.damage[laser.num_damages].edge = laser.num_edges;
@@ -943,6 +949,7 @@ static void DeactivateLaserTargetElement(void)
 {
   if (laser.dest_element_last == EL_BOMB_ACTIVE ||
       laser.dest_element_last == EL_MINE_ACTIVE ||
+      laser.dest_element_last == EL_GRAY_BALL_ACTIVE ||
       laser.dest_element_last == EL_GRAY_BALL_OPENING)
   {
     int x = laser.dest_element_last_x;
@@ -951,9 +958,9 @@ static void DeactivateLaserTargetElement(void)
 
     if (Tile[x][y] == element)
       Tile[x][y] = (element == EL_BOMB_ACTIVE ? EL_BOMB :
-                   element == EL_MINE_ACTIVE ? EL_MINE : EL_BALL_GRAY);
+                   element == EL_MINE_ACTIVE ? EL_MINE : EL_GRAY_BALL);
 
-    if (Tile[x][y] == EL_BALL_GRAY)
+    if (Tile[x][y] == EL_GRAY_BALL)
       MovDelay[x][y] = 0;
 
     laser.dest_element_last = EL_EMPTY;
@@ -1177,6 +1184,22 @@ void ScanLaser(void)
 #endif
 }
 
+static void ScanLaser_FromLastMirror(void)
+{
+  int start_pos = (laser.num_damages > 0 ? laser.num_damages - 1 : 0);
+  int i;
+
+  for (i = start_pos; i >= 0; i--)
+    if (laser.damage[i].is_mirror)
+      break;
+
+  int start_edge = (i > 0 ? laser.damage[i].edge - 1 : 0);
+
+  DrawLaser(start_edge, DL_LASER_DISABLED);
+
+  ScanLaser();
+}
+
 static void DrawLaserExt(int start_edge, int num_edges, int mode)
 {
   int element;
@@ -1488,6 +1511,8 @@ boolean HitElement(int element, int hit_mask)
   // this is more precise: check if laser would go through the center
   if ((ELX * TILEX + 14 - LX) * YS != (ELY * TILEY + 14 - LY) * XS)
   {
+    int skip_count = 0;
+
     // prevent cutting through laser emitter with laser beam
     if (IS_LASER(element))
       return TRUE;
@@ -1497,15 +1522,18 @@ boolean HitElement(int element, int hit_mask)
     {
       LX += XS;
       LY += YS;
+
+      skip_count++;
     }
     while (ELX == LX/TILEX && ELY == LY/TILEY && LX > 0 && LY > 0);
 
-    if (LX/TILEX > ELX || LY/TILEY > ELY)
+    if ((LX/TILEX > ELX || LY/TILEY > ELY) && skip_count > 1)
     {
       /* skipping scan positions to the right and down skips one scan
         position too much, because this is only the top left scan position
         of totally four scan positions (plus one to the right, one to the
         bottom and one to the bottom right) */
+      /* ... but only roll back scan position if more than one step done */
 
       LX -= XS;
       LY -= YS;
@@ -1639,11 +1667,13 @@ boolean HitElement(int element, int hit_mask)
     return TRUE;
   }
 
-  if (element == EL_BOMB || element == EL_MINE)
+  if (element == EL_BOMB || element == EL_MINE || element == EL_GRAY_BALL)
   {
     PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_HITTING);
 
-    Tile[ELX][ELY] = (element == EL_BOMB ? EL_BOMB_ACTIVE : EL_MINE_ACTIVE);
+    Tile[ELX][ELY] = (element == EL_BOMB ? EL_BOMB_ACTIVE :
+                     element == EL_MINE ? EL_MINE_ACTIVE :
+                     EL_GRAY_BALL_ACTIVE);
 
     laser.dest_element_last = Tile[ELX][ELY];
     laser.dest_element_last_x = ELX;
@@ -1658,9 +1688,11 @@ boolean HitElement(int element, int hit_mask)
       element == EL_KEY ||
       element == EL_LIGHTBALL ||
       element == EL_PACMAN ||
-      IS_PACMAN(element))
+      IS_PACMAN(element) ||
+      IS_ENVELOPE(element))
   {
-    if (!IS_PACMAN(element))
+    if (!IS_PACMAN(element) &&
+       !IS_ENVELOPE(element))
       Bang_MM(ELX, ELY);
 
     if (element == EL_PACMAN)
@@ -1688,6 +1720,10 @@ boolean HitElement(int element, int hit_mask)
     {
       DeletePacMan(ELX, ELY);
     }
+    else if (IS_ENVELOPE(element))
+    {
+      Tile[ELX][ELY] = EL_ENVELOPE_1_OPENING + ENVELOPE_NR(Tile[ELX][ELY]);
+    }
 
     RaiseScoreElement_MM(element);
 
@@ -2439,12 +2475,25 @@ static void OpenExit(int x, int y)
   }
 }
 
-static void OpenSurpriseBall(int x, int y)
+static void OpenGrayBall(int x, int y)
 {
   int delay = 2;
 
   if (!MovDelay[x][y])         // next animation frame
+  {
+    if (IS_WALL(Store[x][y]))
+    {
+      DrawWalls_MM(x, y, Store[x][y]);
+
+      // copy wall tile to spare bitmap for "melting" animation
+      BlitBitmap(drawto, bitmap_db_field, cSX + x * TILEX, cSY + y * TILEY,
+                TILEX, TILEY, x * TILEX, y * TILEY);
+
+      DrawElement_MM(x, y, EL_GRAY_BALL);
+    }
+
     MovDelay[x][y] = 50 * delay;
+  }
 
   if (MovDelay[x][y])          // wait some time before next frame
   {
@@ -2453,15 +2502,28 @@ static void OpenSurpriseBall(int x, int y)
     if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y))
     {
       Bitmap *bitmap;
-      int graphic = el2gfx(Store[x][y]);
       int gx, gy;
       int dx = RND(26), dy = RND(26);
 
-      getGraphicSource(graphic, 0, &bitmap, &gx, &gy);
+      if (IS_WALL(Store[x][y]))
+      {
+       // copy wall tile from spare bitmap for "melting" animation
+       bitmap = bitmap_db_field;
+       gx = x * TILEX;
+       gy = y * TILEY;
+      }
+      else
+      {
+       int graphic = el2gfx(Store[x][y]);
+
+       getGraphicSource(graphic, 0, &bitmap, &gx, &gy);
+      }
 
       BlitBitmap(bitmap, drawto, gx + dx, gy + dy, 6, 6,
                 cSX + x * TILEX + dx, cSY + y * TILEY + dy);
 
+      laser.redraw = TRUE;
+
       MarkTileDirty(x, y);
     }
 
@@ -2469,10 +2531,48 @@ static void OpenSurpriseBall(int x, int y)
     {
       Tile[x][y] = Store[x][y];
       Store[x][y] = Store2[x][y] = 0;
+      MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
+
+      InitField(x, y, FALSE);
+      DrawField_MM(x, y);
+
+      ScanLaser_FromLastMirror();
+    }
+  }
+}
+
+static void OpenEnvelope(int x, int y)
+{
+  int num_frames = 8;          // seven frames plus final empty space
+
+  if (!MovDelay[x][y])         // next animation frame
+    MovDelay[x][y] = num_frames;
+
+  if (MovDelay[x][y])          // wait some time before next frame
+  {
+    int nr = ENVELOPE_OPENING_NR(Tile[x][y]);
+
+    MovDelay[x][y]--;
+
+    if (MovDelay[x][y] > 0 && IN_SCR_FIELD(x, y))
+    {
+      int graphic = el_act2gfx(EL_ENVELOPE_1 + nr, MM_ACTION_COLLECTING);
+      int frame = num_frames - MovDelay[x][y] - 1;
+
+      DrawGraphicAnimation_MM(x, y, graphic, frame);
+
+      laser.redraw = TRUE;
+    }
+
+    if (MovDelay[x][y] == 0)
+    {
+      Tile[x][y] = EL_EMPTY;
 
       DrawField_MM(x, y);
 
       ScanLaser();
+
+      ShowEnvelope_MM(nr);
     }
   }
 }
@@ -2496,8 +2596,6 @@ static void MeltIce(int x, int y)
 
     if (!MovDelay[x][y])
     {
-      int i;
-
       Tile[x][y] = real_element & (wall_mask ^ 0xFF);
       Store[x][y] = Store2[x][y] = 0;
 
@@ -2506,16 +2604,7 @@ static void MeltIce(int x, int y)
       if (Tile[x][y] == EL_WALL_ICE)
        Tile[x][y] = EL_EMPTY;
 
-      for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--)
-       if (laser.damage[i].is_mirror)
-         break;
-
-      if (i > 0)
-       DrawLaser(laser.damage[i].edge - 1, DL_LASER_DISABLED);
-      else
-       DrawLaser(0, DL_LASER_DISABLED);
-
-      ScanLaser();
+      ScanLaser_FromLastMirror();
     }
     else if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y))
     {
@@ -2619,15 +2708,14 @@ static void Explode_MM(int x, int y, int phase, int mode)
       Tile[x][y] = center_element;
     }
 
-    if (center_element == EL_BOMB_ACTIVE || IS_MCDUFFIN(center_element))
-      Store[x][y] = center_element;
-    else
-      Store[x][y] = EL_EMPTY;
-
+    Store[x][y] = center_element;
     Store2[x][y] = mode;
 
     Tile[x][y] = EL_EXPLODING_OPAQUE;
-    GfxElement[x][y] = center_element;
+
+    GfxElement[x][y] = (center_element == EL_BOMB_ACTIVE ? EL_BOMB :
+                       IS_MCDUFFIN(center_element) ? EL_MCDUFFIN :
+                       center_element);
 
     MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
 
@@ -2657,7 +2745,6 @@ static void Explode_MM(int x, int y, int phase, int mode)
       InitLaser();
 
       Bang_MM(laser.start_edge.x, laser.start_edge.y);
-      Store[x][y] = EL_EMPTY;
 
       GameOver_MM(GAME_OVER_DELAYED);
 
@@ -2665,16 +2752,15 @@ static void Explode_MM(int x, int y, int phase, int mode)
     }
     else if (IS_MCDUFFIN(Store[x][y]))
     {
-      Store[x][y] = EL_EMPTY;
-
       GameOver_MM(GAME_OVER_BOMB);
     }
 
-    Tile[x][y] = Store[x][y];
+    Tile[x][y] = EL_EMPTY;
+
     Store[x][y] = Store2[x][y] = 0;
     MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
 
-    InitField(x, y);
+    InitField(x, y, FALSE);
     DrawField_MM(x, y);
   }
   else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
@@ -2692,10 +2778,6 @@ static void Bang_MM(int x, int y)
 {
   int element = Tile[x][y];
 
-#if 0
-  DrawLaser(0, DL_LASER_ENABLED);
-#endif
-
   if (IS_PACMAN(element))
     PlayLevelSound_MM(x, y, element, MM_ACTION_EXPLODING);
   else if (element == EL_BOMB_ACTIVE || IS_MCDUFFIN(element))
@@ -2978,6 +3060,12 @@ boolean ClickElement(int x, int y, int button)
 
     element_clicked = TRUE;
   }
+  else if (IS_ENVELOPE(element))
+  {
+    Tile[x][y] = EL_ENVELOPE_1_OPENING + ENVELOPE_NR(element);
+
+    element_clicked = TRUE;
+  }
 
   click_delay.value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY);
   new_button = FALSE;
@@ -3060,8 +3148,6 @@ void RotateMirror(int x, int y, int button)
         IS_POLAR(Tile[x][y]) ||
         IS_POLAR_CROSS(Tile[x][y])) && x == ELX && y == ELY)
     {
-      check = 0;
-
       if (IS_BEAMER(Tile[x][y]))
       {
 #if 0
@@ -3069,12 +3155,13 @@ void RotateMirror(int x, int y, int button)
              LX, LY, laser.beamer_edge, laser.beamer[1].num);
 #endif
 
-#if 0
-       laser.num_edges--;
-#endif
+       if (check == 1)
+         laser.num_edges--;
       }
 
       ScanLaser();
+
+      check = 0;
     }
 
     if (check == 2)
@@ -3167,50 +3254,6 @@ void DeletePacMan(int px, int py)
   }
 }
 
-void ColorCycling(void)
-{
-  static int CC, Cc = 0;
-
-  static int color, old = 0xF00, new = 0x010, mult = 1;
-  static unsigned short red, green, blue;
-
-  if (color_status == STATIC_COLORS)
-    return;
-
-  CC = FrameCounter;
-
-  if (CC < Cc || CC > Cc + 2)
-  {
-    Cc = CC;
-
-    color = old + new * mult;
-    if (mult > 0)
-      mult++;
-    else
-      mult--;
-
-    if (ABS(mult) == 16)
-    {
-      mult =- mult / 16;
-      old = color;
-      new = new << 4;
-
-      if (new > 0x100)
-       new = 0x001;
-    }
-
-    red   = 0x0e00 * ((color & 0xF00) >> 8);
-    green = 0x0e00 * ((color & 0x0F0) >> 4);
-    blue  = 0x0e00 * ((color & 0x00F));
-    SetRGB(pen_magicolor[0], red, green, blue);
-
-    red   = 0x1111 * ((color & 0xF00) >> 8);
-    green = 0x1111 * ((color & 0x0F0) >> 4);
-    blue  = 0x1111 * ((color & 0x00F));
-    SetRGB(pen_magicolor[1], red, green, blue);
-  }
-}
-
 static void GameActions_MM_Ext(void)
 {
   int element;
@@ -3234,7 +3277,9 @@ static void GameActions_MM_Ext(void)
     else if (element == EL_EXIT_OPENING)
       OpenExit(x, y);
     else if (element == EL_GRAY_BALL_OPENING)
-      OpenSurpriseBall(x, y);
+      OpenGrayBall(x, y);
+    else if (IS_ENVELOPE_OPENING(element))
+      OpenEnvelope(x, y);
     else if (IS_WALL_CHANGING(element) && Store[x][y] == EL_WALL_ICE)
       MeltIce(x, y);
     else if (IS_WALL_CHANGING(element) && Store[x][y] == EL_WALL_AMOEBA)
@@ -3243,7 +3288,7 @@ static void GameActions_MM_Ext(void)
             IS_MIRROR_FIXED(element) ||
             element == EL_PRISM)
       DrawFieldTwinkle(x, y);
-    else if (element == EL_GRAY_BALL_OPENING ||
+    else if (element == EL_GRAY_BALL_ACTIVE ||
             element == EL_BOMB_ACTIVE ||
             element == EL_MINE_ACTIVE)
       DrawFieldAnimated_MM(x, y);
@@ -3311,7 +3356,8 @@ static void GameActions_MM_Ext(void)
       element != EL_BOMB_ACTIVE &&
       element != EL_MINE &&
       element != EL_MINE_ACTIVE &&
-      element != EL_BALL_GRAY &&
+      element != EL_GRAY_BALL &&
+      element != EL_GRAY_BALL_ACTIVE &&
       element != EL_BLOCK_STONE &&
       element != EL_BLOCK_WOOD &&
       element != EL_FUSE_ON &&
@@ -3353,30 +3399,6 @@ static void GameActions_MM_Ext(void)
     else
       PlaySound_MM(SND_MM_GAME_HEALTH_CHARGING);
 
-    if (laser.overloaded)
-    {
-#if 0
-      BlitBitmap(pix[PIX_DOOR], drawto,
-                DOOR_GFX_PAGEX4 + XX_OVERLOAD,
-                DOOR_GFX_PAGEY1 + YY_OVERLOAD + OVERLOAD_YSIZE
-                - laser.overload_value,
-                OVERLOAD_XSIZE, laser.overload_value,
-                DX_OVERLOAD, DY_OVERLOAD + OVERLOAD_YSIZE
-                - laser.overload_value);
-#endif
-      redraw_mask |= REDRAW_DOOR_1;
-    }
-    else
-    {
-#if 0
-      BlitBitmap(pix[PIX_DOOR], drawto,
-                DOOR_GFX_PAGEX5 + XX_OVERLOAD, DOOR_GFX_PAGEY1 + YY_OVERLOAD,
-                OVERLOAD_XSIZE, OVERLOAD_YSIZE - laser.overload_value,
-                DX_OVERLOAD, DY_OVERLOAD);
-#endif
-      redraw_mask |= REDRAW_DOOR_1;
-    }
-
     if (laser.overload_value == MAX_LASER_OVERLOAD)
     {
       UpdateAndDisplayGameControlValues();
@@ -3416,7 +3438,7 @@ static void GameActions_MM_Ext(void)
     DrawGraphic_MM(ELX, ELY, IMG_MM_FUSE);
   }
 
-  if (element == EL_BALL_GRAY && CT > native_mm_level.time_ball)
+  if (element == EL_GRAY_BALL && CT > native_mm_level.time_ball)
   {
     if (!Store2[ELX][ELY])     // check if content element not yet determined
     {
@@ -3436,109 +3458,27 @@ static void GameActions_MM_Ext(void)
       game_mm.ball_choice_pos++;
 
       int new_element = native_mm_level.ball_content[element_pos];
+      int new_element_unmapped = unmap_element(new_element);
 
-      Store[ELX][ELY] = new_element + RND(get_num_elements(new_element));
+      if (IS_WALL(new_element_unmapped))
+      {
+       // always use completely filled wall element
+       new_element = new_element_unmapped | 0x000f;
+      }
+      else if (native_mm_level.rotate_ball_content &&
+              get_num_elements(new_element) > 1)
+      {
+       // randomly rotate newly created game element
+       new_element = get_rotated_element(new_element, RND(16));
+      }
+
+      Store[ELX][ELY] = new_element;
       Store2[ELX][ELY] = TRUE;
     }
 
     Tile[ELX][ELY] = EL_GRAY_BALL_OPENING;
 
-    // !!! CHECK AGAIN: Laser on Polarizer !!!
-    ScanLaser();
-
     laser.dest_element_last = Tile[ELX][ELY];
-    laser.dest_element_last_x = ELX;
-    laser.dest_element_last_y = ELY;
-
-    return;
-
-#if 0
-    int graphic;
-
-    switch (RND(5))
-    {
-      case 0:
-        element = EL_MIRROR_START + RND(16);
-       break;
-      case 1:
-       {
-         int rnd = RND(3);
-
-         element = (rnd == 0 ? EL_KETTLE : rnd == 1 ? EL_BOMB : EL_PRISM);
-       }
-       break;
-      default:
-       {
-         int rnd = RND(3);
-
-         element = (rnd == 0 ? EL_FUSE_ON :
-                    rnd >= 1 && rnd <= 4 ? EL_PACMAN_RIGHT + rnd - 1 :
-                    rnd >= 5 && rnd <= 20 ? EL_POLAR_START + rnd - 5 :
-                    rnd >= 21 && rnd <= 24 ? EL_POLAR_CROSS_START + rnd - 21 :
-                    EL_MIRROR_FIXED_START + rnd - 25);
-       }
-       break;
-    }
-
-    graphic = el2gfx(element);
-
-    for (i = 0; i < 50; i++)
-    {
-      int x = RND(26);
-      int y = RND(26);
-
-#if 0
-      BlitBitmap(pix[PIX_BACK], drawto,
-                SX + (graphic % GFX_PER_LINE) * TILEX + x,
-                SY + (graphic / GFX_PER_LINE) * TILEY + y, 6, 6,
-                SX + ELX * TILEX + x,
-                SY + ELY * TILEY + y);
-#endif
-      MarkTileDirty(ELX, ELY);
-      BackToFront();
-
-      DrawLaser(0, DL_LASER_ENABLED);
-
-      Delay_WithScreenUpdates(50);
-    }
-
-    Tile[ELX][ELY] = element;
-    DrawField_MM(ELX, ELY);
-
-#if 0
-    Debug("game:mm:GameActions_MM_Ext", "NEW ELEMENT: (%d, %d)", ELX, ELY);
-#endif
-
-    // above stuff: GRAY BALL -> PRISM !!!
-/*
-    LX = ELX * TILEX + 14;
-    LY = ELY * TILEY + 14;
-    if (laser.current_angle == (laser.current_angle >> 1) << 1)
-      OK = 8;
-    else
-      OK = 4;
-    LX -= OK * XS;
-    LY -= OK * YS;
-
-    laser.num_edges -= 2;
-    laser.num_damages--;
-*/
-
-#if 0
-    for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i>=0; i--)
-      if (laser.damage[i].is_mirror)
-       break;
-
-    if (i > 0)
-      DrawLaser(laser.damage[i].edge - 1, DL_LASER_DISABLED);
-    else
-      DrawLaser(0, DL_LASER_DISABLED);
-#else
-    DrawLaser(0, DL_LASER_DISABLED);
-#endif
-
-    ScanLaser();
-#endif
 
     return;
   }
@@ -3547,57 +3487,18 @@ static void GameActions_MM_Ext(void)
   {
     PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_SHRINKING);
 
-    {
-      Tile[ELX][ELY] = Tile[ELX][ELY] - EL_WALL_ICE + EL_WALL_CHANGING;
-      Store[ELX][ELY] = EL_WALL_ICE;
-      Store2[ELX][ELY] = laser.wall_mask;
+    Tile[ELX][ELY] = Tile[ELX][ELY] - EL_WALL_ICE + EL_WALL_CHANGING;
+    Store[ELX][ELY] = EL_WALL_ICE;
+    Store2[ELX][ELY] = laser.wall_mask;
 
-      laser.dest_element = Tile[ELX][ELY];
-
-      return;
-    }
-
-    for (i = 0; i < 5; i++)
-    {
-      int phase = i + 1;
-
-      if (i == 4)
-      {
-       Tile[ELX][ELY] &= (laser.wall_mask ^ 0xFF);
-       phase = 0;
-      }
-
-      DrawWallsAnimation_MM(ELX, ELY, Tile[ELX][ELY], phase, laser.wall_mask);
-      BackToFront();
-      Delay_WithScreenUpdates(100);
-    }
-
-    if (Tile[ELX][ELY] == EL_WALL_ICE)
-      Tile[ELX][ELY] = EL_EMPTY;
-
-/*
-    laser.num_edges--;
-    LX = laser.edge[laser.num_edges].x - cSX2;
-    LY = laser.edge[laser.num_edges].y - cSY2;
-*/
-
-    for (i = (laser.num_damages > 0 ? laser.num_damages - 1 : 0); i >= 0; i--)
-      if (laser.damage[i].is_mirror)
-       break;
-
-    if (i > 0)
-      DrawLaser(laser.damage[i].edge - 1, DL_LASER_DISABLED);
-    else
-      DrawLaser(0, DL_LASER_DISABLED);
-
-    ScanLaser();
+    laser.dest_element = Tile[ELX][ELY];
 
     return;
   }
 
   if (IS_WALL_AMOEBA(element) && CT > 60)
   {
-    int k1, k2, k3, dx, dy, de, dm;
+    int k1, k2, k3;
     int element2 = Tile[ELX][ELY];
 
     if (element2 != EL_EMPTY && !IS_WALL_AMOEBA(element))
@@ -3668,44 +3569,17 @@ static void GameActions_MM_Ext(void)
 
     Tile[ELX][ELY] = element | laser.wall_mask;
 
-    dx = ELX;
-    dy = ELY;
-    de = Tile[ELX][ELY];
-    dm = laser.wall_mask;
-
-#if 1
-    {
-      int x = ELX, y = ELY;
-      int wall_mask = laser.wall_mask;
+    int x = ELX, y = ELY;
+    int wall_mask = laser.wall_mask;
 
-      ScanLaser();
-      DrawLaser(0, DL_LASER_ENABLED);
-
-      PlayLevelSound_MM(dx, dy, element, MM_ACTION_GROWING);
-
-      Tile[x][y] = Tile[x][y] - EL_WALL_AMOEBA + EL_WALL_CHANGING;
-      Store[x][y] = EL_WALL_AMOEBA;
-      Store2[x][y] = wall_mask;
-
-      return;
-    }
-#endif
-
-    DrawWallsAnimation_MM(dx, dy, de, 4, dm);
     ScanLaser();
     DrawLaser(0, DL_LASER_ENABLED);
 
-    PlayLevelSound_MM(dx, dy, element, MM_ACTION_GROWING);
-
-    for (i = 4; i >= 0; i--)
-    {
-      DrawWallsAnimation_MM(dx, dy, de, i, dm);
-
-      BackToFront();
-      Delay_WithScreenUpdates(20);
-    }
+    PlayLevelSound_MM(x, y, element, MM_ACTION_GROWING);
 
-    DrawLaser(0, DL_LASER_ENABLED);
+    Tile[x][y] = Tile[x][y] - EL_WALL_AMOEBA + EL_WALL_CHANGING;
+    Store[x][y] = EL_WALL_AMOEBA;
+    Store2[x][y] = wall_mask;
 
     return;
   }
@@ -3797,8 +3671,6 @@ static void GameActions_MM_Ext(void)
 
     return;
   }
-
-  return;
 }
 
 void GameActions_MM(struct MouseActionInfo action)
@@ -3973,16 +3845,6 @@ static int MovingOrBlocked2Element_MM(int x, int y)
   return element;
 }
 
-#if 0
-static void RemoveField(int x, int y)
-{
-  Tile[x][y] = EL_EMPTY;
-  MovPos[x][y] = 0;
-  MovDir[x][y] = 0;
-  MovDelay[x][y] = 0;
-}
-#endif
-
 static void RemoveMovingField_MM(int x, int y)
 {
   int oldx = x, oldy = y, newx = x, newy = y;
@@ -4012,44 +3874,6 @@ static void RemoveMovingField_MM(int x, int y)
   DrawLevelField_MM(newx, newy);
 }
 
-void PlaySoundLevel(int x, int y, int sound_nr)
-{
-  int sx = SCREENX(x), sy = SCREENY(y);
-  int volume, stereo;
-  int silence_distance = 8;
-
-  if ((!setup.sound_simple && !IS_LOOP_SOUND(sound_nr)) ||
-      (!setup.sound_loops && IS_LOOP_SOUND(sound_nr)))
-    return;
-
-  if (!IN_LEV_FIELD(x, y) ||
-      sx < -silence_distance || sx >= SCR_FIELDX+silence_distance ||
-      sy < -silence_distance || sy >= SCR_FIELDY+silence_distance)
-    return;
-
-  volume = SOUND_MAX_VOLUME;
-
-#ifndef MSDOS
-  stereo = (sx - SCR_FIELDX/2) * 12;
-#else
-  stereo = SOUND_MIDDLE + (2 * sx - (SCR_FIELDX - 1)) * 5;
-  if (stereo > SOUND_MAX_RIGHT)
-    stereo = SOUND_MAX_RIGHT;
-  if (stereo < SOUND_MAX_LEFT)
-    stereo = SOUND_MAX_LEFT;
-#endif
-
-  if (!IN_SCR_FIELD(sx, sy))
-  {
-    int dx = ABS(sx - SCR_FIELDX/2) - SCR_FIELDX/2;
-    int dy = ABS(sy - SCR_FIELDY/2) - SCR_FIELDY/2;
-
-    volume -= volume * (dx > dy ? dx : dy) / silence_distance;
-  }
-
-  PlaySoundExt(sound_nr, volume, stereo, SND_CTRL_PLAY_SOUND);
-}
-
 static void RaiseScore_MM(int value)
 {
   game_mm.score += value;