From: Holger Schemel Date: Sat, 1 Apr 2017 15:18:26 +0000 (+0200) Subject: fixed sound for charging level time (energy) for MM engine X-Git-Tag: 4.1.0.0~144 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=457e98ec0803cd9005a522018e7c255454d1e915 fixed sound for charging level time (energy) for MM engine --- diff --git a/sounds/snd_classic/fuel.wav b/sounds/snd_classic/fuel.wav new file mode 100644 index 00000000..cc9463c9 Binary files /dev/null and b/sounds/snd_classic/fuel.wav differ diff --git a/src/conf_snd.c b/src/conf_snd.c index e2d7a530..957259b5 100644 --- a/src/conf_snd.c +++ b/src/conf_snd.c @@ -240,8 +240,11 @@ struct ConfigInfo sound_config[] = /* sounds for other game actions */ { "game.starting", UNDEFINED_FILENAME }, + { "game.leveltime_charging", "fuel.wav" }, + { "game.health_charging", UNDEFINED_FILENAME }, { "game.running_out_of_time", "gong.wav" }, { "game.leveltime_bonus", "sirr.wav" }, + { "game.health_bonus", "sirr.wav" }, { "game.losing", "lachen.wav" }, { "game.winning", UNDEFINED_FILENAME }, { "game.sokoban_solving", "buing.wav" }, diff --git a/src/game.c b/src/game.c index cc6f27d6..de844f42 100644 --- a/src/game.c +++ b/src/game.c @@ -14695,6 +14695,47 @@ void PlayLevelSound_SP(int xx, int yy, int element_sp, int action_sp) PlayLevelSoundElementAction(x, y, element, action); } +void PlayLevelSound_MM(int xx, int yy, int element_mm, int action_mm) +{ + int element = map_element_MM_to_RND(element_mm); + int action = map_action_MM_to_RND(action_mm); + int offset = 0; + int x = xx - offset; + int y = yy - offset; + + PlayLevelSoundElementAction(x, y, element, action); +} + +void PlaySound_MM(int sound_mm) +{ + int sound = map_sound_MM_to_RND(sound_mm); + + if (sound == SND_UNDEFINED) + return; + + PlaySound(sound); +} + +void PlaySoundLoop_MM(int sound_mm) +{ + int sound = map_sound_MM_to_RND(sound_mm); + + if (sound == SND_UNDEFINED) + return; + + PlaySoundLoop(sound); +} + +void StopSound_MM(int sound_mm) +{ + int sound = map_sound_MM_to_RND(sound_mm); + + if (sound == SND_UNDEFINED) + return; + + StopSound(sound); +} + void RaiseScore(int value) { local_player->score += value; diff --git a/src/game.h b/src/game.h index 0e87912e..c6f74f86 100644 --- a/src/game.h +++ b/src/game.h @@ -384,6 +384,10 @@ void ScrollLevel(int, int); void InitPlayLevelSound(); void PlayLevelSound_EM(int, int, int, int); void PlayLevelSound_SP(int, int, int, int); +void PlayLevelSound_MM(int, int, int, int); +void PlaySound_MM(int); +void PlaySoundLoop_MM(int); +void StopSound_MM(int); void RaiseScore(int); void RaiseScoreElement(int); diff --git a/src/game_mm/export.h b/src/game_mm/export.h index a46f89d5..1ea220b4 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -50,6 +50,9 @@ #define EL_MM_EMPTY_NATIVE 0 #define EL_DF_EMPTY_NATIVE 304 +/* sounds */ +#define SND_MM_GAME_LEVELTIME_CHARGING 0 + /* ------------------------------------------------------------------------- */ /* data structure definitions */ diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index a649d233..ed84121d 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -378,13 +378,14 @@ void InitGameActions_MM() OpenDoor(DOOR_OPEN_ALL); #endif - if (setup.sound_loops) - PlaySoundExt(SND_FUEL, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT, SND_CTRL_PLAY_LOOP); - for (i = 0; i <= num_init_game_frames; i++) { - if (!setup.sound_loops) - PlaySoundStereo(SND_FUEL, SOUND_MAX_RIGHT); + if (i == num_init_game_frames) + StopSound_MM(SND_MM_GAME_LEVELTIME_CHARGING); + else if (setup.sound_loops) + PlaySoundLoop_MM(SND_MM_GAME_LEVELTIME_CHARGING); + else + PlaySound_MM(SND_MM_GAME_LEVELTIME_CHARGING); game_mm.energy_left = native_mm_level.time * i / num_init_game_frames; @@ -407,9 +408,6 @@ void InitGameActions_MM() #endif } - if (setup.sound_loops) - StopSound(SND_FUEL); - #if 0 if (setup.sound_music && num_bg_loops) PlayMusic(level_nr % num_bg_loops); diff --git a/src/tools.c b/src/tools.c index ee00da19..e1ff8140 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7396,6 +7396,24 @@ int map_element_MM_to_RND(int element_mm) EL_EMPTY); } +int map_action_MM_to_RND(int action_mm) +{ + /* all MM actions are defined to exactly match their RND counterparts */ + return action_mm; +} + +int map_sound_MM_to_RND(int sound_mm) +{ + switch (sound_mm) + { + case SND_MM_GAME_LEVELTIME_CHARGING: + return SND_GAME_LEVELTIME_CHARGING; + + default: + return SND_UNDEFINED; + } +} + int map_mm_wall_element(int element) { return (element >= EL_MM_STEEL_WALL_START && diff --git a/src/tools.h b/src/tools.h index b1f67434..7727ab69 100644 --- a/src/tools.h +++ b/src/tools.h @@ -224,6 +224,8 @@ int map_action_SP_to_RND(int); int map_element_RND_to_MM(int); int map_element_MM_to_RND(int); +int map_action_MM_to_RND(int); +int map_sound_MM_to_RND(int); int map_mm_wall_element(int); int map_mm_wall_element_editor(int);