added support for moving/pushing rock animations to BD engine
authorHolger Schemel <holger.schemel@virtion.de>
Sat, 5 Oct 2024 17:11:41 +0000 (19:11 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sat, 5 Oct 2024 17:11:43 +0000 (19:11 +0200)
src/game_bd/bd_cave.c
src/game_bd/bd_cave.h
src/game_bd/bd_cavedb.c
src/game_bd/bd_elements.h
src/game_bd/bd_gameplay.c
src/tools.c

index f85088fda5bdb0f8ec4c904c2e46852e244b81a1..7a579b4389330dc44b315d0178958cfb4a22cb9b 100644 (file)
@@ -1379,7 +1379,7 @@ static inline boolean el_pushable(const int element)
 void gd_drawcave_game(const GdCave *cave,
                      int **element_buffer, int **last_element_buffer,
                      int **drawing_buffer, int **last_drawing_buffer, int **gfx_buffer,
-                     int **covered_buffer,
+                     int **covered_buffer, int **dir_buffer_from, int **dir_buffer_to,
                      boolean bonus_life_flash, int animcycle, boolean hate_invisible_outbox)
 {
   static boolean player_blinking = FALSE;
@@ -1630,6 +1630,7 @@ void gd_drawcave_game(const GdCave *cave,
     for (x = cave->x1; x <= cave->x2; x++)
     {
       GdElement actual = cave->map[y][x];
+      int dir_to = dir_buffer_to[y][x];
 
       // if covered, real element is not important
       if (covered_buffer[y][x])
@@ -1643,6 +1644,24 @@ void gd_drawcave_game(const GdCave *cave,
        draw = elemdrawing[actual];
       }
 
+      // draw special graphics if element is moving
+      if (dir_to == GD_MV_LEFT || dir_to == GD_MV_RIGHT)
+      {
+        if (actual == O_STONE || actual == O_STONE_F)
+        {
+          if (dir_to == GD_MV_LEFT)
+          {
+           map = O_STONE_MOVE_LEFT;
+           draw = elemdrawing[O_STONE_MOVE_LEFT];
+          }
+          else
+          {
+           map = O_STONE_MOVE_RIGHT;
+           draw = elemdrawing[O_STONE_MOVE_RIGHT];
+          }
+        }
+      }
+
       // draw special graphics if player is pushing something (but not while stirring the pot)
       if (use_bd_pushing_graphics() &&
          (cave->last_direction == GD_MV_LEFT || cave->last_direction == GD_MV_RIGHT) &&
index 0c7300e7b62df1f1dea0d7a970668623872144b0..420775ba26ce276f137d377aeff89f4ce43f0b6a 100644 (file)
@@ -728,7 +728,7 @@ GdScheduling gd_scheduling_from_string(const char *str);
 void gd_drawcave_game(const GdCave *cave,
                      int **element_buffer, int **last_element_buffer,
                      int **drawing_buffer, int **last_drawing_buffer, int **gfx_buffer,
-                     int **covered_buffer,
+                     int **covered_buffer, int **dir_buffer_from, int **dir_buffer_to,
                      boolean bonus_life_flash, int animcycle, boolean hate_invisible_outbox);
 
 // function to copy a GdString
index 1e30fbb513fca696c47af3a992ee2cdb2c7b28d9..4290398b4404052d87bc205c1c82f36c18891c98 100644 (file)
@@ -1891,6 +1891,27 @@ GdElementProperty gd_element_properties[] =
     NULL, 0, 15, 15, 15
   },
 
+  {
+    O_STONE_MOVE_LEFT, O_STONE_MOVE_LEFT, N_("Stone, moved left"),
+    0,
+    NULL, 0, 1, 1, 1,
+  },
+  {
+    O_STONE_MOVE_RIGHT, O_STONE_MOVE_RIGHT, N_("Stone, moved right"),
+    0,
+    NULL, 0, 1, 1, 1,
+  },
+  {
+    O_STONE_PUSH_LEFT, O_STONE_PUSH_LEFT, N_("Stone, pushed left"),
+    0,
+    NULL, 0, 1, 1, 1,
+  },
+  {
+    O_STONE_PUSH_RIGHT, O_STONE_PUSH_RIGHT, N_("Stone, pushed right"),
+    0,
+    NULL, 0, 1, 1, 1,
+  },
+
   {
     O_QUESTION_MARK, O_QUESTION_MARK, NULL,
     0,
index ad594c46b0797ff2238301eaf8a8a362093ae9be..30a087655f2342dad8ed417c798abde2d532399a 100644 (file)
@@ -400,6 +400,11 @@ typedef enum _element
   O_BITER_SWITCH_3,
   O_BITER_SWITCH_4,
 
+  O_STONE_MOVE_LEFT,
+  O_STONE_MOVE_RIGHT,
+  O_STONE_PUSH_LEFT,
+  O_STONE_PUSH_RIGHT,
+
   O_QUESTION_MARK,
   O_EATABLE,
   O_DOWN_ARROW,
index 629e03620da17c6fcd295f93cdff9aecef01a3a2..eef5ddaeccc42c5f73472760e0ba012cc12b0788 100644 (file)
@@ -644,7 +644,7 @@ static GdGameState gd_game_main_int(GdGame *game, boolean allow_iterate, boolean
   if (game->element_buffer && game->drawing_buffer && game->gfx_buffer)
     gd_drawcave_game(game->cave, game->element_buffer, game->last_element_buffer,
                     game->drawing_buffer, game->last_drawing_buffer, game->gfx_buffer,
-                    game->covered_buffer,
+                    game->covered_buffer, game->dir_buffer_from, game->dir_buffer_to,
                     game->bonus_life_flash != 0, game->animcycle, setup.bd_show_invisible_outbox);
 
   game->state_counter = counter_next;
index 460bf148f821ac54025c02e4ca0e09b1bc772b0d..2b40ad417a0450ded757e2680b6b23fafc885a2e 100644 (file)
@@ -7892,6 +7892,22 @@ bd_object_mapping_list[] =
     O_BITER_SWITCH_4,                          FALSE,
     EL_BDX_BITER_SWITCH_4,                     -1, -1
   },
+  {
+    O_STONE_MOVE_LEFT,                         FALSE,
+    EL_BDX_ROCK,                               ACTION_MOVING, MV_BIT_LEFT
+  },
+  {
+    O_STONE_MOVE_RIGHT,                                FALSE,
+    EL_BDX_ROCK,                               ACTION_MOVING, MV_BIT_RIGHT
+  },
+  {
+    O_STONE_PUSH_LEFT,                         FALSE,
+    EL_BDX_ROCK,                               ACTION_PUSHING, MV_BIT_LEFT
+  },
+  {
+    O_STONE_PUSH_RIGHT,                                FALSE,
+    EL_BDX_ROCK,                               ACTION_PUSHING, MV_BIT_RIGHT
+  },
 
   {
     -1,                                                FALSE,