From: Holger Schemel Date: Tue, 17 Dec 2024 18:09:12 +0000 (+0100) Subject: added crumbled graphics support for more BD style game elements X-Git-Tag: 4.4.0.0~11 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=3e1da6a5a6461670e0768a68a8b21cccb84f73c6;p=rocksndiamonds.git added crumbled graphics support for more BD style game elements - bdx_sand_sloped_up_left - bdx_sand_sloped_up_right - bdx_sand_sloped_down_left - bdx_sand_sloped_down_right --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index befdea02..ee37b0e6 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -660,18 +660,26 @@ struct ConfigInfo image_config[] = { "bdx_sand_sloped_up_left.xpos", "8" }, { "bdx_sand_sloped_up_left.ypos", "5" }, { "bdx_sand_sloped_up_left.frames", "1" }, + { "bdx_sand_sloped_up_left.CRUMBLED", UNDEFINED_FILENAME }, + { "bdx_sand_sloped_up_left.CRUMBLED.clone_from", "bdx_sand.CRUMBLED" }, { "bdx_sand_sloped_up_right", "RocksBD.png" }, { "bdx_sand_sloped_up_right.xpos", "9" }, { "bdx_sand_sloped_up_right.ypos", "5" }, { "bdx_sand_sloped_up_right.frames", "1" }, + { "bdx_sand_sloped_up_right.CRUMBLED", UNDEFINED_FILENAME }, + { "bdx_sand_sloped_up_right.CRUMBLED.clone_from", "bdx_sand.CRUMBLED" }, { "bdx_sand_sloped_down_left", "RocksBD.png" }, { "bdx_sand_sloped_down_left.xpos", "10" }, { "bdx_sand_sloped_down_left.ypos", "5" }, { "bdx_sand_sloped_down_left.frames", "1" }, + { "bdx_sand_sloped_down_left.CRUMBLED", UNDEFINED_FILENAME }, + { "bdx_sand_sloped_down_left.CRUMBLED.clone_from", "bdx_sand.CRUMBLED" }, { "bdx_sand_sloped_down_right", "RocksBD.png" }, { "bdx_sand_sloped_down_right.xpos", "11" }, { "bdx_sand_sloped_down_right.ypos", "5" }, { "bdx_sand_sloped_down_right.frames", "1" }, + { "bdx_sand_sloped_down_right.CRUMBLED", UNDEFINED_FILENAME }, + { "bdx_sand_sloped_down_right.CRUMBLED.clone_from", "bdx_sand.CRUMBLED" }, { "bdx_sand_glued", UNDEFINED_FILENAME }, { "bdx_sand_glued.clone_from", "bdx_sand" }, diff --git a/src/game_bd/bd_cavedb.c b/src/game_bd/bd_cavedb.c index 76b7efe2..8ee0eddf 100644 --- a/src/game_bd/bd_cavedb.c +++ b/src/game_bd/bd_cavedb.c @@ -194,6 +194,26 @@ GdElementProperty gd_element_properties[] = P_DIRT | P_SLOPED_DOWN | P_SLOPED_RIGHT | P_AMOEBA_CONSUMES | P_DIGGABLE, "DIRTSLOPEDDOWNRIGHT", 0, 283, 283, 283 }, + { + O_DIRT_SLOPED_UP_RIGHT_CRUMBLED, O_DIRT_SLOPED_UP_RIGHT_CRUMBLED, N_("Sloped dirt (up & right, crumbled)"), + P_DIRT | P_SLOPED_UP | P_SLOPED_RIGHT | P_AMOEBA_CONSUMES | P_DIGGABLE, + "DIRTSLOPEDUPRIGHT_CRUMBLED", 0, 280, 280, 280 + }, + { + O_DIRT_SLOPED_UP_LEFT_CRUMBLED, O_DIRT_SLOPED_UP_LEFT_CRUMBLED, N_("Sloped dirt (up & left, crumbled)"), + P_DIRT | P_SLOPED_UP | P_SLOPED_LEFT | P_AMOEBA_CONSUMES | P_DIGGABLE, + "DIRTSLOPEDUPLEFT_CRUMBLED", 0, 281, 281, 281 + }, + { + O_DIRT_SLOPED_DOWN_LEFT_CRUMBLED, O_DIRT_SLOPED_DOWN_LEFT_CRUMBLED, N_("Sloped dirt (down & left, crumbled)"), + P_DIRT | P_SLOPED_DOWN | P_SLOPED_LEFT | P_AMOEBA_CONSUMES | P_DIGGABLE, + "DIRTSLOPEDDOWNLEFT_CRUMBLED", 0, 282, 282, 282 + }, + { + O_DIRT_SLOPED_DOWN_RIGHT_CRUMBLED, O_DIRT_SLOPED_DOWN_RIGHT_CRUMBLED, N_("Sloped dirt (down & right, crumbled)"), + P_DIRT | P_SLOPED_DOWN | P_SLOPED_RIGHT | P_AMOEBA_CONSUMES | P_DIGGABLE, + "DIRTSLOPEDDOWNRIGHT_CRUMBLED", 0, 283, 283, 283 + }, { O_DIRT_BALL, O_DIRT_BALL_scanned, N_("Dirt ball"), P_DIRT | P_SLOPED | P_AMOEBA_CONSUMES | P_MOVED_BY_CONVEYOR_TOP | P_DIGGABLE | P_CAN_FALL, diff --git a/src/game_bd/bd_elements.h b/src/game_bd/bd_elements.h index bbb61e06..13cb0a4a 100644 --- a/src/game_bd/bd_elements.h +++ b/src/game_bd/bd_elements.h @@ -39,6 +39,10 @@ typedef enum _element O_DIRT_SLOPED_UP_LEFT, O_DIRT_SLOPED_DOWN_LEFT, O_DIRT_SLOPED_DOWN_RIGHT, + O_DIRT_SLOPED_UP_RIGHT_CRUMBLED, + O_DIRT_SLOPED_UP_LEFT_CRUMBLED, + O_DIRT_SLOPED_DOWN_LEFT_CRUMBLED, + O_DIRT_SLOPED_DOWN_RIGHT_CRUMBLED, O_DIRT_BALL, O_DIRT_BALL_scanned, O_DIRT_BALL_F, diff --git a/src/game_bd/bd_graphics.c b/src/game_bd/bd_graphics.c index d93ef969..8f96f9a5 100644 --- a/src/game_bd/bd_graphics.c +++ b/src/game_bd/bd_graphics.c @@ -509,13 +509,17 @@ static inline boolean el_can_dig(const int element) static inline boolean el_has_crumbled(const int element) { int tile_gfx = element; - int tile_crm = (element == O_DIRT ? O_DIRT_CRUMBLED : - element == O_DIRT2 ? O_DIRT2_CRUMBLED : - element == O_DIRT_GLUED ? O_DIRT_GLUED_CRUMBLED : - element == O_BITER_SWITCH_1 ? O_BITER_SWITCH_1_CRUMBLED : - element == O_BITER_SWITCH_2 ? O_BITER_SWITCH_2_CRUMBLED : - element == O_BITER_SWITCH_3 ? O_BITER_SWITCH_3_CRUMBLED : - element == O_BITER_SWITCH_4 ? O_BITER_SWITCH_4_CRUMBLED : + int tile_crm = (element == O_DIRT ? O_DIRT_CRUMBLED : + element == O_DIRT2 ? O_DIRT2_CRUMBLED : + element == O_DIRT_GLUED ? O_DIRT_GLUED_CRUMBLED : + element == O_DIRT_SLOPED_UP_RIGHT ? O_DIRT_SLOPED_UP_RIGHT_CRUMBLED : + element == O_DIRT_SLOPED_UP_LEFT ? O_DIRT_SLOPED_UP_LEFT_CRUMBLED : + element == O_DIRT_SLOPED_DOWN_LEFT ? O_DIRT_SLOPED_DOWN_LEFT_CRUMBLED : + element == O_DIRT_SLOPED_DOWN_RIGHT ? O_DIRT_SLOPED_DOWN_RIGHT_CRUMBLED : + element == O_BITER_SWITCH_1 ? O_BITER_SWITCH_1_CRUMBLED : + element == O_BITER_SWITCH_2 ? O_BITER_SWITCH_2_CRUMBLED : + element == O_BITER_SWITCH_3 ? O_BITER_SWITCH_3_CRUMBLED : + element == O_BITER_SWITCH_4 ? O_BITER_SWITCH_4_CRUMBLED : element); struct GraphicInfo_BD *gfx = &graphic_info_bd_object[tile_gfx][0]; struct GraphicInfo_BD *crm = &graphic_info_bd_object[tile_crm][0]; @@ -594,6 +598,18 @@ static int get_dirt_element(int element, int dir, boolean crumbled) case O_DIRT_GLUED: return (crumbled ? O_DIRT_GLUED_CRUMBLED : O_DIRT_GLUED); + case O_DIRT_SLOPED_UP_RIGHT: + return (crumbled ? O_DIRT_SLOPED_UP_RIGHT_CRUMBLED : O_DIRT_SLOPED_UP_RIGHT); + + case O_DIRT_SLOPED_UP_LEFT: + return (crumbled ? O_DIRT_SLOPED_UP_LEFT_CRUMBLED : O_DIRT_SLOPED_UP_LEFT); + + case O_DIRT_SLOPED_DOWN_LEFT: + return (crumbled ? O_DIRT_SLOPED_DOWN_LEFT_CRUMBLED : O_DIRT_SLOPED_DOWN_LEFT); + + case O_DIRT_SLOPED_DOWN_RIGHT: + return (crumbled ? O_DIRT_SLOPED_DOWN_RIGHT_CRUMBLED : O_DIRT_SLOPED_DOWN_RIGHT); + case O_BITER_SWITCH_1: return (crumbled ? O_BITER_SWITCH_1_CRUMBLED : O_BITER_SWITCH_1); @@ -665,6 +681,17 @@ static void gd_drawcave_crumbled(Bitmap *dest, GdGame *game, int x, int y, boole boolean draw_normal = ((el_has_crumbled(draw)) || (el_has_crumbled(draw_last) && is_moving_to)); + // special case: handle sloped sand sides separately + if ((dir == GD_MV_UP && (draw == O_DIRT_SLOPED_DOWN_LEFT || + draw == O_DIRT_SLOPED_DOWN_RIGHT)) || + (dir == GD_MV_DOWN && (draw == O_DIRT_SLOPED_UP_LEFT || + draw == O_DIRT_SLOPED_UP_RIGHT)) || + (dir == GD_MV_LEFT && (draw == O_DIRT_SLOPED_UP_RIGHT || + draw == O_DIRT_SLOPED_DOWN_RIGHT)) || + (dir == GD_MV_RIGHT && (draw == O_DIRT_SLOPED_UP_LEFT || + draw == O_DIRT_SLOPED_DOWN_LEFT))) + draw_normal = FALSE; + if (draw_normal) blit_bitmap(gfx->bitmap, dest, gfx->src_x + xoffset, gfx->src_y + yoffset, xsize, ysize, sx + xoffset, sy + yoffset); diff --git a/src/tools.c b/src/tools.c index 6b8a53e1..749da0eb 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6184,6 +6184,22 @@ bd_object_mapping_list[] = O_DIRT_SLOPED_DOWN_RIGHT, TRUE, EL_BDX_SAND_SLOPED_DOWN_RIGHT, -1, -1 }, + { + O_DIRT_SLOPED_UP_RIGHT_CRUMBLED, FALSE, + EL_BDX_SAND_SLOPED_UP_RIGHT, -1, -1 + }, + { + O_DIRT_SLOPED_UP_LEFT_CRUMBLED, FALSE, + EL_BDX_SAND_SLOPED_UP_LEFT, -1, -1 + }, + { + O_DIRT_SLOPED_DOWN_LEFT_CRUMBLED, FALSE, + EL_BDX_SAND_SLOPED_DOWN_LEFT, -1, -1 + }, + { + O_DIRT_SLOPED_DOWN_RIGHT_CRUMBLED, FALSE, + EL_BDX_SAND_SLOPED_DOWN_RIGHT, -1, -1 + }, { O_DIRT_BALL, TRUE, EL_BDX_GRASS_BALL, -1, -1 @@ -11248,13 +11264,17 @@ void InitGraphicInfo_BD(void) { int effective_element = element; int effective_action = action; - int graphic = (i == O_DIRT_CRUMBLED || - i == O_DIRT2_CRUMBLED || - i == O_DIRT_GLUED_CRUMBLED || - i == O_BITER_SWITCH_1_CRUMBLED || - i == O_BITER_SWITCH_2_CRUMBLED || - i == O_BITER_SWITCH_3_CRUMBLED || - i == O_BITER_SWITCH_4_CRUMBLED ? + int graphic = (i == O_DIRT_CRUMBLED || + i == O_DIRT2_CRUMBLED || + i == O_DIRT_GLUED_CRUMBLED || + i == O_DIRT_SLOPED_UP_RIGHT_CRUMBLED || + i == O_DIRT_SLOPED_UP_LEFT_CRUMBLED || + i == O_DIRT_SLOPED_DOWN_LEFT_CRUMBLED || + i == O_DIRT_SLOPED_DOWN_RIGHT_CRUMBLED || + i == O_BITER_SWITCH_1_CRUMBLED || + i == O_BITER_SWITCH_2_CRUMBLED || + i == O_BITER_SWITCH_3_CRUMBLED || + i == O_BITER_SWITCH_4_CRUMBLED ? graphic = el_act2crm(effective_element, effective_action) : i == O_DIRT_DIGGING_LEFT_CRUMBLED || i == O_DIRT_DIGGING_RIGHT_CRUMBLED ||