added support for custom graphics for many elements of MM game engine
authorHolger Schemel <info@artsoft.org>
Wed, 2 Nov 2022 14:17:37 +0000 (15:17 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 2 Nov 2022 14:17:37 +0000 (15:17 +0100)
src/game_mm/mm_game.c
src/game_mm/mm_tools.c

index d4838873c978d51a4958a657ed11b76656315572..1ef6339e826957c521ef5d79efc81935cbd8ebba 100644 (file)
@@ -537,7 +537,6 @@ static void InitCycleElements_RotateSingleStep(void)
 
     Tile[x][y] = next_element;
 
-    DrawField_MM(x, y);
     game_mm.cycle[i].steps -= step;
   }
 }
@@ -691,6 +690,11 @@ void InitGameActions_MM(void)
       cycle_steps_done++;
     }
 
+    AdvanceFrameCounter();
+    AdvanceGfxFrame();
+
+    DrawLevel_MM();
+
     BackToFront();
 
     ColorCycling();
@@ -2398,6 +2402,16 @@ static void GrowAmoeba(int x, int y)
   }
 }
 
+static void DrawFieldAnimated_MM(int x, int y)
+{
+  if (IS_BLOCKED(x, y))
+    return;
+
+  DrawField_MM(x, y);
+
+  laser.redraw = TRUE;
+}
+
 static void Explode_MM(int x, int y, int phase, int mode)
 {
   int num_phase = 9, delay = 2;
@@ -3084,6 +3098,8 @@ static void GameActions_MM_Ext(void)
       MeltIce(x, y);
     else if (IS_WALL_CHANGING(element) && Store[x][y] == EL_WALL_AMOEBA)
       GrowAmoeba(x, y);
+    else
+      DrawFieldAnimated_MM(x, y);
   }
 
   AutoRotateMirrors();
index 3fb8b4bb64da0b2f7e4e6a284c683368dcd6f510..1f23bc902c0114420e544d7ed68635a391cb98a1 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);
 }
@@ -1291,9 +1293,6 @@ int el2gfx(int element)
 
   switch (element)
   {
-    case EL_LIGHTBALL:
-      return IMG_MM_LIGHTBALL_RED + RND(3);
-
     default:
       return el2img_mm(element);
   }