From 9b548fa47b0622e7aa28c9b63ed3db37c22b4e6d Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 16 Dec 2024 21:00:30 +0100 Subject: [PATCH] added sound support for some enemies for the BD engine --- src/conf_snd.c | 9 +++++++++ src/game.c | 8 ++++++++ src/game_bd/bd_cavedb.c | 40 +++++++++++++++++++++++++++++++++++++ src/game_bd/bd_caveengine.c | 19 +++++++++++++++++- src/game_bd/bd_elements.h | 16 +++++++++++++++ src/game_bd/bd_sound.c | 8 ++++++++ src/tools.c | 32 +++++++++++++++++++++++++++++ 7 files changed, 131 insertions(+), 1 deletion(-) diff --git a/src/conf_snd.c b/src/conf_snd.c index c6fb6128..830cedcd 100644 --- a/src/conf_snd.c +++ b/src/conf_snd.c @@ -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" }, diff --git a/src/game.c b/src/game.c index 42732f50..db6de614 100644 --- a/src/game.c +++ b/src/game.c @@ -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: diff --git a/src/game_bd/bd_cavedb.c b/src/game_bd/bd_cavedb.c index 559a49dd..f61913d0 100644 --- a/src/game_bd/bd_cavedb.c +++ b/src/game_bd/bd_cavedb.c @@ -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, diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index 3b870543..ae161348 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -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; diff --git a/src/game_bd/bd_elements.h b/src/game_bd/bd_elements.h index 106a9222..bbb61e06 100644 --- a/src/game_bd/bd_elements.h +++ b/src/game_bd/bd_elements.h @@ -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, diff --git a/src/game_bd/bd_sound.c b/src/game_bd/bd_sound.c index 9dd3c7ce..37abc49b 100644 --- a/src/game_bd/bd_sound.c +++ b/src/game_bd/bd_sound.c @@ -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 }, diff --git a/src/tools.c b/src/tools.c index 6ec7373a..6b8a53e1 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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 -- 2.34.1