removed unneeded mask element and graphic definitions from MM engine
authorHolger Schemel <info@artsoft.org>
Thu, 5 Jan 2023 00:28:04 +0000 (01:28 +0100)
committerHolger Schemel <info@artsoft.org>
Thu, 5 Jan 2023 00:41:44 +0000 (01:41 +0100)
Instead, the already existing element mask array (which was added
earlier to prevent reading pixels from bitmaps) is accessed now by
directly using the mask array positions (instead of using dummy mask
element and graphics definitions only for mapping to the mask array
positions).

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/main.c
src/main.h
src/tools.c

index b2b816ea85c78d96673edd089fc8b66d04944251..b5066c690a137cc11e7c0384538c2f03a90d9920 100644 (file)
Binary files a/graphics/gfx_classic/RocksMM.png and b/graphics/gfx_classic/RocksMM.png differ
index b9cc9756889070866bf2f9a1f1def88c13236135..5b601e626fae1c3dde606f68b027c60b51181d20 100644 (file)
@@ -5201,50 +5201,6 @@ struct ConfigInfo image_config[] =
   { "mm_pacman.eating.down.ypos",              "4"                     },
   { "mm_pacman.eating.down.frames",            "1"                     },
 
-  { "mm_mask_mcduffin.right",                  "RocksMM.png"           },
-  { "mm_mask_mcduffin.right.xpos",             "8"                     },
-  { "mm_mask_mcduffin.right.ypos",             "8"                     },
-  { "mm_mask_mcduffin.right.frames",           "1"                     },
-  { "mm_mask_mcduffin.up",                     "RocksMM.png"           },
-  { "mm_mask_mcduffin.up.xpos",                        "9"                     },
-  { "mm_mask_mcduffin.up.ypos",                        "8"                     },
-  { "mm_mask_mcduffin.up.frames",              "1"                     },
-  { "mm_mask_mcduffin.left",                   "RocksMM.png"           },
-  { "mm_mask_mcduffin.left.xpos",              "10"                    },
-  { "mm_mask_mcduffin.left.ypos",              "8"                     },
-  { "mm_mask_mcduffin.left.frames",            "1"                     },
-  { "mm_mask_mcduffin.down",                   "RocksMM.png"           },
-  { "mm_mask_mcduffin.down.xpos",              "11"                    },
-  { "mm_mask_mcduffin.down.ypos",              "8"                     },
-  { "mm_mask_mcduffin.down.frames",            "1"                     },
-
-  { "mm_mask_grid_1",                          "RocksMM.png"           },
-  { "mm_mask_grid_1.xpos",                     "4"                     },
-  { "mm_mask_grid_1.ypos",                     "8"                     },
-  { "mm_mask_grid_1.frames",                   "1"                     },
-  { "mm_mask_grid_2",                          "RocksMM.png"           },
-  { "mm_mask_grid_2.xpos",                     "5"                     },
-  { "mm_mask_grid_2.ypos",                     "8"                     },
-  { "mm_mask_grid_2.frames",                   "1"                     },
-  { "mm_mask_grid_3",                          "RocksMM.png"           },
-  { "mm_mask_grid_3.xpos",                     "6"                     },
-  { "mm_mask_grid_3.ypos",                     "8"                     },
-  { "mm_mask_grid_3.frames",                   "1"                     },
-  { "mm_mask_grid_4",                          "RocksMM.png"           },
-  { "mm_mask_grid_4.xpos",                     "7"                     },
-  { "mm_mask_grid_4.ypos",                     "8"                     },
-  { "mm_mask_grid_4.frames",                   "1"                     },
-
-  { "mm_mask_rectangle",                       "RocksMM.png"           },
-  { "mm_mask_rectangle.xpos",                  "1"                     },
-  { "mm_mask_rectangle.ypos",                  "8"                     },
-  { "mm_mask_rectangle.frames",                        "1"                     },
-
-  { "mm_mask_circle",                          "RocksMM.png"           },
-  { "mm_mask_circle.xpos",                     "0"                     },
-  { "mm_mask_circle.ypos",                     "8"                     },
-  { "mm_mask_circle.frames",                   "1"                     },
-
   { "[mm_default].exploding",                  "RocksMM.png"           },
   { "[mm_default].exploding.xpos",             "8"                     },
   { "[mm_default].exploding.ypos",             "4"                     },
index 07ebf934e92d01804b5ac6151de36a51b1fdba1a..f600993f4dfc0d4b9e4d607316ec988e2935b8cf 100644 (file)
@@ -43,9 +43,6 @@
 #define EL_MM_RUNTIME_START_NATIVE     500
 #define EL_MM_RUNTIME_END_NATIVE       504
 
-#define EL_MM_DUMMY_START_NATIVE       700
-#define EL_MM_DUMMY_END_NATIVE         709
-
 // elements to be specially mapped
 #define EL_MM_EMPTY_NATIVE             0
 #define EL_DF_EMPTY_NATIVE             304
index 8e0ab22a65eb2db45ac750a068fb243e98aa5796..164f1e394b0139f92dba98aebab6f3167aa3fb05 100644 (file)
@@ -116,8 +116,22 @@ static DelayCounter pacman_delay = { PACMAN_MOVE_DELAY };
 static DelayCounter energy_delay = { ENERGY_DELAY };
 static DelayCounter overload_delay = { 0 };
 
+// element mask positions for scanning pixels of MM elements
+#define MM_MASK_MCDUFFIN_RIGHT 0
+#define MM_MASK_MCDUFFIN_UP    1
+#define MM_MASK_MCDUFFIN_LEFT  2
+#define MM_MASK_MCDUFFIN_DOWN  3
+#define MM_MASK_GRID_1         4
+#define MM_MASK_GRID_2         5
+#define MM_MASK_GRID_3         6
+#define MM_MASK_GRID_4         7
+#define MM_MASK_RECTANGLE      8
+#define MM_MASK_CIRCLE         9
+
+#define NUM_MM_MASKS           10
+
 // element masks for scanning pixels of MM elements
-static const char mm_masks[10][16][16 + 1] =
+static const char mm_masks[NUM_MM_MASKS][16][16 + 1] =
 {
   {
     "                ",
@@ -813,13 +827,13 @@ static boolean StepBehind(void)
 static int getMaskFromElement(int element)
 {
   if (IS_GRID(element))
-    return IMG_MM_MASK_GRID_1 + get_element_phase(element);
+    return MM_MASK_GRID_1 + get_element_phase(element);
   else if (IS_MCDUFFIN(element))
-    return IMG_MM_MASK_MCDUFFIN_RIGHT + get_element_phase(element);
+    return MM_MASK_MCDUFFIN_RIGHT + get_element_phase(element);
   else if (IS_RECTANGLE(element) || IS_DF_GRID(element))
-    return IMG_MM_MASK_RECTANGLE;
+    return MM_MASK_RECTANGLE;
   else
-    return IMG_MM_MASK_CIRCLE;
+    return MM_MASK_CIRCLE;
 }
 
 static int ScanPixel(void)
@@ -873,7 +887,7 @@ static int ScanPixel(void)
        }
        else
        {
-         int pos = getMaskFromElement(element) - IMG_MM_MASK_MCDUFFIN_RIGHT;
+         int pos = getMaskFromElement(element);
 
          pixel = (mm_masks[pos][dy / 2][dx / 2] == 'X' ? 1 : 0);
        }
index 29e68592c2fb966175d77c0f2360d600d0aa9776..2c12cfcca502bfd61601d8f4d37a37f7f5a2afeb 100644 (file)
@@ -662,18 +662,6 @@ extern int         num_element_info;
 #define EL_EXPLODING_OPAQUE    601
 #define EL_EXPLODING_TRANSP    602
 
-// dummy elements (never used as game elements, only used as graphics)
-#define EL_MM_MASK_MCDUFFIN_RIGHT      700
-#define EL_MM_MASK_MCDUFFIN_UP         701
-#define EL_MM_MASK_MCDUFFIN_LEFT       702
-#define EL_MM_MASK_MCDUFFIN_DOWN       703
-#define EL_MM_MASK_GRID_1              704
-#define EL_MM_MASK_GRID_2              705
-#define EL_MM_MASK_GRID_3              706
-#define EL_MM_MASK_GRID_4              707
-#define EL_MM_MASK_RECTANGE            708
-#define EL_MM_MASK_CIRCLE              709
-
 
 // game graphics:
 //       0 -  191: graphics from "MirrorScreen"
index b4369b74127571d7d943ddb08dda6deccbd1d058..c7291eae8cefd41f054de02d4aa6147dd9028123 100644 (file)
@@ -7022,56 +7022,6 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "-",
     "-"
   },
-  {
-    "mm_mask_mcduffin.right",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_mcduffin.up",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_mcduffin.left",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_mcduffin.down",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_1",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_2",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_3",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_4",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_rectangle",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_circle",
-    "-",
-    "-"
-  },
   {
     "[default]",
     "default",
index e062ed9fd2d0bd8837e4e7ef5962788108d3605a..de5e736dfa727a58eb29059aebf5b2c3ae7c7603 100644 (file)
 #define EL_MM_LIGHTBALL_RED            (EL_FIRST_DUMMY + 21)
 #define EL_MM_LIGHTBALL_BLUE           (EL_FIRST_DUMMY + 22)
 #define EL_MM_LIGHTBALL_YELLOW         (EL_FIRST_DUMMY + 23)
-#define EL_MM_MASK_MCDUFFIN_RIGHT      (EL_FIRST_DUMMY + 24)
-#define EL_MM_MASK_MCDUFFIN_UP         (EL_FIRST_DUMMY + 25)
-#define EL_MM_MASK_MCDUFFIN_LEFT       (EL_FIRST_DUMMY + 26)
-#define EL_MM_MASK_MCDUFFIN_DOWN       (EL_FIRST_DUMMY + 27)
-#define EL_MM_MASK_GRID_1              (EL_FIRST_DUMMY + 28)
-#define EL_MM_MASK_GRID_2              (EL_FIRST_DUMMY + 29)
-#define EL_MM_MASK_GRID_3              (EL_FIRST_DUMMY + 30)
-#define EL_MM_MASK_GRID_4              (EL_FIRST_DUMMY + 31)
-#define EL_MM_MASK_RECTANGLE           (EL_FIRST_DUMMY + 32)
-#define EL_MM_MASK_CIRCLE              (EL_FIRST_DUMMY + 33)
-#define EL_DEFAULT                     (EL_FIRST_DUMMY + 34)
-#define EL_BD_DEFAULT                  (EL_FIRST_DUMMY + 35)
-#define EL_SP_DEFAULT                  (EL_FIRST_DUMMY + 36)
-#define EL_SB_DEFAULT                  (EL_FIRST_DUMMY + 37)
-#define EL_MM_DEFAULT                  (EL_FIRST_DUMMY + 38)
-#define EL_GRAPHIC_1                   (EL_FIRST_DUMMY + 39)
-#define EL_GRAPHIC_2                   (EL_FIRST_DUMMY + 40)
-#define EL_GRAPHIC_3                   (EL_FIRST_DUMMY + 41)
-#define EL_GRAPHIC_4                   (EL_FIRST_DUMMY + 42)
-#define EL_GRAPHIC_5                   (EL_FIRST_DUMMY + 43)
-#define EL_GRAPHIC_6                   (EL_FIRST_DUMMY + 44)
-#define EL_GRAPHIC_7                   (EL_FIRST_DUMMY + 45)
-#define EL_GRAPHIC_8                   (EL_FIRST_DUMMY + 46)
-
-#define EL_MM_DUMMY_START              EL_MM_MASK_MCDUFFIN_RIGHT
-#define EL_MM_DUMMY_END                        EL_MM_MASK_CIRCLE
+#define EL_DEFAULT                     (EL_FIRST_DUMMY + 24)
+#define EL_BD_DEFAULT                  (EL_FIRST_DUMMY + 25)
+#define EL_SP_DEFAULT                  (EL_FIRST_DUMMY + 26)
+#define EL_SB_DEFAULT                  (EL_FIRST_DUMMY + 27)
+#define EL_MM_DEFAULT                  (EL_FIRST_DUMMY + 28)
+#define EL_GRAPHIC_1                   (EL_FIRST_DUMMY + 29)
+#define EL_GRAPHIC_2                   (EL_FIRST_DUMMY + 30)
+#define EL_GRAPHIC_3                   (EL_FIRST_DUMMY + 31)
+#define EL_GRAPHIC_4                   (EL_FIRST_DUMMY + 32)
+#define EL_GRAPHIC_5                   (EL_FIRST_DUMMY + 33)
+#define EL_GRAPHIC_6                   (EL_FIRST_DUMMY + 34)
+#define EL_GRAPHIC_7                   (EL_FIRST_DUMMY + 35)
+#define EL_GRAPHIC_8                   (EL_FIRST_DUMMY + 36)
 
 // internal elements (only used for internal purposes like copying)
-#define EL_FIRST_INTERNAL              (EL_FIRST_DUMMY + 47)
+#define EL_FIRST_INTERNAL              (EL_FIRST_DUMMY + 37)
 
 #define EL_INTERNAL_CLIPBOARD_CUSTOM   (EL_FIRST_INTERNAL + 0)
 #define EL_INTERNAL_CLIPBOARD_CHANGE   (EL_FIRST_INTERNAL + 1)
index 98e60731333f9add8584999855c3ee65459e3e1f..7f448fdfc25df57f38c753c924afafc00d0e2c90 100644 (file)
@@ -8205,10 +8205,6 @@ int map_element_RND_to_MM(int element_rnd)
          element_rnd <= EL_MM_RUNTIME_END ?
          EL_MM_RUNTIME_START_NATIVE + element_rnd - EL_MM_RUNTIME_START :
 
-         element_rnd >= EL_MM_DUMMY_START &&
-         element_rnd <= EL_MM_DUMMY_END ?
-         EL_MM_DUMMY_START_NATIVE + element_rnd - EL_MM_DUMMY_START :
-
          EL_MM_EMPTY_NATIVE);
 }
 
@@ -8234,10 +8230,6 @@ int map_element_MM_to_RND(int element_mm)
          element_mm <= EL_MM_RUNTIME_END_NATIVE ?
          EL_MM_RUNTIME_START + element_mm - EL_MM_RUNTIME_START_NATIVE :
 
-         element_mm >= EL_MM_DUMMY_START_NATIVE &&
-         element_mm <= EL_MM_DUMMY_END_NATIVE ?
-         EL_MM_DUMMY_START + element_mm - EL_MM_DUMMY_START_NATIVE :
-
          EL_EMPTY);
 }