added checking availability of level specific colors in level editor
[rocksndiamonds.git] / src / game_bd / bd_caveengine.c
index e174f916bfc7329a1f83c9d295dc2723b9672a1f..6d0e3fcd2c13614bfa7ad887f9d2c05f1fad1cda 100644 (file)
@@ -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)
   {
@@ -3623,7 +3633,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.