From: Holger Schemel Date: Thu, 5 Jan 2023 00:28:04 +0000 (+0100) Subject: removed unneeded mask element and graphic definitions from MM engine X-Git-Tag: 4.3.5.0~53 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=10f312b2236afd0bd063d1dab380064d8431a850;p=rocksndiamonds.git removed unneeded mask element and graphic definitions from MM engine 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). --- diff --git a/graphics/gfx_classic/RocksMM.png b/graphics/gfx_classic/RocksMM.png index b2b816ea..b5066c69 100644 Binary files a/graphics/gfx_classic/RocksMM.png and b/graphics/gfx_classic/RocksMM.png differ diff --git a/src/conf_gfx.c b/src/conf_gfx.c index b9cc9756..5b601e62 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -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" }, diff --git a/src/game_mm/export.h b/src/game_mm/export.h index 07ebf934..f600993f 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -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 diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 8e0ab22a..164f1e39 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -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); } diff --git a/src/game_mm/mm_main.h b/src/game_mm/mm_main.h index 29e68592..2c12cfcc 100644 --- a/src/game_mm/mm_main.h +++ b/src/game_mm/mm_main.h @@ -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" diff --git a/src/main.c b/src/main.c index b4369b74..c7291eae 100644 --- a/src/main.c +++ b/src/main.c @@ -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", diff --git a/src/main.h b/src/main.h index e062ed9f..de5e736d 100644 --- a/src/main.h +++ b/src/main.h @@ -2086,35 +2086,22 @@ #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) diff --git a/src/tools.c b/src/tools.c index 98e60731..7f448fdf 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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); }