renamed preprocessor constant for game element in MM engine
[rocksndiamonds.git] / src / game_mm / mm_tools.c
index 2c34884abb7dd4d2ece638e99062a4044ccd6188..59c59d25737982bc64883d8abb1a763626b8d693 100644 (file)
@@ -92,7 +92,7 @@ void DrawGraphicExt_MM(DrawBuffer *d, int x, int y, int graphic)
   BlitBitmap(bitmap, d, src_x, src_y, TILEX, TILEY, x, y);
 }
 
-void DrawGraphicThruMask_MM(int x, int y, int graphic)
+void DrawGraphicThruMask_MM(int x, int y, int graphic, int frame)
 {
 #if DEBUG
   if (!IN_SCR_FIELD(x,y))
@@ -106,13 +106,13 @@ void DrawGraphicThruMask_MM(int x, int y, int graphic)
 #endif
 
   DrawGraphicThruMaskExt_MM(drawto_field, cFX + x * TILEX, cFY + y * TILEY,
-                           graphic);
+                           graphic, frame);
 
   MarkTileDirty(x,y);
 }
 
 void DrawGraphicThruMaskExt_MM(DrawBuffer *d, int dest_x, int dest_y,
-                              int graphic)
+                              int graphic, int frame)
 {
   int src_x, src_y;
   Bitmap *src_bitmap;
@@ -120,7 +120,7 @@ void DrawGraphicThruMaskExt_MM(DrawBuffer *d, int dest_x, int dest_y,
   if (graphic == IMG_EMPTY)
     return;
 
-  getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+  getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
 
   BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dest_x, dest_y);
 }
@@ -286,7 +286,7 @@ void DrawScreenElementExt_MM(int x, int y, int dx, int dy, int element,
   if (dx || dy)
     DrawGraphicShifted_MM(x, y, dx, dy, graphic, cut_mode, mask_mode);
   else if (mask_mode == USE_MASKING)
-    DrawGraphicThruMask_MM(x, y, graphic);
+    DrawGraphicThruMask_MM(x, y, graphic, 0);
   else
     DrawGraphic_MM(x, y, graphic);
 }
@@ -524,6 +524,14 @@ 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_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)
+    DrawGraphic_MM(x, y, el_act2gfx(EL_MINE, MM_ACTION_ACTIVE));
   else
     DrawGraphic_MM(x, y, el2gfx(element));
 }
@@ -1287,11 +1295,31 @@ static int map_element(int element)
   }
 }
 
+int unmap_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;
+
+    default:                   return element;
+  }
+}
+
 int el2gfx(int element)
 {
   return el2img_mm(map_element(element));
 }
 
+int el_act2gfx(int element, int action)
+{
+  return el_act2img_mm(map_element(element), action);
+}
+
 void RedrawPlayfield_MM(void)
 {
   DrawLevel_MM();