fixed sound for charging level time (energy) for MM engine
[rocksndiamonds.git] / src / game_mm / mm_game.c
index 9d8a8763f5d77de1f3e407485c844008ca8b3c59..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);
@@ -2430,13 +2428,12 @@ static void ContinueMoving_MM(int x, int y)
   laser.redraw = TRUE;
 }
 
-void ClickElement(int mx, int my, int button)
+void ClickElement(int x, int y, int button)
 {
   static unsigned int click_delay = 0;
   static int click_delay_value = CLICK_DELAY_SHORT;
   static boolean new_button = TRUE;
   int element;
-  int x = (mx - SX) / TILEX, y = (my - SY) / TILEY;
 
   /* do not rotate objects hit by the laser after the game was solved */
   if (game_mm.level_solved && Hit[x][y])
@@ -2459,7 +2456,7 @@ void ClickElement(int mx, int my, int button)
   if (button == MB_MIDDLEBUTTON)       /* middle button has no function */
     return;
 
-  if (!IN_PIX_FIELD(mx - SX, my - SY))
+  if (!IN_LEV_FIELD(x, y))
     return;
 
   if (Feld[x][y] == EL_EMPTY)
@@ -2762,7 +2759,7 @@ void ColorCycling(void)
   }
 }
 
-static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode)
+static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode)
 {
   static unsigned int action_delay = 0;
   static unsigned int pacman_delay = 0;
@@ -3440,10 +3437,9 @@ static void GameActions_MM_Ext(byte action[MAX_PLAYERS], boolean warp_mode)
   return;
 }
 
-void GameActions_MM(byte action[MAX_PLAYERS], boolean warp_mode)
+void GameActions_MM(struct MouseActionInfo action, boolean warp_mode)
 {
-  if (!button_status)
-    ClickElement(0, 0, MB_NOT_PRESSED);
+  ClickElement(action.lx, action.ly, action.button);
 
   GameActions_MM_Ext(action, warp_mode);
 }