added frame parameter to graphics drawing function for MM engine
[rocksndiamonds.git] / src / game_mm / mm_tools.c
index 3fb8b4bb64da0b2f7e4e6a284c683368dcd6f510..d4bb5d37553ae80e1c72032f91e2cfc5146f281a 100644 (file)
@@ -75,7 +75,9 @@ void DrawGraphic_MM(int x, int y, int graphic)
   }
 #endif
 
-  DrawGraphicExt_MM(drawto_field, cFX + x * TILEX, cFY + y * TILEY, graphic);
+  int frame = getGraphicAnimationFrameXY(graphic, x, y);
+
+  DrawGraphicAnimation_MM(x, y, graphic, frame);
 
   MarkTileDirty(x, y);
 }
@@ -90,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))
@@ -104,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;
@@ -118,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);
 }
@@ -284,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);
 }
@@ -1287,16 +1289,7 @@ static int map_element(int element)
 
 int el2gfx(int element)
 {
-  element = map_element(element);
-
-  switch (element)
-  {
-    case EL_LIGHTBALL:
-      return IMG_MM_LIGHTBALL_RED + RND(3);
-
-    default:
-      return el2img_mm(element);
-  }
+  return el2img_mm(map_element(element));
 }
 
 void RedrawPlayfield_MM(void)