added Deflektor style fixed mirror game elements to MM engine
authorHolger Schemel <info@artsoft.org>
Tue, 11 Apr 2023 14:19:34 +0000 (16:19 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 11 Apr 2023 14:19:34 +0000 (16:19 +0200)
graphics/gfx_classic/RocksDF.png
src/conf_gfx.c
src/editor.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
src/tools.c

index 7eb105be566fcef0feb1eadfaeeba8a5eef29bb6..3d881babd8129d136d44cd45867a9f0713726203 100644 (file)
Binary files a/graphics/gfx_classic/RocksDF.png and b/graphics/gfx_classic/RocksDF.png differ
index e2c7c3504397288cd88b1d6007cafc1b4292ad9c..67fc180735f169d3126d98458508b3c4d3d583c8 100644 (file)
@@ -5787,6 +5787,71 @@ struct ConfigInfo image_config[] =
   { "df_mine.active.delay",                    "6"                     },
   { "df_mine.active.anim_mode",                        "pingpong"              },
 
+  { "df_mirror_fixed_1",                       "RocksDF.png"           },
+  { "df_mirror_fixed_1.xpos",                  "0"                     },
+  { "df_mirror_fixed_1.ypos",                  "10"                    },
+  { "df_mirror_fixed_1.frames",                        "1"                     },
+  { "df_mirror_fixed_2",                       "RocksDF.png"           },
+  { "df_mirror_fixed_2.xpos",                  "1"                     },
+  { "df_mirror_fixed_2.ypos",                  "10"                    },
+  { "df_mirror_fixed_2.frames",                        "1"                     },
+  { "df_mirror_fixed_3",                       "RocksDF.png"           },
+  { "df_mirror_fixed_3.xpos",                  "2"                     },
+  { "df_mirror_fixed_3.ypos",                  "10"                    },
+  { "df_mirror_fixed_3.frames",                        "1"                     },
+  { "df_mirror_fixed_4",                       "RocksDF.png"           },
+  { "df_mirror_fixed_4.xpos",                  "3"                     },
+  { "df_mirror_fixed_4.ypos",                  "10"                    },
+  { "df_mirror_fixed_4.frames",                        "1"                     },
+  { "df_mirror_fixed_5",                       "RocksDF.png"           },
+  { "df_mirror_fixed_5.xpos",                  "4"                     },
+  { "df_mirror_fixed_5.ypos",                  "10"                    },
+  { "df_mirror_fixed_5.frames",                        "1"                     },
+  { "df_mirror_fixed_6",                       "RocksDF.png"           },
+  { "df_mirror_fixed_6.xpos",                  "5"                     },
+  { "df_mirror_fixed_6.ypos",                  "10"                    },
+  { "df_mirror_fixed_6.frames",                        "1"                     },
+  { "df_mirror_fixed_7",                       "RocksDF.png"           },
+  { "df_mirror_fixed_7.xpos",                  "6"                     },
+  { "df_mirror_fixed_7.ypos",                  "10"                    },
+  { "df_mirror_fixed_7.frames",                        "1"                     },
+  { "df_mirror_fixed_8",                       "RocksDF.png"           },
+  { "df_mirror_fixed_8.xpos",                  "7"                     },
+  { "df_mirror_fixed_8.ypos",                  "10"                    },
+  { "df_mirror_fixed_8.frames",                        "1"                     },
+  { "df_mirror_fixed_9",                       "RocksDF.png"           },
+  { "df_mirror_fixed_9.xpos",                  "8"                     },
+  { "df_mirror_fixed_9.ypos",                  "10"                    },
+  { "df_mirror_fixed_9.frames",                        "1"                     },
+  { "df_mirror_fixed_10",                      "RocksDF.png"           },
+  { "df_mirror_fixed_10.xpos",                 "9"                     },
+  { "df_mirror_fixed_10.ypos",                 "10"                    },
+  { "df_mirror_fixed_10.frames",               "1"                     },
+  { "df_mirror_fixed_11",                      "RocksDF.png"           },
+  { "df_mirror_fixed_11.xpos",                 "10"                    },
+  { "df_mirror_fixed_11.ypos",                 "10"                    },
+  { "df_mirror_fixed_11.frames",               "1"                     },
+  { "df_mirror_fixed_12",                      "RocksDF.png"           },
+  { "df_mirror_fixed_12.xpos",                 "11"                    },
+  { "df_mirror_fixed_12.ypos",                 "10"                    },
+  { "df_mirror_fixed_12.frames",               "1"                     },
+  { "df_mirror_fixed_13",                      "RocksDF.png"           },
+  { "df_mirror_fixed_13.xpos",                 "12"                    },
+  { "df_mirror_fixed_13.ypos",                 "10"                    },
+  { "df_mirror_fixed_13.frames",               "1"                     },
+  { "df_mirror_fixed_14",                      "RocksDF.png"           },
+  { "df_mirror_fixed_14.xpos",                 "13"                    },
+  { "df_mirror_fixed_14.ypos",                 "10"                    },
+  { "df_mirror_fixed_14.frames",               "1"                     },
+  { "df_mirror_fixed_15",                      "RocksDF.png"           },
+  { "df_mirror_fixed_15.xpos",                 "14"                    },
+  { "df_mirror_fixed_15.ypos",                 "10"                    },
+  { "df_mirror_fixed_15.frames",               "1"                     },
+  { "df_mirror_fixed_16",                      "RocksDF.png"           },
+  { "df_mirror_fixed_16.xpos",                 "15"                    },
+  { "df_mirror_fixed_16.ypos",                 "10"                    },
+  { "df_mirror_fixed_16.frames",               "1"                     },
+
   // (these are only defined as elements to support ".PANEL" definitions)
   { "graphic_1",                               UNDEFINED_FILENAME      },
   { "graphic_2",                               UNDEFINED_FILENAME      },
index fc122b245a5e44ba39fb617ce8b1e79e32effd12..d7aa2122adf1aa99147053bbe166d2af76571c3e 100644 (file)
@@ -4697,8 +4697,8 @@ static int editor_el_deflektor[] =
 
   EL_DF_MIRROR_START,
   EL_DF_MIRROR_ROTATING_START,
+  EL_DF_MIRROR_FIXED_START,
   EL_DF_CELL,
-  EL_DF_MINE,
 
   EL_DF_FIBRE_OPTIC_RED_1,
   EL_DF_FIBRE_OPTIC_YELLOW_1,
@@ -4713,7 +4713,7 @@ static int editor_el_deflektor[] =
   EL_DF_STEEL_WALL,
   EL_DF_WOODEN_WALL,
   EL_DF_REFRACTOR,
-  EL_EMPTY
+  EL_DF_MINE
 };
 static int *editor_hl_deflektor_ptr = editor_hl_deflektor;
 static int *editor_el_deflektor_ptr = editor_el_deflektor;
@@ -11918,6 +11918,24 @@ static void SetElementIntelliDraw(int x, int y, int dx, int dy, int new_element,
        EL_DF_MIRROR_ROTATING_3,
        EL_DF_MIRROR_ROTATING_2
       },
+      {
+       EL_DF_MIRROR_FIXED_1,
+       EL_DF_MIRROR_FIXED_16,
+       EL_DF_MIRROR_FIXED_15,
+       EL_DF_MIRROR_FIXED_14,
+       EL_DF_MIRROR_FIXED_13,
+       EL_DF_MIRROR_FIXED_12,
+       EL_DF_MIRROR_FIXED_11,
+       EL_DF_MIRROR_FIXED_10,
+       EL_DF_MIRROR_FIXED_9,
+       EL_DF_MIRROR_FIXED_8,
+       EL_DF_MIRROR_FIXED_7,
+       EL_DF_MIRROR_FIXED_6,
+       EL_DF_MIRROR_FIXED_5,
+       EL_DF_MIRROR_FIXED_4,
+       EL_DF_MIRROR_FIXED_3,
+       EL_DF_MIRROR_FIXED_2
+      },
 
       {
        -1,
index 014f5deb6c869e7102689c7b18ac8162f11e5764..11ee725812ad71272b5b37bfe2f738f08c22a2f0 100644 (file)
@@ -42,6 +42,9 @@
 #define EL_MM_START_2_NATIVE           240
 #define EL_MM_END_2_NATIVE             430
 
+#define EL_MM_START_3_NATIVE           431
+#define EL_MM_END_3_NATIVE             446
+
 #define EL_MM_RUNTIME_START_NATIVE     500
 #define EL_MM_RUNTIME_END_NATIVE       504
 
index 87ee350cc78027170fcc03aaeeeae3a87bbddbda..be1bfad64051591d5fc725f781c1064269ef04b6 100644 (file)
@@ -1692,6 +1692,7 @@ static boolean HitElement(int element, int hit_mask)
       IS_POLAR_CROSS(element) ||
       IS_DF_MIRROR(element) ||
       IS_DF_MIRROR_AUTO(element) ||
+      IS_DF_MIRROR_FIXED(element) ||
       element == EL_PRISM ||
       element == EL_REFRACTOR)
   {
@@ -1710,7 +1711,8 @@ static boolean HitElement(int element, int hit_mask)
     if (IS_MIRROR(element) ||
        IS_MIRROR_FIXED(element) ||
        IS_DF_MIRROR(element) ||
-       IS_DF_MIRROR_AUTO(element))
+       IS_DF_MIRROR_AUTO(element) ||
+       IS_DF_MIRROR_FIXED(element))
       laser.current_angle = get_mirrored_angle(laser.current_angle,
                                               get_element_angle(element));
 
index 40397e8a7784347442b4722524193a4349f18959..96ff6f28247cc16018cce53c8a4f8388a425e4f3 100644 (file)
                                 (e) <= EL_DF_MIRROR_END)
 #define IS_DF_MIRROR_AUTO(e)   ((e) >= EL_DF_MIRROR_AUTO_START &&      \
                                 (e) <= EL_DF_MIRROR_AUTO_END)
+#define IS_DF_MIRROR_FIXED(e)  ((e) >= EL_DF_MIRROR_FIXED_START &&     \
+                                (e) <= EL_DF_MIRROR_FIXED_END)
 #define IS_LASER(e)            ((e) >= EL_LASER_START &&               \
                                 (e) <= EL_LASER_END)
 #define IS_RECEIVER(e)         ((e) >= EL_RECEIVER_START &&            \
@@ -585,7 +587,26 @@ extern int         num_element_info;
 #define EL_DF_WALL_STEEL       429
 #define EL_DF_WALL_WOOD                430
 
-#define EL_MM_END_2            430
+#define EL_DF_MIRROR_FIXED_START 431
+#define EL_DF_MIRROR_FIXED_00  (EL_DF_MIRROR_FIXED_START + 0)
+#define EL_DF_MIRROR_FIXED_01  (EL_DF_MIRROR_FIXED_START + 1)
+#define EL_DF_MIRROR_FIXED_02  (EL_DF_MIRROR_FIXED_START + 2)
+#define EL_DF_MIRROR_FIXED_03  (EL_DF_MIRROR_FIXED_START + 3)
+#define EL_DF_MIRROR_FIXED_04  (EL_DF_MIRROR_FIXED_START + 4)
+#define EL_DF_MIRROR_FIXED_05  (EL_DF_MIRROR_FIXED_START + 5)
+#define EL_DF_MIRROR_FIXED_06  (EL_DF_MIRROR_FIXED_START + 6)
+#define EL_DF_MIRROR_FIXED_07  (EL_DF_MIRROR_FIXED_START + 7)
+#define EL_DF_MIRROR_FIXED_08  (EL_DF_MIRROR_FIXED_START + 8)
+#define EL_DF_MIRROR_FIXED_09  (EL_DF_MIRROR_FIXED_START + 9)
+#define EL_DF_MIRROR_FIXED_10  (EL_DF_MIRROR_FIXED_START + 10)
+#define EL_DF_MIRROR_FIXED_11  (EL_DF_MIRROR_FIXED_START + 11)
+#define EL_DF_MIRROR_FIXED_12  (EL_DF_MIRROR_FIXED_START + 12)
+#define EL_DF_MIRROR_FIXED_13  (EL_DF_MIRROR_FIXED_START + 13)
+#define EL_DF_MIRROR_FIXED_14  (EL_DF_MIRROR_FIXED_START + 14)
+#define EL_DF_MIRROR_FIXED_15  (EL_DF_MIRROR_FIXED_START + 15)
+#define EL_DF_MIRROR_FIXED_END EL_DF_MIRROR_FIXED_15
+
+#define EL_MM_END_2            446
 #define EL_MM_END              EL_MM_END_2
 
 // "real" (and therefore drawable) runtime elements
index 48c99912b2a14a63bd6d1837300f2c34df76fe8c..6a2067a43204cf7dd7b3d8a84f2c83aea8b7be69 100644 (file)
@@ -1147,6 +1147,8 @@ int get_base_element(int element)
     return EL_DF_MIRROR_START;
   else if (IS_DF_MIRROR_AUTO(element))
     return EL_DF_MIRROR_AUTO_START;
+  else if (IS_DF_MIRROR_FIXED(element))
+    return EL_DF_MIRROR_FIXED_START;
   else if (IS_PACMAN(element))
     return EL_PACMAN_START;
   else if (IS_GRID_STEEL(element))
@@ -1190,7 +1192,8 @@ int get_num_elements(int element)
       IS_POLAR(element) ||
       IS_BEAMER(element) ||
       IS_DF_MIRROR(element) ||
-      IS_DF_MIRROR_AUTO(element))
+      IS_DF_MIRROR_AUTO(element) ||
+      IS_DF_MIRROR_FIXED(element))
     return 16;
   else if (IS_GRID_STEEL_FIXED(element) ||
           IS_GRID_WOOD_FIXED(element) ||
index 95de1f87afde36118f92a3c33c3cc371eacf7447..1767aff4e71966dec5bd6177d59c67457ee5d32b 100644 (file)
@@ -6360,6 +6360,86 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "empty_space",
     "empty space 16"
   },
+  {
+    "df_mirror_fixed_1",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (0\xb0)"
+  },
+  {
+    "df_mirror_fixed_2",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (11.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_3",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (22.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_4",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (33.75\xb0)"
+  },
+  {
+    "df_mirror_fixed_5",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (45\xb0)"
+  },
+  {
+    "df_mirror_fixed_6",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (56.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_7",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (67.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_8",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (78.75\xb0)"
+  },
+  {
+    "df_mirror_fixed_9",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (90\xb0)"
+  },
+  {
+    "df_mirror_fixed_10",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (101.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_11",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (112.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_12",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (123.75\xb0)"
+  },
+  {
+    "df_mirror_fixed_13",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (135\xb0)"
+  },
+  {
+    "df_mirror_fixed_14",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (146.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_15",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (157.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_16",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (168.75\xb0)"
+  },
 
   // --------------------------------------------------------------------------
   // "real" (and therefore drawable) runtime elements
index 643d62bb8673e8c88555712a5d05b043083ccd8a..32c877527c9713642bb246ffa86b2a137c73ee50 100644 (file)
 #define EL_EMPTY_SPACE_END             1232
 // ---------- end of empty space elements section -----------------------------
 
-#define NUM_FILE_ELEMENTS              1233
+#define EL_MM_START_3                  EL_DF_MIRROR_FIXED_START
+
+#define EL_DF_MIRROR_FIXED_START       1233
+#define EL_DF_MIRROR_FIXED_1           (EL_DF_MIRROR_FIXED_START + 0)
+#define EL_DF_MIRROR_FIXED_2           (EL_DF_MIRROR_FIXED_START + 1)
+#define EL_DF_MIRROR_FIXED_3           (EL_DF_MIRROR_FIXED_START + 2)
+#define EL_DF_MIRROR_FIXED_4           (EL_DF_MIRROR_FIXED_START + 3)
+#define EL_DF_MIRROR_FIXED_5           (EL_DF_MIRROR_FIXED_START + 4)
+#define EL_DF_MIRROR_FIXED_6           (EL_DF_MIRROR_FIXED_START + 5)
+#define EL_DF_MIRROR_FIXED_7           (EL_DF_MIRROR_FIXED_START + 6)
+#define EL_DF_MIRROR_FIXED_8           (EL_DF_MIRROR_FIXED_START + 7)
+#define EL_DF_MIRROR_FIXED_9           (EL_DF_MIRROR_FIXED_START + 8)
+#define EL_DF_MIRROR_FIXED_10          (EL_DF_MIRROR_FIXED_START + 9)
+#define EL_DF_MIRROR_FIXED_11          (EL_DF_MIRROR_FIXED_START + 10)
+#define EL_DF_MIRROR_FIXED_12          (EL_DF_MIRROR_FIXED_START + 11)
+#define EL_DF_MIRROR_FIXED_13          (EL_DF_MIRROR_FIXED_START + 12)
+#define EL_DF_MIRROR_FIXED_14          (EL_DF_MIRROR_FIXED_START + 13)
+#define EL_DF_MIRROR_FIXED_15          (EL_DF_MIRROR_FIXED_START + 14)
+#define EL_DF_MIRROR_FIXED_16          (EL_DF_MIRROR_FIXED_START + 15)
+#define EL_DF_MIRROR_FIXED_END         EL_DF_MIRROR_FIXED_16
+
+#define EL_MM_END_3                    EL_DF_MIRROR_FIXED_END
+
+#define NUM_FILE_ELEMENTS              1249
 
 
 // "real" (and therefore drawable) runtime elements
index fde8811da0c225e52a1d88bfb932d3a2a00ae6ea..e321f18c513a81dc3008e0e0cc87ed5581a285b4 100644 (file)
@@ -8228,6 +8228,10 @@ int map_element_RND_to_MM(int element_rnd)
          element_rnd <= EL_MM_END_2 ?
          EL_MM_START_2_NATIVE + element_rnd - EL_MM_START_2 :
 
+         element_rnd >= EL_MM_START_3 &&
+         element_rnd <= EL_MM_END_3 ?
+         EL_MM_START_3_NATIVE + element_rnd - EL_MM_START_3 :
+
          element_rnd >= EL_CHAR_START &&
          element_rnd <= EL_CHAR_END ?
          EL_MM_CHAR_START_NATIVE + element_rnd - EL_CHAR_START :
@@ -8253,6 +8257,10 @@ int map_element_MM_to_RND(int element_mm)
          element_mm <= EL_MM_END_2_NATIVE ?
          EL_MM_START_2 + element_mm - EL_MM_START_2_NATIVE :
 
+         element_mm >= EL_MM_START_3_NATIVE &&
+         element_mm <= EL_MM_END_3_NATIVE ?
+         EL_MM_START_3 + element_mm - EL_MM_START_3_NATIVE :
+
          element_mm >= EL_MM_CHAR_START_NATIVE &&
          element_mm <= EL_MM_CHAR_END_NATIVE ?
          EL_CHAR_START + element_mm - EL_MM_CHAR_START_NATIVE :