added setup option for muting double falling sounds in BD engine
authorHolger Schemel <info@artsoft.org>
Sun, 14 Apr 2024 22:41:57 +0000 (00:41 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 14 Apr 2024 22:41:57 +0000 (00:41 +0200)
src/files.c
src/game_bd/bd_caveengine.c
src/game_bd/export_bd.h
src/game_bd/main_bd.c
src/libgame/system.h
src/screens.c

index 175efdd5c89727d1296bba234cafcd4f5247609a..53c877712b787c7140744c4de06c1b75a2d7d076 100644 (file)
@@ -10783,6 +10783,10 @@ static struct TokenInfo global_setup_tokens[] =
     TYPE_SWITCH3,
     &setup.bd_up_down_graphics,                        "bd_up_down_graphics"
   },
+  {
+    TYPE_SWITCH3,
+    &setup.bd_skip_falling_sounds,             "bd_skip_falling_sounds"
+  },
   {
     TYPE_INTEGER,
     &setup.bd_palette_c64,                     "bd_palette_c64"
@@ -11630,6 +11634,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->bd_smooth_movements = AUTO;
   si->bd_pushing_graphics = TRUE;
   si->bd_up_down_graphics = TRUE;
+  si->bd_skip_falling_sounds = AUTO;
   si->bd_palette_c64 = GD_DEFAULT_PALETTE_C64;
   si->bd_palette_c64dtv = GD_DEFAULT_PALETTE_C64DTV;
   si->bd_palette_atari = GD_DEFAULT_PALETTE_ATARI;
index e174f916bfc7329a1f83c9d295dc2723b9672a1f..2793d26f2f93c968e7b4d4d83ff2df997abac611 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) && skip_bd_falling_sounds())
+    return;
+
   // stone and diamond fall sounds.
   switch (element)
   {
index 4ee1e9485f413218dd58b1da1e166a1c0bc794b8..60e70c2046316f57531c87d916e773697e0cf47d 100644 (file)
@@ -116,6 +116,7 @@ boolean use_native_bd_graphics_engine(void);
 boolean use_bd_smooth_movements(void);
 boolean use_bd_pushing_graphics(void);
 boolean use_bd_up_down_graphics(void);
+boolean skip_bd_falling_sounds(void);
 
 Bitmap **GetTitleScreenBitmaps_BD(void);
 void CoverScreen_BD(void);
index d2da72f17460aaca33850c709a1e76a297a8466d..c11022b0c57951c6ea2fdfede1b36dc474205e17 100644 (file)
@@ -460,6 +460,13 @@ boolean use_bd_up_down_graphics(void)
          (setup.bd_up_down_graphics == AUTO && !use_native_bd_graphics_engine()));
 }
 
+// check if skipping falling sounds selected in setup menu
+boolean skip_bd_falling_sounds(void)
+{
+  return ((setup.bd_skip_falling_sounds == TRUE) ||
+         (setup.bd_skip_falling_sounds == AUTO && !game.use_native_bd_sound_engine));
+}
+
 Bitmap **GetTitleScreenBitmaps_BD(void)
 {
   Bitmap **title_screen_bitmaps = gd_get_title_screen_bitmaps();
index 15c55f776c85fc397deabcf3b067fd3cd5c9bbc8..19a9747af9fddd1aa0298e83b526dc532d6cb9e7 100644 (file)
@@ -1518,6 +1518,7 @@ struct SetupInfo
   int bd_smooth_movements;             // not boolean -- can also be "AUTO"
   int bd_pushing_graphics;             // not boolean -- can also be "AUTO"
   int bd_up_down_graphics;             // not boolean -- can also be "AUTO"
+  int bd_skip_falling_sounds;          // not boolean -- can also be "AUTO"
   int bd_palette_c64;
   int bd_palette_c64dtv;
   int bd_palette_atari;
index 241d25f0154358127dc0a2055f29730b6e3008c9..7360b9c74392f8bfa39d1ba6ce77e6265177b812 100644 (file)
@@ -7975,6 +7975,7 @@ static struct TokenInfo setup_info_engines[] =
   { TYPE_YES_NO_AUTO,  &setup.bd_smooth_movements,     "Smooth Element Movement:"      },
   { TYPE_YES_NO_AUTO,  &setup.bd_pushing_graphics,     "Use Player Pushing Graphics:"  },
   { TYPE_YES_NO_AUTO,  &setup.bd_up_down_graphics,     "Use Player Up/Down Graphics:"  },
+  { TYPE_YES_NO_AUTO,  &setup.bd_skip_falling_sounds,  "Mute Double Falling Sounds:"   },
   { TYPE_ENTER_LIST,   &execSetupChoosePaletteC64,     "Color Palette (C64):"          },
   { TYPE_STRING,       &bd_palette_c64_text,           ""                              },
   { TYPE_ENTER_LIST,   &execSetupChoosePaletteC64DTV,  "Color Palette (C64DTV):"       },