fixed amoeba sounds for BD engine
authorHolger Schemel <holger.schemel@virtion.de>
Mon, 16 Dec 2024 19:06:32 +0000 (20:06 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Mon, 16 Dec 2024 15:07:52 +0000 (16:07 +0100)
src/conf_snd.c
src/game.c
src/game_bd/bd_caveengine.c
src/game_bd/bd_elements.h
src/game_bd/bd_sound.c

index bee15aaa68223298a794a9460cde94c92217de0a..c6fb6128b864e51c8a8fb423ce83943877585279 100644 (file)
@@ -97,9 +97,14 @@ struct ConfigInfo sound_config[] =
   { "bdx_bomb.collecting",                     "pong.wav"                      },
   { "bdx_bomb.dropping",                       "zisch.wav"                     },
   { "bdx_magic_wall.active",                   "miep.wav"                      },
+  { "bdx_amoeba_1.growing",                    "amoebe.wav"                    },
+  { "bdx_amoeba_1.growing.mode_loop",          "false"                         },
   { "bdx_amoeba_1.active",                     UNDEFINED_FILENAME              },
-  { "bdx_amoeba_1.other",                      UNDEFINED_FILENAME              },
+  { "bdx_amoeba_1.other",                      "miep.wav"                      },
+  { "bdx_amoeba_2.growing",                    "amoebe.wav"                    },
+  { "bdx_amoeba_2.growing.mode_loop",          "false"                         },
   { "bdx_amoeba_2.active",                     UNDEFINED_FILENAME              },
+  { "bdx_amoeba_2.other",                      "miep.wav"                      },
   { "bdx_pneumatic_hammer.active",             "hammer.wav"                    },
   { "bdx_covered.active",                      "jingle.wav"                    },
   { "bdx_inbox.opening",                       "crash.wav"                     },
index 72562d28ea5089d546d98232cb5acb6d96c5da66..42732f50e62560561acb486c04ace7731679bfb6 100644 (file)
@@ -15700,6 +15700,8 @@ static int getSoundAction_BD(int sample)
     case GD_S_LAVA:
     case GD_S_ACID_SPREADING:
     case GD_S_BLADDER_CONVERTING:
+    case GD_S_AMOEBA_GROWING:
+    case GD_S_AMOEBA_2_GROWING:
       return ACTION_GROWING;
 
     case GD_S_DIAMOND_COLLECTING:
@@ -15761,6 +15763,7 @@ static int getSoundAction_BD(int sample)
 
     case GD_S_COVERING:
     case GD_S_AMOEBA:
+    case GD_S_AMOEBA_2:
     case GD_S_MAGIC_WALL:
     case GD_S_PNEUMATIC_HAMMER:
     case GD_S_WATER:
@@ -15818,6 +15821,7 @@ static int getSoundAction_BD(int sample)
       return ACTION_OTHER;
 
     case GD_S_AMOEBA_MAGIC:
+    case GD_S_AMOEBA_2_MAGIC:
     case GD_S_FINISHED:
       // trigger special post-processing (and force sound to be looping)
       return ACTION_DEFAULT;
@@ -15935,6 +15939,10 @@ static int getSoundEffect_BD(int element_bd, int sample)
       sound_effect = SND_BDX_AMOEBA_1_OTHER;
       break;
 
+    case GD_S_AMOEBA_2_MAGIC:
+      sound_effect = SND_BDX_AMOEBA_2_OTHER;
+      break;
+
     case GD_S_FINISHED:
       sound_effect = SND_GAME_LEVELTIME_BONUS;
       break;
index 38ddc094ca97c18a8e484f22ea611ccd000a374f..3b8705435613d6df1fe83d3adc4729e693ec4383 100644 (file)
@@ -1834,7 +1834,7 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
     O_STONE
   };
 
-  boolean amoeba_sound, magic_sound;
+  boolean amoeba_1_sound, amoeba_2_sound, magic_sound;
 
   gd_cave_clear_sounds(cave);
 
@@ -3280,25 +3280,37 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
                    case 0:
                       // let this be up. numbers indifferent.
                      if (amoeba_eats(cave, x, y, GD_MV_UP))
+                      {
                        store_dir(cave, x, y, GD_MV_UP, O_AMOEBA);
+                        gd_sound_play(cave, GD_S_AMOEBA_GROWING, O_AMOEBA, -1, -1);
+                      }
                      break;
 
                    case 1:
                       // down
                      if (amoeba_eats(cave, x, y, GD_MV_DOWN))
+                      {
                        store_dir(cave, x, y, GD_MV_DOWN, O_AMOEBA);
+                        gd_sound_play(cave, GD_S_AMOEBA_GROWING, O_AMOEBA, -1, -1);
+                      }
                      break;
 
                    case 2:
                       // left
                      if (amoeba_eats(cave, x, y, GD_MV_LEFT))
+                      {
                        store_dir(cave, x, y, GD_MV_LEFT, O_AMOEBA);
+                        gd_sound_play(cave, GD_S_AMOEBA_GROWING, O_AMOEBA, -1, -1);
+                      }
                      break;
 
                    case 3:
                       // right
                      if (amoeba_eats(cave, x, y, GD_MV_RIGHT))
+                      {
                        store_dir(cave, x, y, GD_MV_RIGHT, O_AMOEBA);
+                        gd_sound_play(cave, GD_S_AMOEBA_GROWING, O_AMOEBA, -1, -1);
+                      }
                      break;
                  }
                }
@@ -3360,25 +3372,37 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
                      case 0:
                         // let this be up. numbers indifferent.
                        if (amoeba_eats(cave, x, y, GD_MV_UP))
+                        {
                          store_dir(cave, x, y, GD_MV_UP, O_AMOEBA_2);
+                          gd_sound_play(cave, GD_S_AMOEBA_2_GROWING, O_AMOEBA_2, -1, -1);
+                        }
                        break;
 
                      case 1:
                         // down
                        if (amoeba_eats(cave, x, y, GD_MV_DOWN))
+                        {
                          store_dir(cave, x, y, GD_MV_DOWN, O_AMOEBA_2);
+                          gd_sound_play(cave, GD_S_AMOEBA_2_GROWING, O_AMOEBA_2, -1, -1);
+                        }
                        break;
 
                      case 2:
                         // left
                        if (amoeba_eats(cave, x, y, GD_MV_LEFT))
+                        {
                          store_dir(cave, x, y, GD_MV_LEFT, O_AMOEBA_2);
+                          gd_sound_play(cave, GD_S_AMOEBA_2_GROWING, O_AMOEBA_2, -1, -1);
+                        }
                        break;
 
                      case 3:
                         // right
                        if (amoeba_eats(cave, x, y, GD_MV_RIGHT))
+                        {
                          store_dir(cave, x, y, GD_MV_RIGHT, O_AMOEBA_2);
+                          gd_sound_play(cave, GD_S_AMOEBA_2_GROWING, O_AMOEBA_2, -1, -1);
+                        }
                        break;
                    }
                  }
@@ -4072,34 +4096,43 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
   // SPECIAL SOUNDS
 
   // cave 3 sounds. precedence is controlled by the sound_play function.
-  // but we have to check amoeba&magic together as they had a different gritty sound when mixed
+  // but we have to check amoeba & magic together as they had a different gritty sound when mixed
   if (found_water)
     gd_sound_play(cave, GD_S_WATER, O_WATER, -1, -1);
 
   magic_sound = (cave->magic_wall_state == GD_MW_ACTIVE &&
                 cave->magic_wall_sound);
 
-  amoeba_sound = (cave->hatched && cave->amoeba_sound &&
-                 ((amoeba_count > 0 && cave->amoeba_state == GD_AM_AWAKE) ||
-                  (amoeba_2_count > 0 && cave->amoeba_2_state == GD_AM_AWAKE)));
+  amoeba_1_sound = (cave->hatched && cave->amoeba_sound &&
+                    amoeba_count > 0 && cave->amoeba_state == GD_AM_AWAKE);
 
-  if (amoeba_sound && magic_sound)
+  amoeba_2_sound = (cave->hatched && cave->amoeba_sound &&
+                    amoeba_2_count > 0 && cave->amoeba_2_state == GD_AM_AWAKE);
+
+  if (amoeba_1_sound && magic_sound)
   {
     gd_sound_play(cave, GD_S_AMOEBA_MAGIC, O_AMOEBA, -1, -1);
   }
+  else if (amoeba_2_sound && magic_sound)
+  {
+    gd_sound_play(cave, GD_S_AMOEBA_2_MAGIC, O_AMOEBA_2, -1, -1);
+  }
   else
   {
-    if (amoeba_sound)
+    if (amoeba_1_sound)
       gd_sound_play(cave, GD_S_AMOEBA, O_AMOEBA, -1, -1);
+    else if (amoeba_2_sound)
+      gd_sound_play(cave, GD_S_AMOEBA_2, O_AMOEBA_2, -1, -1);
     else if (magic_sound)
       gd_sound_play(cave, GD_S_MAGIC_WALL, O_MAGIC_WALL, -1, -1);
   }
 
   if (cave->hatched)
   {
-    if ((amoeba_count   > 0 && cave->amoeba_state   == GD_AM_AWAKE) ||
-       (amoeba_2_count > 0 && cave->amoeba_2_state == GD_AM_AWAKE))
+    if (amoeba_count > 0 && cave->amoeba_state == GD_AM_AWAKE)
       play_sound_of_element(cave, O_AMOEBA, -1, -1);
+    else if (amoeba_2_count > 0 && cave->amoeba_2_state == GD_AM_AWAKE)
+      play_sound_of_element(cave, O_AMOEBA_2, -1, -1);
   }
 
 
index ab60e908e08860b59bc4cc305ec320dca2079b73..106a92229ce648af9a1ca9919dd2977ad6a45be8 100644 (file)
@@ -562,9 +562,13 @@ typedef enum _sound
   GD_S_SWITCH_EXPANDING,
   GD_S_SWITCH_CONVEYOR,
   GD_S_SWITCH_REPLICATOR,
+  GD_S_AMOEBA_GROWING,
+  GD_S_AMOEBA_2_GROWING,
 
   GD_S_AMOEBA,                 // loop
+  GD_S_AMOEBA_2,               // loop
   GD_S_AMOEBA_MAGIC,           // loop
+  GD_S_AMOEBA_2_MAGIC,         // loop
   GD_S_MAGIC_WALL,             // loop
   GD_S_COVERING,               // loop
   GD_S_PNEUMATIC_HAMMER,       // loop
index 794610c4a97573670889fcfdfd76edf58b0fabf4..9dd3c7cec4acafe5f7687225b66f1be91d8da63e 100644 (file)
@@ -205,10 +205,14 @@ static SoundProperty sound_flags[] =
   { GD_S_SWITCH_EXPANDING,             2, 10                                   },
   { GD_S_SWITCH_CONVEYOR,              2, 10                                   },
   { GD_S_SWITCH_REPLICATOR,            2, 10                                   },
+  { GD_S_AMOEBA_GROWING,               2, 10                                   },
+  { GD_S_AMOEBA_2_GROWING,             2, 10                                   },
 
   // channel 3 sounds.
   { GD_S_AMOEBA,                       3, 30,  GD_SP_LOOPED                    },
+  { GD_S_AMOEBA_2,                     3, 30,  GD_SP_LOOPED                    },
   { GD_S_AMOEBA_MAGIC,                 3, 40,  GD_SP_LOOPED                    },
+  { GD_S_AMOEBA_2_MAGIC,               3, 40,  GD_SP_LOOPED                    },
   { GD_S_MAGIC_WALL,                   3, 35,  GD_SP_LOOPED                    },
   { GD_S_COVERING,                     3, 100, GD_SP_LOOPED                    },
   { GD_S_PNEUMATIC_HAMMER,             3, 50,  GD_SP_LOOPED                    },