From 7cd6de7ff30ee0c3b4de934063e4b9ae7c00776b Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 24 Sep 2024 02:10:00 +0200 Subject: [PATCH] fixed smooth movement for elements passing through slime in BD engine --- src/game_bd/bd_caveengine.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 080046e6..e3cec549 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -3423,36 +3423,39 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, // space under the slime? elements may pass from top to bottom then. if (is_like_space(cave, x, y, grav)) { + int what_x = getx(cave, x + gd_dx[oppos], y + gd_dy[oppos]); + int what_y = gety(cave, x + gd_dx[oppos], y + gd_dy[oppos]); + if (get_dir(cave, x, y, oppos) == cave->slime_eats_1) { // output a falling xy under - store_dir(cave, x, y, grav, cave->slime_converts_1); + store_dir(cave, what_x, what_y, twice[grav], cave->slime_converts_1); store_dir(cave, x, y, oppos, O_SPACE); play_sound_of_element(cave, O_SLIME, x, y); } else if (get_dir(cave, x, y, oppos) == cave->slime_eats_2) { - store_dir(cave, x, y, grav, cave->slime_converts_2); + store_dir(cave, what_x, what_y, twice[grav], cave->slime_converts_2); store_dir(cave, x, y, oppos, O_SPACE); play_sound_of_element(cave, O_SLIME, x, y); } else if (get_dir(cave, x, y, oppos) == cave->slime_eats_3) { - store_dir(cave, x, y, grav, cave->slime_converts_3); + store_dir(cave, what_x, what_y, twice[grav], cave->slime_converts_3); store_dir(cave, x, y, oppos, O_SPACE); play_sound_of_element(cave, O_SLIME, x, y); } else if (get_dir(cave, x, y, oppos) == O_WAITING_STONE) { // waiting stones pass without awakening - store_dir(cave, x, y, grav, O_WAITING_STONE); + store_dir(cave, what_x, what_y, twice[grav], O_WAITING_STONE); store_dir(cave, x, y, oppos, O_SPACE); play_sound_of_element(cave, O_SLIME, x, y); } else if (get_dir(cave, x, y, oppos) == O_CHASING_STONE) { // chasing stones pass - store_dir(cave, x, y, grav, O_CHASING_STONE); + store_dir(cave, what_x, what_y, twice[grav], O_CHASING_STONE); store_dir(cave, x, y, oppos, O_SPACE); play_sound_of_element(cave, O_SLIME, x, y); } @@ -3462,23 +3465,26 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, // or space over the slime? elements may pass from bottom to up then. if (is_like_space(cave, x, y, oppos)) { + int what_x = getx(cave, x + gd_dx[grav], y + gd_dy[grav]); + int what_y = gety(cave, x + gd_dx[grav], y + gd_dy[grav]); + if (get_dir(cave, x, y, grav) == O_BLADDER) { // bladders move UP the slime store_dir(cave, x, y, grav, O_SPACE); - store_dir(cave, x, y, oppos, O_BLADDER_1); + store_dir(cave, what_x, what_y, twice[oppos], O_BLADDER_1); play_sound_of_element(cave, O_SLIME, x, y); } else if (get_dir(cave, x, y, grav) == O_FLYING_STONE) { store_dir(cave, x, y, grav, O_SPACE); - store_dir(cave, x, y, oppos, O_FLYING_STONE_F); + store_dir(cave, what_x, what_y, twice[oppos], O_FLYING_STONE_F); play_sound_of_element(cave, O_SLIME, x, y); } else if (get_dir(cave, x, y, grav) == O_FLYING_DIAMOND) { store_dir(cave, x, y, grav, O_SPACE); - store_dir(cave, x, y, oppos, O_FLYING_DIAMOND_F); + store_dir(cave, what_x, what_y, twice[oppos], O_FLYING_DIAMOND_F); play_sound_of_element(cave, O_SLIME, x, y); } } -- 2.34.1