fixed broken BD player pushing animation when pushing an element
authorHolger Schemel <holger.schemel@virtion.de>
Sun, 22 Sep 2024 19:23:25 +0000 (21:23 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Sun, 22 Sep 2024 19:23:42 +0000 (21:23 +0200)
src/game_bd/bd_cave.h
src/game_bd/bd_cavedb.c
src/game_bd/bd_graphics.c

index 50c28ff283b79ec9f4d698c9fcc3470ff97cf5f7..42a31d3a114abc18e5f77d6cc44c7f2963288341 100644 (file)
@@ -120,6 +120,7 @@ enum _element_property_enum
   E_P_VISUAL_EFFECT,            // if the element can use a visual effect.
                                // used to check consistency of the code
   E_P_PLAYER,                   // easier to find out if it is a player element
+  E_P_PLAYER_PUSHING,           // player pushing some element
   E_P_PLAYER_STIRRING,          // player stirring the pot
   E_P_MOVED_BY_CONVEYOR_TOP,    // can be moved by conveyor belt
   E_P_MOVED_BY_CONVEYOR_BOTTOM, // can be moved UNDER the conveyor belt
@@ -165,6 +166,7 @@ enum _element_property_enum
 #define P_CAN_BE_HAMMERED              (1 << E_P_CAN_BE_HAMMERED)
 #define P_VISUAL_EFFECT                        (1 << E_P_VISUAL_EFFECT)
 #define P_PLAYER                       (1 << E_P_PLAYER)
+#define P_PLAYER_PUSHING               (1 << E_P_PLAYER_PUSHING)
 #define P_PLAYER_STIRRING              (1 << E_P_PLAYER_STIRRING)
 #define P_MOVED_BY_CONVEYOR_TOP                (1 << E_P_MOVED_BY_CONVEYOR_TOP)
 #define P_MOVED_BY_CONVEYOR_BOTTOM     (1 << E_P_MOVED_BY_CONVEYOR_BOTTOM)
index 1582128238b87624b2c7c4c4bed7aa6479c1defc..1fd326ab270bc06d39e4dc55a58772da33e0bf28 100644 (file)
@@ -1770,12 +1770,12 @@ GdElementProperty gd_element_properties[] =
   },
   {
     O_PLAYER_PUSH_LEFT, O_PLAYER_PUSH_LEFT, N_("Player, pushing left"),
-    P_PLAYER,
+    P_PLAYER | P_PLAYER_PUSHING,
     NULL, 0, 392, -392, -392
   },
   {
     O_PLAYER_PUSH_RIGHT, O_PLAYER_PUSH_RIGHT, N_("Player, pushing right"),
-    P_PLAYER,
+    P_PLAYER | P_PLAYER_PUSHING,
     NULL, 0, 400, -400, -400
   },
   {
index cc7a7bd704c7267c58528ad6a870fb4011c179f6..bfa5b9ad6da785ed032e55a6410ce605fe49acd8 100644 (file)
@@ -554,6 +554,12 @@ static inline boolean el_player(const int element)
   return has_property(element, P_PLAYER);
 }
 
+// returns true if the element is a player who is pushing some element
+static inline boolean el_player_pushing(const int element)
+{
+  return has_property(element, P_PLAYER_PUSHING);
+}
+
 #if 0
 // returns true if the element is walkable
 static inline boolean el_walkable(const int element)
@@ -707,7 +713,7 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d
     }
 
     // player killed by lava or explosion was standing still before moving into lava or enemy
-    if (el_player(tile_from))
+    if (el_player(tile_from) && !el_player_pushing(draw_from))
       draw_from = (dir_from == GD_MV_LEFT  ? O_PLAYER_LEFT  :
                    dir_from == GD_MV_RIGHT ? O_PLAYER_RIGHT :
                    dir_from == GD_MV_UP    ? O_PLAYER_UP    :