From c832c896d038244ace055b19bc46747a9665fe94 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 22 Sep 2024 20:31:57 +0200 Subject: [PATCH] fixed using BD player pushing animation while stirring the pot --- src/game_bd/bd_cave.c | 5 +++-- src/game_bd/bd_cave.h | 2 ++ src/game_bd/bd_cavedb.c | 2 +- src/game_bd/bd_caveengine.c | 6 ++++++ src/game_bd/bd_caveengine.h | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index cdd82f19..fe8ab447 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -1625,10 +1625,11 @@ void gd_drawcave_game(const GdCave *cave, draw = elemdrawing[actual]; } - // draw special graphics if player is pushing something + // 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) && - is_player(cave, x, y) && can_be_pushed(cave, x, y, cave->last_direction)) + is_player(cave, x, y) && can_be_pushed(cave, x, y, cave->last_direction) && + !is_player_stirring(cave, x, y)) { // special check needed when smooth game element movements selected in setup menu: // last element must either be player (before pushing) or pushable element (while pushing) diff --git a/src/game_bd/bd_cave.h b/src/game_bd/bd_cave.h index e3495ce1..50c28ff2 100644 --- a/src/game_bd/bd_cave.h +++ b/src/game_bd/bd_cave.h @@ -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_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 @@ -164,6 +165,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_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) diff --git a/src/game_bd/bd_cavedb.c b/src/game_bd/bd_cavedb.c index 87347c45..15821282 100644 --- a/src/game_bd/bd_cavedb.c +++ b/src/game_bd/bd_cavedb.c @@ -1279,7 +1279,7 @@ GdElementProperty gd_element_properties[] = }, // is not a real player! so active x, y will not find it. no P_PLAYER bit! { O_PLAYER_STIRRING, O_PLAYER_STIRRING, N_("Player stirring"), - P_BLOWS_UP_FLIES | P_EXPLODES_BY_HIT | P_PLAYER, + P_BLOWS_UP_FLIES | P_EXPLODES_BY_HIT | P_PLAYER | P_PLAYER_STIRRING, "GUYSTIRRING", 0, 256, -256, -256 }, diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 42f3b3eb..69c98678 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -493,6 +493,12 @@ boolean is_player(const GdCave *cave, const int x, const int y) return has_property(get(cave, x, y), P_PLAYER); } +// returns true if the element is a player stirring the pot +boolean is_player_stirring(const GdCave *cave, const int x, const int y) +{ + return has_property(get(cave, x, y), P_PLAYER_STIRRING); +} + // returns true if the element is a player (normal player, player glued, player with bomb) (+ dir) static inline boolean is_player_dir(const GdCave *cave, const int x, const int y, const GdDirection dir) diff --git a/src/game_bd/bd_caveengine.h b/src/game_bd/bd_caveengine.h index 81dcfc77..c1e91bf3 100644 --- a/src/game_bd/bd_caveengine.h +++ b/src/game_bd/bd_caveengine.h @@ -25,6 +25,7 @@ boolean is_scanned_element(GdElement e); GdElement scanned_pair(GdElement of_what); GdElement non_scanned_pair(GdElement of_what); boolean is_player(const GdCave *cave, const int x, const int y); +boolean is_player_stirring(const GdCave *cave, const int x, const int y); boolean can_be_pushed(const GdCave *cave, const int x, const int y, const GdDirection dir); GdDirection gd_direction_from_keypress(boolean up, boolean down, boolean left, boolean right); void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, boolean suicide); -- 2.34.1