removed unused function parameters
[rocksndiamonds.git] / src / game_mm / mm_game.c
index a954715524374dc13ce5069849f87eb7285f34f7..093e837363e306753ca2f178aa1340680c7c1898 100644 (file)
@@ -4,7 +4,7 @@
 // (c) 1994-2017 by Artsoft Entertainment
 //                         Holger Schemel
 //                 info@artsoft.org
-//                 http://www.artsoft.org/
+//                 https://www.artsoft.org/
 // ----------------------------------------------------------------------------
 // mm_game.c
 // ============================================================================
@@ -111,10 +111,10 @@ static int hold_x = -1, hold_y = -1;
 static int pacman_nr = -1;
 
 // various game engine delay counters
-static unsigned int rotate_delay = 0;
-static unsigned int pacman_delay = 0;
-static unsigned int energy_delay = 0;
-static unsigned int overload_delay = 0;
+static DelayCounter rotate_delay = { AUTO_ROTATE_DELAY };
+static DelayCounter pacman_delay = { PACMAN_MOVE_DELAY };
+static DelayCounter energy_delay = { ENERGY_DELAY };
+static DelayCounter overload_delay = { 0 };
 
 // element masks for scanning pixels of MM elements
 static const char mm_masks[10][16][16 + 1] =
@@ -375,19 +375,19 @@ static void CheckExitMM(void)
   {
     for (x = 0; x < lev_fieldx; x++)
     {
-      if (Feld[x][y] == EL_EXIT_CLOSED)
+      if (Tile[x][y] == EL_EXIT_CLOSED)
       {
        // initiate opening animation of exit door
-       Feld[x][y] = EL_EXIT_OPENING;
+       Tile[x][y] = EL_EXIT_OPENING;
 
        exit_element = EL_EXIT_OPEN;
        exit_x = x;
        exit_y = y;
       }
-      else if (IS_RECEIVER(Feld[x][y]))
+      else if (IS_RECEIVER(Tile[x][y]))
       {
        // remove field that blocks receiver
-       int phase = Feld[x][y] - EL_RECEIVER_START;
+       int phase = Tile[x][y] - EL_RECEIVER_START;
        int blocking_x, blocking_y;
 
        blocking_x = x + xy[phase][0];
@@ -395,7 +395,7 @@ static void CheckExitMM(void)
 
        if (IN_LEV_FIELD(blocking_x, blocking_y))
        {
-         Feld[blocking_x][blocking_y] = EL_EMPTY;
+         Tile[blocking_x][blocking_y] = EL_EMPTY;
 
          DrawField_MM(blocking_x, blocking_y);
        }
@@ -413,7 +413,7 @@ static void CheckExitMM(void)
 
 static void InitMovDir_MM(int x, int y)
 {
-  int element = Feld[x][y];
+  int element = Tile[x][y];
   static int direction[3][4] =
   {
     { MV_RIGHT, MV_UP,    MV_LEFT,  MV_DOWN },
@@ -421,13 +421,13 @@ static void InitMovDir_MM(int x, int y)
     { MV_LEFT,  MV_RIGHT, MV_UP,    MV_DOWN }
   };
 
-  switch(element)
+  switch (element)
   {
     case EL_PACMAN_RIGHT:
     case EL_PACMAN_UP:
     case EL_PACMAN_LEFT:
     case EL_PACMAN_DOWN:
-      Feld[x][y] = EL_PACMAN;
+      Tile[x][y] = EL_PACMAN;
       MovDir[x][y] = direction[0][element - EL_PACMAN_RIGHT];
       break;
 
@@ -438,12 +438,12 @@ static void InitMovDir_MM(int x, int y)
 
 static void InitField(int x, int y, boolean init_game)
 {
-  int element = Feld[x][y];
+  int element = Tile[x][y];
 
   switch (element)
   {
     case EL_DF_EMPTY:
-      Feld[x][y] = EL_EMPTY;
+      Tile[x][y] = EL_EMPTY;
       break;
 
     case EL_KETTLE:
@@ -470,8 +470,8 @@ static void InitField(int x, int y, boolean init_game)
       {
        if (IS_BEAMER_OLD(element))
        {
-         Feld[x][y] = EL_BEAMER_BLUE_START + (element - EL_BEAMER_START);
-         element = Feld[x][y];
+         Tile[x][y] = EL_BEAMER_BLUE_START + (element - EL_BEAMER_START);
+         element = Tile[x][y];
        }
 
        if (!IS_FIBRE_OPTIC(element))
@@ -529,13 +529,13 @@ static void InitCycleElements_RotateSingleStep(void)
     int x = game_mm.cycle[i].x;
     int y = game_mm.cycle[i].y;
     int step = SIGN(game_mm.cycle[i].steps);
-    int last_element = Feld[x][y];
+    int last_element = Tile[x][y];
     int next_element = get_rotated_element(last_element, step);
 
     if (!game_mm.cycle[i].steps)
       continue;
 
-    Feld[x][y] = next_element;
+    Tile[x][y] = next_element;
 
     DrawField_MM(x, y);
     game_mm.cycle[i].steps -= step;
@@ -544,7 +544,7 @@ static void InitCycleElements_RotateSingleStep(void)
 
 static void InitLaser(void)
 {
-  int start_element = Feld[laser.start_edge.x][laser.start_edge.y];
+  int start_element = Tile[laser.start_edge.x][laser.start_edge.y];
   int step = (IS_LASER(start_element) ? 4 : 0);
 
   LX = laser.start_edge.x * TILEX;
@@ -637,10 +637,10 @@ void InitGameEngine_MM(void)
 
   CT = Ct = 0;
 
-  rotate_delay = 0;
-  pacman_delay = 0;
-  energy_delay = 0;
-  overload_delay = 0;
+  rotate_delay.count = 0;
+  pacman_delay.count = 0;
+  energy_delay.count = 0;
+  overload_delay.count = 0;
 
   ClickElement(-1, -1, -1);
 
@@ -648,7 +648,7 @@ void InitGameEngine_MM(void)
   {
     for (y = 0; y < lev_fieldy; y++)
     {
-      Feld[x][y] = Ur[x][y];
+      Tile[x][y] = Ur[x][y];
       Hit[x][y] = Box[x][y] = 0;
       Angle[x][y] = 0;
       MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
@@ -717,7 +717,7 @@ void AddLaserEdge(int lx, int ly)
 
   if (clx < -2 || cly < -2 || clx >= SXSIZE + 2 || cly >= SYSIZE + 2)
   {
-    Error(ERR_WARN, "AddLaserEdge: out of bounds: %d, %d", lx, ly);
+    Warn("AddLaserEdge: out of bounds: %d, %d", lx, ly);
 
     return;
   }
@@ -771,8 +771,8 @@ static int ScanPixel(void)
   int hit_mask = 0;
 
 #if 0
-  printf("ScanPixel: start scanning at (%d, %d) [%d, %d] [%d, %d]\n",
-        LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY);
+  Debug("game:mm:ScanPixel", "start scanning at (%d, %d) [%d, %d] [%d, %d]",
+       LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY);
 #endif
 
   // follow laser beam until it hits something (at least the screen border)
@@ -785,7 +785,7 @@ static int ScanPixel(void)
     if (SX + LX < REAL_SX || SX + LX >= REAL_SX + FULL_SXSIZE ||
        SY + LY < REAL_SY || SY + LY >= REAL_SY + FULL_SYSIZE)
     {
-      printf("ScanPixel: touched screen border!\n");
+      Debug("game:mm:ScanPixel", "touched screen border!");
 
       return HIT_MASK_ALL;
     }
@@ -803,7 +803,7 @@ static int ScanPixel(void)
 
       if (IN_LEV_FIELD(lx, ly))
       {
-       int element = Feld[lx][ly];
+       int element = Tile[lx][ly];
 
        if (element == EL_EMPTY || element == EL_EXPLODING_TRANSP)
        {
@@ -858,8 +858,9 @@ void ScanLaser(void)
   DrawLaser(0, DL_LASER_ENABLED);
 
 #if 0
-  printf("Start scanning with LX == %d, LY == %d, XS == %d, YS == %d\n",
-        LX, LY, XS, YS);
+  Debug("game:mm:ScanLaser",
+       "Start scanning with LX == %d, LY == %d, XS == %d, YS == %d",
+       LX, LY, XS, YS);
 #endif
 
   while (1)
@@ -877,8 +878,9 @@ void ScanLaser(void)
     hit_mask = ScanPixel();
 
 #if 0
-    printf("Hit something at LX == %d, LY == %d, XS == %d, YS == %d\n",
-          LX, LY, XS, YS);
+    Debug("game:mm:ScanLaser",
+         "Hit something at LX == %d, LY == %d, XS == %d, YS == %d",
+         LX, LY, XS, YS);
 #endif
 
     // hit something -- check out what it was
@@ -886,8 +888,8 @@ void ScanLaser(void)
     ELY = (LY + YS) / TILEY;
 
 #if 0
-    printf("hit_mask (1) == '%x' (%d, %d) (%d, %d)\n",
-          hit_mask, LX, LY, ELX, ELY);
+    Debug("game:mm:ScanLaser", "hit_mask (1) == '%x' (%d, %d) (%d, %d)",
+         hit_mask, LX, LY, ELX, ELY);
 #endif
 
     if (!IN_LEV_FIELD(ELX, ELY) || !IN_PIX_FIELD(LX, LY))
@@ -919,24 +921,26 @@ void ScanLaser(void)
     }
 
 #if 0
-    printf("hit_mask (2) == '%x' (%d, %d) (%d, %d)\n",
-          hit_mask, LX, LY, ELX, ELY);
+    Debug("game:mm:ScanLaser", "hit_mask (2) == '%x' (%d, %d) (%d, %d)",
+         hit_mask, LX, LY, ELX, ELY);
 #endif
 
-    element = Feld[ELX][ELY];
+    element = Tile[ELX][ELY];
     laser.dest_element = element;
 
 #if 0
-    printf("Hit element %d at (%d, %d) [%d, %d] [%d, %d] [%d]\n",
-          element, ELX, ELY,
-          LX, LY,
-          LX % TILEX, LY % TILEY,
-          hit_mask);
+    Debug("game:mm:ScanLaser",
+         "Hit element %d at (%d, %d) [%d, %d] [%d, %d] [%d]",
+         element, ELX, ELY,
+         LX, LY,
+         LX % TILEX, LY % TILEY,
+         hit_mask);
 #endif
 
 #if 0
     if (!IN_LEV_FIELD(ELX, ELY))
-      printf("WARNING! (1) %d, %d (%d)\n", ELX, ELY, element);
+      Debug("game:mm:ScanLaser", "WARNING! (1) %d, %d (%d)",
+           ELX, ELY, element);
 #endif
 
     if (element == EL_EMPTY)
@@ -1000,17 +1004,18 @@ void ScanLaser(void)
   }
 
 #if 0
-  if (laser.dest_element != Feld[ELX][ELY])
+  if (laser.dest_element != Tile[ELX][ELY])
   {
-    printf("ALARM: laser.dest_element == %d, Feld[ELX][ELY] == %d\n",
-          laser.dest_element, Feld[ELX][ELY]);
+    Debug("game:mm:ScanLaser",
+         "ALARM: laser.dest_element == %d, Tile[ELX][ELY] == %d",
+         laser.dest_element, Tile[ELX][ELY]);
   }
 #endif
 
   if (!end && !laser.stops_inside_element && !StepBehind())
   {
 #if 0
-    printf("ScanLaser: Go one step back\n");
+    Debug("game:mm:ScanLaser", "Go one step back");
 #endif
 
     LX -= XS;
@@ -1026,7 +1031,7 @@ void ScanLaser(void)
 
 #if 0
     if (!IN_LEV_FIELD(ELX, ELY))
-      printf("WARNING! (2) %d, %d\n", ELX, ELY);
+      Debug("game:mm:ScanLaser", "WARNING! (2) %d, %d", ELX, ELY);
 #endif
 }
 
@@ -1036,20 +1041,20 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
   int elx, ely;
 
 #if 0
-  printf("DrawLaserExt: start_edge, num_edges, mode == %d, %d, %d\n",
-        start_edge, num_edges, mode);
+  Debug("game:mm:DrawLaserExt", "start_edge, num_edges, mode == %d, %d, %d",
+       start_edge, num_edges, mode);
 #endif
 
   if (start_edge < 0)
   {
-    Error(ERR_WARN, "DrawLaserExt: start_edge < 0");
+    Warn("DrawLaserExt: start_edge < 0");
 
     return;
   }
 
   if (num_edges < 0)
   {
-    Error(ERR_WARN, "DrawLaserExt: num_edges < 0");
+    Warn("DrawLaserExt: num_edges < 0");
 
     return;
   }
@@ -1057,7 +1062,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
 #if 0
   if (mode == DL_LASER_DISABLED)
   {
-    printf("DrawLaser: Delete laser from edge %d\n", start_edge);
+    Debug("game:mm:DrawLaserExt", "Delete laser from edge %d", start_edge);
   }
 #endif
 
@@ -1094,7 +1099,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
     {
       int lx = laser.damage[i].x;
       int ly = laser.damage[i].y;
-      int element = Feld[lx][ly];
+      int element = Tile[lx][ly];
 
       if (Hit[lx][ly] == laser.damage[i].edge)
        if (!((IS_BEAMER(element) || IS_FIBRE_OPTIC(element)) &&
@@ -1109,7 +1114,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
 
     elx = laser.damage[damage_start].x;
     ely = laser.damage[damage_start].y;
-    element = Feld[elx][ely];
+    element = Tile[elx][ely];
 
 #if 0
     if (IS_BEAMER(element))
@@ -1117,11 +1122,12 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
       int i;
 
       for (i = 0; i < laser.num_beamers; i++)
-       printf("-> %d\n", laser.beamer_edge[i]);
-      printf("DrawLaserExt: IS_BEAMER: [%d]: Hit[%d][%d] == %d [%d]\n",
-            mode, elx, ely, Hit[elx][ely], start_edge);
-      printf("DrawLaserExt: IS_BEAMER: %d / %d\n",
-            get_element_angle(element), laser.damage[damage_start].angle);
+       Debug("game:mm:DrawLaserExt", "-> %d", laser.beamer_edge[i]);
+
+      Debug("game:mm:DrawLaserExt", "IS_BEAMER: [%d]: Hit[%d][%d] == %d [%d]",
+           mode, elx, ely, Hit[elx][ely], start_edge);
+      Debug("game:mm:DrawLaserExt", "IS_BEAMER: %d / %d",
+           get_element_angle(element), laser.damage[damage_start].angle);
     }
 #endif
 
@@ -1148,7 +1154,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
 
     elx = laser.start_edge.x;
     ely = laser.start_edge.y;
-    element = Feld[elx][ely];
+    element = Tile[elx][ely];
   }
 
   laser.num_edges = start_edge + 1;
@@ -1161,8 +1167,8 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
   YS = 2 * Step[laser.current_angle].y;
 
 #if 0
-  printf("DrawLaser: Set (LX, LY) to (%d, %d) [%d]\n",
-        LX, LY, element);
+  Debug("game:mm:DrawLaserExt", "Set (LX, LY) to (%d, %d) [%d]",
+       LX, LY, element);
 #endif
 
   if (start_edge > 0)
@@ -1177,7 +1183,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
       int step_size;
 
 #if 0
-      printf("element == %d\n", element);
+      Debug("game:mm:DrawLaserExt", "element == %d", element);
 #endif
 
       if (IS_22_5_ANGLE(laser.current_angle))  // neither 90° nor 45° angle
@@ -1197,10 +1203,9 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
 
 #if 0
       if (IS_BEAMER(element))
-      {
-       printf("start_edge == %d, laser.beamer_edge == %d\n",
-              start_edge, laser.beamer_edge);
-      }
+       Debug("game:mm:DrawLaserExt",
+             "start_edge == %d, laser.beamer_edge == %d",
+             start_edge, laser.beamer_edge);
 #endif
 
       LX += step_size * XS;
@@ -1215,8 +1220,8 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode)
   }
 
 #if 0
-  printf("DrawLaser: Finally: (LX, LY) to (%d, %d) [%d]\n",
-        LX, LY, element);
+  Debug("game:mm:DrawLaserExt", "Finally: (LX, LY) to (%d, %d) [%d]",
+       LX, LY, element);
 #endif
 }
 
@@ -1224,7 +1229,7 @@ void DrawLaser(int start_edge, int mode)
 {
   if (laser.num_edges - start_edge < 0)
   {
-    Error(ERR_WARN, "DrawLaser: laser.num_edges - start_edge < 0");
+    Warn("DrawLaser: laser.num_edges - start_edge < 0");
 
     return;
   }
@@ -1247,8 +1252,8 @@ void DrawLaser(int start_edge, int mode)
          continue;
 
 #if 0
-       printf("DrawLaser: DL_LASER_ENABLED: i==%d: %d, %d\n",
-              i, laser.beamer_edge[i], tmp_start_edge);
+       Debug("game:mm:DrawLaser", "DL_LASER_ENABLED: i==%d: %d, %d",
+             i, laser.beamer_edge[i], tmp_start_edge);
 #endif
 
        DrawLaserExt(tmp_start_edge, tmp_num_edges, DL_LASER_ENABLED);
@@ -1282,8 +1287,8 @@ void DrawLaser(int start_edge, int mode)
 
 #if 0
       if (last_num_edges - start_edge <= 0)
-       printf("DrawLaser: DL_LASER_DISABLED: %d, %d\n",
-              last_num_edges, start_edge);
+       Debug("game:mm:DrawLaser", "DL_LASER_DISABLED: %d, %d",
+             last_num_edges, start_edge);
 #endif
 
       // special case when rotating first beamer: delete laser edge on beamer
@@ -1317,14 +1322,16 @@ boolean HitElement(int element, int hit_mask)
     element = MovingOrBlocked2Element_MM(ELX, ELY);
 
 #if 0
-  printf("HitElement (1): element == %d\n", element);
+  Debug("game:mm:HitElement", "(1): element == %d", element);
 #endif
 
 #if 0
   if ((ELX * TILEX + 14 - LX) * YS == (ELY * TILEY + 14 - LY) * XS)
-    printf("HitElement (%d): EXACT MATCH @ (%d, %d)\n", element, ELX, ELY);
+    Debug("game:mm:HitElement", "(%d): EXACT MATCH @ (%d, %d)",
+         element, ELX, ELY);
   else
-    printf("HitElement (%d): FUZZY MATCH @ (%d, %d)\n", element, ELX, ELY);
+    Debug("game:mm:HitElement", "(%d): FUZZY MATCH @ (%d, %d)",
+         element, ELX, ELY);
 #endif
 
   AddDamagedField(ELX, ELY);
@@ -1355,7 +1362,7 @@ boolean HitElement(int element, int hit_mask)
   }
 
 #if 0
-  printf("HitElement (2): element == %d\n", element);
+  Debug("game:mm:HitElement", "(2): element == %d", element);
 #endif
 
   if (LX + 5 * XS < 0 ||
@@ -1368,7 +1375,7 @@ boolean HitElement(int element, int hit_mask)
   }
 
 #if 0
-  printf("HitElement (3): element == %d\n", element);
+  Debug("game:mm:HitElement", "(3): element == %d", element);
 #endif
 
   if (IS_POLAR(element) &&
@@ -1399,9 +1406,9 @@ boolean HitElement(int element, int hit_mask)
   {
 #if 0
     if ((ELX * TILEX + 14 - LX) * YS == (ELY * TILEY + 14 - LY) * XS)
-      printf("EXACT MATCH @ (%d, %d)\n", ELX, ELY);
+      Debug("game:mm:HitElement", "EXACT MATCH @ (%d, %d)", ELX, ELY);
     else
-      printf("FUZZY MATCH @ (%d, %d)\n", ELX, ELY);
+      Debug("game:mm:HitElement", "FUZZY MATCH @ (%d, %d)", ELX, ELY);
 #endif
 
     LX = ELX * TILEX + 14;
@@ -1534,14 +1541,14 @@ boolean HitElement(int element, int hit_mask)
 
     DrawLaser(0, DL_LASER_ENABLED);
 
-    if (Feld[ELX][ELY] == EL_LIGHTBULB_OFF)
+    if (Tile[ELX][ELY] == EL_LIGHTBULB_OFF)
     {
-      Feld[ELX][ELY] = EL_LIGHTBULB_ON;
+      Tile[ELX][ELY] = EL_LIGHTBULB_ON;
       game_mm.lights_still_needed--;
     }
     else
     {
-      Feld[ELX][ELY] = EL_LIGHTBULB_OFF;
+      Tile[ELX][ELY] = EL_LIGHTBULB_OFF;
       game_mm.lights_still_needed++;
     }
 
@@ -1557,7 +1564,7 @@ boolean HitElement(int element, int hit_mask)
   }
 
 #if 0
-  printf("HitElement (4): element == %d\n", element);
+  Debug("game:mm:HitElement", "(4): element == %d", element);
 #endif
 
   if ((IS_BEAMER(element) || IS_FIBRE_OPTIC(element)) &&
@@ -1569,7 +1576,7 @@ boolean HitElement(int element, int hit_mask)
     int step_size;
 
 #if 0
-  printf("HitElement (BEAMER): element == %d\n", element);
+    Debug("game:mm:HitElement", "(BEAMER): element == %d", element);
 #endif
 
     laser.num_damages--;
@@ -1599,7 +1606,7 @@ boolean HitElement(int element, int hit_mask)
 
       if (IS_BEAMER(element))
       {
-       laser.current_angle = get_element_angle(Feld[ELX][ELY]);
+       laser.current_angle = get_element_angle(Tile[ELX][ELY]);
        XS = 2 * Step[laser.current_angle].x;
        YS = 2 * Step[laser.current_angle].y;
       }
@@ -1636,7 +1643,8 @@ boolean HitOnlyAnEdge(int element, int hit_mask)
   // check if the laser hit only the edge of an element and, if so, go on
 
 #if 0
-  printf("LX, LY, hit_mask == %d, %d, %d\n", LX, LY, hit_mask);
+  Debug("game:mm:HitOnlyAnEdge", "LX, LY, hit_mask == %d, %d, %d",
+       LX, LY, hit_mask);
 #endif
 
   if ((hit_mask == HIT_MASK_TOPLEFT ||
@@ -1674,14 +1682,14 @@ boolean HitOnlyAnEdge(int element, int hit_mask)
     LY += YS;
 
 #if 0
-    printf("[HitOnlyAnEdge() == TRUE]\n");
+    Debug("game:mm:HitOnlyAnEdge", "[HitOnlyAnEdge() == TRUE]");
 #endif
 
     return TRUE;
   }
 
 #if 0
-    printf("[HitOnlyAnEdge() == FALSE]\n");
+  Debug("game:mm:HitOnlyAnEdge", "[HitOnlyAnEdge() == FALSE]");
 #endif
 
   return FALSE;
@@ -1697,8 +1705,8 @@ boolean HitPolarizer(int element, int hit_mask)
     int grid_angle = get_element_angle(element);
 
 #if 0
-    printf("HitPolarizer: angle: grid == %d, laser == %d\n",
-          grid_angle, laser.current_angle);
+    Debug("game:mm:HitPolarizer", "angle: grid == %d, laser == %d",
+         grid_angle, laser.current_angle);
 #endif
 
     AddLaserEdge(LX, LY);
@@ -1735,10 +1743,10 @@ boolean HitPolarizer(int element, int hit_mask)
       LY += YS;
 
 #if 0
-      printf("HitPolarizer: LX, LY == %d, %d [%d, %d] [%d, %d]\n",
-            LX, LY,
-            LX / TILEX, LY / TILEY,
-            LX % TILEX, LY % TILEY);
+      Debug("game:mm:HitPolarizer", "LX, LY == %d, %d [%d, %d] [%d, %d]",
+           LX, LY,
+           LX / TILEX, LY / TILEY,
+           LX % TILEX, LY % TILEY);
 #endif
 
       return FALSE;
@@ -2220,7 +2228,7 @@ boolean HitAbsorbingWalls(int element, int hit_mask)
   {
     int elx = (LX - 2 * XS) / TILEX;
     int ely = (LY - 2 * YS) / TILEY;
-    int element2 = Feld[elx][ely];
+    int element2 = Tile[elx][ely];
     int mask;
 
     if (element2 != EL_EMPTY && !IS_WALL_AMOEBA(element2))
@@ -2266,7 +2274,7 @@ static void OpenExit(int x, int y)
 
     if (!MovDelay[x][y])
     {
-      Feld[x][y] = EL_EXIT_OPEN;
+      Tile[x][y] = EL_EXIT_OPEN;
       DrawField_MM(x, y);
     }
   }
@@ -2300,7 +2308,7 @@ static void OpenSurpriseBall(int x, int y)
 
     if (!MovDelay[x][y])
     {
-      Feld[x][y] = Store[x][y];
+      Tile[x][y] = Store[x][y];
       Store[x][y] = 0;
       DrawField_MM(x, y);
 
@@ -2321,7 +2329,7 @@ static void MeltIce(int x, int y)
   {
     int phase;
     int wall_mask = Store2[x][y];
-    int real_element = Feld[x][y] - EL_WALL_CHANGING + EL_WALL_ICE;
+    int real_element = Tile[x][y] - EL_WALL_CHANGING + EL_WALL_ICE;
 
     MovDelay[x][y]--;
     phase = frames - MovDelay[x][y] / delay - 1;
@@ -2330,13 +2338,13 @@ static void MeltIce(int x, int y)
     {
       int i;
 
-      Feld[x][y] = real_element & (wall_mask ^ 0xFF);
+      Tile[x][y] = real_element & (wall_mask ^ 0xFF);
       Store[x][y] = Store2[x][y] = 0;
 
-      DrawWalls_MM(x, y, Feld[x][y]);
+      DrawWalls_MM(x, y, Tile[x][y]);
 
-      if (Feld[x][y] == EL_WALL_ICE)
-       Feld[x][y] = EL_EMPTY;
+      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)
@@ -2370,17 +2378,17 @@ static void GrowAmoeba(int x, int y)
   {
     int phase;
     int wall_mask = Store2[x][y];
-    int real_element = Feld[x][y] - EL_WALL_CHANGING + EL_WALL_AMOEBA;
+    int real_element = Tile[x][y] - EL_WALL_CHANGING + EL_WALL_AMOEBA;
 
     MovDelay[x][y]--;
     phase = MovDelay[x][y] / delay;
 
     if (!MovDelay[x][y])
     {
-      Feld[x][y] = real_element;
+      Tile[x][y] = real_element;
       Store[x][y] = Store2[x][y] = 0;
 
-      DrawWalls_MM(x, y, Feld[x][y]);
+      DrawWalls_MM(x, y, Tile[x][y]);
       DrawLaser(0, DL_LASER_ENABLED);
     }
     else if (!(MovDelay[x][y] % delay) && IN_SCR_FIELD(x, y))
@@ -2400,7 +2408,7 @@ static void Explode_MM(int x, int y, int phase, int mode)
 
   if (phase == EX_PHASE_START)         // initialize 'Store[][]' field
   {
-    int center_element = Feld[x][y];
+    int center_element = Tile[x][y];
 
     if (IS_MOVING(x, y) || IS_BLOCKED(x, y))
     {
@@ -2408,7 +2416,7 @@ static void Explode_MM(int x, int y, int phase, int mode)
       center_element = MovingOrBlocked2Element_MM(x, y);
       RemoveMovingField_MM(x, y);
 
-      Feld[x][y] = center_element;
+      Tile[x][y] = center_element;
     }
 
     if (center_element == EL_BOMB || IS_MCDUFFIN(center_element))
@@ -2417,7 +2425,7 @@ static void Explode_MM(int x, int y, int phase, int mode)
       Store[x][y] = EL_EMPTY;
 
     Store2[x][y] = mode;
-    Feld[x][y] = EL_EXPLODING_OPAQUE;
+    Tile[x][y] = EL_EXPLODING_OPAQUE;
     MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
     Frame[x][y] = 1;
 
@@ -2428,7 +2436,7 @@ static void Explode_MM(int x, int y, int phase, int mode)
 
   if (phase == half_phase)
   {
-    Feld[x][y] = EL_EXPLODING_TRANSP;
+    Tile[x][y] = EL_EXPLODING_TRANSP;
 
     if (x == ELX && y == ELY)
       ScanLaser();
@@ -2458,7 +2466,7 @@ static void Explode_MM(int x, int y, int phase, int mode)
       game.restart_game_message = "Bomb killed Mc Duffin! Play it again?";
     }
 
-    Feld[x][y] = Store[x][y];
+    Tile[x][y] = Store[x][y];
     Store[x][y] = Store2[x][y] = 0;
     MovDir[x][y] = MovPos[x][y] = MovDelay[x][y] = 0;
 
@@ -2512,14 +2520,14 @@ static void Explode_MM(int x, int y, int phase, int mode)
 
 static void Bang_MM(int x, int y)
 {
-  int element = Feld[x][y];
+  int element = Tile[x][y];
   int mode = EX_NORMAL;
 
 #if 0
   DrawLaser(0, DL_LASER_ENABLED);
 #endif
 
-  switch(element)
+  switch (element)
   {
     case EL_KETTLE:
       mode = EX_KETTLE;
@@ -2576,7 +2584,7 @@ void TurnRound(int x, int y)
     { MV_RIGHT,        MV_LEFT,        MV_UP }
   };
 
-  int element = Feld[x][y];
+  int element = Tile[x][y];
   int old_move_dir = MovDir[x][y];
   int right_dir = turn[old_move_dir].right;
   int back_dir = turn[old_move_dir].back;
@@ -2588,7 +2596,7 @@ void TurnRound(int x, int y)
     boolean can_turn_right = FALSE;
 
     if (IN_LEV_FIELD(right_x, right_y) &&
-       IS_EATABLE4PACMAN(Feld[right_x][right_y]))
+       IS_EATABLE4PACMAN(Tile[right_x][right_y]))
       can_turn_right = TRUE;
 
     if (can_turn_right)
@@ -2602,7 +2610,7 @@ void TurnRound(int x, int y)
 
 static void StartMoving_MM(int x, int y)
 {
-  int element = Feld[x][y];
+  int element = Tile[x][y];
 
   if (Stop[x][y])
     return;
@@ -2624,11 +2632,11 @@ static void StartMoving_MM(int x, int y)
     Moving2Blocked_MM(x, y, &newx, &newy);     // get next screen position
 
     if (element == EL_PACMAN &&
-       IN_LEV_FIELD(newx, newy) && IS_EATABLE4PACMAN(Feld[newx][newy]) &&
+       IN_LEV_FIELD(newx, newy) && IS_EATABLE4PACMAN(Tile[newx][newy]) &&
        !ObjHit(newx, newy, HIT_POS_CENTER))
     {
-      Store[newx][newy] = Feld[newx][newy];
-      Feld[newx][newy] = EL_EMPTY;
+      Store[newx][newy] = Tile[newx][newy];
+      Tile[newx][newy] = EL_EMPTY;
 
       DrawField_MM(newx, newy);
     }
@@ -2651,7 +2659,7 @@ static void StartMoving_MM(int x, int y)
 
 static void ContinueMoving_MM(int x, int y)
 {
-  int element = Feld[x][y];
+  int element = Tile[x][y];
   int direction = MovDir[x][y];
   int dx = (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
   int dy = (direction == MV_UP   ? -1 : direction == MV_DOWN  ? +1 : 0);
@@ -2663,8 +2671,8 @@ static void ContinueMoving_MM(int x, int y)
 
   if (ABS(MovPos[x][y]) >= TILEX)      // object reached its destination
   {
-    Feld[x][y] = EL_EMPTY;
-    Feld[newx][newy] = element;
+    Tile[x][y] = EL_EMPTY;
+    Tile[newx][newy] = element;
 
     MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
     MovDelay[newx][newy] = 0;
@@ -2701,8 +2709,7 @@ static void ContinueMoving_MM(int x, int y)
 
 boolean ClickElement(int x, int y, int button)
 {
-  static unsigned int click_delay = 0;
-  static int click_delay_value = CLICK_DELAY;
+  static DelayCounter click_delay = { CLICK_DELAY };
   static boolean new_button = TRUE;
   boolean element_clicked = FALSE;
   int element;
@@ -2710,8 +2717,8 @@ boolean ClickElement(int x, int y, int button)
   if (button == -1)
   {
     // initialize static variables
-    click_delay = 0;
-    click_delay_value = CLICK_DELAY;
+    click_delay.count = 0;
+    click_delay.value = CLICK_DELAY;
     new_button = TRUE;
 
     return FALSE;
@@ -2724,7 +2731,7 @@ boolean ClickElement(int x, int y, int button)
   if (button == MB_RELEASED)
   {
     new_button = TRUE;
-    click_delay_value = CLICK_DELAY;
+    click_delay.value = CLICK_DELAY;
 
     // release eventually hold auto-rotating mirror
     RotateMirror(x, y, MB_RELEASED);
@@ -2732,7 +2739,7 @@ boolean ClickElement(int x, int y, int button)
     return FALSE;
   }
 
-  if (!FrameReached(&click_delay, click_delay_value) && !new_button)
+  if (!FrameReached(&click_delay) && !new_button)
     return FALSE;
 
   if (button == MB_MIDDLEBUTTON)       // middle button has no function
@@ -2741,10 +2748,10 @@ boolean ClickElement(int x, int y, int button)
   if (!IN_LEV_FIELD(x, y))
     return FALSE;
 
-  if (Feld[x][y] == EL_EMPTY)
+  if (Tile[x][y] == EL_EMPTY)
     return FALSE;
 
-  element = Feld[x][y];
+  element = Tile[x][y];
 
   if (IS_MIRROR(element) ||
       IS_BEAMER(element) ||
@@ -2773,7 +2780,7 @@ boolean ClickElement(int x, int y, int button)
 
     InitLaser();
 
-    Feld[x][y] = element;
+    Tile[x][y] = element;
     DrawField_MM(x, y);
 
     /*
@@ -2819,7 +2826,7 @@ boolean ClickElement(int x, int y, int button)
     element_clicked = TRUE;
   }
 
-  click_delay_value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY);
+  click_delay.value = (new_button ? CLICK_DELAY_FIRST : CLICK_DELAY);
   new_button = FALSE;
 
   return element_clicked;
@@ -2836,17 +2843,17 @@ void RotateMirror(int x, int y, int button)
     return;
   }
 
-  if (IS_MIRROR(Feld[x][y]) ||
-      IS_POLAR_CROSS(Feld[x][y]) ||
-      IS_POLAR(Feld[x][y]) ||
-      IS_BEAMER(Feld[x][y]) ||
-      IS_DF_MIRROR(Feld[x][y]) ||
-      IS_GRID_STEEL_AUTO(Feld[x][y]) ||
-      IS_GRID_WOOD_AUTO(Feld[x][y]))
+  if (IS_MIRROR(Tile[x][y]) ||
+      IS_POLAR_CROSS(Tile[x][y]) ||
+      IS_POLAR(Tile[x][y]) ||
+      IS_BEAMER(Tile[x][y]) ||
+      IS_DF_MIRROR(Tile[x][y]) ||
+      IS_GRID_STEEL_AUTO(Tile[x][y]) ||
+      IS_GRID_WOOD_AUTO(Tile[x][y]))
   {
-    Feld[x][y] = get_rotated_element(Feld[x][y], BUTTON_ROTATION(button));
+    Tile[x][y] = get_rotated_element(Tile[x][y], BUTTON_ROTATION(button));
   }
-  else if (IS_DF_MIRROR_AUTO(Feld[x][y]))
+  else if (IS_DF_MIRROR_AUTO(Tile[x][y]))
   {
     if (button == MB_LEFTBUTTON)
     {
@@ -2857,11 +2864,11 @@ void RotateMirror(int x, int y, int button)
     }
     else if (button == MB_RIGHTBUTTON && (hold_x != x || hold_y != y))
     {
-      Feld[x][y] = get_rotated_element(Feld[x][y], ROTATE_RIGHT);
+      Tile[x][y] = get_rotated_element(Tile[x][y], ROTATE_RIGHT);
     }
   }
 
-  if (IS_GRID_STEEL_AUTO(Feld[x][y]) || IS_GRID_WOOD_AUTO(Feld[x][y]))
+  if (IS_GRID_STEEL_AUTO(Tile[x][y]) || IS_GRID_WOOD_AUTO(Tile[x][y]))
   {
     int edge = Hit[x][y];
 
@@ -2879,7 +2886,8 @@ void RotateMirror(int x, int y, int button)
 
     if (edge == 0)
     {
-      Error(ERR_WARN, "RotateMirror: inconsistent field Hit[][]!\n");
+      Warn("RotateMirror: inconsistent field Hit[][]!\n");
+
       edge = 1;
     }
 
@@ -2895,18 +2903,17 @@ void RotateMirror(int x, int y, int button)
 
     DrawField_MM(x, y);
 
-    if ((IS_BEAMER(Feld[x][y]) ||
-        IS_POLAR(Feld[x][y]) ||
-        IS_POLAR_CROSS(Feld[x][y])) && x == ELX && y == ELY)
+    if ((IS_BEAMER(Tile[x][y]) ||
+        IS_POLAR(Tile[x][y]) ||
+        IS_POLAR_CROSS(Tile[x][y])) && x == ELX && y == ELY)
     {
       check = 0;
 
-      if (IS_BEAMER(Feld[x][y]))
+      if (IS_BEAMER(Tile[x][y]))
       {
 #if 0
-       printf("TEST (%d, %d) [%d] [%d]\n",
-              LX, LY,
-              laser.beamer_edge, laser.beamer[1].num);
+       Debug("game:mm:RotateMirror", "TEST (%d, %d) [%d] [%d]",
+             LX, LY, laser.beamer_edge, laser.beamer[1].num);
 #endif
 
        laser.num_edges--;
@@ -2924,14 +2931,14 @@ static void AutoRotateMirrors(void)
 {
   int x, y;
 
-  if (!FrameReached(&rotate_delay, AUTO_ROTATE_DELAY))
+  if (!FrameReached(&rotate_delay))
     return;
 
   for (x = 0; x < lev_fieldx; x++)
   {
     for (y = 0; y < lev_fieldy; y++)
     {
-      int element = Feld[x][y];
+      int element = Tile[x][y];
 
       // do not rotate objects hit by the laser after the game was solved
       if (game_mm.level_solved && Hit[x][y])
@@ -3049,7 +3056,7 @@ void ColorCycling(void)
   }
 }
 
-static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
+static void GameActions_MM_Ext(struct MouseActionInfo action)
 {
   int element;
   int x, y, i;
@@ -3061,7 +3068,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
   for (y = 0; y < lev_fieldy; y++) for (x = 0; x < lev_fieldx; x++)
   {
-    element = Feld[x][y];
+    element = Tile[x][y];
 
     if (!IS_MOVING(x, y) && CAN_MOVE(element))
       StartMoving_MM(x, y);
@@ -3092,7 +3099,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
   CT = FrameCounter;
 
-  if (game_mm.num_pacman && FrameReached(&pacman_delay, PACMAN_MOVE_DELAY))
+  if (game_mm.num_pacman && FrameReached(&pacman_delay))
   {
     MovePacMen();
 
@@ -3103,7 +3110,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     }
   }
 
-  if (FrameReached(&energy_delay, ENERGY_DELAY))
+  if (FrameReached(&energy_delay))
   {
     if (game_mm.energy_left > 0)
     {
@@ -3111,7 +3118,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;
 
@@ -3127,7 +3134,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
        DrawLaser(0, DL_LASER_ENABLED);
        BackToFront();
-       Delay(50);
+       Delay_WithScreenUpdates(50);
       }
 
       StopSound_MM(SND_MM_GAME_HEALTH_CHARGING);
@@ -3143,19 +3150,6 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       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))
-      {
-       InitGame();
-      }
-      else
-      {
-       game_status = MAINMENU;
-       DrawMainMenu();
-      }
-#endif
-
       return;
     }
   }
@@ -3163,10 +3157,10 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
   element = laser.dest_element;
 
 #if 0
-  if (element != Feld[ELX][ELY])
+  if (element != Tile[ELX][ELY])
   {
-    printf("element == %d, Feld[ELX][ELY] == %d\n",
-          element, Feld[ELX][ELY]);
+    Debug("game:mm:GameActions_MM_Ext", "element == %d, Tile[ELX][ELY] == %d",
+         element, Tile[ELX][ELY]);
   }
 #endif
 
@@ -3182,9 +3176,11 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
       !IS_WALL_AMOEBA(element))
     return;
 
+  overload_delay.value = HEALTH_DELAY(laser.overloaded);
+
   if (((laser.overloaded && laser.overload_value < MAX_LASER_OVERLOAD) ||
        (!laser.overloaded && laser.overload_value > 0)) &&
-      FrameReached(&overload_delay, HEALTH_DELAY(laser.overloaded)))
+      FrameReached(&overload_delay))
   {
     if (laser.overloaded)
       laser.overload_value++;
@@ -3264,7 +3260,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
        DrawLaser(0, DL_LASER_ENABLED);
        BackToFront();
-       Delay(50);
+       Delay_WithScreenUpdates(50);
       }
 
       DrawLaser(0, DL_LASER_DISABLED);
@@ -3276,19 +3272,6 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       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))
-      {
-       InitGame();
-      }
-      else
-      {
-       game_status = MAINMENU;
-       DrawMainMenu();
-      }
-#endif
-
       return;
     }
   }
@@ -3303,36 +3286,10 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     if (game_mm.cheat_no_explosion)
       return;
 
-#if 0
-    laser.num_damages--;
-    DrawLaser(0, DL_LASER_DISABLED);
-    laser.num_edges = 0;
-#endif
-
     Bang_MM(ELX, ELY);
 
     laser.dest_element = EL_EXPLODING_OPAQUE;
 
-#if 0
-    Bang_MM(ELX, ELY);
-    laser.num_damages--;
-    DrawLaser(0, DL_LASER_DISABLED);
-
-    laser.num_edges = 0;
-    Bang_MM(laser.start_edge.x, laser.start_edge.y);
-
-    if (Request("Bomb killed Mc Duffin! Play it again?",
-               REQ_ASK | REQ_STAY_CLOSED))
-    {
-      InitGame();
-    }
-    else
-    {
-      game_status = MAINMENU;
-      DrawMainMenu();
-    }
-#endif
-
     return;
   }
 
@@ -3363,7 +3320,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     int new_element = new_elements[RND(num_new_elements)];
 
     Store[ELX][ELY] = new_element + RND(get_num_elements(new_element));
-    Feld[ELX][ELY] = EL_GRAY_BALL_OPENING;
+    Tile[ELX][ELY] = EL_GRAY_BALL_OPENING;
 
     // !!! CHECK AGAIN: Laser on Polarizer !!!
     ScanLaser();
@@ -3417,14 +3374,14 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       DrawLaser(0, DL_LASER_ENABLED);
 
-      Delay(50);
+      Delay_WithScreenUpdates(50);
     }
 
-    Feld[ELX][ELY] = element;
+    Tile[ELX][ELY] = element;
     DrawField_MM(ELX, ELY);
 
 #if 0
-    printf("NEW ELEMENT: (%d, %d)\n", ELX, ELY);
+    Debug("game:mm:GameActions_MM_Ext", "NEW ELEMENT: (%d, %d)", ELX, ELY);
 #endif
 
     // above stuff: GRAY BALL -> PRISM !!!
@@ -3456,10 +3413,6 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 #endif
 
     ScanLaser();
-
-    /*
-    printf("TEST ELEMENT: %d\n", Feld[0][0]);
-    */
 #endif
 
     return;
@@ -3470,11 +3423,11 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
     PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_SHRINKING);
 
     {
-      Feld[ELX][ELY] = Feld[ELX][ELY] - EL_WALL_ICE + EL_WALL_CHANGING;
+      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 = Feld[ELX][ELY];
+      laser.dest_element = Tile[ELX][ELY];
 
       return;
     }
@@ -3485,17 +3438,17 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       if (i == 4)
       {
-       Feld[ELX][ELY] &= (laser.wall_mask ^ 0xFF);
+       Tile[ELX][ELY] &= (laser.wall_mask ^ 0xFF);
        phase = 0;
       }
 
-      DrawWallsAnimation_MM(ELX, ELY, Feld[ELX][ELY], phase, laser.wall_mask);
+      DrawWallsAnimation_MM(ELX, ELY, Tile[ELX][ELY], phase, laser.wall_mask);
       BackToFront();
-      Delay(100);
+      Delay_WithScreenUpdates(100);
     }
 
-    if (Feld[ELX][ELY] == EL_WALL_ICE)
-      Feld[ELX][ELY] = EL_EMPTY;
+    if (Tile[ELX][ELY] == EL_WALL_ICE)
+      Tile[ELX][ELY] = EL_EMPTY;
 
 /*
     laser.num_edges--;
@@ -3520,7 +3473,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
   if (IS_WALL_AMOEBA(element) && CT > 60)
   {
     int k1, k2, k3, dx, dy, de, dm;
-    int element2 = Feld[ELX][ELY];
+    int element2 = Tile[ELX][ELY];
 
     if (element2 != EL_EMPTY && !IS_WALL_AMOEBA(element))
       return;
@@ -3588,11 +3541,11 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
       DrawLaser(0, DL_LASER_DISABLED);
     }
 
-    Feld[ELX][ELY] = element | laser.wall_mask;
+    Tile[ELX][ELY] = element | laser.wall_mask;
 
     dx = ELX;
     dy = ELY;
-    de = Feld[ELX][ELY];
+    de = Tile[ELX][ELY];
     dm = laser.wall_mask;
 
 #if 1
@@ -3605,7 +3558,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
       PlayLevelSound_MM(dx, dy, element, MM_ACTION_GROWING);
 
-      Feld[x][y] = Feld[x][y] - EL_WALL_AMOEBA + EL_WALL_CHANGING;
+      Tile[x][y] = Tile[x][y] - EL_WALL_AMOEBA + EL_WALL_CHANGING;
       Store[x][y] = EL_WALL_AMOEBA;
       Store2[x][y] = wall_mask;
 
@@ -3624,7 +3577,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
       DrawWallsAnimation_MM(dx, dy, de, i, dm);
 
       BackToFront();
-      Delay(20);
+      Delay_WithScreenUpdates(20);
     }
 
     DrawLaser(0, DL_LASER_ENABLED);
@@ -3655,7 +3608,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
       x = ELX + Step[k * 4].x;
       y = ELY + Step[k * 4].y;
 
-      if (!IN_LEV_FIELD(x, y) || Feld[x][y] != EL_EMPTY)
+      if (!IN_LEV_FIELD(x, y) || Tile[x][y] != EL_EMPTY)
        continue;
 
       if (ObjHit(x, y, HIT_POS_CENTER | HIT_POS_EDGE | HIT_POS_BETWEEN))
@@ -3673,8 +3626,8 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 
     PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_PUSHING);
 
-    Feld[ELX][ELY] = 0;
-    Feld[x][y] = element;
+    Tile[ELX][ELY] = 0;
+    Tile[x][y] = element;
 
     DrawGraphic_MM(ELX, ELY, IMG_EMPTY);
     DrawField_MM(x, y);
@@ -3705,11 +3658,11 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
       redraw_mask |= REDRAW_DOOR_1;
       BackToFront();
 
-      Delay(20);
+      Delay_WithScreenUpdates(20);
     }
 
     game_mm.energy_left = MAX_LASER_ENERGY;
-    Feld[ELX][ELY] = EL_FUEL_EMPTY;
+    Tile[ELX][ELY] = EL_FUEL_EMPTY;
     DrawField_MM(ELX, ELY);
 
     DrawLaser(0, DL_LASER_ENABLED);
@@ -3720,12 +3673,12 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
   return;
 }
 
-void GameActions_MM(struct MouseActionInfo action, boolean warp_mode)
+void GameActions_MM(struct MouseActionInfo action)
 {
   boolean element_clicked = ClickElement(action.lx, action.ly, action.button);
   boolean button_released = (action.button == MB_RELEASED);
 
-  GameActions_MM_Ext(action, warp_mode);
+  GameActions_MM_Ext(action);
 
   CheckSingleStepMode_MM(element_clicked, button_released);
 }
@@ -3763,7 +3716,7 @@ void MovePacMen(void)
     oy = game_mm.pacman[pacman_nr].y;
     nx = ox + mx;
     ny = oy + my;
-    element = Feld[nx][ny];
+    element = Tile[nx][ny];
 
     if (nx < 0 || nx > 15 || ny < 0 || ny > 11)
       continue;
@@ -3774,8 +3727,8 @@ void MovePacMen(void)
     if (ObjHit(nx, ny, HIT_POS_CENTER))
       continue;
 
-    Feld[ox][oy] = EL_EMPTY;
-    Feld[nx][ny] =
+    Tile[ox][oy] = EL_EMPTY;
+    Tile[nx][ny] =
       EL_PACMAN_RIGHT - 1 +
       (game_mm.pacman[pacman_nr].dir - 1 +
        (game_mm.pacman[pacman_nr].dir % 2) * 2);
@@ -3787,7 +3740,7 @@ void MovePacMen(void)
 
     if (element != EL_EMPTY)
     {
-      int graphic = el2gfx(Feld[nx][ny]);
+      int graphic = el2gfx(Tile[nx][ny]);
       Bitmap *bitmap;
       int src_x, src_y;
       int i;
@@ -3835,182 +3788,6 @@ void MovePacMen(void)
   }
 }
 
-void GameWon_MM(void)
-{
-  int hi_pos;
-  boolean raise_level = FALSE;
-
-#if 0
-  if (local_player->MovPos)
-    return;
-
-  local_player->LevelSolved = FALSE;
-#endif
-
-  if (game_mm.energy_left)
-  {
-    if (setup.sound_loops)
-      PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
-                  SND_CTRL_PLAY_LOOP);
-
-    while (game_mm.energy_left > 0)
-    {
-      if (!setup.sound_loops)
-       PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT);
-
-      /*
-      if (game_mm.energy_left > 0 && !(game_mm.energy_left % 10))
-       RaiseScore_MM(native_mm_level.score[SC_ZEITBONUS]);
-      */
-
-      RaiseScore_MM(5);
-
-      game_mm.energy_left--;
-      if (game_mm.energy_left >= 0)
-      {
-#if 0
-       BlitBitmap(pix[PIX_DOOR], drawto,
-                  DOOR_GFX_PAGEX5 + XX_ENERGY, DOOR_GFX_PAGEY1 + YY_ENERGY,
-                  ENERGY_XSIZE, ENERGY_YSIZE - game_mm.energy_left,
-                  DX_ENERGY, DY_ENERGY);
-#endif
-       redraw_mask |= REDRAW_DOOR_1;
-      }
-
-      BackToFront();
-      Delay(10);
-    }
-
-    if (setup.sound_loops)
-      StopSound(SND_SIRR);
-  }
-  else if (native_mm_level.time == 0)          // level without time limit
-  {
-    if (setup.sound_loops)
-      PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
-                  SND_CTRL_PLAY_LOOP);
-
-    while (TimePlayed < 999)
-    {
-      if (!setup.sound_loops)
-       PlaySoundStereo(SND_SIRR, SOUND_MAX_RIGHT);
-      if (TimePlayed < 999 && !(TimePlayed % 10))
-       RaiseScore_MM(native_mm_level.score[SC_TIME_BONUS]);
-      if (TimePlayed < 900 && !(TimePlayed % 10))
-       TimePlayed += 10;
-      else
-       TimePlayed++;
-
-      /*
-      DrawText(DX_TIME, DY_TIME, int2str(TimePlayed, 3), FONT_TEXT_2);
-      */
-
-      BackToFront();
-      Delay(10);
-    }
-
-    if (setup.sound_loops)
-      StopSound(SND_SIRR);
-  }
-
-  CloseDoor(DOOR_CLOSE_1);
-
-  Request("Level solved!", REQ_CONFIRM);
-
-  if (level_nr == leveldir_current->handicap_level)
-  {
-    leveldir_current->handicap_level++;
-    SaveLevelSetup_SeriesInfo();
-  }
-
-  if (level_editor_test_game)
-    game_mm.score = -1;                // no highscore when playing from editor
-  else if (level_nr < leveldir_current->last_level)
-    raise_level = TRUE;                // advance to next level
-
-  if ((hi_pos = NewHiScore_MM()) >= 0)
-  {
-    game_status = HALLOFFAME;
-
-    // DrawHallOfFame(hi_pos);
-
-    if (raise_level)
-      level_nr++;
-  }
-  else
-  {
-    game_status = MAINMENU;
-
-    if (raise_level)
-      level_nr++;
-
-    // DrawMainMenu();
-  }
-
-  BackToFront();
-}
-
-int NewHiScore_MM(void)
-{
-  int k, l;
-  int position = -1;
-
-  // LoadScore(level_nr);
-
-  if (strcmp(setup.player_name, EMPTY_PLAYER_NAME) == 0 ||
-      game_mm.score < highscore[MAX_SCORE_ENTRIES - 1].Score)
-    return -1;
-
-  for (k = 0; k < MAX_SCORE_ENTRIES; k++)
-  {
-    if (game_mm.score > highscore[k].Score)
-    {
-      // player has made it to the hall of fame
-
-      if (k < MAX_SCORE_ENTRIES - 1)
-      {
-       int m = MAX_SCORE_ENTRIES - 1;
-
-#ifdef ONE_PER_NAME
-       for (l = k; l < MAX_SCORE_ENTRIES; l++)
-         if (!strcmp(setup.player_name, highscore[l].Name))
-           m = l;
-       if (m == k)     // player's new highscore overwrites his old one
-         goto put_into_list;
-#endif
-
-       for (l = m; l>k; l--)
-       {
-         strcpy(highscore[l].Name, highscore[l - 1].Name);
-         highscore[l].Score = highscore[l - 1].Score;
-       }
-      }
-
-#ifdef ONE_PER_NAME
-      put_into_list:
-#endif
-      strncpy(highscore[k].Name, setup.player_name, MAX_PLAYER_NAME_LEN);
-      highscore[k].Name[MAX_PLAYER_NAME_LEN] = '\0';
-      highscore[k].Score = game_mm.score;
-      position = k;
-
-      break;
-    }
-
-#ifdef ONE_PER_NAME
-    else if (!strncmp(setup.player_name, highscore[k].Name,
-                     MAX_PLAYER_NAME_LEN))
-      break;   // player already there with a higher score
-#endif
-
-  }
-
-  // if (position >= 0)
-  //   SaveScore(level_nr);
-
-  return position;
-}
-
 static void InitMovingField_MM(int x, int y, int direction)
 {
   int newx = x + (direction == MV_LEFT ? -1 : direction == MV_RIGHT ? +1 : 0);
@@ -4019,8 +3796,8 @@ static void InitMovingField_MM(int x, int y, int direction)
   MovDir[x][y] = direction;
   MovDir[newx][newy] = direction;
 
-  if (Feld[newx][newy] == EL_EMPTY)
-    Feld[newx][newy] = EL_BLOCKED;
+  if (Tile[newx][newy] == EL_EMPTY)
+    Tile[newx][newy] = EL_BLOCKED;
 }
 
 static void Moving2Blocked_MM(int x, int y, int *goes_to_x, int *goes_to_y)
@@ -4054,7 +3831,7 @@ static void Blocked2Moving_MM(int x, int y,
 
 static int MovingOrBlocked2Element_MM(int x, int y)
 {
-  int element = Feld[x][y];
+  int element = Tile[x][y];
 
   if (element == EL_BLOCKED)
   {
@@ -4062,7 +3839,7 @@ static int MovingOrBlocked2Element_MM(int x, int y)
 
     Blocked2Moving_MM(x, y, &oldx, &oldy);
 
-    return Feld[oldx][oldy];
+    return Tile[oldx][oldy];
   }
 
   return element;
@@ -4071,7 +3848,7 @@ static int MovingOrBlocked2Element_MM(int x, int y)
 #if 0
 static void RemoveField(int x, int y)
 {
-  Feld[x][y] = EL_EMPTY;
+  Tile[x][y] = EL_EMPTY;
   MovPos[x][y] = 0;
   MovDir[x][y] = 0;
   MovDelay[x][y] = 0;
@@ -4082,24 +3859,24 @@ static void RemoveMovingField_MM(int x, int y)
 {
   int oldx = x, oldy = y, newx = x, newy = y;
 
-  if (Feld[x][y] != EL_BLOCKED && !IS_MOVING(x, y))
+  if (Tile[x][y] != EL_BLOCKED && !IS_MOVING(x, y))
     return;
 
   if (IS_MOVING(x, y))
   {
     Moving2Blocked_MM(x, y, &newx, &newy);
-    if (Feld[newx][newy] != EL_BLOCKED)
+    if (Tile[newx][newy] != EL_BLOCKED)
       return;
   }
-  else if (Feld[x][y] == EL_BLOCKED)
+  else if (Tile[x][y] == EL_BLOCKED)
   {
     Blocked2Moving_MM(x, y, &oldx, &oldy);
     if (!IS_MOVING(oldx, oldy))
       return;
   }
 
-  Feld[oldx][oldy] = EL_EMPTY;
-  Feld[newx][newy] = EL_EMPTY;
+  Tile[oldx][oldy] = EL_EMPTY;
+  Tile[newx][newy] = EL_EMPTY;
   MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0;
   MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0;
 
@@ -4152,7 +3929,7 @@ static void RaiseScore_MM(int value)
 
 void RaiseScoreElement_MM(int element)
 {
-  switch(element)
+  switch (element)
   {
     case EL_PACMAN:
     case EL_PACMAN_RIGHT:
@@ -4299,7 +4076,7 @@ int getButtonFromTouchPosition(int x, int y, int dst_mx, int dst_my)
   if (!IN_LEV_FIELD(x, y))
     return 0;
 
-  element = Feld[x][y];
+  element = Tile[x][y];
 
   if (!IS_MCDUFFIN(element) &&
       !IS_MIRROR(element) &&