X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_bd%2Fbd_caveengine.c;h=5b2bfcdfcd1292268083f70c45a5fa64fd235469;hb=8fdd23c078934ae797980a824fd145903c84cae7;hp=e174f916bfc7329a1f83c9d295dc2723b9672a1f;hpb=70d64256513a57f375431931c606ae85ed5b9d3f;p=rocksndiamonds.git diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index e174f916..5b2bfcdf 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -126,9 +126,19 @@ void gd_cave_set_seconds_sound(GdCave *cave) } } +// returns true if the element can fall +static inline boolean el_can_fall(const int element) +{ + return (gd_elements[element & O_MASK].properties & P_CAN_FALL) != 0; +} + // play diamond or stone sound of given 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) && !use_bd_falling_sounds()) + return; + // stone and diamond fall sounds. switch (element) { @@ -1560,6 +1570,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) @@ -1825,15 +1838,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; @@ -3623,7 +3646,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.