added fallback from random to default BD style diamond impact sound
authorHolger Schemel <info@artsoft.org>
Tue, 13 Feb 2024 20:24:29 +0000 (21:24 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 18 Feb 2024 15:16:59 +0000 (16:16 +0100)
src/game.c

index 47f3611731f7bf4bff3741f45681d2b1fb37b73d..d6ff2454cff5f4fcfe07cf5c3aa4efd82d771194 100644 (file)
@@ -15668,6 +15668,9 @@ static int getSoundEffect_BD(int element_bd, int sample)
     case GD_S_DIAMOND_RANDOM:
       nr = GetSimpleRandom(8);
       sound_effect = SND_BD_DIAMOND_IMPACT_RANDOM_1 + nr;
+
+      if (getSoundInfoEntryFilename(sound_effect) == NULL)
+       sound_effect = SND_BD_DIAMOND_IMPACT;
       break;
 
     case GD_S_DIAMOND_1:
@@ -15680,6 +15683,9 @@ static int getSoundEffect_BD(int element_bd, int sample)
     case GD_S_DIAMOND_8:
       nr = sample - GD_S_DIAMOND_1;
       sound_effect = SND_BD_DIAMOND_IMPACT_RANDOM_1 + nr;
+
+      if (getSoundInfoEntryFilename(sound_effect) == NULL)
+       sound_effect = SND_BD_DIAMOND_IMPACT;
       break;
 
     case GD_S_TIMEOUT_0: