From eea88cc5712224a52d4c606795f021be11ef5135 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 14 Feb 2024 19:52:25 +0100 Subject: [PATCH] added various new element action sounds to native BD engine --- src/conf_snd.c | 48 ++++++++++ src/game.c | 182 ++++++++++++++++++++++++++++-------- src/game_bd/bd_caveengine.c | 106 ++++++++++++++++++--- src/game_bd/bd_elements.h | 75 ++++++++++++--- src/game_bd/bd_sound.c | 136 ++++++++++++++++++++++----- 5 files changed, 459 insertions(+), 88 deletions(-) diff --git a/src/conf_snd.c b/src/conf_snd.c index b8706001..ab46bda8 100644 --- a/src/conf_snd.c +++ b/src/conf_snd.c @@ -43,10 +43,33 @@ struct ConfigInfo sound_config[] = { "[mm_default].exploding", "kabumm.wav" }, // sounds for Boulder Dash style elements and actions + { "bd_sand_ball.falling", UNDEFINED_FILENAME }, + { "bd_sand_ball.impact", "schlurf.wav" }, + { "bd_sand_loose.falling", UNDEFINED_FILENAME }, + { "bd_sand_loose.impact", "schlurf.wav" }, { "bd_diamond.collecting", "pong.wav" }, + { "bd_diamond.falling", UNDEFINED_FILENAME }, { "bd_diamond.impact", "pling.wav" }, + { "bd_flying_diamond.collecting", "pong.wav" }, + { "bd_flying_diamond.falling", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact", "pling.wav" }, { "bd_rock.pushing", "pusch.wav" }, + { "bd_rock.falling", UNDEFINED_FILENAME }, { "bd_rock.impact", "klopf.wav" }, + { "bd_flying_rock.pushing", "pusch.wav" }, + { "bd_flying_rock.falling", UNDEFINED_FILENAME }, + { "bd_flying_rock.impact", "klopf.wav" }, + { "bd_mega_rock.pushing", "pusch.wav" }, + { "bd_mega_rock.falling", UNDEFINED_FILENAME }, + { "bd_mega_rock.impact", "klopf.wav" }, + { "bd_waiting_rock.pushing", "pusch.wav" }, + { "bd_chasing_rock.pushing", "pusch.wav" }, + { "bd_nut.pushing", "knurk.wav" }, + { "bd_nut.breaking", "knack.wav" }, + { "bd_nut.falling", UNDEFINED_FILENAME }, + { "bd_nut.impact", "klumpf.wav" }, + { "bd_nitro_pack.pushing", "pusch.wav" }, + { "bd_nitro_pack.impact", "klopf.wav" }, { "bd_magic_wall.activating", "quirk.wav" }, { "bd_magic_wall.active", "miep.wav" }, { "bd_magic_wall.filling", "quirk.wav" }, @@ -56,6 +79,7 @@ struct ConfigInfo sound_config[] = { "bd_amoeba.turning_to_gem.mode_loop", "false" }, { "bd_amoeba.turning_to_rock", "klopf.wav" }, { "bd_amoeba.turning_to_rock.mode_loop", "false" }, + { "bd_amoeba.other", UNDEFINED_FILENAME }, { "bd_butterfly.moving", "klapper.wav" }, { "bd_butterfly.waiting", "klapper.wav" }, { "bd_firefly.moving", "roehr.wav" }, @@ -292,6 +316,14 @@ struct ConfigInfo sound_config[] = // keyword to stop parser: "NO_MORE_ELEMENT_SOUNDS" <-- do not change! // sounds for Boulder Dash style elements and actions + { "bd_diamond.falling.RANDOM_1", UNDEFINED_FILENAME }, + { "bd_diamond.falling.RANDOM_2", UNDEFINED_FILENAME }, + { "bd_diamond.falling.RANDOM_3", UNDEFINED_FILENAME }, + { "bd_diamond.falling.RANDOM_4", UNDEFINED_FILENAME }, + { "bd_diamond.falling.RANDOM_5", UNDEFINED_FILENAME }, + { "bd_diamond.falling.RANDOM_6", UNDEFINED_FILENAME }, + { "bd_diamond.falling.RANDOM_7", UNDEFINED_FILENAME }, + { "bd_diamond.falling.RANDOM_8", UNDEFINED_FILENAME }, { "bd_diamond.impact.RANDOM_1", UNDEFINED_FILENAME }, { "bd_diamond.impact.RANDOM_2", UNDEFINED_FILENAME }, { "bd_diamond.impact.RANDOM_3", UNDEFINED_FILENAME }, @@ -300,6 +332,22 @@ struct ConfigInfo sound_config[] = { "bd_diamond.impact.RANDOM_6", UNDEFINED_FILENAME }, { "bd_diamond.impact.RANDOM_7", UNDEFINED_FILENAME }, { "bd_diamond.impact.RANDOM_8", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_1", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_2", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_3", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_4", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_5", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_6", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_7", UNDEFINED_FILENAME }, + { "bd_flying_diamond.falling.RANDOM_8", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_1", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_2", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_3", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_4", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_5", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_6", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_7", UNDEFINED_FILENAME }, + { "bd_flying_diamond.impact.RANDOM_8", UNDEFINED_FILENAME }, // sounds for other game actions { "game.starting", UNDEFINED_FILENAME }, diff --git a/src/game.c b/src/game.c index 1a546d98..1b16a6f9 100644 --- a/src/game.c +++ b/src/game.c @@ -15537,11 +15537,35 @@ static int getSoundAction_BD(int sample) { switch (sample) { - case GD_S_STONE: - case GD_S_NUT: - case GD_S_DIRT_BALL: - case GD_S_NITRO_PACK: - case GD_S_FALLING_WALL: + case GD_S_STONE_PUSHING: + case GD_S_MEGA_STONE_PUSHING: + case GD_S_FLYING_STONE_PUSHING: + case GD_S_WAITING_STONE_PUSHING: + case GD_S_CHASING_STONE_PUSHING: + case GD_S_NUT_PUSHING: + case GD_S_NITRO_PACK_PUSHING: + case GD_S_BLADDER_PUSHING: + case GD_S_BOX_PUSHING: + return ACTION_PUSHING; + + case GD_S_STONE_FALLING: + case GD_S_MEGA_STONE_FALLING: + case GD_S_FLYING_STONE_FALLING: + case GD_S_NUT_FALLING: + case GD_S_DIRT_BALL_FALLING: + case GD_S_DIRT_LOOSE_FALLING: + case GD_S_NITRO_PACK_FALLING: + case GD_S_FALLING_WALL_FALLING: + return ACTION_FALLING; + + case GD_S_STONE_IMPACT: + case GD_S_MEGA_STONE_IMPACT: + case GD_S_FLYING_STONE_IMPACT: + case GD_S_NUT_IMPACT: + case GD_S_DIRT_BALL_IMPACT: + case GD_S_DIRT_LOOSE_IMPACT: + case GD_S_NITRO_PACK_IMPACT: + case GD_S_FALLING_WALL_IMPACT: return ACTION_IMPACT; case GD_S_NUT_CRACKING: @@ -15555,6 +15579,7 @@ static int getSoundAction_BD(int sample) return ACTION_GROWING; case GD_S_DIAMOND_COLLECTING: + case GD_S_FLYING_DIAMOND_COLLECTING: case GD_S_SKELETON_COLLECTING: case GD_S_PNEUMATIC_COLLECTING: case GD_S_BOMB_COLLECTING: @@ -15598,9 +15623,6 @@ static int getSoundAction_BD(int sample) case GD_S_STIRRING: return ACTION_ACTIVATING; - case GD_S_BOX_PUSHING: - return ACTION_PUSHING; - case GD_S_TELEPORTER: return ACTION_PASSING; @@ -15613,21 +15635,47 @@ static int getSoundAction_BD(int sample) case GD_S_COVERING: case GD_S_AMOEBA: - case GD_S_AMOEBA_MAGIC: case GD_S_MAGIC_WALL: case GD_S_PNEUMATIC_HAMMER: case GD_S_WATER: return ACTION_ACTIVE; - case GD_S_DIAMOND_RANDOM: - case GD_S_DIAMOND_1: - case GD_S_DIAMOND_2: - case GD_S_DIAMOND_3: - case GD_S_DIAMOND_4: - case GD_S_DIAMOND_5: - case GD_S_DIAMOND_6: - case GD_S_DIAMOND_7: - case GD_S_DIAMOND_8: + case GD_S_DIAMOND_FALLING_RANDOM: + case GD_S_DIAMOND_FALLING_1: + case GD_S_DIAMOND_FALLING_2: + case GD_S_DIAMOND_FALLING_3: + case GD_S_DIAMOND_FALLING_4: + case GD_S_DIAMOND_FALLING_5: + case GD_S_DIAMOND_FALLING_6: + case GD_S_DIAMOND_FALLING_7: + case GD_S_DIAMOND_FALLING_8: + case GD_S_DIAMOND_IMPACT_RANDOM: + case GD_S_DIAMOND_IMPACT_1: + case GD_S_DIAMOND_IMPACT_2: + case GD_S_DIAMOND_IMPACT_3: + case GD_S_DIAMOND_IMPACT_4: + case GD_S_DIAMOND_IMPACT_5: + case GD_S_DIAMOND_IMPACT_6: + case GD_S_DIAMOND_IMPACT_7: + case GD_S_DIAMOND_IMPACT_8: + case GD_S_FLYING_DIAMOND_FALLING_RANDOM: + case GD_S_FLYING_DIAMOND_FALLING_1: + case GD_S_FLYING_DIAMOND_FALLING_2: + case GD_S_FLYING_DIAMOND_FALLING_3: + case GD_S_FLYING_DIAMOND_FALLING_4: + case GD_S_FLYING_DIAMOND_FALLING_5: + case GD_S_FLYING_DIAMOND_FALLING_6: + case GD_S_FLYING_DIAMOND_FALLING_7: + case GD_S_FLYING_DIAMOND_FALLING_8: + case GD_S_FLYING_DIAMOND_IMPACT_RANDOM: + case GD_S_FLYING_DIAMOND_IMPACT_1: + case GD_S_FLYING_DIAMOND_IMPACT_2: + case GD_S_FLYING_DIAMOND_IMPACT_3: + case GD_S_FLYING_DIAMOND_IMPACT_4: + case GD_S_FLYING_DIAMOND_IMPACT_5: + case GD_S_FLYING_DIAMOND_IMPACT_6: + case GD_S_FLYING_DIAMOND_IMPACT_7: + case GD_S_FLYING_DIAMOND_IMPACT_8: case GD_S_TIMEOUT_0: case GD_S_TIMEOUT_1: case GD_S_TIMEOUT_2: @@ -15640,10 +15688,12 @@ static int getSoundAction_BD(int sample) case GD_S_TIMEOUT_9: case GD_S_TIMEOUT_10: case GD_S_BONUS_LIFE: - // kludge to prevent playing as loop sound + // trigger special post-processing (and force sound to be non-looping) return ACTION_OTHER; + case GD_S_AMOEBA_MAGIC: case GD_S_FINISHED: + // trigger special post-processing (and force sound to be looping) return ACTION_DEFAULT; default: @@ -15662,32 +15712,77 @@ static int getSoundEffect_BD(int element_bd, int sample) sound_action != ACTION_DEFAULT) return sound_effect; - // special sounds + // special post-processing for some sounds switch (sample) { - case GD_S_DIAMOND_RANDOM: - nr = GetSimpleRandom(8); - sound_effect = SND_BD_DIAMOND_IMPACT_RANDOM_1 + nr; + case GD_S_DIAMOND_FALLING_RANDOM: + case GD_S_DIAMOND_FALLING_1: + case GD_S_DIAMOND_FALLING_2: + case GD_S_DIAMOND_FALLING_3: + case GD_S_DIAMOND_FALLING_4: + case GD_S_DIAMOND_FALLING_5: + case GD_S_DIAMOND_FALLING_6: + case GD_S_DIAMOND_FALLING_7: + case GD_S_DIAMOND_FALLING_8: + nr = (sample == GD_S_DIAMOND_FALLING_RANDOM ? GetSimpleRandom(8) : + sample - GD_S_DIAMOND_FALLING_1); + sound_effect = SND_BD_DIAMOND_FALLING_RANDOM_1 + nr; if (getSoundInfoEntryFilename(sound_effect) == NULL) - sound_effect = SND_BD_DIAMOND_IMPACT; + sound_effect = SND_BD_DIAMOND_FALLING; break; - case GD_S_DIAMOND_1: - case GD_S_DIAMOND_2: - case GD_S_DIAMOND_3: - case GD_S_DIAMOND_4: - case GD_S_DIAMOND_5: - case GD_S_DIAMOND_6: - case GD_S_DIAMOND_7: - case GD_S_DIAMOND_8: - nr = sample - GD_S_DIAMOND_1; + case GD_S_DIAMOND_IMPACT_RANDOM: + case GD_S_DIAMOND_IMPACT_1: + case GD_S_DIAMOND_IMPACT_2: + case GD_S_DIAMOND_IMPACT_3: + case GD_S_DIAMOND_IMPACT_4: + case GD_S_DIAMOND_IMPACT_5: + case GD_S_DIAMOND_IMPACT_6: + case GD_S_DIAMOND_IMPACT_7: + case GD_S_DIAMOND_IMPACT_8: + nr = (sample == GD_S_DIAMOND_IMPACT_RANDOM ? GetSimpleRandom(8) : + sample - GD_S_DIAMOND_IMPACT_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_FLYING_DIAMOND_FALLING_RANDOM: + case GD_S_FLYING_DIAMOND_FALLING_1: + case GD_S_FLYING_DIAMOND_FALLING_2: + case GD_S_FLYING_DIAMOND_FALLING_3: + case GD_S_FLYING_DIAMOND_FALLING_4: + case GD_S_FLYING_DIAMOND_FALLING_5: + case GD_S_FLYING_DIAMOND_FALLING_6: + case GD_S_FLYING_DIAMOND_FALLING_7: + case GD_S_FLYING_DIAMOND_FALLING_8: + nr = (sample == GD_S_FLYING_DIAMOND_FALLING_RANDOM ? GetSimpleRandom(8) : + sample - GD_S_FLYING_DIAMOND_FALLING_1); + sound_effect = SND_BD_FLYING_DIAMOND_FALLING_RANDOM_1 + nr; + + if (getSoundInfoEntryFilename(sound_effect) == NULL) + sound_effect = SND_BD_FLYING_DIAMOND_FALLING; + break; + + case GD_S_FLYING_DIAMOND_IMPACT_RANDOM: + case GD_S_FLYING_DIAMOND_IMPACT_1: + case GD_S_FLYING_DIAMOND_IMPACT_2: + case GD_S_FLYING_DIAMOND_IMPACT_3: + case GD_S_FLYING_DIAMOND_IMPACT_4: + case GD_S_FLYING_DIAMOND_IMPACT_5: + case GD_S_FLYING_DIAMOND_IMPACT_6: + case GD_S_FLYING_DIAMOND_IMPACT_7: + case GD_S_FLYING_DIAMOND_IMPACT_8: + nr = (sample == GD_S_FLYING_DIAMOND_IMPACT_RANDOM ? GetSimpleRandom(8) : + sample - GD_S_FLYING_DIAMOND_IMPACT_1); + sound_effect = SND_BD_FLYING_DIAMOND_IMPACT_RANDOM_1 + nr; + + if (getSoundInfoEntryFilename(sound_effect) == NULL) + sound_effect = SND_BD_FLYING_DIAMOND_IMPACT; + break; + case GD_S_TIMEOUT_0: case GD_S_TIMEOUT_1: case GD_S_TIMEOUT_2: @@ -15706,14 +15801,18 @@ static int getSoundEffect_BD(int element_bd, int sample) sound_effect = SND_GAME_RUNNING_OUT_OF_TIME; break; - case GD_S_FINISHED: - sound_effect = SND_GAME_LEVELTIME_BONUS; - break; - case GD_S_BONUS_LIFE: sound_effect = SND_GAME_HEALTH_BONUS; break; + case GD_S_AMOEBA_MAGIC: + sound_effect = SND_BD_AMOEBA_OTHER; + break; + + case GD_S_FINISHED: + sound_effect = SND_GAME_LEVELTIME_BONUS; + break; + default: sound_effect = SND_UNDEFINED; break; @@ -15732,7 +15831,14 @@ void PlayLevelSound_BD(int xx, int yy, int element_bd, int sample) int x = xx - offset; int y = yy - offset; - if (sound_action == ACTION_OTHER) + // some sound actions are always looping in native BD game engine + if (sound_action == ACTION_DEFAULT) + is_loop_sound = TRUE; + + // some sound actions are always non-looping in native BD game engine + if (sound_action == ACTION_FALLING || + sound_action == ACTION_MOVING || + sound_action == ACTION_OTHER) is_loop_sound = FALSE; if (sound_effect != SND_UNDEFINED) diff --git a/src/game_bd/bd_caveengine.c b/src/game_bd/bd_caveengine.c index b3723b9b..1fe5b2b0 100644 --- a/src/game_bd/bd_caveengine.c +++ b/src/game_bd/bd_caveengine.c @@ -135,29 +135,51 @@ static void play_sound_of_element(GdCave *cave, GdElement element, int x, int y) switch (element) { case O_NUT: + gd_sound_play(cave, GD_S_NUT_FALLING, element, x, y); + break; + case O_NUT_F: - gd_sound_play(cave, GD_S_NUT, element, x, y); + gd_sound_play(cave, GD_S_NUT_IMPACT, element, x, y); break; case O_STONE: + gd_sound_play(cave, GD_S_STONE_FALLING, element, x, y); + break; + case O_STONE_F: + gd_sound_play(cave, GD_S_STONE_IMPACT, element, x, y); + break; + case O_FLYING_STONE: + gd_sound_play(cave, GD_S_FLYING_STONE_FALLING, element, x, y); + break; + case O_FLYING_STONE_F: + gd_sound_play(cave, GD_S_FLYING_STONE_IMPACT, element, x, y); + break; + case O_MEGA_STONE: + gd_sound_play(cave, GD_S_MEGA_STONE_FALLING, element, x, y); + break; + case O_MEGA_STONE_F: - case O_WAITING_STONE: - case O_CHASING_STONE: - gd_sound_play(cave, GD_S_STONE, element, x, y); + gd_sound_play(cave, GD_S_MEGA_STONE_IMPACT, element, x, y); break; case O_NITRO_PACK: + gd_sound_play(cave, GD_S_NITRO_PACK_FALLING, element, x, y); + break; + case O_NITRO_PACK_F: - gd_sound_play(cave, GD_S_NITRO_PACK, element, x, y); + gd_sound_play(cave, GD_S_NITRO_PACK_IMPACT, element, x, y); break; case O_FALLING_WALL: + gd_sound_play(cave, GD_S_FALLING_WALL_FALLING, element, x, y); + break; + case O_FALLING_WALL_F: - gd_sound_play(cave, GD_S_FALLING_WALL, element, x, y); + gd_sound_play(cave, GD_S_FALLING_WALL_IMPACT, element, x, y); break; case O_H_EXPANDING_WALL: @@ -170,10 +192,19 @@ static void play_sound_of_element(GdCave *cave, GdElement element, int x, int y) break; case O_DIAMOND: + gd_sound_play(cave, GD_S_DIAMOND_FALLING_RANDOM, element, x, y); + break; + case O_DIAMOND_F: + gd_sound_play(cave, GD_S_DIAMOND_IMPACT_RANDOM, element, x, y); + break; + case O_FLYING_DIAMOND: + gd_sound_play(cave, GD_S_FLYING_DIAMOND_FALLING_RANDOM, element, x, y); + break; + case O_FLYING_DIAMOND_F: - gd_sound_play(cave, GD_S_DIAMOND_RANDOM, element, x, y); + gd_sound_play(cave, GD_S_FLYING_DIAMOND_IMPACT_RANDOM, element, x, y); break; case O_BLADDER_SPENDER: @@ -208,10 +239,62 @@ static void play_sound_of_element(GdCave *cave, GdElement element, int x, int y) break; case O_DIRT_BALL: + gd_sound_play(cave, GD_S_DIRT_BALL_FALLING, element, x, y); + break; + case O_DIRT_BALL_F: + gd_sound_play(cave, GD_S_DIRT_BALL_IMPACT, element, x, y); + break; + case O_DIRT_LOOSE: + gd_sound_play(cave, GD_S_DIRT_LOOSE_FALLING, element, x, y); + break; + case O_DIRT_LOOSE_F: - gd_sound_play(cave, GD_S_DIRT_BALL, element, x, y); + gd_sound_play(cave, GD_S_DIRT_LOOSE_IMPACT, element, x, y); + break; + + default: + /* do nothing. */ + break; + } +} + +/* play sound of given element being pushed. */ +static void play_sound_of_element_pushing(GdCave *cave, GdElement element, int x, int y) +{ + switch (element) + { + case O_NUT: + gd_sound_play(cave, GD_S_NUT_PUSHING, element, x, y); + break; + + case O_STONE: + gd_sound_play(cave, GD_S_STONE_PUSHING, element, x, y); + break; + + case O_FLYING_STONE: + gd_sound_play(cave, GD_S_FLYING_STONE_PUSHING, element, x, y); + break; + + case O_MEGA_STONE: + gd_sound_play(cave, GD_S_MEGA_STONE_PUSHING, element, x, y); + break; + + case O_WAITING_STONE: + gd_sound_play(cave, GD_S_WAITING_STONE_PUSHING, element, x, y); + break; + + case O_CHASING_STONE: + gd_sound_play(cave, GD_S_CHASING_STONE_PUSHING, element, x, y); + break; + + case O_NITRO_PACK: + gd_sound_play(cave, GD_S_NITRO_PACK_PUSHING, element, x, y); + break; + + case O_BLADDER: + gd_sound_play(cave, GD_S_BLADDER_PUSHING, element, x, y); break; default: @@ -802,7 +885,8 @@ static GdElement player_get_element(GdCave* cave, const GdElement object, int x, case O_FLYING_DIAMOND: // prevent diamond sounds for O_SKELETON (see below) if (x != -1 && y != -1) - gd_sound_play(cave, GD_S_DIAMOND_COLLECTING, object, x, y); + gd_sound_play(cave, (object == O_DIAMOND ? GD_S_DIAMOND_COLLECTING : + GD_S_FLYING_DIAMOND_COLLECTING), object, x, y); cave->score += cave->diamond_value; cave->diamonds_collected++; @@ -973,7 +1057,7 @@ static boolean do_push(GdCave *cave, int x, int y, GdDirection player_move, bool { /* if decided that he will be able to push, */ store_dir(cave, x, y, GD_MV_TWICE + player_move, what); - play_sound_of_element(cave, what, x, y); + play_sound_of_element_pushing(cave, what, x, y); result = TRUE; } } @@ -1044,7 +1128,7 @@ static boolean do_push(GdCave *cave, int x, int y, GdDirection player_move, bool } if (result) - play_sound_of_element(cave, O_BLADDER, x, y); + play_sound_of_element_pushing(cave, O_BLADDER, x, y); } break; diff --git a/src/game_bd/bd_elements.h b/src/game_bd/bd_elements.h index 3355a780..8d670430 100644 --- a/src/game_bd/bd_elements.h +++ b/src/game_bd/bd_elements.h @@ -317,24 +317,70 @@ typedef enum _sound { GD_S_NONE, - GD_S_STONE, - GD_S_NUT, + GD_S_STONE_PUSHING, + GD_S_STONE_FALLING, + GD_S_STONE_IMPACT, + GD_S_MEGA_STONE_PUSHING, + GD_S_MEGA_STONE_FALLING, + GD_S_MEGA_STONE_IMPACT, + GD_S_FLYING_STONE_PUSHING, + GD_S_FLYING_STONE_FALLING, + GD_S_FLYING_STONE_IMPACT, + GD_S_WAITING_STONE_PUSHING, + GD_S_CHASING_STONE_PUSHING, + GD_S_NUT_PUSHING, + GD_S_NUT_FALLING, + GD_S_NUT_IMPACT, GD_S_NUT_CRACKING, - GD_S_DIRT_BALL, - GD_S_NITRO_PACK, - GD_S_FALLING_WALL, + GD_S_DIRT_BALL_FALLING, + GD_S_DIRT_BALL_IMPACT, + GD_S_DIRT_LOOSE_FALLING, + GD_S_DIRT_LOOSE_IMPACT, + GD_S_NITRO_PACK_PUSHING, + GD_S_NITRO_PACK_FALLING, + GD_S_NITRO_PACK_IMPACT, + GD_S_FALLING_WALL_FALLING, + GD_S_FALLING_WALL_IMPACT, GD_S_EXPANDING_WALL, GD_S_WALL_REAPPEARING, - GD_S_DIAMOND_RANDOM, /* randomly select a diamond sound */ - GD_S_DIAMOND_1, - GD_S_DIAMOND_2, - GD_S_DIAMOND_3, - GD_S_DIAMOND_4, - GD_S_DIAMOND_5, - GD_S_DIAMOND_6, - GD_S_DIAMOND_7, - GD_S_DIAMOND_8, + GD_S_DIAMOND_FALLING_RANDOM, /* randomly select a diamond falling sound */ + GD_S_DIAMOND_FALLING_1, + GD_S_DIAMOND_FALLING_2, + GD_S_DIAMOND_FALLING_3, + GD_S_DIAMOND_FALLING_4, + GD_S_DIAMOND_FALLING_5, + GD_S_DIAMOND_FALLING_6, + GD_S_DIAMOND_FALLING_7, + GD_S_DIAMOND_FALLING_8, + GD_S_DIAMOND_IMPACT_RANDOM, /* randomly select a diamond impact sound */ + GD_S_DIAMOND_IMPACT_1, + GD_S_DIAMOND_IMPACT_2, + GD_S_DIAMOND_IMPACT_3, + GD_S_DIAMOND_IMPACT_4, + GD_S_DIAMOND_IMPACT_5, + GD_S_DIAMOND_IMPACT_6, + GD_S_DIAMOND_IMPACT_7, + GD_S_DIAMOND_IMPACT_8, + GD_S_FLYING_DIAMOND_FALLING_RANDOM, /* randomly select a flying diamond falling sound */ + GD_S_FLYING_DIAMOND_FALLING_1, + GD_S_FLYING_DIAMOND_FALLING_2, + GD_S_FLYING_DIAMOND_FALLING_3, + GD_S_FLYING_DIAMOND_FALLING_4, + GD_S_FLYING_DIAMOND_FALLING_5, + GD_S_FLYING_DIAMOND_FALLING_6, + GD_S_FLYING_DIAMOND_FALLING_7, + GD_S_FLYING_DIAMOND_FALLING_8, + GD_S_FLYING_DIAMOND_IMPACT_RANDOM, /* randomly select a flying diamond impact sound */ + GD_S_FLYING_DIAMOND_IMPACT_1, + GD_S_FLYING_DIAMOND_IMPACT_2, + GD_S_FLYING_DIAMOND_IMPACT_3, + GD_S_FLYING_DIAMOND_IMPACT_4, + GD_S_FLYING_DIAMOND_IMPACT_5, + GD_S_FLYING_DIAMOND_IMPACT_6, + GD_S_FLYING_DIAMOND_IMPACT_7, + GD_S_FLYING_DIAMOND_IMPACT_8, GD_S_DIAMOND_COLLECTING, + GD_S_FLYING_DIAMOND_COLLECTING, GD_S_SKELETON_COLLECTING, GD_S_PNEUMATIC_COLLECTING, GD_S_BOMB_COLLECTING, @@ -347,6 +393,7 @@ typedef enum _sound GD_S_REPLICATOR, GD_S_ACID_SPREADING, GD_S_BLADDER_MOVING, + GD_S_BLADDER_PUSHING, GD_S_BLADDER_CONVERTING, GD_S_BLADDER_SPENDER, GD_S_BITER_EATING, diff --git a/src/game_bd/bd_sound.c b/src/game_bd/bd_sound.c index 13edc0d9..2087da4c 100644 --- a/src/game_bd/bd_sound.c +++ b/src/game_bd/bd_sound.c @@ -77,28 +77,74 @@ static SoundProperty sound_flags[] = /* channel 1 sounds. */ /* CHANNEL 1 SOUNDS ARE ALWAYS RESTARTED, so no need for GD_SP_FORCE flag. */ - { GD_S_STONE, 1, 10 }, + { GD_S_STONE_PUSHING, 1, 10 }, + { GD_S_STONE_FALLING, 1, 10 }, + { GD_S_STONE_IMPACT, 1, 10 }, + { GD_S_MEGA_STONE_PUSHING, 1, 10 }, + { GD_S_MEGA_STONE_FALLING, 1, 10 }, + { GD_S_MEGA_STONE_IMPACT, 1, 10 }, + { GD_S_FLYING_STONE_PUSHING, 1, 10 }, + { GD_S_FLYING_STONE_FALLING, 1, 10 }, + { GD_S_FLYING_STONE_IMPACT, 1, 10 }, + { GD_S_WAITING_STONE_PUSHING, 1, 10 }, + { GD_S_CHASING_STONE_PUSHING, 1, 10 }, /* nut falling is relatively silent, so low precedence. */ - { GD_S_NUT, 1, 8 }, + { GD_S_NUT_PUSHING, 1, 8 }, + { GD_S_NUT_FALLING, 1, 8 }, + { GD_S_NUT_IMPACT, 1, 8 }, /* higher precedence than a stone bouncing. */ { GD_S_NUT_CRACKING, 1, 12 }, /* sligthly lower precedence, as stones and diamonds should be "louder" */ - { GD_S_DIRT_BALL, 1, 8 }, - { GD_S_NITRO_PACK, 1, 10 }, - { GD_S_FALLING_WALL, 1, 10 }, + { GD_S_DIRT_BALL_FALLING, 1, 8 }, + { GD_S_DIRT_BALL_IMPACT, 1, 8 }, + { GD_S_DIRT_LOOSE_FALLING, 1, 8 }, + { GD_S_DIRT_LOOSE_IMPACT, 1, 8 }, + { GD_S_NITRO_PACK_PUSHING, 1, 10 }, + { GD_S_NITRO_PACK_FALLING, 1, 10 }, + { GD_S_NITRO_PACK_IMPACT, 1, 10 }, + { GD_S_FALLING_WALL_FALLING, 1, 10 }, + { GD_S_FALLING_WALL_IMPACT, 1, 10 }, { GD_S_EXPANDING_WALL, 1, 10 }, { GD_S_WALL_REAPPEARING, 1, 9 }, - { GD_S_DIAMOND_RANDOM, 1, 10 }, - { GD_S_DIAMOND_1, 1, 10 }, - { GD_S_DIAMOND_2, 1, 10 }, - { GD_S_DIAMOND_3, 1, 10 }, - { GD_S_DIAMOND_4, 1, 10 }, - { GD_S_DIAMOND_5, 1, 10 }, - { GD_S_DIAMOND_6, 1, 10 }, - { GD_S_DIAMOND_7, 1, 10 }, - { GD_S_DIAMOND_8, 1, 10 }, + { GD_S_DIAMOND_FALLING_RANDOM, 1, 10 }, + { GD_S_DIAMOND_FALLING_1, 1, 10 }, + { GD_S_DIAMOND_FALLING_2, 1, 10 }, + { GD_S_DIAMOND_FALLING_3, 1, 10 }, + { GD_S_DIAMOND_FALLING_4, 1, 10 }, + { GD_S_DIAMOND_FALLING_5, 1, 10 }, + { GD_S_DIAMOND_FALLING_6, 1, 10 }, + { GD_S_DIAMOND_FALLING_7, 1, 10 }, + { GD_S_DIAMOND_FALLING_8, 1, 10 }, + { GD_S_DIAMOND_IMPACT_RANDOM, 1, 10 }, + { GD_S_DIAMOND_IMPACT_1, 1, 10 }, + { GD_S_DIAMOND_IMPACT_2, 1, 10 }, + { GD_S_DIAMOND_IMPACT_3, 1, 10 }, + { GD_S_DIAMOND_IMPACT_4, 1, 10 }, + { GD_S_DIAMOND_IMPACT_5, 1, 10 }, + { GD_S_DIAMOND_IMPACT_6, 1, 10 }, + { GD_S_DIAMOND_IMPACT_7, 1, 10 }, + { GD_S_DIAMOND_IMPACT_8, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_RANDOM, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_1, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_2, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_3, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_4, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_5, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_6, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_7, 1, 10 }, + { GD_S_FLYING_DIAMOND_FALLING_8, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_RANDOM, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_1, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_2, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_3, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_4, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_5, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_6, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_7, 1, 10 }, + { GD_S_FLYING_DIAMOND_IMPACT_8, 1, 10 }, /* diamond collect sound has precedence over everything. */ { GD_S_DIAMOND_COLLECTING, 1, 100 }, + { GD_S_FLYING_DIAMOND_COLLECTING, 1, 100 }, /* collect sounds have higher precedence than falling sounds and the like. */ { GD_S_SKELETON_COLLECTING, 1, 100 }, @@ -113,6 +159,7 @@ static SoundProperty sound_flags[] = { GD_S_REPLICATOR, 1, 5 }, { GD_S_ACID_SPREADING, 1, 3 }, /* same for acid, even lower. */ { GD_S_BLADDER_MOVING, 1, 5 }, /* same for bladder. */ + { GD_S_BLADDER_PUSHING, 1, 5 }, { GD_S_BLADDER_CONVERTING, 1, 8 }, { GD_S_BLADDER_SPENDER, 1, 8 }, { GD_S_BITER_EATING, 1, 3 }, /* very low precedence. biters tend to produce too much sound. */ @@ -236,24 +283,63 @@ static void play_sound(int channel, GdSound sound) { /* channel 1 and channel 4 are used alternating */ /* channel 2 and channel 5 are used alternating */ - static const GdSound diamond_sounds[] = + static const GdSound diamond_falling_sounds[] = { - GD_S_DIAMOND_1, - GD_S_DIAMOND_2, - GD_S_DIAMOND_3, - GD_S_DIAMOND_4, - GD_S_DIAMOND_5, - GD_S_DIAMOND_6, - GD_S_DIAMOND_7, - GD_S_DIAMOND_8, + GD_S_DIAMOND_FALLING_1, + GD_S_DIAMOND_FALLING_2, + GD_S_DIAMOND_FALLING_3, + GD_S_DIAMOND_FALLING_4, + GD_S_DIAMOND_FALLING_5, + GD_S_DIAMOND_FALLING_6, + GD_S_DIAMOND_FALLING_7, + GD_S_DIAMOND_FALLING_8, + }; + static const GdSound diamond_impact_sounds[] = + { + GD_S_DIAMOND_IMPACT_1, + GD_S_DIAMOND_IMPACT_2, + GD_S_DIAMOND_IMPACT_3, + GD_S_DIAMOND_IMPACT_4, + GD_S_DIAMOND_IMPACT_5, + GD_S_DIAMOND_IMPACT_6, + GD_S_DIAMOND_IMPACT_7, + GD_S_DIAMOND_IMPACT_8, + }; + static const GdSound flying_diamond_falling_sounds[] = + { + GD_S_FLYING_DIAMOND_FALLING_1, + GD_S_FLYING_DIAMOND_FALLING_2, + GD_S_FLYING_DIAMOND_FALLING_3, + GD_S_FLYING_DIAMOND_FALLING_4, + GD_S_FLYING_DIAMOND_FALLING_5, + GD_S_FLYING_DIAMOND_FALLING_6, + GD_S_FLYING_DIAMOND_FALLING_7, + GD_S_FLYING_DIAMOND_FALLING_8, + }; + static const GdSound flying_diamond_impact_sounds[] = + { + GD_S_FLYING_DIAMOND_IMPACT_1, + GD_S_FLYING_DIAMOND_IMPACT_2, + GD_S_FLYING_DIAMOND_IMPACT_3, + GD_S_FLYING_DIAMOND_IMPACT_4, + GD_S_FLYING_DIAMOND_IMPACT_5, + GD_S_FLYING_DIAMOND_IMPACT_6, + GD_S_FLYING_DIAMOND_IMPACT_7, + GD_S_FLYING_DIAMOND_IMPACT_8, }; if (sound == GD_S_NONE) return; /* change diamond falling random to a selected diamond falling sound. */ - if (sound == GD_S_DIAMOND_RANDOM) - sound = diamond_sounds[g_random_int_range(0, G_N_ELEMENTS(diamond_sounds))]; + if (sound == GD_S_DIAMOND_FALLING_RANDOM) + sound = diamond_falling_sounds[g_random_int_range(0, 8)]; + else if (sound == GD_S_DIAMOND_IMPACT_RANDOM) + sound = diamond_impact_sounds[g_random_int_range(0, 8)]; + else if (sound == GD_S_FLYING_DIAMOND_FALLING_RANDOM) + sound = flying_diamond_falling_sounds[g_random_int_range(0, 8)]; + else if (sound == GD_S_FLYING_DIAMOND_IMPACT_RANDOM) + sound = flying_diamond_impact_sounds[g_random_int_range(0, 8)]; /* channel 1 may have been changed to channel 4 above. */ -- 2.34.1