From: Holger Schemel Date: Tue, 11 Apr 2023 14:19:34 +0000 (+0200) Subject: added Deflektor style fixed mirror game elements to MM engine X-Git-Tag: 4.3.6.0~35 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7b347435;p=rocksndiamonds.git added Deflektor style fixed mirror game elements to MM engine --- diff --git a/graphics/gfx_classic/RocksDF.png b/graphics/gfx_classic/RocksDF.png index 7eb105be..3d881bab 100644 Binary files a/graphics/gfx_classic/RocksDF.png and b/graphics/gfx_classic/RocksDF.png differ diff --git a/src/conf_gfx.c b/src/conf_gfx.c index e2c7c350..67fc1807 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -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 }, diff --git a/src/editor.c b/src/editor.c index fc122b24..d7aa2122 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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, diff --git a/src/game_mm/export.h b/src/game_mm/export.h index 014f5deb..11ee7258 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -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 diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 87ee350c..be1bfad6 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -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)); diff --git a/src/game_mm/mm_main.h b/src/game_mm/mm_main.h index 40397e8a..96ff6f28 100644 --- a/src/game_mm/mm_main.h +++ b/src/game_mm/mm_main.h @@ -103,6 +103,8 @@ (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 diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index 48c99912..6a2067a4 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -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) || diff --git a/src/main.c b/src/main.c index 95de1f87..1767aff4 100644 --- a/src/main.c +++ b/src/main.c @@ -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 diff --git a/src/main.h b/src/main.h index 643d62bb..32c87752 100644 --- a/src/main.h +++ b/src/main.h @@ -1947,7 +1947,30 @@ #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 diff --git a/src/tools.c b/src/tools.c index fde8811d..e321f18c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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 :