added crumbled graphics support for more BD style game elements
authorHolger Schemel <holger.schemel@virtion.de>
Tue, 17 Dec 2024 18:09:12 +0000 (19:09 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Tue, 17 Dec 2024 13:12:13 +0000 (14:12 +0100)
- bdx_sand_sloped_up_left
- bdx_sand_sloped_up_right
- bdx_sand_sloped_down_left
- bdx_sand_sloped_down_right

src/conf_gfx.c
src/game_bd/bd_cavedb.c
src/game_bd/bd_elements.h
src/game_bd/bd_graphics.c
src/tools.c

index befdea0261f95c409db6606a763e1e7be14b0c01..ee37b0e637e9078722f1095071385908b36d3862 100644 (file)
@@ -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"                      },
index 76b7efe2b508fe95070462f4c4c1962a87f4b50f..8ee0eddfafb8c585021b1783ae24f00c78e0bacb 100644 (file)
@@ -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,
index bbb61e060d78f34ed93c24d05f10a31f4f13faf1..13cb0a4a76e68b6d8ce460244381b4a94a2ef3f5 100644 (file)
@@ -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,
index d93ef96915e1e5aa95c0647fd67c49bfd40f68d3..8f96f9a52e42bf960333e6a9d24db2deaf25928a 100644 (file)
@@ -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);
index 6b8a53e1ff069ec26be836507204aff7423c9b89..749da0ebe3a2a17c43267e31cff7aaa40593ec1e 100644 (file)
@@ -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  ||