X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_caveengine.c;h=9df249eba1fba020e9ef53063c92c0aed0b8dbe7;hb=ac8ca29d0e4dec7b621225457f6eb5179655ea14;hp=2793d26f2f93c968e7b4d4d83ff2df997abac611;hpb=b9781a9921b1ae15f27c737a3da7c00b3f7a9f7e;p=rocksndiamonds.git diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 2793d26f..9df249eb 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -136,7 +136,7 @@ static inline boolean el_can_fall(const int element) static void play_sound_of_element(GdCave *cave, GdElement element, int x, int y) { // check if sound should be skipped for falling elements (and only be played on impact) - if (el_can_fall(element) && skip_bd_falling_sounds()) + if (el_can_fall(element) && !use_bd_falling_sounds()) return; // stone and diamond fall sounds. @@ -543,6 +543,9 @@ static inline boolean is_space_dir(const GdCave *cave, const int x, const int y, static inline void store_dir_buffer(GdCave *cave, const int x, const int y, const GdDirection dir) { + int old_x = x; + int old_y = y; + // raw values without range correction int raw_x = x + gd_dx[dir]; int raw_y = y + gd_dy[dir]; @@ -552,7 +555,18 @@ static inline void store_dir_buffer(GdCave *cave, const int x, const int y, cons int new_y = gety(cave, raw_x, raw_y); int new_dir = (dir > GD_MV_TWICE ? dir - GD_MV_TWICE : dir); - game_bd.game->dir_buffer[new_y][new_x] = new_dir; + // if tile is moving two steps at once, correct old position + if (dir > GD_MV_TWICE) + { + raw_x = x + gd_dx[new_dir]; + raw_y = y + gd_dy[new_dir]; + + old_x = getx(cave, raw_x, raw_y); + old_y = gety(cave, raw_x, raw_y); + } + + game_bd.game->dir_buffer_from[old_y][old_x] = new_dir; + game_bd.game->dir_buffer_to[new_y][new_x] = new_dir; } // store an element at the given position @@ -1570,6 +1584,9 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, gd_cave_clear_sounds(cave); + game_bd.player_moving = FALSE; + game_bd.player_snapping = FALSE; + // if diagonal movements not allowed, // horizontal movements have precedence. [BROADRIBB] if (!cave->diagonal_movements) @@ -1835,15 +1852,25 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, // if snapping anything and we have snapping explosions set. // but these is not true for pushing. if (remains == O_SPACE && player_fire && !push) + { remains = cave->snap_element; + game_bd.player_snapping = TRUE; + } + if (remains != O_SPACE || player_fire) + { // if any other element than space, player cannot move. // also if pressing fire, will not move. store_dir(cave, x, y, player_move, remains); + } else + { // if space remains there, the player moves. move(cave, x, y, player_move, O_PLAYER); + + game_bd.player_moving = TRUE; + } } } break; @@ -3633,7 +3660,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire, { if ((amoeba_count > 0 && cave->amoeba_state == GD_AM_AWAKE) || (amoeba_2_count > 0 && cave->amoeba_2_state == GD_AM_AWAKE)) - play_sound_of_element(cave, O_AMOEBA, x, y); + play_sound_of_element(cave, O_AMOEBA, -1, -1); } // pneumatic hammer sound - overrides everything.