From 1ecacd1d866912d304f7d9a626db29d6de427605 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 23 Sep 2024 20:28:57 +0200 Subject: [PATCH] fixed bug with drawing diagonal player movement in BD engine This fixes drawing a game element moving into the tile just left by the diagonally moving player (as described in the last commit). --- src/game_bd/bd_graphics.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/game_bd/bd_graphics.c b/src/game_bd/bd_graphics.c index 4c7c5cd6..021e7c15 100644 --- a/src/game_bd/bd_graphics.c +++ b/src/game_bd/bd_graphics.c @@ -681,10 +681,8 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d // if element is moving away from this tile, determine element that is moving if (is_moving_from) { - int dx = (dir_from == GD_MV_LEFT ? -1 : dir_from == GD_MV_RIGHT ? +1 : 0); - int dy = (dir_from == GD_MV_UP ? -1 : dir_from == GD_MV_DOWN ? +1 : 0); - int new_x = cave->getx(cave, x + dx, y + dy); - int new_y = cave->gety(cave, x + dx, y + dy); + int new_x = cave->getx(cave, x + dx_from, y + dy_from); + int new_y = cave->gety(cave, x + dx_from, y + dy_from); int new_dir_to = game->dir_buffer_to[new_y][new_x]; tile_from = game->element_buffer[new_y][new_x]; -- 2.34.1