From fd0ec980e5c4c22978545aa72a2b0b9da0944de7 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 6 Nov 2020 15:35:02 +0100 Subject: [PATCH] fixed graphical bugs if digging or collecting caused player relocation If digging or collecting (but not snapping!) certain tiles or elements causes the player to be relocated ("teleported"), the corresponding digging or collecting animation for this element will not be continued anymore (because the player does not move towards this tile anymore). To fix this problem, the digged or collected tile will be treated like being snapped (using a temporary run-time element) for this edge case. (The resulting engine behaviour is slightly different to the previous behaviour, but should not break too many levels as this case should be rather uncommon.) --- src/game.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/game.c b/src/game.c index 8b77ddef..c6a7ef73 100644 --- a/src/game.c +++ b/src/game.c @@ -13997,6 +13997,10 @@ static int DigField(struct PlayerInfo *player, CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_DIGS_X, player->index_bit, dig_side); + // if digging triggered player relocation, finish digging tile + if (mode == DF_DIG && (player->jx != jx || player->jy != jy)) + setFieldForSnapping(x, y, element, move_direction); + if (mode == DF_SNAP) { if (level.block_snap_field) @@ -14118,9 +14122,15 @@ static int DigField(struct PlayerInfo *player, PlayLevelSoundElementAction(x, y, element, ACTION_COLLECTING); if (is_player) + { CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_COLLECTS_X, player->index_bit, dig_side); + // if collecting triggered player relocation, finish collecting tile + if (mode == DF_DIG && (player->jx != jx || player->jy != jy)) + setFieldForSnapping(x, y, element, move_direction); + } + if (mode == DF_SNAP) { if (level.block_snap_field) -- 2.34.1