added sound support for some enemies for the BD engine
authorHolger Schemel <holger.schemel@virtion.de>
Mon, 16 Dec 2024 20:00:30 +0000 (21:00 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Mon, 16 Dec 2024 18:02:05 +0000 (19:02 +0100)
src/conf_snd.c
src/game.c
src/game_bd/bd_cavedb.c
src/game_bd/bd_caveengine.c
src/game_bd/bd_elements.h
src/game_bd/bd_sound.c
src/tools.c

index c6fb6128b864e51c8a8fb423ce83943877585279..830cedcdc1d76bcb171ccd55bf7b6104211ab10d 100644 (file)
@@ -105,6 +105,15 @@ struct ConfigInfo sound_config[] =
   { "bdx_amoeba_2.growing.mode_loop",          "false"                         },
   { "bdx_amoeba_2.active",                     UNDEFINED_FILENAME              },
   { "bdx_amoeba_2.other",                      "miep.wav"                      },
+  { "bdx_butterfly_1.active",                  "klapper.wav"                   },
+  { "bdx_butterfly_2.active",                  "klapper.wav"                   },
+  { "bdx_firefly_1.active",                    "roehr.wav"                     },
+  { "bdx_firefly_2.active",                    "roehr.wav"                     },
+  { "bdx_dragonfly.active",                    "klapper.wav"                   },
+  { "bdx_stonefly.active",                     "roehr.wav"                     },
+  { "bdx_biter.active",                                "klapper.wav"                   },
+  { "bdx_biter.eating",                                "njam.wav"                      },
+  { "bdx_cow.active",                          "roehr.wav"                     },
   { "bdx_pneumatic_hammer.active",             "hammer.wav"                    },
   { "bdx_covered.active",                      "jingle.wav"                    },
   { "bdx_inbox.opening",                       "crash.wav"                     },
index 42732f50e62560561acb486c04ace7731679bfb6..db6de61429f41d5717a520cb03fea2174467d6d3 100644 (file)
@@ -15767,6 +15767,14 @@ static int getSoundAction_BD(int sample)
     case GD_S_MAGIC_WALL:
     case GD_S_PNEUMATIC_HAMMER:
     case GD_S_WATER:
+    case GD_S_COW:
+    case GD_S_BITER:
+    case GD_S_FIREFLY:
+    case GD_S_ALT_FIREFLY:
+    case GD_S_BUTTER:
+    case GD_S_ALT_BUTTER:
+    case GD_S_STONEFLY:
+    case GD_S_DRAGONFLY:
       return ACTION_ACTIVE;
 
     case GD_S_DIAMOND_FALLING_RANDOM:
index 559a49dd0b32831f0d4db2dc79d3b79d56fd75a5..f61913d04077af5e96adb5a5c660c94937bd3d3a 100644 (file)
@@ -835,6 +835,11 @@ GdElementProperty gd_element_properties[] =
     0,
     "WATER16", 0, 96, -96, -96
   },
+  {
+    O_COW, O_COW, N_("Cow (internal)"),
+    0,
+    "COW", 0, 0, 0, 0,
+  },
   {
     O_COW_1, O_COW_1_scanned, N_("Cow (left)"),
     P_CCW | P_CAN_MOVE,
@@ -1062,6 +1067,11 @@ GdElementProperty gd_element_properties[] =
     P_SCANNED,
     "SCANN_GHOST", 0, 160, -160, -160
   },
+  {
+    O_FIREFLY, O_FIREFLY, N_("Firefly (internal)"),
+    0,
+    "FIREFLY", 0, 0, 0, 0,
+  },
   {
     O_FIREFLY_1, O_FIREFLY_1_scanned, N_("Firefly, left"),
     P_EXPLODES_BY_HIT | P_CCW | P_CAN_MOVE,
@@ -1102,6 +1112,11 @@ GdElementProperty gd_element_properties[] =
     P_SCANNED,
     "SCANN_FIREFLYd", 0, i_firefly_4, -136, -136
   },
+  {
+    O_ALT_FIREFLY, O_ALT_FIREFLY, N_("Alternative firefly (internal)"),
+    0,
+    "A_FIREFLY", 0, 0, 0, 0,
+  },
   {
     O_ALT_FIREFLY_1, O_ALT_FIREFLY_1_scanned, N_("Alternative firefly, left"),
     P_EXPLODES_BY_HIT | P_CAN_MOVE,
@@ -1142,6 +1157,11 @@ GdElementProperty gd_element_properties[] =
     P_SCANNED,
     "SCANN_A_FIREFLYd", 0, i_alt_firefly_4, -104, -104
   },
+  {
+    O_BUTTER, O_BUTTER, N_("Butterfly (internal)"),
+    0,
+    "BUTTERFLY", 0, 0, 0, 0,
+  },
   {
     O_BUTTER_1, O_BUTTER_1_scanned, N_("Butterfly, left"),
     P_EXPLODES_BY_HIT | P_CAN_MOVE,
@@ -1182,6 +1202,11 @@ GdElementProperty gd_element_properties[] =
     P_SCANNED,
     "SCANN_BUTTERFLYd", 0, i_butter_4, -144, -144
   },
+  {
+    O_ALT_BUTTER, O_ALT_BUTTER, N_("Alternative butterfly (internal)"),
+    0,
+    "A_BUTTERFLY", 0, 0, 0, 0,
+  },
   {
     O_ALT_BUTTER_1, O_ALT_BUTTER_1_scanned, N_("Alternative butterfly, left"),
     P_EXPLODES_BY_HIT | P_CCW | P_CAN_MOVE,
@@ -1222,6 +1247,11 @@ GdElementProperty gd_element_properties[] =
     P_SCANNED,
     "SCANN_A_BUTTERFLYd", 0, i_alt_butter_4, -112, -112
   },
+  {
+    O_STONEFLY, O_STONEFLY, N_("Stonefly (internal)"),
+    0,
+    "STONEFLY", 0, 0, 0, 0,
+  },
   {
     O_STONEFLY_1, O_STONEFLY_1_scanned, N_("Stonefly, left"),
     P_EXPLODES_BY_HIT | P_CAN_MOVE,
@@ -1262,6 +1292,11 @@ GdElementProperty gd_element_properties[] =
     P_SCANNED,
     "SCANN_STONEFLYd", 0, i_stonefly_4, -152, -152
   },
+  {
+    O_BITER, O_BITER, N_("Biter (internal)"),
+    0,
+    "BITER", 0, 0, 0, 0,
+  },
   {
     O_BITER_1, O_BITER_1_scanned, N_("Biter, up"),
     P_CAN_MOVE,
@@ -1302,6 +1337,11 @@ GdElementProperty gd_element_properties[] =
     P_SCANNED,
     "SCANN_BITERl", 0, i_biter_4, -168, -168
   },
+  {
+    O_DRAGONFLY, O_DRAGONFLY, N_("Dragonfly (internal)"),
+    0,
+    "DRAGONFLY", 0, 0, 0, 0,
+  },
   {
     O_DRAGONFLY_1, O_DRAGONFLY_1_scanned, N_("Dragonfly, left"),
     P_EXPLODES_BY_HIT | P_CCW | P_CAN_MOVE,
index 3b8705435613d6df1fe83d3adc4729e693ec4383..ae16134804d07be134e48cdd8153c73d6678cd1e 100644 (file)
@@ -247,7 +247,7 @@ static void play_sound_of_element(GdCave *cave, GdElement element, int x, int y)
     case O_BITER_2:
     case O_BITER_3:
     case O_BITER_4:
-      gd_sound_play(cave, GD_S_BITER_EATING, element, x, y);
+      gd_sound_play(cave, GD_S_BITER_EATING, O_BITER, x, y);
       break;
 
     case O_DIRT_BALL:
@@ -2656,6 +2656,8 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
               // turn in place if nothing else possible
              store(cave, x, y, base + dirp);
             }
+
+            gd_sound_play(cave, GD_S_COW, O_COW, x, y);
          }
          break;
 
@@ -2777,6 +2779,17 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
               // turn in place if nothing else possible
              store(cave, x, y, base + dirp);
             }
+
+            if (base == O_FIREFLY_1)
+              gd_sound_play(cave, GD_S_FIREFLY, O_FIREFLY, x, y);
+            else if (base == O_ALT_FIREFLY_1)
+              gd_sound_play(cave, GD_S_ALT_FIREFLY, O_ALT_FIREFLY, x, y);
+            else if (base == O_BUTTER_1)
+              gd_sound_play(cave, GD_S_BUTTER, O_BUTTER, x, y);
+            else if (base == O_ALT_BUTTER_1)
+              gd_sound_play(cave, GD_S_ALT_BUTTER, O_ALT_BUTTER, x, y);
+            else if (base == O_STONEFLY_1)
+              gd_sound_play(cave, GD_S_STONEFLY, O_STONEFLY, x, y);
          }
          break;
 
@@ -3045,6 +3058,8 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
            // if biter did move, we had sound. play it.
            if (made_sound_of != O_NONE)
              play_sound_of_element(cave, made_sound_of, x, y);
+            else
+              gd_sound_play(cave, GD_S_BITER, O_BITER, x, y);
          }
          break;
 
@@ -3097,6 +3112,8 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
              // otherwise turns 90 degrees in place.
              store(cave, x, y, base + dirn);
             }
+
+            gd_sound_play(cave, GD_S_DRAGONFLY, O_DRAGONFLY, x, y);
          }
          break;
 
index 106a92229ce648af9a1ca9919dd2977ad6a45be8..bbb61e060d78f34ed93c24d05f10a31f4f13faf1 100644 (file)
@@ -174,6 +174,7 @@ typedef enum _element
   O_WATER_14,
   O_WATER_15,
   O_WATER_16,
+  O_COW,
   O_COW_1,
   O_COW_2,
   O_COW_3,
@@ -221,6 +222,7 @@ typedef enum _element
   O_CHASING_STONE_scanned,
   O_GHOST,
   O_GHOST_scanned,
+  O_FIREFLY,
   O_FIREFLY_1,
   O_FIREFLY_2,
   O_FIREFLY_3,
@@ -229,6 +231,7 @@ typedef enum _element
   O_FIREFLY_2_scanned,
   O_FIREFLY_3_scanned,
   O_FIREFLY_4_scanned,
+  O_ALT_FIREFLY,
   O_ALT_FIREFLY_1,
   O_ALT_FIREFLY_2,
   O_ALT_FIREFLY_3,
@@ -237,6 +240,7 @@ typedef enum _element
   O_ALT_FIREFLY_2_scanned,
   O_ALT_FIREFLY_3_scanned,
   O_ALT_FIREFLY_4_scanned,
+  O_BUTTER,
   O_BUTTER_1,
   O_BUTTER_2,
   O_BUTTER_3,
@@ -245,6 +249,7 @@ typedef enum _element
   O_BUTTER_2_scanned,
   O_BUTTER_3_scanned,
   O_BUTTER_4_scanned,
+  O_ALT_BUTTER,
   O_ALT_BUTTER_1,
   O_ALT_BUTTER_2,
   O_ALT_BUTTER_3,
@@ -253,6 +258,7 @@ typedef enum _element
   O_ALT_BUTTER_2_scanned,
   O_ALT_BUTTER_3_scanned,
   O_ALT_BUTTER_4_scanned,
+  O_STONEFLY,
   O_STONEFLY_1,
   O_STONEFLY_2,
   O_STONEFLY_3,
@@ -261,6 +267,7 @@ typedef enum _element
   O_STONEFLY_2_scanned,
   O_STONEFLY_3_scanned,
   O_STONEFLY_4_scanned,
+  O_BITER,
   O_BITER_1,
   O_BITER_2,
   O_BITER_3,
@@ -269,6 +276,7 @@ typedef enum _element
   O_BITER_2_scanned,
   O_BITER_3_scanned,
   O_BITER_4_scanned,
+  O_DRAGONFLY,
   O_DRAGONFLY_1,
   O_DRAGONFLY_2,
   O_DRAGONFLY_3,
@@ -573,6 +581,14 @@ typedef enum _sound
   GD_S_COVERING,               // loop
   GD_S_PNEUMATIC_HAMMER,       // loop
   GD_S_WATER,                  // loop
+  GD_S_COW,                    // loop
+  GD_S_BITER,                  // loop
+  GD_S_FIREFLY,                        // loop
+  GD_S_ALT_FIREFLY,            // loop
+  GD_S_BUTTER,                 // loop
+  GD_S_ALT_BUTTER,             // loop
+  GD_S_STONEFLY,               // loop
+  GD_S_DRAGONFLY,              // loop
 
   GD_S_CRACKING,
   GD_S_GRAVITY_CHANGING,
index 9dd3c7cec4acafe5f7687225b66f1be91d8da63e..37abc49bedeefcced8678dd47a89e0006e61b4aa 100644 (file)
@@ -217,6 +217,14 @@ static SoundProperty sound_flags[] =
   { GD_S_COVERING,                     3, 100, GD_SP_LOOPED                    },
   { GD_S_PNEUMATIC_HAMMER,             3, 50,  GD_SP_LOOPED                    },
   { GD_S_WATER,                                3, 20,  GD_SP_LOOPED                    },
+  { GD_S_COW,                          3, 20,  GD_SP_LOOPED                    },
+  { GD_S_BITER,                                3, 20,  GD_SP_LOOPED                    },
+  { GD_S_FIREFLY,                      3, 20,  GD_SP_LOOPED                    },
+  { GD_S_ALT_FIREFLY,                  3, 20,  GD_SP_LOOPED                    },
+  { GD_S_BUTTER,                       3, 20,  GD_SP_LOOPED                    },
+  { GD_S_ALT_BUTTER,                   3, 20,  GD_SP_LOOPED                    },
+  { GD_S_STONEFLY,                     3, 20,  GD_SP_LOOPED                    },
+  { GD_S_DRAGONFLY,                    3, 20,  GD_SP_LOOPED                    },
   { GD_S_CRACKING,                     3, 150                                  },
   { GD_S_GRAVITY_CHANGING,             3, 60                                   },
 
index 6ec7373a21fd804ee06ff2936d762f8f887fedf7..6b8a53e1ff069ec26be836507204aff7423c9b89 100644 (file)
@@ -6696,6 +6696,10 @@ bd_object_mapping_list[] =
     O_WATER_16,                                        FALSE,
     EL_BDX_WATER,                              -1, -1
   },
+  {
+    O_COW,                                     TRUE,
+    EL_BDX_COW,                                        -1, -1
+  },
   {
     O_COW_1,                                   TRUE,
     EL_BDX_COW_LEFT,                           -1, -1
@@ -6900,6 +6904,10 @@ bd_object_mapping_list[] =
     O_GHOST,                                   TRUE,
     EL_BDX_GHOST,                              -1, -1
   },
+  {
+    O_FIREFLY,                                 TRUE,
+    EL_BDX_FIREFLY_1,                          -1, -1
+  },
   {
     O_FIREFLY_1,                               TRUE,
     EL_BDX_FIREFLY_1_LEFT,                     -1, -1
@@ -6916,6 +6924,10 @@ bd_object_mapping_list[] =
     O_FIREFLY_4,                               TRUE,
     EL_BDX_FIREFLY_1_DOWN,                     -1, -1
   },
+  {
+    O_ALT_FIREFLY,                             TRUE,
+    EL_BDX_FIREFLY_2,                          -1, -1
+  },
   {
     O_ALT_FIREFLY_1,                           TRUE,
     EL_BDX_FIREFLY_2_LEFT,                     -1, -1
@@ -6932,6 +6944,10 @@ bd_object_mapping_list[] =
     O_ALT_FIREFLY_4,                           TRUE,
     EL_BDX_FIREFLY_2_DOWN,                     -1, -1
   },
+  {
+    O_BUTTER,                                  TRUE,
+    EL_BDX_BUTTERFLY_1,                                -1, -1
+  },
   {
     O_BUTTER_1,                                        TRUE,
     EL_BDX_BUTTERFLY_1_LEFT,                   -1, -1
@@ -6948,6 +6964,10 @@ bd_object_mapping_list[] =
     O_BUTTER_4,                                        TRUE,
     EL_BDX_BUTTERFLY_1_DOWN,                   -1, -1
   },
+  {
+    O_ALT_BUTTER,                              TRUE,
+    EL_BDX_BUTTERFLY_2,                                -1, -1
+  },
   {
     O_ALT_BUTTER_1,                            TRUE,
     EL_BDX_BUTTERFLY_2_LEFT,                   -1, -1
@@ -6964,6 +6984,10 @@ bd_object_mapping_list[] =
     O_ALT_BUTTER_4,                            TRUE,
     EL_BDX_BUTTERFLY_2_DOWN,                   -1, -1
   },
+  {
+    O_STONEFLY,                                        TRUE,
+    EL_BDX_STONEFLY,                           -1, -1
+  },
   {
     O_STONEFLY_1,                              TRUE,
     EL_BDX_STONEFLY_LEFT,                      -1, -1
@@ -6980,6 +7004,10 @@ bd_object_mapping_list[] =
     O_STONEFLY_4,                              TRUE,
     EL_BDX_STONEFLY_DOWN,                      -1, -1
   },
+  {
+    O_BITER,                                   TRUE,
+    EL_BDX_BITER,                              -1, -1
+  },
   {
     O_BITER_1,                                 TRUE,
     EL_BDX_BITER_UP,                           -1, -1
@@ -6996,6 +7024,10 @@ bd_object_mapping_list[] =
     O_BITER_4,                                 TRUE,
     EL_BDX_BITER_LEFT,                         -1, -1
   },
+  {
+    O_DRAGONFLY,                               TRUE,
+    EL_BDX_DRAGONFLY,                          -1, -1
+  },
   {
     O_DRAGONFLY_1,                             TRUE,
     EL_BDX_DRAGONFLY_LEFT,                     -1, -1