added active animation for bomb and mine in MM engine
authorHolger Schemel <info@artsoft.org>
Sat, 7 Jan 2023 17:04:41 +0000 (18:04 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 8 Jan 2023 01:14:43 +0000 (02:14 +0100)
graphics/gfx_classic/RocksMM.png
src/conf_gfx.c
src/game_mm/export.h
src/game_mm/mm_game.c
src/game_mm/mm_main.h
src/game_mm/mm_tools.c
src/main.c
src/main.h

index 3fd82443622c49061986b9796404f20d7a2e4213..47d0add242e2dec7dcfd045f30f5c09615ec4732 100644 (file)
Binary files a/graphics/gfx_classic/RocksMM.png and b/graphics/gfx_classic/RocksMM.png differ
index 28a22318586abec39305fef963acbdca7e79d346..b4789635243a7cb622ecc6ae8344291c72165c76 100644 (file)
@@ -5051,6 +5051,12 @@ struct ConfigInfo image_config[] =
   { "mm_bomb.xpos",                            "5"                     },
   { "mm_bomb.ypos",                            "2"                     },
   { "mm_bomb.frames",                          "1"                     },
+  { "mm_bomb.active",                          "RocksMM.png"           },
+  { "mm_bomb.active.xpos",                     "12"                    },
+  { "mm_bomb.active.ypos",                     "1"                     },
+  { "mm_bomb.active.frames",                   "3"                     },
+  { "mm_bomb.active.delay",                    "6"                     },
+  { "mm_bomb.active.anim_mode",                        "pingpong"              },
 
   { "mm_prism",                                        "RocksMM.png"           },
   { "mm_prism.xpos",                           "0"                     },
@@ -5747,6 +5753,12 @@ struct ConfigInfo image_config[] =
   { "df_mine.xpos",                            "4"                     },
   { "df_mine.ypos",                            "8"                     },
   { "df_mine.frames",                          "1"                     },
+  { "df_mine.active",                          "RocksDF.png"           },
+  { "df_mine.active.xpos",                     "3"                     },
+  { "df_mine.active.ypos",                     "8"                     },
+  { "df_mine.active.frames",                   "3"                     },
+  { "df_mine.active.delay",                    "6"                     },
+  { "df_mine.active.anim_mode",                        "pingpong"              },
 
   // (these are only defined as elements to support ".PANEL" definitions)
   { "graphic_1",                               UNDEFINED_FILENAME      },
index f600993f4dfc0d4b9e4d607316ec988e2935b8cf..f69946245731da069b9024720821c2a837b4c9e2 100644 (file)
@@ -112,6 +112,9 @@ struct LaserInfo
   int fuse_x, fuse_y;
 
   int dest_element;
+  int dest_element_last;
+  int dest_element_last_x;
+  int dest_element_last_y;
   boolean stops_inside_element;
 
   boolean redraw;
index 85a9d4092995b18fcbdd5550ab4b60d1911a7895..e817b1187613c8cb76445be6ba5b48137bd8267f 100644 (file)
@@ -647,6 +647,9 @@ void InitGameEngine_MM(void)
   laser.fuse_x = laser.fuse_y = -1;
 
   laser.dest_element = EL_EMPTY;
+  laser.dest_element_last = EL_EMPTY;
+  laser.dest_element_last_x = -1;
+  laser.dest_element_last_y = -1;
   laser.wall_mask = 0;
 
   last_LX = 0;
@@ -921,6 +924,21 @@ void ScanLaser(void)
   if (game_mm.game_over)
     return;
 
+  if (laser.dest_element_last == EL_BOMB_ACTIVE ||
+      laser.dest_element_last == EL_MINE_ACTIVE)
+  {
+    int x = laser.dest_element_last_x;
+    int y = laser.dest_element_last_y;
+    int element = laser.dest_element_last;
+
+    if (Tile[x][y] == element)
+      Tile[x][y] = (element == EL_BOMB_ACTIVE ? EL_BOMB : EL_MINE);
+
+    laser.dest_element_last = EL_EMPTY;
+    laser.dest_element_last_x = -1;
+    laser.dest_element_last_y = -1;
+  }
+
   laser.overloaded = FALSE;
   laser.stops_inside_element = FALSE;
 
@@ -1559,6 +1577,12 @@ boolean HitElement(int element, int hit_mask)
   {
     PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_HITTING);
 
+    Tile[ELX][ELY] = (element == EL_BOMB ? EL_BOMB_ACTIVE : EL_MINE_ACTIVE);
+
+    laser.dest_element_last = Tile[ELX][ELY];
+    laser.dest_element_last_x = ELX;
+    laser.dest_element_last_y = ELY;
+
     if (element == EL_MINE)
       laser.overloaded = TRUE;
   }
@@ -2518,7 +2542,7 @@ static void Explode_MM(int x, int y, int phase, int mode)
       Tile[x][y] = center_element;
     }
 
-    if (center_element == EL_BOMB || IS_MCDUFFIN(center_element))
+    if (center_element == EL_BOMB_ACTIVE || IS_MCDUFFIN(center_element))
       Store[x][y] = center_element;
     else
       Store[x][y] = EL_EMPTY;
@@ -2550,7 +2574,7 @@ static void Explode_MM(int x, int y, int phase, int mode)
 
   if (phase == last_phase)
   {
-    if (Store[x][y] == EL_BOMB)
+    if (Store[x][y] == EL_BOMB_ACTIVE)
     {
       DrawLaser(0, DL_LASER_DISABLED);
       InitLaser();
@@ -2597,7 +2621,7 @@ static void Bang_MM(int x, int y)
 
   if (IS_PACMAN(element))
     PlayLevelSound_MM(x, y, element, MM_ACTION_EXPLODING);
-  else if (element == EL_BOMB || IS_MCDUFFIN(element))
+  else if (element == EL_BOMB_ACTIVE || IS_MCDUFFIN(element))
     PlayLevelSound_MM(x, y, element, MM_ACTION_EXPLODING);
   else if (element == EL_KEY)
     PlayLevelSound_MM(x, y, element, MM_ACTION_EXPLODING);
@@ -3199,7 +3223,9 @@ static void GameActions_MM_Ext(void)
 
   if (!laser.overloaded && laser.overload_value == 0 &&
       element != EL_BOMB &&
+      element != EL_BOMB_ACTIVE &&
       element != EL_MINE &&
+      element != EL_MINE_ACTIVE &&
       element != EL_BALL_GRAY &&
       element != EL_BLOCK_STONE &&
       element != EL_BLOCK_WOOD &&
index 5d0718f5f4ae188e37ed43d1db9313b776a9efdb..0fb74d9e215efac28658873ccd73d46ee89f8ec6 100644 (file)
@@ -653,6 +653,8 @@ extern int          num_element_info;
 #define EL_GRAY_BALL_OPENING   502
 #define EL_ICE_WALL_SHRINKING  503
 #define EL_AMOEBA_WALL_GROWING 504
+#define EL_BOMB_ACTIVE         505
+#define EL_MINE_ACTIVE         506
 
 #define EL_WALL_CHANGING       512
 #define EL_WALL_CHANGING_START (EL_WALL_CHANGING + 0)
index a8edba4e2e152d6b0b397d70f9f4bc8c2c4169c0..d8dbe8becaa5270253801ca4a406f0255f8d1aa3 100644 (file)
@@ -526,6 +526,10 @@ void DrawElement_MM(int x, int y, int element)
     DrawGraphic_MM(x, y, IMG_MM_FUSE);
   else if (element == EL_GRAY_BALL_OPENING)
     DrawGraphic_MM(x, y, el_act2gfx(EL_BALL_GRAY, 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));
 }
index c7291eae8cefd41f054de02d4aa6147dd9028123..13cab898ed95bf930dccaa0c2d8e8b1949b29bfa 100644 (file)
@@ -6772,6 +6772,16 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "mm_pacman",
     "pac man (eating down)"
   },
+  {
+    "mm_bomb.active",
+    "mm_bomb",
+    "active bomb (MM style)"
+  },
+  {
+    "df_mine.active",
+    "df_mine",
+    "active mine"
+  },
 
   // --------------------------------------------------------------------------
   // "unreal" (and therefore not drawable) runtime elements
index de5e736dfa727a58eb29059aebf5b2c3ae7c7603..5800f5ef5dbdca6e94fffe4c32862d6ec4ca1117 100644 (file)
 #define EL_MM_PACMAN_EATING_UP         (EL_FIRST_RUNTIME_REAL + 78)
 #define EL_MM_PACMAN_EATING_LEFT       (EL_FIRST_RUNTIME_REAL + 79)
 #define EL_MM_PACMAN_EATING_DOWN       (EL_FIRST_RUNTIME_REAL + 80)
+#define EL_MM_BOMB_ACTIVE              (EL_FIRST_RUNTIME_REAL + 81)
+#define EL_DF_MINE_ACTIVE              (EL_FIRST_RUNTIME_REAL + 82)
 
-#define NUM_DRAWABLE_ELEMENTS          (EL_FIRST_RUNTIME_REAL + 81)
+#define NUM_DRAWABLE_ELEMENTS          (EL_FIRST_RUNTIME_REAL + 83)
 
 #define EL_MM_RUNTIME_START            EL_MM_EXIT_OPENING
 #define EL_MM_RUNTIME_END              EL_MM_AMOEBA_WALL_GROWING