From: Holger Schemel Date: Mon, 23 Sep 2024 18:28:57 +0000 (+0200) Subject: fixed bug with drawing diagonal player movement in BD engine X-Git-Tag: 4.4.0.0-test-4~201 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1ecacd1d866912d304f7d9a626db29d6de427605;p=rocksndiamonds.git 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). --- 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];