fixed sound for charging level time (energy) for MM engine
authorHolger Schemel <info@artsoft.org>
Sat, 1 Apr 2017 15:18:26 +0000 (17:18 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:11 +0000 (23:21 +0100)
sounds/snd_classic/fuel.wav [new file with mode: 0644]
src/conf_snd.c
src/game.c
src/game.h
src/game_mm/export.h
src/game_mm/mm_game.c
src/tools.c
src/tools.h

diff --git a/sounds/snd_classic/fuel.wav b/sounds/snd_classic/fuel.wav
new file mode 100644 (file)
index 0000000..cc9463c
Binary files /dev/null and b/sounds/snd_classic/fuel.wav differ
index e2d7a5303fa32210790025495d73fd55311656e7..957259b56669c15bbed6e363b6da88b44019a8f3 100644 (file)
@@ -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"                     },
index cc6f27d69459e037abb378f3082755cd6564607e..de844f4298ca0351fcaceab4ce88082c9c8402c7 100644 (file)
@@ -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;
index 0e87912e25e4c6e42c76b7c975818709fe790ded..c6f74f865d36a0179decb5160e100c08ff99a3d2 100644 (file)
@@ -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);
index a46f89d5ee757bd79f36b4d000f2fe3ef98cfbe7..1ea220b43c492cf92d8062f19f4ad301c113edfd 100644 (file)
@@ -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                                                */
index a649d2333583832d335f48dd8a0d6e59669907ea..ed84121dd2d75d463aeb4f6535e4ffa47d7d5e41 100644 (file)
@@ -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);
index ee00da19228e710bae0cd5641acf931aaf0b06de..e1ff8140e3d56fbc44f8e30f050024072961a5d2 100644 (file)
@@ -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 &&
index b1f674342c391647462dabec2ec356ea7e5f2c44..7727ab696545a1b16a18a9002f00130778f3e952 100644 (file)
@@ -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);