From: Holger Schemel Date: Mon, 4 Nov 2024 20:10:35 +0000 (+0100) Subject: fixed pushing element from left side onto conveyor belt in BD engine X-Git-Tag: 4.4.0.0-test-4~85 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c1a2e3cc;p=rocksndiamonds.git fixed pushing element from left side onto conveyor belt in BD engine This prevents game elements that are pushed onto a conveyor belt from the left side to move two tiles at once. This is a result of the cave scan order (already pushed element moved another tile when conveyor belt is handled during scan of the next cave row). Although unlikely, this change affects the game engine and therefore may break existing caves (and will break existing replays that use this case). So far, this is the only change that affects the game engine that was made to fix weird behavior when using smooth movement animations. --- diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 97ce3fe9..107441d5 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -3680,8 +3680,12 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, int old_x = getx(cave, raw_x, raw_y); int old_y = gety(cave, raw_x, raw_y); - store_dir(cave, x, y, GD_MV_UP, O_SPACE); // place a space ... - store_dir(cave, old_x, old_y, move_dir, tile); // and move element. + // only move game element if not already moving in that direction + if (game_bd.game->dir_buffer_to[old_y][old_x] != move_dir) + { + store_dir(cave, x, y, GD_MV_UP, O_SPACE); // place a space ... + store_dir(cave, old_x, old_y, move_dir, tile); // and move element. + } } } @@ -3710,8 +3714,12 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, int old_x = getx(cave, raw_x, raw_y); int old_y = gety(cave, raw_x, raw_y); - store_dir(cave, x, y, GD_MV_DOWN, O_SPACE); // place a space ... - store_dir(cave, old_x, old_y, move_dir, tile); // and move element. + // only move game element if not already moving in that direction + if (game_bd.game->dir_buffer_to[old_y][old_x] != move_dir) + { + store_dir(cave, x, y, GD_MV_DOWN, O_SPACE); // place a space ... + store_dir(cave, old_x, old_y, move_dir, tile); // and move element. + } } } }