From: Holger Schemel Date: Sat, 7 Jan 2023 17:04:41 +0000 (+0100) Subject: added active animation for bomb and mine in MM engine X-Git-Tag: 4.3.5.0~47 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=c2575609f053eab9617b11f2150e308904cab339 added active animation for bomb and mine in MM engine --- diff --git a/graphics/gfx_classic/RocksMM.png b/graphics/gfx_classic/RocksMM.png index 3fd82443..47d0add2 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 28a22318..b4789635 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5051,6 +5051,12 @@ struct ConfigInfo image_config[] = { "mm_bomb.xpos", "5" }, { "mm_bomb.ypos", "2" }, { "mm_bomb.frames", "1" }, + { "mm_bomb.active", "RocksMM.png" }, + { "mm_bomb.active.xpos", "12" }, + { "mm_bomb.active.ypos", "1" }, + { "mm_bomb.active.frames", "3" }, + { "mm_bomb.active.delay", "6" }, + { "mm_bomb.active.anim_mode", "pingpong" }, { "mm_prism", "RocksMM.png" }, { "mm_prism.xpos", "0" }, @@ -5747,6 +5753,12 @@ struct ConfigInfo image_config[] = { "df_mine.xpos", "4" }, { "df_mine.ypos", "8" }, { "df_mine.frames", "1" }, + { "df_mine.active", "RocksDF.png" }, + { "df_mine.active.xpos", "3" }, + { "df_mine.active.ypos", "8" }, + { "df_mine.active.frames", "3" }, + { "df_mine.active.delay", "6" }, + { "df_mine.active.anim_mode", "pingpong" }, // (these are only defined as elements to support ".PANEL" definitions) { "graphic_1", UNDEFINED_FILENAME }, diff --git a/src/game_mm/export.h b/src/game_mm/export.h index f600993f..f6994624 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -112,6 +112,9 @@ struct LaserInfo int fuse_x, fuse_y; int dest_element; + int dest_element_last; + int dest_element_last_x; + int dest_element_last_y; boolean stops_inside_element; boolean redraw; diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 85a9d409..e817b118 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -647,6 +647,9 @@ void InitGameEngine_MM(void) laser.fuse_x = laser.fuse_y = -1; laser.dest_element = EL_EMPTY; + laser.dest_element_last = EL_EMPTY; + laser.dest_element_last_x = -1; + laser.dest_element_last_y = -1; laser.wall_mask = 0; last_LX = 0; @@ -921,6 +924,21 @@ void ScanLaser(void) if (game_mm.game_over) return; + if (laser.dest_element_last == EL_BOMB_ACTIVE || + laser.dest_element_last == EL_MINE_ACTIVE) + { + int x = laser.dest_element_last_x; + int y = laser.dest_element_last_y; + int element = laser.dest_element_last; + + if (Tile[x][y] == element) + Tile[x][y] = (element == EL_BOMB_ACTIVE ? EL_BOMB : EL_MINE); + + laser.dest_element_last = EL_EMPTY; + laser.dest_element_last_x = -1; + laser.dest_element_last_y = -1; + } + laser.overloaded = FALSE; laser.stops_inside_element = FALSE; @@ -1559,6 +1577,12 @@ boolean HitElement(int element, int hit_mask) { PlayLevelSound_MM(ELX, ELY, element, MM_ACTION_HITTING); + Tile[ELX][ELY] = (element == EL_BOMB ? EL_BOMB_ACTIVE : EL_MINE_ACTIVE); + + laser.dest_element_last = Tile[ELX][ELY]; + laser.dest_element_last_x = ELX; + laser.dest_element_last_y = ELY; + if (element == EL_MINE) laser.overloaded = TRUE; } @@ -2518,7 +2542,7 @@ static void Explode_MM(int x, int y, int phase, int mode) Tile[x][y] = center_element; } - if (center_element == EL_BOMB || IS_MCDUFFIN(center_element)) + if (center_element == EL_BOMB_ACTIVE || IS_MCDUFFIN(center_element)) Store[x][y] = center_element; else Store[x][y] = EL_EMPTY; @@ -2550,7 +2574,7 @@ static void Explode_MM(int x, int y, int phase, int mode) if (phase == last_phase) { - if (Store[x][y] == EL_BOMB) + if (Store[x][y] == EL_BOMB_ACTIVE) { DrawLaser(0, DL_LASER_DISABLED); InitLaser(); @@ -2597,7 +2621,7 @@ static void Bang_MM(int x, int y) if (IS_PACMAN(element)) PlayLevelSound_MM(x, y, element, MM_ACTION_EXPLODING); - else if (element == EL_BOMB || IS_MCDUFFIN(element)) + else if (element == EL_BOMB_ACTIVE || IS_MCDUFFIN(element)) PlayLevelSound_MM(x, y, element, MM_ACTION_EXPLODING); else if (element == EL_KEY) PlayLevelSound_MM(x, y, element, MM_ACTION_EXPLODING); @@ -3199,7 +3223,9 @@ static void GameActions_MM_Ext(void) if (!laser.overloaded && laser.overload_value == 0 && element != EL_BOMB && + element != EL_BOMB_ACTIVE && element != EL_MINE && + element != EL_MINE_ACTIVE && element != EL_BALL_GRAY && element != EL_BLOCK_STONE && element != EL_BLOCK_WOOD && diff --git a/src/game_mm/mm_main.h b/src/game_mm/mm_main.h index 5d0718f5..0fb74d9e 100644 --- a/src/game_mm/mm_main.h +++ b/src/game_mm/mm_main.h @@ -653,6 +653,8 @@ extern int num_element_info; #define EL_GRAY_BALL_OPENING 502 #define EL_ICE_WALL_SHRINKING 503 #define EL_AMOEBA_WALL_GROWING 504 +#define EL_BOMB_ACTIVE 505 +#define EL_MINE_ACTIVE 506 #define EL_WALL_CHANGING 512 #define EL_WALL_CHANGING_START (EL_WALL_CHANGING + 0) diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index a8edba4e..d8dbe8be 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -526,6 +526,10 @@ void DrawElement_MM(int x, int y, int element) DrawGraphic_MM(x, y, IMG_MM_FUSE); else if (element == EL_GRAY_BALL_OPENING) DrawGraphic_MM(x, y, el_act2gfx(EL_BALL_GRAY, MM_ACTION_OPENING)); + else if (element == EL_BOMB_ACTIVE) + DrawGraphic_MM(x, y, el_act2gfx(EL_BOMB, MM_ACTION_ACTIVE)); + else if (element == EL_MINE_ACTIVE) + DrawGraphic_MM(x, y, el_act2gfx(EL_MINE, MM_ACTION_ACTIVE)); else DrawGraphic_MM(x, y, el2gfx(element)); } diff --git a/src/main.c b/src/main.c index c7291eae..13cab898 100644 --- a/src/main.c +++ b/src/main.c @@ -6772,6 +6772,16 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "mm_pacman", "pac man (eating down)" }, + { + "mm_bomb.active", + "mm_bomb", + "active bomb (MM style)" + }, + { + "df_mine.active", + "df_mine", + "active mine" + }, // -------------------------------------------------------------------------- // "unreal" (and therefore not drawable) runtime elements diff --git a/src/main.h b/src/main.h index de5e736d..5800f5ef 100644 --- a/src/main.h +++ b/src/main.h @@ -2023,8 +2023,10 @@ #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 EL_MM_BOMB_ACTIVE (EL_FIRST_RUNTIME_REAL + 81) +#define EL_DF_MINE_ACTIVE (EL_FIRST_RUNTIME_REAL + 82) -#define NUM_DRAWABLE_ELEMENTS (EL_FIRST_RUNTIME_REAL + 81) +#define NUM_DRAWABLE_ELEMENTS (EL_FIRST_RUNTIME_REAL + 83) #define EL_MM_RUNTIME_START EL_MM_EXIT_OPENING #define EL_MM_RUNTIME_END EL_MM_AMOEBA_WALL_GROWING