From: Holger Schemel Date: Fri, 6 Nov 2020 14:35:02 +0000 (+0100) Subject: fixed graphical bugs if digging or collecting caused player relocation X-Git-Tag: 4.2.0.4^0 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=fd0ec980;p=rocksndiamonds.git 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.) --- 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)