From aa7c878a41c7322c8156dac987776c9ee9b3a51c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 16 Sep 2024 19:51:22 +0200 Subject: [PATCH] changed BD engine to match new GDash code (falling walls) --- src/game_bd/bd_caveengine.c | 43 ++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index e059e17b..4f4ac8eb 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -3569,10 +3569,9 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, // try falling if space under. int yy; + // yy < y + cave->h is to check everything OVER the wall - since caves wrap around !! for (yy = y + 1; yy < y + cave->h; yy++) - // yy < y + cave->h is to check everything OVER the wall - since caves wrap around !! - if (get(cave, x, yy) != O_SPACE) - // stop cycle when other than space + if (!is_like_space(cave, x, yy, GD_MV_STILL)) // stop cycle when other than space break; // if scanning stopped by a player... start falling! @@ -3587,27 +3586,23 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, break; case O_FALLING_WALL_F: - switch (get_dir(cave, x, y, grav_compat)) - { - case O_PLAYER: - case O_PLAYER_GLUED: - case O_PLAYER_BOMB: - // if player under, it explodes - the falling wall, not the player! - explode(cave, x, y); - break; - - case O_SPACE: - // continue falling - move(cave, x, y, grav_compat, O_FALLING_WALL_F); - break; - - default: - // stop - play_sound_of_element(cave, get(cave, x, y), x, y); - store(cave, x, y, O_FALLING_WALL); - break; - } - break; + if (is_player_dir(cave, x, y, grav_compat)) + { + // if player under, it explodes - the falling wall, not the player! + explode(cave, x, y); + } + else if (is_like_space(cave, x, y, grav_compat)) + { + // continue falling + move(cave, x, y, grav_compat, O_FALLING_WALL_F); + } + else + { + // stop falling + play_sound_of_element(cave, O_FALLING_WALL_F, x, y); + store(cave, x, y, O_FALLING_WALL); + } + break; // ====================================================================================== -- 2.34.1