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 e2d7a53..957259b 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 cc6f27d..de844f4 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 0e87912..c6f74f8 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 a46f89d..1ea220b 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 a649d23..ed84121 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 ee00da1..e1ff814 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 b1f6743..7727ab6 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);