added game over messages for Deflektor style levels in MM game engine
[rocksndiamonds.git] / src / game_mm / mm_tools.c
index 4e9254a7c7a29383abed7a33a993c21d0590208f..dd7edbdf16660f5115b6e2200a20e52692053080 100644 (file)
@@ -133,13 +133,6 @@ void DrawMiniGraphic_MM(int x, int y, int graphic)
   MarkTileDirty(x / 2, y / 2);
 }
 
-#if 0
-static void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
-{
-  getSizedGraphicSource(graphic, 0, TILESIZE / 4, bitmap, x, y);
-}
-#endif
-
 void DrawMiniGraphicExt_MM(DrawBuffer *d, int x, int y, int graphic)
 {
   Bitmap *bitmap;
@@ -524,8 +517,10 @@ void DrawElement_MM(int x, int y, int element)
           laser.fuse_x == x &&
           laser.fuse_y == y)
     DrawGraphic_MM(x, y, IMG_MM_FUSE);
+  else if (element == EL_GRAY_BALL_ACTIVE)
+    DrawGraphic_MM(x, y, el_act2gfx(EL_GRAY_BALL, MM_ACTION_ACTIVE));
   else if (element == EL_GRAY_BALL_OPENING)
-    DrawGraphic_MM(x, y, el_act2gfx(EL_BALL_GRAY, MM_ACTION_OPENING));
+    DrawGraphic_MM(x, y, el_act2gfx(EL_GRAY_BALL, MM_ACTION_OPENING));
   else if (element == EL_BOMB_ACTIVE)
     DrawGraphic_MM(x, y, el_act2gfx(EL_BOMB, MM_ACTION_ACTIVE));
   else if (element == EL_MINE_ACTIVE)
@@ -534,64 +529,6 @@ void DrawElement_MM(int x, int y, int element)
     DrawGraphic_MM(x, y, el2gfx(element));
 }
 
-#if 0
-static void DrawMicroWalls_MM(int x, int y, int element)
-{
-  Bitmap *bitmap;
-  int graphic = el2gfx(WALL_BASE(element));
-  int gx, gy;
-  int i;
-
-  getMicroGraphicSource(graphic, &bitmap, &gx, &gy);
-
-  for (i = 0; i < 4; i++)
-  {
-    int xpos = MICROLEV_XPOS + x * MICRO_TILEX + MICRO_WALLX * (i % 2);
-    int ypos = MICROLEV_YPOS + y * MICRO_TILEY + MICRO_WALLY * (i / 2);
-
-    if (element & (1 << i))
-      BlitBitmap(bitmap, drawto, gx, gy, MICRO_WALLX, MICRO_WALLY, xpos, ypos);
-    else
-      ClearRectangle(drawto, xpos, ypos, MICRO_WALLX, MICRO_WALLY);
-  }
-}
-
-static void DrawMicroElement_MM(int x, int y, int element)
-{
-  Bitmap *bitmap;
-  int graphic = el2gfx(element);
-  int gx, gy;
-
-  if (element == EL_EMPTY)
-    return;
-
-  if (IS_WALL(element))
-  {
-    DrawMicroWalls_MM(x, y, element);
-
-    return;
-  }
-
-  getMicroGraphicSource(graphic, &bitmap, &gx, &gy);
-
-  BlitBitmap(bitmap, drawto, gx, gy, MICRO_TILEX, MICRO_TILEY,
-            MICROLEV_XPOS + x * MICRO_TILEX, MICROLEV_YPOS + y * MICRO_TILEY);
-}
-
-static void DrawMicroLevelExt_MM(int xpos, int ypos)
-{
-  int x, y;
-
-  ClearRectangle(drawto, xpos, ypos, MICROLEV_XSIZE, MICROLEV_YSIZE);
-
-  for (x = 0; x < STD_LEV_FIELDX; x++)
-    for (y = 0; y < STD_LEV_FIELDY; y++)
-      DrawMicroElement_MM(x, y, Ur[x][y]);
-
-  redraw_mask |= REDRAW_FIELD;
-}
-#endif
-
 
 // ----------------------------------------------------------------------------
 // XSN
@@ -1157,31 +1094,11 @@ void DrawTileCursor_MM(int draw_target, boolean tile_cursor_active)
                     dst_x, dst_y);
 }
 
-#if 0
-static int REQ_in_range(int x, int y)
-{
-  if (y > DY + 249 && y < DY + 278)
-  {
-    if (x > DX + 1 && x < DX + 48)
-      return 1;
-    else if (x > DX + 51 && x < DX + 98)
-      return 2;
-  }
-
-  return 0;
-}
-#endif
-
 Pixel ReadPixel(DrawBuffer *bitmap, int x, int y)
 {
   return GetPixel(bitmap, x, y);
 }
 
-void SetRGB(unsigned int pixel,
-           unsigned short red, unsigned short green, unsigned short blue)
-{
-}
-
 int get_base_element(int element)
 {
   if (IS_MIRROR(element))
@@ -1278,31 +1195,31 @@ int get_rotated_element(int element, int step)
   return base_element + (element_phase + step + num_elements) % num_elements;
 }
 
-static int map_element(int element)
+int map_wall_from_base_element(int element)
 {
   switch (element)
   {
-    case EL_WALL_STEEL:                return EL_STEEL_WALL;
-    case EL_WALL_WOOD:         return EL_WOODEN_WALL;
-    case EL_WALL_ICE:          return EL_ICE_WALL;
-    case EL_WALL_AMOEBA:       return EL_AMOEBA_WALL;
-    case EL_DF_WALL_STEEL:     return EL_DF_STEEL_WALL;
-    case EL_DF_WALL_WOOD:      return EL_DF_WOODEN_WALL;
+    case EL_WALL_STEEL_BASE:   return EL_WALL_STEEL;
+    case EL_WALL_WOOD_BASE:    return EL_WALL_WOOD;
+    case EL_WALL_ICE_BASE:     return EL_WALL_ICE;
+    case EL_WALL_AMOEBA_BASE:  return EL_WALL_AMOEBA;
+    case EL_DF_WALL_STEEL_BASE:        return EL_DF_WALL_STEEL;
+    case EL_DF_WALL_WOOD_BASE: return EL_DF_WALL_WOOD;
 
     default:                   return element;
   }
 }
 
-int unmap_element(int element)
+int map_wall_to_base_element(int element)
 {
   switch (element)
   {
-    case EL_STEEL_WALL:                return EL_WALL_STEEL;
-    case EL_WOODEN_WALL:       return EL_WALL_WOOD;
-    case EL_ICE_WALL:          return EL_WALL_ICE;
-    case EL_AMOEBA_WALL:       return EL_WALL_AMOEBA;
-    case EL_DF_STEEL_WALL:     return EL_DF_WALL_STEEL;
-    case EL_DF_WOODEN_WALL:    return EL_DF_WALL_WOOD;
+    case EL_WALL_STEEL:                return EL_WALL_STEEL_BASE;
+    case EL_WALL_WOOD:         return EL_WALL_WOOD_BASE;
+    case EL_WALL_ICE:          return EL_WALL_ICE_BASE;
+    case EL_WALL_AMOEBA:       return EL_WALL_AMOEBA_BASE;
+    case EL_DF_WALL_STEEL:     return EL_DF_WALL_STEEL_BASE;
+    case EL_DF_WALL_WOOD:      return EL_DF_WALL_WOOD_BASE;
 
     default:                   return element;
   }
@@ -1310,12 +1227,12 @@ int unmap_element(int element)
 
 int el2gfx(int element)
 {
-  return el2img_mm(map_element(element));
+  return el2img_mm(map_wall_from_base_element(element));
 }
 
 int el_act2gfx(int element, int action)
 {
-  return el_act2img_mm(map_element(element), action);
+  return el_act2img_mm(map_wall_from_base_element(element), action);
 }
 
 void RedrawPlayfield_MM(void)