fixed pacman graphics for Mirror Magic game engine
authorHolger Schemel <info@artsoft.org>
Tue, 21 Feb 2017 07:52:12 +0000 (08:52 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:09 +0000 (23:21 +0100)
src/conf_gfx.c
src/game_mm/mm_game.c
src/game_mm/mm_tools.c
src/main.c
src/main.h

index 06ca3e069203b1fa2ec5823485c4fd6924a40d92..6cdb6fe06c8b39e49df0b25b632ee5dbf9fa3e96 100644 (file)
@@ -5064,27 +5064,35 @@ struct ConfigInfo image_config[] =
   { "mm_pacman.right",                         "RocksMM.png"           },
   { "mm_pacman.right.xpos",                    "0"                     },
   { "mm_pacman.right.ypos",                    "4"                     },
-  { "mm_pacman.right.frames",                  "2"                     },
-  { "mm_pacman.right.delay",                   "4"                     },
-  { "mm_pacman.right.offset",                  "128"                   },
+  { "mm_pacman.right.frames",                  "1"                     },
   { "mm_pacman.up",                            "RocksMM.png"           },
   { "mm_pacman.up.xpos",                       "1"                     },
   { "mm_pacman.up.ypos",                       "4"                     },
-  { "mm_pacman.up.frames",                     "2"                     },
-  { "mm_pacman.up.delay",                      "4"                     },
-  { "mm_pacman.up.offset",                     "128"                   },
+  { "mm_pacman.up.frames",                     "1"                     },
   { "mm_pacman.left",                          "RocksMM.png"           },
   { "mm_pacman.left.xpos",                     "2"                     },
   { "mm_pacman.left.ypos",                     "4"                     },
-  { "mm_pacman.left.frames",                   "2"                     },
-  { "mm_pacman.left.delay",                    "4"                     },
-  { "mm_pacman.left.offset",                   "128"                   },
+  { "mm_pacman.left.frames",                   "1"                     },
   { "mm_pacman.down",                          "RocksMM.png"           },
   { "mm_pacman.down.xpos",                     "3"                     },
   { "mm_pacman.down.ypos",                     "4"                     },
-  { "mm_pacman.down.frames",                   "2"                     },
-  { "mm_pacman.down.delay",                    "4"                     },
-  { "mm_pacman.down.offset",                   "128"                   },
+  { "mm_pacman.down.frames",                   "1"                     },
+  { "mm_pacman.eating.right",                  "RocksMM.png"           },
+  { "mm_pacman.eating.right.xpos",             "4"                     },
+  { "mm_pacman.eating.right.ypos",             "4"                     },
+  { "mm_pacman.eating.right.frames",           "1"                     },
+  { "mm_pacman.eating.up",                     "RocksMM.png"           },
+  { "mm_pacman.eating.up.xpos",                        "5"                     },
+  { "mm_pacman.eating.up.ypos",                        "4"                     },
+  { "mm_pacman.eating.up.frames",              "1"                     },
+  { "mm_pacman.eating.left",                   "RocksMM.png"           },
+  { "mm_pacman.eating.left.xpos",              "6"                     },
+  { "mm_pacman.eating.left.ypos",              "4"                     },
+  { "mm_pacman.eating.left.frames",            "1"                     },
+  { "mm_pacman.eating.down",                   "RocksMM.png"           },
+  { "mm_pacman.eating.down.xpos",              "7"                     },
+  { "mm_pacman.eating.down.ypos",              "4"                     },
+  { "mm_pacman.eating.down.frames",            "1"                     },
 
   { "mm_mask_mcduffin.right",                  "RocksMM.png"           },
   { "mm_mask_mcduffin.right.xpos",             "8"                     },
index 4f4af5f87c9aac8c71acb7a51ab4ffd0803cf6e6..6113871750944202623ddd6f6228c0941187c0c8 100644 (file)
@@ -3312,7 +3312,7 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode)
     Feld[ELX][ELY] = 0;
     Feld[x][y] = element;
 
-    DrawGraphic_MM(ELX, ELY, -1);
+    DrawGraphic_MM(ELX, ELY, IMG_EMPTY);
     DrawField_MM(x, y);
 
     if (element == EL_BLOCK_STONE && Box[ELX][ELY])
@@ -3368,7 +3368,7 @@ void MovePacMen()
 {
   static int p = -1;
   int mx, my, ox, oy, nx, ny;
-  int g, element;
+  int element;
   int l;
 
   if (++p >= game_mm.num_pacman)
@@ -3415,30 +3415,26 @@ void MovePacMen()
 
     game_mm.pacman[p].x = nx;
     game_mm.pacman[p].y = ny;
-    g = Feld[nx][ny] - EL_PACMAN_RIGHT;
+
     DrawGraphic_MM(ox, oy, IMG_EMPTY);
 
     if (element != EL_EMPTY)
     {
+      int graphic = el2gfx(Feld[nx][ny]);
+      Bitmap *bitmap;
+      int src_x, src_y;
       int i;
 
+      getGraphicSource(graphic, 0, &bitmap, &src_x, &src_y);
+
       CT = Counter();
       ox = SX + ox * TILEX;
       oy = SY + oy * TILEY;
 
       for(i=1; i<33; i+=2)
-      {
-#if 1
-       // !!! temporary fix to compile -- change to game graphics !!!
-       BlitBitmap(drawto, window,
-                  SX + g * TILEX, SY + 4 * TILEY, TILEX, TILEY,
-                  ox + i * mx, oy + i * my);
-#else
-       BlitBitmap(pix[PIX_BACK], window,
-                  SX + g * TILEX, SY + 4 * TILEY, TILEX, TILEY,
+       BlitBitmap(bitmap, window,
+                  src_x, src_y, TILEX, TILEY,
                   ox + i * mx, oy + i * my);
-#endif
-      }
       Ct = Ct + Counter() - CT;
     }
     DrawField_MM(nx, ny);
index dbe6ab212f74663bacd540a3611d394eff27d659..e037aac9cc838af2da1f0ecc7be98e3c16a92795 100644 (file)
@@ -271,7 +271,7 @@ void DrawScreenElementExt_MM(int x, int y, int dx, int dy, int element,
 
   if (element == EL_PACMAN)
   {
-    graphic += 4 * !phase2;
+    graphic = (phase2 ? IMG_MM_PACMAN_RIGHT : IMG_MM_PACMAN_EATING_RIGHT);
 
     if (dir == MV_UP)
       graphic += 1;
index c2e2338da2420fc3c1f460c5cd2660adb452af40..f766a5ded682202fc8e2be0aa15dd82d7127079c 100644 (file)
@@ -6641,6 +6641,26 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "mm_amoeba_wall",
     "-",
   },
+  {
+    "mm_pacman.eating.right",
+    "mm_pacman",
+    "pac man (eating right)"
+  },
+  {
+    "mm_pacman.eating.up",
+    "mm_pacman",
+    "pac man (eating up)"
+  },
+  {
+    "mm_pacman.eating.left",
+    "mm_pacman",
+    "pac man (eating left)"
+  },
+  {
+    "mm_pacman.eating.down",
+    "mm_pacman",
+    "pac man (eating down)"
+  },
 
   /* ----------------------------------------------------------------------- */
   /* "unreal" (and therefore not drawable) runtime elements                  */
index 845f471237cda7d1900ed2fb6af53a6d3dd1c8ac..b535fed953f1dd34de643eb4a5706a86630ceca3 100644 (file)
 #define EL_MM_GRAY_BALL_OPENING                (EL_FIRST_RUNTIME_REAL + 74)
 #define EL_MM_ICE_WALL_SHRINKING       (EL_FIRST_RUNTIME_REAL + 75)
 #define EL_MM_AMOEBA_WALL_GROWING      (EL_FIRST_RUNTIME_REAL + 76)
+#define EL_MM_PACMAN_EATING_RIGHT      (EL_FIRST_RUNTIME_REAL + 77)
+#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 NUM_DRAWABLE_ELEMENTS          (EL_FIRST_RUNTIME_REAL + 77)
+#define NUM_DRAWABLE_ELEMENTS          (EL_FIRST_RUNTIME_REAL + 81)
 
 #define EL_MM_RUNTIME_START            EL_MM_EXIT_OPENING
 #define EL_MM_RUNTIME_END              EL_MM_AMOEBA_WALL_GROWING